diff --git a/Android/src/app/build.gradle.kts b/Android/src/app/build.gradle.kts index 70b62fb..9ff6202 100644 --- a/Android/src/app/build.gradle.kts +++ b/Android/src/app/build.gradle.kts @@ -23,6 +23,7 @@ plugins { alias(libs.plugins.kotlin.serialization) alias(libs.plugins.protobuf) alias(libs.plugins.hilt.application) + alias(libs.plugins.oss.licenses) kotlin("kapt") } @@ -97,6 +98,7 @@ dependencies { implementation(libs.protobuf.javalite) implementation(libs.hilt.android) implementation(libs.hilt.navigation.compose) + implementation(libs.play.services.oss.licenses) implementation(platform(libs.firebase.bom)) implementation(libs.firebase.analytics) kapt(libs.hilt.android.compiler) diff --git a/Android/src/app/src/main/AndroidManifest.xml b/Android/src/app/src/main/AndroidManifest.xml index b4218ac..c91a4c6 100644 --- a/Android/src/app/src/main/AndroidManifest.xml +++ b/Android/src/app/src/main/AndroidManifest.xml @@ -48,12 +48,18 @@ android:supportsRtl="true" android:theme="@style/Theme.Gallery" tools:targetApi="31"> + @@ -72,6 +78,16 @@ + + + + = Build.VERSION_CODES.S) { + val uiModeManager = + context.applicationContext.getSystemService(Context.UI_MODE_SERVICE) + as UiModeManager + if (theme == Theme.THEME_AUTO) { + uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_AUTO) + } else if (theme == Theme.THEME_LIGHT) { + uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_NO) + } else { + uiModeManager.setApplicationNightMode(UiModeManager.MODE_NIGHT_YES) + } + } }, checked = theme == selectedTheme, label = { Text(themeLabel(theme)) }, @@ -166,7 +192,7 @@ fun SettingsDialog( ) // Show the start of the token. val curHfToken = hfToken - if (curHfToken != null) { + if (curHfToken != null && curHfToken.accessToken.isNotEmpty()) { Text( curHfToken.accessToken.substring(0, min(16, curHfToken.accessToken.length)) + "...", style = MaterialTheme.typography.bodyMedium, @@ -254,6 +280,24 @@ fun SettingsDialog( } } } + + // Third party licenses. + Column(modifier = Modifier.fillMaxWidth()) { + Text( + "Third-party libraries", + style = MaterialTheme.typography.titleSmall.copy(fontWeight = FontWeight.Bold), + ) + OutlinedButton( + onClick = { + // Create an Intent to launch a license viewer that displays a list of + // third-party library names. Clicking a name will show its license content. + val intent = Intent(context, OssLicensesMenuActivity::class.java) + context.startActivity(intent) + } + ) { + Text("View licenses") + } + } } // Button row. diff --git a/Android/src/app/src/main/res/values-night/themes.xml b/Android/src/app/src/main/res/values-night/themes.xml new file mode 100644 index 0000000..663a1b1 --- /dev/null +++ b/Android/src/app/src/main/res/values-night/themes.xml @@ -0,0 +1,22 @@ + + + + + + \ No newline at end of file diff --git a/Android/src/app/src/main/res/values/themes.xml b/Android/src/app/src/main/res/values/themes.xml index beeda9c..b69d8fb 100644 --- a/Android/src/app/src/main/res/values/themes.xml +++ b/Android/src/app/src/main/res/values/themes.xml @@ -15,10 +15,13 @@ limitations under the License. --> - + + \ No newline at end of file diff --git a/Android/src/gradle/libs.versions.toml b/Android/src/gradle/libs.versions.toml index 10dd2e5..19d5d3f 100644 --- a/Android/src/gradle/libs.versions.toml +++ b/Android/src/gradle/libs.versions.toml @@ -31,6 +31,8 @@ netOpenidAppauth = "0.11.1" splashscreen = "1.2.0-beta01" hilt = "2.56.2" hiltNavigation = "1.2.0" +ossLicenses = "0.10.6" +playServicesOssLicenses = "17.1.0" googleService = "4.4.3" firebaseBom = "33.16.0" @@ -75,6 +77,7 @@ hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigation" } hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" } hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" } +play-services-oss-licenses = { module = "com.google.android.gms:play-services-oss-licenses", version.ref = "playServicesOssLicenses"} firebase-bom = { group = "com.google.firebase", name = "firebase-bom", version.ref = "firebaseBom" } # When using the Firebase BoM, you don't specify versions in Firebase # library dependencies. @@ -87,4 +90,5 @@ kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "ko kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "serializationPlugin" } protobuf = {id = "com.google.protobuf", version.ref = "protobuf"} hilt-application = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +oss-licenses = {id = "com.google.android.gms.oss-licenses-plugin", version.ref = "ossLicenses"} google-services = { id = "com.google.gms.google-services", version.ref = "googleService" } \ No newline at end of file diff --git a/Android/src/settings.gradle.kts b/Android/src/settings.gradle.kts index fa3d79f..e10f0ee 100644 --- a/Android/src/settings.gradle.kts +++ b/Android/src/settings.gradle.kts @@ -26,6 +26,13 @@ pluginManagement { mavenCentral() gradlePluginPortal() } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "com.google.android.gms.oss-licenses-plugin") { + useModule("com.google.android.gms:oss-licenses-plugin:0.10.6") + } + } + } } dependencyResolutionManagement {