From d86189c720105b9819915648a0d5bb3539f6cd53 Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Tue, 22 Aug 2023 23:12:37 +0900 Subject: [PATCH 01/11] Add to Gradle version catalog --- gradle/libs.versions.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index eea24e33c..f8fd0147c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -32,6 +32,8 @@ multiplatformFirebase = "1.8.1" kermit = "1.2.2" okHttp = "4.11.0" ktorfit = "1.5.0" +ossLicensesPlugin = "0.10.6" +ossLicenses = "17.0.1" detekt = "1.23.1" twitterComposeRule = "0.0.26" @@ -124,6 +126,11 @@ ktorfitKsp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = # Test +# etc + +ossLicenses = { module = "com.google.android.gms:play-services-oss-licenses", version.ref = "ossLicenses" } +ossLicensesPlugin = { module = "com.google.android.gms:oss-licenses-plugin", version.ref = "ossLicensesPlugin" } + junit = { module = "junit:junit", version.ref = "junit" } androidxTestExtJunit = { module = "androidx.test.ext:junit", version.ref = "androidxTestExt" } androidxTestEspressoEspressoCore = { module = "androidx.test.espresso:espresso-core", version.ref = "androidxTestEspresso" } @@ -143,6 +150,7 @@ roborazziGradlePlugin = { id = "io.github.takahirom.roborazzi", version.ref = "r kspGradlePlugin = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlinxKover = { id = "org.jetbrains.kotlinx.kover", version = "0.7.3" } detektGradlePlugin = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +ossLicensesPlugin = { id = "com.google.android.gms.oss-licenses-plugin", version.ref = "ossLicensesPlugin" } [bundles] plugins = [ From 64d50ea6cee38bc84dafa95c62089064b9df5e6e Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Tue, 22 Aug 2023 23:12:52 +0900 Subject: [PATCH 02/11] Add dependencies --- app-android/build.gradle.kts | 1 + build.gradle.kts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app-android/build.gradle.kts b/app-android/build.gradle.kts index 975d7a14f..103ca1457 100644 --- a/app-android/build.gradle.kts +++ b/app-android/build.gradle.kts @@ -97,6 +97,7 @@ dependencies { implementation(libs.accompanistSystemUiController) implementation(libs.androidxBrowser) implementation(libs.androidxWindow) + implementation(libs.ossLicenses) implementation(libs.kermit) testImplementation(projects.core.testing) } diff --git a/build.gradle.kts b/build.gradle.kts index 8c97fa717..4638125ab 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,7 @@ plugins { alias(libs.plugins.androidGradleLibraryPlugin) apply false alias(libs.plugins.kotlinGradlePlugin) apply false alias(libs.plugins.kotlinxKover) apply false + alias(libs.plugins.ossLicensesPlugin) apply false } tasks.register("clean", Delete::class) { @@ -12,6 +13,9 @@ tasks.register("clean", Delete::class) { } buildscript { + dependencies { + classpath(libs.ossLicensesPlugin) + } configurations.all { resolutionStrategy.eachDependency { when { From 837b806da0e11f847abc32ab8be883ddcf59bece Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Tue, 22 Aug 2023 23:13:07 +0900 Subject: [PATCH 03/11] Replace to navigation logic for license screen --- .../java/io/github/droidkaigi/confsched2023/KaigiApp.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt index 860fe596f..6ac942452 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt @@ -20,6 +20,7 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext +import androidx.core.content.ContextCompat.startActivity import androidx.core.net.toUri import androidx.core.os.bundleOf import androidx.hilt.navigation.compose.hiltViewModel @@ -31,6 +32,7 @@ import androidx.navigation.compose.rememberNavController import androidx.window.layout.DisplayFeature import co.touchlab.kermit.Logger import com.google.accompanist.systemuicontroller.rememberSystemUiController +import com.google.android.gms.oss.licenses.OssLicensesMenuActivity import io.github.droidkaigi.confsched2023.about.aboutScreenRoute import io.github.droidkaigi.confsched2023.about.navigateAboutScreen import io.github.droidkaigi.confsched2023.about.nestedAboutScreen @@ -159,7 +161,7 @@ private fun NavGraphBuilder.mainScreen( Sponsors -> navController.navigateSponsorsScreen() CodeOfConduct -> externalNavController.navigate(url = "https://portal.droidkaigi.jp/about/code-of-conduct") Contributors -> mainNestedNavController.navigate(contributorsScreenRoute) - License -> TODO() + License -> externalNavController.navigateToLicenseScreen() Medium -> externalNavController.navigate(url = "https://medium.com/droidkaigi") PrivacyPolicy -> externalNavController.navigate(url = "https://portal.droidkaigi.jp/about/privacy") Staff -> navController.navigateStaffScreen() @@ -269,6 +271,10 @@ private class ExternalNavController( } } + fun navigateToLicenseScreen(){ + context.startActivity(Intent(context,OssLicensesMenuActivity::class.java)) + } + @Suppress("SwallowedException") @RequiresApi(Build.VERSION_CODES.R) private fun navigateToNativeAppApi30(context: Context, uri: Uri): Boolean { From 4a0b1c0ed958cd9585c4d3c2ca8feef9bbad6b8c Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Tue, 22 Aug 2023 23:13:36 +0900 Subject: [PATCH 04/11] Update theme for License screen --- app-android/src/main/res/values/themes.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app-android/src/main/res/values/themes.xml b/app-android/src/main/res/values/themes.xml index 9164df707..566a6e8c8 100644 --- a/app-android/src/main/res/values/themes.xml +++ b/app-android/src/main/res/values/themes.xml @@ -1,7 +1,7 @@ - \ No newline at end of file From ea95eea34366b8e13d86102c63d0def58d51ba79 Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Tue, 22 Aug 2023 23:24:58 +0900 Subject: [PATCH 05/11] Fix plugin handling --- build.gradle.kts | 1 - gradle/libs.versions.toml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 4638125ab..b09df6005 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,6 @@ plugins { alias(libs.plugins.androidGradleLibraryPlugin) apply false alias(libs.plugins.kotlinGradlePlugin) apply false alias(libs.plugins.kotlinxKover) apply false - alias(libs.plugins.ossLicensesPlugin) apply false } tasks.register("clean", Delete::class) { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index f8fd0147c..b1e0b442c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -165,4 +165,5 @@ plugins = [ "kotlinxSerializationGradlePlugin", "completeKotlinPlugin", "detektGradlePlugin", + "ossLicensesPlugin" ] From fa3f764be3b8ab1de53fa756954adfc63a9cb020 Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Thu, 24 Aug 2023 19:30:38 +0900 Subject: [PATCH 06/11] Improve define place for Gradle version catalog --- gradle/libs.versions.toml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 276fb731c..50d8fc88e 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -51,6 +51,7 @@ completeKotlinPlugin = { module = "com.louiscad.complete-kotlin:plugin", version detektGradlePlugin = { group = "io.gitlab.arturbosch.detekt", name = "detekt-gradle-plugin", version.ref = "detekt" } detektFormatting = { group = "io.gitlab.arturbosch.detekt", name = "detekt-formatting", version.ref = "detekt" } twitterComposeRule = { module = "com.twitter.compose.rules:detekt", version.ref = "twitterComposeRule" } +ossLicensesPlugin = { group = "com.google.android.gms", name = "oss-licenses-plugin", version.ref = "ossLicensesPlugin" } androidDesugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } @@ -125,10 +126,7 @@ ktorfitKsp = { module = "de.jensklingenberg.ktorfit:ktorfit-ksp", version.ref = # Test -# etc - ossLicenses = { module = "com.google.android.gms:play-services-oss-licenses", version.ref = "ossLicenses" } -ossLicensesPlugin = { module = "com.google.android.gms:oss-licenses-plugin", version.ref = "ossLicensesPlugin" } junit = { module = "junit:junit", version.ref = "junit" } androidxTestExtJunit = { module = "androidx.test.ext:junit", version.ref = "androidxTestExt" } From f4d5d177ee4628506038ef9db09bea37332b04d8 Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Thu, 24 Aug 2023 19:31:07 +0900 Subject: [PATCH 07/11] Convert to OSS licenses plugin --- app-android/build.gradle.kts | 3 ++- build-logic/build.gradle.kts | 4 ++++ .../confsched2023/primitive/OssLicensePlugin.kt | 17 +++++++++++++++++ build.gradle.kts | 3 --- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt diff --git a/app-android/build.gradle.kts b/app-android/build.gradle.kts index e49e6c079..8adf03dbe 100644 --- a/app-android/build.gradle.kts +++ b/app-android/build.gradle.kts @@ -10,6 +10,7 @@ plugins { id("droidkaigi.primitive.detekt") id("droidkaigi.primitive.android.roborazzi") id("droidkaigi.primitive.kover") + id("droidkaigi.primitive.osslicenses") } val keystorePropertiesFile = file("keystore.properties") @@ -96,7 +97,7 @@ dependencies { implementation(libs.composeMaterialWindowSize) implementation(libs.androidxBrowser) implementation(libs.androidxWindow) - implementation(libs.ossLicenses) implementation(libs.kermit) + implementation(libs.ossLicenses) testImplementation(projects.core.testing) } diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 3990d7375..b947c7b15 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -98,6 +98,10 @@ gradlePlugin { id = "droidkaigi.primitive.detekt" implementationClass = "io.github.droidkaigi.confsched2023.primitive.DetektPlugin" } + register("oss-licenses") { + id = "droidkaigi.primitive.osslicenses" + implementationClass = "io.github.droidkaigi.confsched2023.primitive.OssLicensesPlugin" + } // Conventions register("androidFeature") { diff --git a/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt new file mode 100644 index 000000000..40ee3c124 --- /dev/null +++ b/build-logic/src/main/kotlin/io/github/droidkaigi/confsched2023/primitive/OssLicensePlugin.kt @@ -0,0 +1,17 @@ +package io.github.droidkaigi.confsched2023.primitive + +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class OssLicensesPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + pluginManager.apply("com.google.android.gms.oss-licenses-plugin") + + dependencies { + implementation(libs.library("ossLicenses")) + } + } + } +} diff --git a/build.gradle.kts b/build.gradle.kts index b09df6005..8c97fa717 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,9 +12,6 @@ tasks.register("clean", Delete::class) { } buildscript { - dependencies { - classpath(libs.ossLicensesPlugin) - } configurations.all { resolutionStrategy.eachDependency { when { From 1744bfa15541e5ff84035101e03961c53ab1884d Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Thu, 24 Aug 2023 19:31:50 +0900 Subject: [PATCH 08/11] Remove unnecessary library reference --- app-android/build.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/app-android/build.gradle.kts b/app-android/build.gradle.kts index 8adf03dbe..690ce4d15 100644 --- a/app-android/build.gradle.kts +++ b/app-android/build.gradle.kts @@ -98,6 +98,5 @@ dependencies { implementation(libs.androidxBrowser) implementation(libs.androidxWindow) implementation(libs.kermit) - implementation(libs.ossLicenses) testImplementation(projects.core.testing) } From 488bf27f9b3fa6e122354da59ec720d7804a5cb4 Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Thu, 24 Aug 2023 19:33:35 +0900 Subject: [PATCH 09/11] Fix codeformat by detekt auto-correct --- .../main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt index 1ebd33558..36bdf6eec 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched2023/KaigiApp.kt @@ -28,7 +28,6 @@ import androidx.navigation.compose.composable import androidx.navigation.compose.rememberNavController import androidx.window.layout.DisplayFeature import co.touchlab.kermit.Logger -import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.google.android.gms.oss.licenses.OssLicensesMenuActivity import io.github.droidkaigi.confsched2023.about.aboutScreenRoute import io.github.droidkaigi.confsched2023.about.navigateAboutScreen @@ -262,8 +261,8 @@ private class ExternalNavController( } } - fun navigateToLicenseScreen(){ - context.startActivity(Intent(context,OssLicensesMenuActivity::class.java)) + fun navigateToLicenseScreen() { + context.startActivity(Intent(context, OssLicensesMenuActivity::class.java)) } @Suppress("SwallowedException") From b1109b0faa549ca4bf8972c7f73919fa84799a7b Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Thu, 24 Aug 2023 19:48:15 +0900 Subject: [PATCH 10/11] Revert unnecessary theme changes --- app-android/src/main/AndroidManifest.xml | 8 ++++++++ app-android/src/main/res/values/themes.xml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app-android/src/main/AndroidManifest.xml b/app-android/src/main/AndroidManifest.xml index d21214924..0774c0eb1 100644 --- a/app-android/src/main/AndroidManifest.xml +++ b/app-android/src/main/AndroidManifest.xml @@ -28,6 +28,14 @@ + + + + diff --git a/app-android/src/main/res/values/themes.xml b/app-android/src/main/res/values/themes.xml index 566a6e8c8..9164df707 100644 --- a/app-android/src/main/res/values/themes.xml +++ b/app-android/src/main/res/values/themes.xml @@ -1,7 +1,7 @@ - \ No newline at end of file From f318919669e6ce68c7d2e0949dc21efc60859d17 Mon Sep 17 00:00:00 2001 From: fumiya-kume Date: Thu, 24 Aug 2023 20:03:50 +0900 Subject: [PATCH 11/11] Switching theme based on device night module config --- app-android/src/main/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app-android/src/main/AndroidManifest.xml b/app-android/src/main/AndroidManifest.xml index 0774c0eb1..524f48e16 100644 --- a/app-android/src/main/AndroidManifest.xml +++ b/app-android/src/main/AndroidManifest.xml @@ -30,11 +30,11 @@ + android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar" /> + android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar" />