diff --git a/.github/scripts/gradlew_recursive.sh b/.github/scripts/gradlew_recursive.sh new file mode 100755 index 00000000..ca5d6b0e --- /dev/null +++ b/.github/scripts/gradlew_recursive.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -xe + +# Crawl all gradlew files which indicate an Android project +# You may edit this if your repo has a different project structure +for GRADLEW in `find . -name "gradlew"` ; do + SAMPLE=$(dirname "${GRADLEW}") + # Tell Gradle that this is a CI environment and disable parallel compilation + bash "$GRADLEW" -p "$SAMPLE" -Pci --no-parallel --stacktrace $@ +done diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 00000000..da328ab8 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,73 @@ +name: Android CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + + test: + name: Unit Tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 9 + uses: actions/setup-java@v1 + with: + java-version: 9 + - name: Run unit tests + run: .github/scripts/gradlew_recursive.sh test + - name: Zip reports + if: always() + run: zip -r reports.zip . -i '**/reports/*.xml' '**/reports/*.html' + - name: Upload reports + if: always() + uses: actions/upload-artifact@v1 + with: + name: unit_test_reports + path: reports.zip + + lint: + name: Lint + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Run linter + run: .github/scripts/gradlew_recursive.sh lint + - name: Zip reports + if: always() + run: zip -r reports.zip . -i '**/reports/*.xml' '**/reports/*.html' + - name: Upload reports + if: always() + uses: actions/upload-artifact@v1 + with: + name: lint_reports + path: reports.zip + + build: + name: Build + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Build project + run: .github/scripts/gradlew_recursive.sh assembleDebug + - name: Zip artifacts + run: zip -r assemble.zip . -i '**/build/*.apk' '**/build/*.aab' '**/build/*.aar' '**/build/*.so' + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: assemble + path: assemble.zip diff --git a/Camera2Basic/app/build.gradle b/Camera2Basic/app/build.gradle index 23c6abd0..78d40e86 100644 --- a/Camera2Basic/app/build.gradle +++ b/Camera2Basic/app/build.gradle @@ -47,17 +47,6 @@ android { } } - // Set the source of tests to same for both Unit and Instrumented tests - sourceSets { - String sharedTestDir = 'src/test/java' - test { - java.srcDir sharedTestDir - } - androidTest { - java.srcDir sharedTestDir - } - } - // Necessary for Robolectric (Unit tests) testOptions.unitTests.includeAndroidResources = true } @@ -66,17 +55,17 @@ dependencies { implementation project(':common') // Kotlin lang - implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3' // App compat and UI things implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-rc03' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0' implementation "androidx.viewpager2:viewpager2:1.0.0" // Navigation library - def nav_version = "2.1.0" + def nav_version = '2.2.1' implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" @@ -92,7 +81,7 @@ dependencies { testImplementation 'androidx.test:rules:1.2.0' testImplementation 'androidx.test:runner:1.2.0' testImplementation 'androidx.test.espresso:espresso-core:3.2.0' - testImplementation "org.robolectric:robolectric:4.3.1" + testImplementation 'org.robolectric:robolectric:4.3.1' // Instrumented testing androidTestImplementation 'androidx.test.ext:junit:1.1.1' diff --git a/Camera2Basic/app/src/main/java/com/example/android/camera2/basic/fragments/CameraFragment.kt b/Camera2Basic/app/src/main/java/com/example/android/camera2/basic/fragments/CameraFragment.kt index de4ede84..8274db4e 100644 --- a/Camera2Basic/app/src/main/java/com/example/android/camera2/basic/fragments/CameraFragment.kt +++ b/Camera2Basic/app/src/main/java/com/example/android/camera2/basic/fragments/CameraFragment.kt @@ -154,7 +154,7 @@ class CameraFragment : Fragment() { // Used to rotate the output media to match device orientation relativeOrientation = OrientationLiveData(requireContext(), characteristics).apply { - observe(this@CameraFragment, Observer { + observe(viewLifecycleOwner, Observer { orientation -> Log.d(TAG, "Orientation changed: $orientation") }) } diff --git a/Camera2Basic/app/src/test/java/com/example/android/camera2/basic/InstrumentedTests.kt b/Camera2Basic/app/src/test/java/com/example/android/camera2/basic/InstrumentedTests.kt index cb8222bb..0427fe7d 100644 --- a/Camera2Basic/app/src/test/java/com/example/android/camera2/basic/InstrumentedTests.kt +++ b/Camera2Basic/app/src/test/java/com/example/android/camera2/basic/InstrumentedTests.kt @@ -18,6 +18,7 @@ package com.example.android.camera2.basic import android.Manifest import android.content.Context +import android.os.Build import androidx.test.core.app.ApplicationProvider import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.rule.ActivityTestRule @@ -27,6 +28,7 @@ import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith + @RunWith(AndroidJUnit4::class) class MainInstrumentedTest { diff --git a/Camera2Basic/build.gradle b/Camera2Basic/build.gradle index 6a9b9bcf..e448747b 100644 --- a/Camera2Basic/build.gradle +++ b/Camera2Basic/build.gradle @@ -26,9 +26,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:3.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0" + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/Camera2Basic/gradle/wrapper/gradle-wrapper.properties b/Camera2Basic/gradle/wrapper/gradle-wrapper.properties index a7133bf8..2dce2567 100644 --- a/Camera2Basic/gradle/wrapper/gradle-wrapper.properties +++ b/Camera2Basic/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Sep 27 14:00:11 AEST 2019 +#Thu Mar 05 15:31:27 EST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/Camera2SlowMotion/app/build.gradle b/Camera2SlowMotion/app/build.gradle index 11d6ff93..3f59fe4d 100644 --- a/Camera2SlowMotion/app/build.gradle +++ b/Camera2SlowMotion/app/build.gradle @@ -66,16 +66,16 @@ dependencies { implementation project(':common') // Kotlin lang - implementation 'androidx.core:core-ktx:1.1.0' + implementation 'androidx.core:core-ktx:1.2.0' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3' // App compat and UI things implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0-rc03' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0' // Navigation library - def nav_version = "2.1.0" + def nav_version = "2.2.1" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" diff --git a/Camera2SlowMotion/app/src/main/AndroidManifest.xml b/Camera2SlowMotion/app/src/main/AndroidManifest.xml index 3ed99bd8..e9d2c7a9 100644 --- a/Camera2SlowMotion/app/src/main/AndroidManifest.xml +++ b/Camera2SlowMotion/app/src/main/AndroidManifest.xml @@ -29,7 +29,7 @@ android:allowBackup="true" android:label="@string/app_name" android:icon="@drawable/ic_launcher" - tools:ignore="GoogleAppIndexingWarning"> + tools:ignore="AllowBackup,GoogleAppIndexingWarning"> Log.d(TAG, "Orientation changed: $orientation") }) } diff --git a/Camera2SlowMotion/app/src/main/res/drawable/ic_photo.xml b/Camera2SlowMotion/app/src/main/res/drawable/ic_photo.xml deleted file mode 100644 index 6676ccb8..00000000 --- a/Camera2SlowMotion/app/src/main/res/drawable/ic_photo.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Camera2SlowMotion/app/src/main/res/layout/activity_camera.xml b/Camera2SlowMotion/app/src/main/res/layout/activity_camera.xml index 33e8a04a..04d9e6fd 100644 --- a/Camera2SlowMotion/app/src/main/res/layout/activity_camera.xml +++ b/Camera2SlowMotion/app/src/main/res/layout/activity_camera.xml @@ -14,20 +14,15 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - - - - \ No newline at end of file + app:defaultNavHost="true" + app:navGraph="@navigation/nav_graph" + tools:context=".CameraActivity" /> diff --git a/Camera2SlowMotion/build.gradle b/Camera2SlowMotion/build.gradle index 2b3fae21..e448747b 100644 --- a/Camera2SlowMotion/build.gradle +++ b/Camera2SlowMotion/build.gradle @@ -26,9 +26,9 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.1' + classpath 'com.android.tools.build:gradle:3.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0" + classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.2.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/Camera2SlowMotion/gradle/wrapper/gradle-wrapper.properties b/Camera2SlowMotion/gradle/wrapper/gradle-wrapper.properties index a7133bf8..9a3e0431 100644 --- a/Camera2SlowMotion/gradle/wrapper/gradle-wrapper.properties +++ b/Camera2SlowMotion/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Sep 27 14:00:11 AEST 2019 +#Thu Mar 05 16:15:48 EST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/Camera2VideoJava/Application/build.gradle b/Camera2VideoJava/Application/build.gradle index 5a99955e..7dc4e1f7 100644 --- a/Camera2VideoJava/Application/build.gradle +++ b/Camera2VideoJava/Application/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' + classpath 'com.android.tools.build:gradle:3.6.1' } } diff --git a/Camera2VideoJava/gradle/wrapper/gradle-wrapper.properties b/Camera2VideoJava/gradle/wrapper/gradle-wrapper.properties index ae45383b..09b47bd1 100644 --- a/Camera2VideoJava/gradle/wrapper/gradle-wrapper.properties +++ b/Camera2VideoJava/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Fri Mar 06 10:33:53 EST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/Camera2VideoKotlin/build.gradle b/Camera2VideoKotlin/build.gradle index 03239d77..3a80490f 100644 --- a/Camera2VideoKotlin/build.gradle +++ b/Camera2VideoKotlin/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.6.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/Camera2VideoKotlin/gradle/wrapper/gradle-wrapper.properties b/Camera2VideoKotlin/gradle/wrapper/gradle-wrapper.properties index f9415508..4e5e0605 100644 --- a/Camera2VideoKotlin/gradle/wrapper/gradle-wrapper.properties +++ b/Camera2VideoKotlin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Fri Mar 06 10:32:20 EST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-4.10.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/CameraXBasic/app/build.gradle b/CameraXBasic/app/build.gradle index f156349c..c831fbf4 100644 --- a/CameraXBasic/app/build.gradle +++ b/CameraXBasic/app/build.gradle @@ -47,17 +47,6 @@ android { } } - // Set the source of tests to same for both Unit and Instrumented tests - sourceSets { - String sharedTestDir = 'src/test/java' - test { - java.srcDir sharedTestDir - } - androidTest { - java.srcDir sharedTestDir - } - } - // Necessary for Robolectric (Unit tests) testOptions { unitTests { @@ -100,14 +89,14 @@ dependencies { // Glide implementation 'com.github.bumptech.glide:glide:4.11.0' - kapt 'com.github.bumptech.glide:compiler:4.10.0' + kapt 'com.github.bumptech.glide:compiler:4.11.0' // Unit testing testImplementation 'androidx.test.ext:junit:1.1.1' testImplementation 'androidx.test:rules:1.2.0' testImplementation 'androidx.test:runner:1.2.0' testImplementation 'androidx.test.espresso:espresso-core:3.2.0' - testImplementation "org.robolectric:robolectric:4.3.1" + testImplementation 'org.robolectric:robolectric:4.3.1' // Instrumented testing androidTestImplementation 'androidx.test.ext:junit:1.1.1' diff --git a/CameraXBasic/app/src/main/AndroidManifest.xml b/CameraXBasic/app/src/main/AndroidManifest.xml index 314df3fe..1fd25e6a 100644 --- a/CameraXBasic/app/src/main/AndroidManifest.xml +++ b/CameraXBasic/app/src/main/AndroidManifest.xml @@ -32,9 +32,9 @@ + android:allowBackup="true" + tools:ignore="AllowBackup"> + android:viewportHeight="46.0" + tools:ignore="VectorRaster"> diff --git a/CameraXBasic/app/src/main/res/layout/activity_main.xml b/CameraXBasic/app/src/main/res/layout/activity_main.xml index 6d198695..f8728388 100644 --- a/CameraXBasic/app/src/main/res/layout/activity_main.xml +++ b/CameraXBasic/app/src/main/res/layout/activity_main.xml @@ -14,21 +14,15 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - - - - - \ No newline at end of file + app:defaultNavHost="true" + app:navGraph="@navigation/nav_graph" + tools:context=".MainActivity"/> diff --git a/CameraXBasic/app/src/main/res/values-v28/styles.xml b/CameraXBasic/app/src/main/res/values-v28/styles.xml index b8e78755..9fb7e0e8 100644 --- a/CameraXBasic/app/src/main/res/values-v28/styles.xml +++ b/CameraXBasic/app/src/main/res/values-v28/styles.xml @@ -18,13 +18,6 @@ diff --git a/CameraXBasic/app/src/main/res/values/styles.xml b/CameraXBasic/app/src/main/res/values/styles.xml index d66bf4f5..b5a51a84 100644 --- a/CameraXBasic/app/src/main/res/values/styles.xml +++ b/CameraXBasic/app/src/main/res/values/styles.xml @@ -18,9 +18,6 @@