Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Gradle
.gradle/
build/
release/

# Android Studio
.idea/
Expand All @@ -23,3 +24,6 @@ signing.properties
amahi-release-key.keystore

.DS*

# Acra
acra.properties
28 changes: 15 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
language: android

before_install:
- yes | sdkmanager "platforms;android-28"

jdk:
- oraclejdk8

sudo: required
env:
global:
- ANDROID_TARGET=android-22
- ANDROID_BUILD_TOOLS_VERSION=28.0.3
- ANDROID_ABI=armeabi-v7a

before_install:
- yes | sdkmanager "platforms;android-29"

android:
components:
- tools
- tools
- platform-tools
- build-tools-28.0.3
- android-28
- android-26
- android-19
- extra-android-support
- build-tools-$ANDROID_BUILD_TOOLS_VERSION
- $ANDROID_TARGET
- extra-android-m2repository
- extra-google-m2repository
- sys-img-armeabi-v7a-android-19
- sys-img-armeabi-v7a-android-22
licenses:
- .+

before_script:
- echo no | android create avd --force -n test -t android-19 --abi armeabi-v7a
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
- emulator -avd test -no-audio -no-window &
- android-wait-for-emulator
- adb shell settings put global window_animation_scale 0 &
- adb shell settings put global transition_animation_scale 0 &
- adb shell settings put global animator_duration_scale 0 &
- adb shell input keyevent 82 &

script:
- ./gradlew assembleDebug
- ./gradlew connectedDebugAndroidTest

notifications:
Expand Down
31 changes: 24 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# Amahi Android App [![Build Status](https://travis-ci.org/amahi/android.svg?branch=master)](https://travis-ci.org/amahi/android)
<h1 align="center"><img alt="Amahi" title="Amahi" src="./src/main/res/drawable-xxhdpi/ic_launcher.png" width="32"> Amahi Android App</h1>
<p align="center">
<a href="https://play.google.com/store/apps/details?id=org.amahi.anywhere">
<img alt="Get it on Google Play" title="Google Play" src="http://i.imgur.com/mtGRPuM.png" width="150">
</a>
</p>

[![Build Status](https://travis-ci.org/amahi/android.svg?branch=master)](https://travis-ci.org/amahi/android)
[![Twitter](https://img.shields.io/twitter/follow/amahi.svg?style=social&label=@amahi)](https://twitter.com/amahi)
[![#amahi on Freenode](https://img.shields.io/badge/chat-on%20freenode-brightgreen)](https://webchat.freenode.net/?channels=amahi)

This repository contains the source code for the Amahi Android app.

You will need JDK 1.7+ installed to work with it. Gradle, Android SDK, and project dependencies will be downloaded automatically.
You will need JDK 1.8+ installed to work with it. Gradle, Android SDK, and project dependencies will be downloaded automatically.

## Building the app

Expand All @@ -20,18 +29,26 @@ You will need JDK 1.7+ installed to work with it. Gradle, Android SDK, and proje
chromecast.app.id = APP_ID
```

This is something to keep **private** and you obtain it by sending a message to `support at Amahi dot org`.
This is something to keep **private** and you obtain it by sending a message to <support@amahi.org>.

2. Set ACRA information

2. Build the application using a command line or using GUI.
```
$ vim acra.properties
```
```
mailto.email = [email protected]
```

Enter your personal email in place of `[email protected]`

3. Build the application using a command line or using GUI.

```
$ ./gradlew clean assembleDebug

```


3. Once you have built the application, you will be needing credentials to use the application. Go to Amahi website and create your account, once the account is activated, you will see the description on how to set up the Amahi server. However, this is not strictly needed, as we have a set up of a demo server called "Welcome to Amahi" which you should see even without your own server installed.
4. Once you have built the application, you will be needing credentials to use the application. Go to Amahi website and create your account, once the account is activated, you will see the description on how to set up the Amahi server. However, this is not strictly needed, as we have a set up of a demo server called "Welcome to Amahi" which you should see even without your own server installed.

## Code Style Convention

Expand Down
4 changes: 4 additions & 0 deletions acra.properties.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Set ACRA mailing information in acra.properties.
# This is something to keep private and can be created by following steps in README.md

mailto.email = [email protected]
39 changes: 31 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'io.fabric.tools:gradle:1.26.1'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'io.fabric.tools:gradle:1.28.1'
}
}

Expand Down Expand Up @@ -52,22 +52,32 @@ android {
targetSdkVersion 28

def apiFile = file("api.properties")
def acraFile = file("acra.properties")
def apiProperties = new Properties()
def acraProperties = new Properties()

// NOTE-cpg: this fake api is here for the tests to pass
// NOTE-cpg: this fakeApi and fakeAcra is here for the tests to pass
def fakeApiFile = file("fakeApi.properties")
def fakeAcraFile = file("fakeAcra.properties")

if (apiFile.exists()) {
apiProperties.load(apiFile.newInputStream())
} else {
apiProperties.load(fakeApiFile.newInputStream())
}

if (acraFile.exists()) {
acraProperties.load(acraFile.newInputStream())
} else {
acraProperties.load(fakeAcraFile.newInputStream())
}

buildConfigField "String", "API_URL_AMAHI", formatStringField(apiProperties["url.amahi"])
buildConfigField "String", "API_URL_PROXY", formatStringField(apiProperties["url.proxy"])
buildConfigField "String", "API_CLIENT_ID", formatStringField(apiProperties["client.id"])
buildConfigField "String", "API_CLIENT_SECRET", formatStringField(apiProperties["client.secret"])
buildConfigField "String", "CHROMECAST_APP_ID", formatStringField(apiProperties["chromecast.app.id"])
buildConfigField "String", "ACRA_EMAIL", formatStringField(acraProperties["mailto.email"])

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -88,8 +98,8 @@ android {
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}

Expand Down Expand Up @@ -140,9 +150,16 @@ dependencies {
implementation 'com.jakewharton.timber:timber:4.5.1'

// Espresso Testing Framework Implementations
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.0'
def ESPRESSO_LIBRARY_VERSION = "3.2.0"
androidTestImplementation ("androidx.test.espresso:espresso-core:${ESPRESSO_LIBRARY_VERSION}") {
exclude group: "javax.inject"
}
androidTestImplementation ("androidx.test.espresso:espresso-web:${ESPRESSO_LIBRARY_VERSION}") {
exclude group: "javax.inject"
}
androidTestImplementation ("androidx.test.espresso:espresso-intents:${ESPRESSO_LIBRARY_VERSION}") {
exclude group: "javax.inject"
}

// Otto and Retrofit
implementation 'com.squareup:otto:1.3.8'
Expand Down Expand Up @@ -176,6 +193,12 @@ dependencies {
implementation 'android.arch.persistence.room:runtime:' + rootProject.archRoomVersion
annotationProcessor 'android.arch.persistence.room:compiler:' + rootProject.archRoomVersion

def acraVersion = '5.6.1'
implementation "ch.acra:acra-mail:$acraVersion"
implementation "ch.acra:acra-dialog:$acraVersion"
implementation "ch.acra:acra-notification:$acraVersion"
implementation "ch.acra:acra-toast:$acraVersion"

// Uncomment the dependencies below to enable Chuck Interceptor for logging
/*
debugImplementation 'com.readystatesoftware.chuck:library:1.1.0'
Expand Down
Binary file removed captures/org.amahi.anywhere_2020.07.11_05.41.li
Binary file not shown.
5 changes: 5 additions & 0 deletions fakeAcra.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Set ACRA mailing information in acra.properties.
# This is something to keep private and can be created by following steps in README.md
# Purpose: This file is required for Tests and Travis checks to pass

mailto.email = [email protected]
2 changes: 2 additions & 0 deletions fakeApi.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Set API information in api.properties.
# This is something to keep private and you obtain it by asking in the Amahi IRC channel or
# send a message to support at Amahi dot org
# Purpose: This file is required for Tests and Travis checks to pass

url.amahi=https://amahi.org
url.proxy=https://amahi.org
client.id=1234567890
Expand Down
2 changes: 2 additions & 0 deletions fakeSigning.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Set API information in api.properties.
# This is something to keep private and you obtain it by asking in the Amahi IRC channel or
# send a message to support at Amahi dot org
# Purpose: This file is required for Tests and Travis checks to pass

keystore.file=debug.keystore
keystore.password=android
key.alias=androiddebugkey
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Jun 09 01:34:57 IST 2019
#Sat Jul 18 05:49:07 IST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@
import org.junit.runners.MethodSorters;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.doesNotExist;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.*;

@RunWith(AndroidJUnit4.class)
@LargeTest
Expand All @@ -30,21 +23,20 @@
public class ExpandedControlsActivityTest {

@Rule
public ActivityTestRule<ExpandedControlsActivity> mActivityRule = new ActivityTestRule<>(
ExpandedControlsActivity.class
);
public ActivityTestRule<ExpandedControlsActivity> mActivityRule
= new ActivityTestRule<>(ExpandedControlsActivity.class);

@Before
public void setUp() throws Exception {
}

@Test
public void test1(){
public void test1() {
onView(withId(R.menu.action_bar_expanded_controller));
}

@Test
public void test2(){
public void test2() {
onView(withId(R.id.media_route_menu_item));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package org.amahi.anywhere.activity;

import androidx.test.filters.LargeTest;
import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;

import org.amahi.anywhere.R;
import org.amahi.anywhere.util.Android;
import org.junit.After;
import org.junit.Before;
import org.junit.FixMethodOrder;
Expand All @@ -16,13 +14,9 @@
import org.junit.runners.MethodSorters;

import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;

import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static org.junit.Assert.*;

@RunWith(AndroidJUnit4.class)
@LargeTest
Expand All @@ -31,46 +25,45 @@
public class IntroductionActivityTest {

@Rule
public ActivityTestRule<IntroductionActivity> mActivityRule = new ActivityTestRule<>(
IntroductionActivity.class
);
public ActivityTestRule<IntroductionActivity> mActivityRule
= new ActivityTestRule<>(IntroductionActivity.class);

@Before
public void setUp() throws Exception {
}

@Test
public void test1(){
public void test1() {
onView(withText(R.string.intro_phone_1)).check(matches(isDisplayed()));
onView(withText(R.string.intro_desc_phone_1)).check(matches(isDisplayed()));
}

@Test
public void test2(){
public void test2() {
onView(withText(R.string.intro_title_2));
onView(withText(R.string.intro_desc_2));
}

@Test
public void test3(){
public void test3() {
onView(withText(R.string.intro_title_3));
onView(withText(R.string.intro_desc_phone_3));
}

@Test
public void test4(){
public void test4() {
onView(withText(R.string.intro_title_4));
onView(withText(R.string.intro_desc_phone_4));
}

@Test
public void test5(){
public void test5() {
onView(withText(R.string.intro_title_5));
onView(withText(R.string.intro_desc_phone_5));
}

@Test
public void test6(){
public void test6() {
onView(withText(R.string.intro_title_6));
onView(withText(R.string.intro_desc_6));
}
Expand Down
Loading