From e0f05008b060137251ce0d27aae0099a4d14b089 Mon Sep 17 00:00:00 2001 From: Mark Tully Date: Wed, 21 Feb 2018 01:00:09 +0000 Subject: [PATCH 01/29] Create .travis.yml --- .travis.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a9e0a69 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,48 @@ +sudo: false + +language: android +android: + components: + # Uncomment the lines below if you want to + # use the latest revision of Android SDK Tools + - tools + - platform-tools + #- tools + + # The BuildTools version used by your project + - build-tools-27.0.3 + + # The SDK version used to compile your project + - android-21 + - android-27 + + # Additional components + - extra-google-m2repository + - extra-android-m2repository + - addon-google_apis-google-27 + + # Specify at least one system image, + # if you need to run emulator(s) during your tests + - sys-img-armeabi-v7a-android-21 + - sys-img-armeabi-v7a-android-27 + +before_install: + - yes | sdkmanager "platforms;android-27" + +env: + global: + # install timeout in minutes (2 minutes by default) + - ADB_INSTALL_TIMEOUT=8 + +# Emulator Management: Create, Start and Wait +before_script: + - echo no | android create avd --force --name test --target android-21 --abi armeabi-v7a + - emulator -avd test -no-skin -no-audio -no-window -gpu off & + - android-wait-for-emulator + - adb devices + - adb shell input keyevent 82 & + +script: + - echo $ADB_INSTALL_TIMEOUT + - android list target + - ./gradlew connectedAndroidTest \ No newline at end of file From e3aa5c2f00e9dcb4c7b54a6165c4aa54a2ef2a36 Mon Sep 17 00:00:00 2001 From: Mark Tully Date: Wed, 21 Feb 2018 01:01:01 +0000 Subject: [PATCH 02/29] Fix tests & testing environment --- app/build.gradle | 6 +++--- .../com/teester/whatsnearby/ExampleInstrumentedTest.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3cb3fc4..0175286 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -17,6 +17,8 @@ android { versionCode 11 versionName "0.11" setProperty("archivesBaseName", "whatsnearby-$versionName") + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } buildTypes { debug { @@ -53,9 +55,7 @@ dependencies { exclude group: 'org.apache.httpcomponents', module: 'httpcore' } - androidTestImplementation('com.android.support.test.espresso:espresso-core:2.3-alpha', { - exclude group: 'com.android.support', module: 'support-annotations' - }) + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.11.0' diff --git a/app/src/androidTest/java/com/teester/whatsnearby/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/teester/whatsnearby/ExampleInstrumentedTest.java index b57ccd3..5cb4aa9 100644 --- a/app/src/androidTest/java/com/teester/whatsnearby/ExampleInstrumentedTest.java +++ b/app/src/androidTest/java/com/teester/whatsnearby/ExampleInstrumentedTest.java @@ -21,6 +21,6 @@ public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); - assertEquals("com.teester.mapquestions", appContext.getPackageName()); + assertEquals("com.teester.whatsnearby", appContext.getPackageName()); } } From 0412e34f135154b81789f8f843acbc57e286e6ce Mon Sep 17 00:00:00 2001 From: Mark Tully Date: Wed, 21 Feb 2018 01:30:31 +0000 Subject: [PATCH 03/29] Adding unit tests --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a9e0a69..34de9fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,4 +45,5 @@ before_script: script: - echo $ADB_INSTALL_TIMEOUT - android list target - - ./gradlew connectedAndroidTest \ No newline at end of file + - ./gradlew connectedAndroidTest + - ./gradlew test \ No newline at end of file From aabe4b893099c60f71498f024a3034a6dc9beee0 Mon Sep 17 00:00:00 2001 From: Mark Tully Date: Thu, 22 Feb 2018 00:45:53 +0000 Subject: [PATCH 04/29] Removing dependency on commons-io and updating other dependencies --- app/build.gradle | 5 ++--- .../teester/whatsnearby/data/source/QueryOverpass.java | 10 ++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 0175286..0d72081 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -40,11 +40,10 @@ dependencies { implementation 'com.android.support:design:27.0.2' implementation 'com.android.support:support-v4:27.0.2' implementation 'com.android.support.constraint:constraint-layout:1.0.2' - implementation 'android.arch.lifecycle:extensions:1.0.0' + implementation 'android.arch.lifecycle:extensions:1.1.0' implementation 'android.arch.persistence.room:runtime:1.0.0' annotationProcessor 'android.arch.persistence.room:compiler:1.0.0' implementation 'com.mapzen.android:lost:3.0.4' - implementation 'commons-io:commons-io:2.4' implementation('de.westnordost:osmapi:1.7') { // it's already included in Android exclude group: 'net.sf.kxml', module: 'kxml2' @@ -59,5 +58,5 @@ dependencies { testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.11.0' - testImplementation 'org.json:json:20171018' + testImplementation 'org.json:json:20180130' } diff --git a/app/src/main/java/com/teester/whatsnearby/data/source/QueryOverpass.java b/app/src/main/java/com/teester/whatsnearby/data/source/QueryOverpass.java index b2f7bc5..db01a5a 100644 --- a/app/src/main/java/com/teester/whatsnearby/data/source/QueryOverpass.java +++ b/app/src/main/java/com/teester/whatsnearby/data/source/QueryOverpass.java @@ -13,13 +13,11 @@ import com.teester.whatsnearby.data.localDatabase.VisitedLocation; import com.teester.whatsnearby.data.location.Notifier; -import org.apache.commons.io.IOUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedInputStream; -import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; @@ -27,6 +25,7 @@ import java.util.Date; import java.util.Iterator; import java.util.List; +import java.util.Scanner; public class QueryOverpass implements SourceContract.Overpass { @@ -89,12 +88,7 @@ public String queryOverpassApi(String urlString) { return e.getMessage(); } - try { - resultToDisplay = IOUtils.toString(in, "UTF-8"); - //to [convert][1] byte stream to a string - } catch (IOException e) { - e.printStackTrace(); - } + resultToDisplay = new Scanner(in, "UTF-8").useDelimiter("\\A").next(); return resultToDisplay; } From 72dab4fc422f4aa1e76480d2beaca3db7e90fa81 Mon Sep 17 00:00:00 2001 From: Mark Tully Date: Fri, 23 Feb 2018 01:13:39 +0000 Subject: [PATCH 05/29] Adding rounded corners --- app/src/main/res/drawable/rounded_bottom.xml | 6 +++++ .../main/res/drawable/rounded_bottom_left.xml | 4 ++++ .../res/drawable/rounded_bottom_right.xml | 4 ++++ app/src/main/res/drawable/rounded_corners.xml | 8 +++++++ app/src/main/res/drawable/rounded_top.xml | 6 +++++ app/src/main/res/layout/activity_main.xml | 10 ++++++-- app/src/main/res/layout/fragment_intro.xml | 24 ++++++++++--------- app/src/main/res/layout/fragment_not_here.xml | 6 +++-- .../main/res/layout/fragment_osm_login.xml | 8 +++++-- app/src/main/res/layout/fragment_question.xml | 21 +++++++++------- app/src/main/res/layout/fragment_upload.xml | 12 ++++++---- app/src/main/res/layout/poi_list_item.xml | 12 ++++------ app/src/main/res/values/dimens.xml | 1 + 13 files changed, 84 insertions(+), 38 deletions(-) create mode 100644 app/src/main/res/drawable/rounded_bottom.xml create mode 100644 app/src/main/res/drawable/rounded_bottom_left.xml create mode 100644 app/src/main/res/drawable/rounded_bottom_right.xml create mode 100644 app/src/main/res/drawable/rounded_corners.xml create mode 100644 app/src/main/res/drawable/rounded_top.xml diff --git a/app/src/main/res/drawable/rounded_bottom.xml b/app/src/main/res/drawable/rounded_bottom.xml new file mode 100644 index 0000000..a32b614 --- /dev/null +++ b/app/src/main/res/drawable/rounded_bottom.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_bottom_left.xml b/app/src/main/res/drawable/rounded_bottom_left.xml new file mode 100644 index 0000000..2006b21 --- /dev/null +++ b/app/src/main/res/drawable/rounded_bottom_left.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_bottom_right.xml b/app/src/main/res/drawable/rounded_bottom_right.xml new file mode 100644 index 0000000..3ad2c62 --- /dev/null +++ b/app/src/main/res/drawable/rounded_bottom_right.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_corners.xml b/app/src/main/res/drawable/rounded_corners.xml new file mode 100644 index 0000000..5cb87d7 --- /dev/null +++ b/app/src/main/res/drawable/rounded_corners.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_top.xml b/app/src/main/res/drawable/rounded_top.xml new file mode 100644 index 0000000..c8b0303 --- /dev/null +++ b/app/src/main/res/drawable/rounded_top.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 5835e85..17ef4ab 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -14,9 +14,12 @@ android:layout_marginLeft="32dp" android:layout_marginRight="32dp" android:layout_marginTop="32dp" - android:background="@color/colorPrimary" + android:background="@drawable/rounded_top" + android:backgroundTint="@color/colorPrimary" android:gravity="center_horizontal" android:paddingBottom="32dp" + android:paddingEnd="8dp" + android:paddingStart="8dp" android:paddingTop="32dp" android:text="@string/osm_login_description" android:textAppearance="@style/TextAppearance.AppCompat.Medium" @@ -34,7 +37,8 @@ android:layout_marginLeft="32dp" android:layout_marginRight="32dp" android:layout_marginTop="0dp" - android:background="@color/colorAccent" + android:background="@drawable/rounded_bottom" + android:backgroundTint="@color/colorAccent" android:text="@string/osm_login_button" android:textColor="@color/white" app:layout_constraintHorizontal_bias="0.0" @@ -49,6 +53,8 @@ android:layout_marginBottom="32dp" android:layout_marginEnd="32dp" android:layout_marginStart="32dp" + android:background="@drawable/rounded_corners" + android:backgroundTint="@color/light_grey" android:text="See Debug Data" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" diff --git a/app/src/main/res/layout/fragment_intro.xml b/app/src/main/res/layout/fragment_intro.xml index ed87781..e7aae49 100644 --- a/app/src/main/res/layout/fragment_intro.xml +++ b/app/src/main/res/layout/fragment_intro.xml @@ -7,24 +7,25 @@ android:layout_height="match_parent"> + tools:text="Name"/> + tools:text="Address"/> + app:layout_constraintTop_toBottomOf="@+id/intro_address"/> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_not_here.xml b/app/src/main/res/layout/fragment_not_here.xml index 879a273..028609f 100644 --- a/app/src/main/res/layout/fragment_not_here.xml +++ b/app/src/main/res/layout/fragment_not_here.xml @@ -12,7 +12,8 @@ android:layout_marginEnd="32dp" android:layout_marginStart="32dp" android:layout_marginTop="32dp" - android:background="@color/colorAccent" + android:background="@drawable/rounded_top" + android:backgroundTint="@color/colorAccent" android:gravity="center" android:paddingBottom="8dp" android:paddingEnd="24dp" @@ -33,7 +34,8 @@ android:layout_marginBottom="32dp" android:layout_marginEnd="32dp" android:layout_marginStart="32dp" - android:background="@color/colorAccent" + android:background="@drawable/rounded_bottom" + android:backgroundTint="@color/colorAccent" android:text="@string/none_of_these_places" android:textColor="@color/white" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/layout/fragment_osm_login.xml b/app/src/main/res/layout/fragment_osm_login.xml index 3011ed6..191fe0e 100644 --- a/app/src/main/res/layout/fragment_osm_login.xml +++ b/app/src/main/res/layout/fragment_osm_login.xml @@ -12,9 +12,12 @@ android:layout_marginLeft="32dp" android:layout_marginRight="32dp" android:layout_marginTop="32dp" - android:background="@color/colorPrimary" + android:background="@drawable/rounded_top" + android:backgroundTint="@color/colorPrimary" android:gravity="center_horizontal" android:paddingBottom="32dp" + android:paddingEnd="8dp" + android:paddingStart="8dp" android:paddingTop="32dp" android:text="@string/osm_login_description" android:textAppearance="@style/TextAppearance.AppCompat.Medium" @@ -32,7 +35,8 @@ android:layout_marginLeft="32dp" android:layout_marginRight="32dp" android:layout_marginTop="0dp" - android:background="@color/colorAccent" + android:background="@drawable/rounded_bottom" + android:backgroundTint="@color/colorAccent" android:text="@string/osm_login_button" android:textColor="@color/white" app:layout_constraintHorizontal_bias="0.0" diff --git a/app/src/main/res/layout/fragment_question.xml b/app/src/main/res/layout/fragment_question.xml index a5244e5..75c71e0 100644 --- a/app/src/main/res/layout/fragment_question.xml +++ b/app/src/main/res/layout/fragment_question.xml @@ -15,13 +15,14 @@ android:layout_marginRight="32dp" android:layout_marginStart="32dp" android:layout_marginTop="32dp" - android:background="@color/colorAccent" + android:background="@drawable/rounded_top" + android:backgroundTint="@color/colorAccent" android:gravity="center" android:minHeight="128dp" android:padding="32dp" android:text="@string/wheelchair" android:textAppearance="@style/TextAppearance.AppCompat.Medium" - android:textColor="#FFFFFF" + android:textColor="@color/white" app:layout_constraintHorizontal_bias="0.0" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" @@ -38,7 +39,7 @@ android:layout_marginStart="8dp" android:text="@string/others_have_answered_this_question" android:textAppearance="@style/TextAppearance.AppCompat.Small" - android:textColor="#FFFFFF" + android:textColor="@color/white" app:layout_constraintBottom_toTopOf="@+id/answer_no" app:layout_constraintLeft_toLeftOf="@+id/question_textview" app:layout_constraintRight_toRightOf="@+id/question_textview"/> @@ -58,7 +59,7 @@ app:layout_constraintLeft_toLeftOf="@+id/question_textview" app:layout_constraintRight_toRightOf="@+id/question_textview" app:layout_constraintTop_toTopOf="@+id/question_textview" - tools:tint="#000000"/> + tools:tint="@color/white"/>