diff --git a/AndroidApp/.idea/kotlinc.xml b/AndroidApp/.idea/kotlinc.xml index 8ad8c861..03fcfb7b 100644 --- a/AndroidApp/.idea/kotlinc.xml +++ b/AndroidApp/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/AndroidApp/app/build.gradle.kts b/AndroidApp/app/build.gradle.kts index cf3c389e..f57641e8 100644 --- a/AndroidApp/app/build.gradle.kts +++ b/AndroidApp/app/build.gradle.kts @@ -1,5 +1,6 @@ plugins { id("common.android") + alias(libs.plugins.about.libraries) } android { @@ -26,4 +27,5 @@ dependencies { // その他 implementation(libs.io.insert.koin) debugImplementation(libs.com.squareup.leakcanary.android) + implementation(libs.about.libraries.core) } \ No newline at end of file diff --git a/AndroidApp/app/licenses.yml b/AndroidApp/app/licenses.yml deleted file mode 100644 index a869d172..00000000 --- a/AndroidApp/app/licenses.yml +++ /dev/null @@ -1,12 +0,0 @@ -- artifact: io.insert-koin:koin-android:+ - name: koin-android - copyrightHolder: Arnaud GIULIANI, Laurent BARESSE - license: The Apache Software License, Version 2.0 - licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt - url: https://insert-koin.io/ -- artifact: com.google.code.gson:gson:+ - name: gson - copyrightHolder: Google Inc. - license: The Apache Software License, Version 2.0 - licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt - url: https://github.com/google/gson diff --git a/AndroidApp/build.gradle.kts b/AndroidApp/build.gradle.kts index db0d8c00..9c2e7bff 100644 --- a/AndroidApp/build.gradle.kts +++ b/AndroidApp/build.gradle.kts @@ -4,5 +4,5 @@ plugins { alias(libs.plugins.org.jetbrains.kotlin.android) apply false alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.com.google.devtools.ksp) apply false - alias(libs.plugins.com.jaredsburrows.license) apply false + alias(libs.plugins.about.libraries) apply false } diff --git a/AndroidApp/gradle/libs.versions.toml b/AndroidApp/gradle/libs.versions.toml index a36a4208..6f844e73 100644 --- a/AndroidApp/gradle/libs.versions.toml +++ b/AndroidApp/gradle/libs.versions.toml @@ -14,7 +14,6 @@ agp = "9.0.0" kotlin = "2.3.0" kotlinx-coroutines = "1.10.2" com-google-devtools-ksp = "2.3.4" -com-jaredsburrows-license = "0.9.8" androidx-core = "1.17.0" androidx-appcompat = "1.7.1" androidx-security = "1.1.0" @@ -33,6 +32,7 @@ io-insert-koin = "4.1.1" com-google-code-gson = "2.13.2" com-squareup-leakcanary = "2.14" mockk = "1.14.7" +about-libraries = "14.0.0-b01" [plugins] com-android-application = { id = "com.android.application", version.ref = "agp" } @@ -40,8 +40,8 @@ com-android-library = { id = "com.android.library", version.ref = "agp" } org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } com-google-devtools-ksp = { id = "com.google.devtools.ksp", version.ref = "com-google-devtools-ksp" } -com-jaredsburrows-license = { id = "com.jaredsburrows.license", version.ref = "com-jaredsburrows-license" } screenshot = { id = "com.android.compose.screenshot", version.ref = "androidx-compose-screenshot" } +about-libraries = { id = "com.mikepenz.aboutlibraries.plugin.android", version.ref = "about-libraries" } [libraries] # androidx @@ -77,10 +77,16 @@ screenshot-validation-api = { group = "com.android.tools.screenshot", name = "sc android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "agp" } # その他 +com-google-code-gson = { module = "com.google.code.gson:gson", version.ref = "com-google-code-gson" } +# DI io-insert-koin = { module = "io.insert-koin:koin-android", version.ref = "io-insert-koin" } io-insert-koin-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "io-insert-koin" } -com-google-code-gson = { module = "com.google.code.gson:gson", version.ref = "com-google-code-gson" } +# analyze com-squareup-leakcanary-android = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "com-squareup-leakcanary" } +# license +about-libraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "about-libraries" } +about-libraries-compose-core = { module = "com.mikepenz:aboutlibraries-compose-core", version.ref = "about-libraries" } +about-libraries-compose-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "about-libraries" } [bundles] androidx-compose = [ diff --git a/AndroidApp/ui/build.gradle.kts b/AndroidApp/ui/build.gradle.kts index 702551d3..5fef9d62 100644 --- a/AndroidApp/ui/build.gradle.kts +++ b/AndroidApp/ui/build.gradle.kts @@ -1,7 +1,5 @@ plugins { id("common.library.compose") - // note: 最新のgradle/agp非対応 -// alias(libs.plugins.com.jaredsburrows.license) alias(libs.plugins.screenshot) } @@ -29,4 +27,6 @@ dependencies { // その他 implementation(libs.io.insert.koin) implementation(libs.io.insert.koin.compose) + implementation(libs.about.libraries.compose.core) + implementation(libs.about.libraries.compose.m3) } diff --git a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/index.html b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/index.html index 39dd0577..88644a28 100644 --- a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/index.html +++ b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/index.html @@ -19,7 +19,7 @@

Test Summary

-
16
+
17

tests

@@ -43,7 +43,7 @@

Test Summary

-
3.154s
+
3.747s

duration

@@ -88,11 +88,11 @@

Packages

me.nya_n.notificationnotifier -16 +17 0 0 0 -3.154s +3.747s 100% @@ -120,17 +120,17 @@

Classes

0 0 0 -1.615s +1.931s 100% me.nya_n.notificationnotifier.ContentScreenshotTest -5 +6 0 0 0 -1.539s +1.816s 100% @@ -139,7 +139,7 @@

Classes

\ No newline at end of file diff --git a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ComponentScreenshotTest.html b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ComponentScreenshotTest.html index f02cbc13..bfa77071 100644 --- a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ComponentScreenshotTest.html +++ b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ComponentScreenshotTest.html @@ -46,7 +46,7 @@

Class me.nya_n.notificationnotifier.ComponentScreenshotTest

-
1.615s
+
1.931s

duration

@@ -361,7 +361,7 @@

TopBarComponentScreenshotTest

\ No newline at end of file diff --git a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ContentScreenshotTest.html b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ContentScreenshotTest.html index 05e45bdb..2d2f3883 100644 --- a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ContentScreenshotTest.html +++ b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.ContentScreenshotTest.html @@ -22,7 +22,7 @@

Class me.nya_n.notificationnotifier.ContentScreenshotTest

-
5
+
6

tests

@@ -46,7 +46,7 @@

Class me.nya_n.notificationnotifier.ContentScreenshotTest

-
1.539s
+
1.816s

duration

@@ -98,6 +98,32 @@

DetailContentScreenshotTest

+ +

LicenseContentScreenshotTest

+ + + + + + + + + + + + + + + + +
Reference ImageActual ImageDiff Image
+Error displaying image at /mnt/e/workspace/ann/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/LicenseContentScreenshotTest_a51312a5_0.png + +Error displaying image at /mnt/e/workspace/ann/AndroidApp/ui/build/outputs/screenshotTest-results/preview/debug/rendered/me/nya_n/notificationnotifier/ContentScreenshotTest/LicenseContentScreenshotTest_a51312a5_0.png +
+
+
+

MainContentScreenshotTest

@@ -112,10 +138,10 @@

MainContentScreenshotTest

-Error displaying image at /mnt/e/workspace/ann/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_0.png +Error displaying image at /mnt/e/workspace/ann/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_a51312a5_0.png -Error displaying image at /mnt/e/workspace/ann/AndroidApp/ui/build/outputs/screenshotTest-results/preview/debug/rendered/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_0.png +Error displaying image at /mnt/e/workspace/ann/AndroidApp/ui/build/outputs/screenshotTest-results/preview/debug/rendered/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_a51312a5_0.png @@ -205,7 +231,7 @@

TargetContentScreenshotTest

\ No newline at end of file diff --git a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.html b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.html index a0610ae8..eeb98b2c 100644 --- a/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.html +++ b/AndroidApp/ui/build/reports/screenshotTest/preview/debug/me.nya_n.notificationnotifier.html @@ -21,7 +21,7 @@

Package me.nya_n.notificationnotifier

-
16
+
17

tests

@@ -45,7 +45,7 @@

Package me.nya_n.notificationnotifier

-
3.154s
+
3.747s

duration

@@ -90,18 +90,18 @@

Classes

0 0 0 -1.615s +1.931s 100% ContentScreenshotTest -5 +6 0 0 0 -1.539s +1.816s 100% @@ -109,7 +109,7 @@

Classes

\ No newline at end of file diff --git a/AndroidApp/ui/src/main/assets/open_source_licenses.html b/AndroidApp/ui/src/main/assets/open_source_licenses.html deleted file mode 100644 index b90d6c62..00000000 --- a/AndroidApp/ui/src/main/assets/open_source_licenses.html +++ /dev/null @@ -1,937 +0,0 @@ - - - - - - Open source licenses - - -

Notice for packages:

- - - diff --git a/AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/license/LicenseScreen.kt b/AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/license/LicenseScreen.kt index 305ec4a6..d9abfe33 100644 --- a/AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/license/LicenseScreen.kt +++ b/AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/license/LicenseScreen.kt @@ -1,36 +1,73 @@ package me.nya_n.notificationnotifier.ui.screen.license -import android.webkit.WebView -import android.webkit.WebViewClient +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.material3.AlertDialogDefaults +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SnackbarHostState import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.viewinterop.AndroidView +import androidx.compose.ui.unit.dp import androidx.navigation.NavController -import androidx.navigation.compose.rememberNavController +import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.aboutlibraries.entity.Developer +import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.aboutlibraries.entity.License +import com.mikepenz.aboutlibraries.entity.Scm +import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults +import com.mikepenz.aboutlibraries.ui.compose.android.produceLibraries +import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer +import com.mikepenz.aboutlibraries.ui.compose.m3.libraryColors import me.nya_n.notificationnotifier.ui.common.AppScaffold import me.nya_n.notificationnotifier.ui.theme.AppTheme @Composable fun LicenseScreen(navController: NavController) { val snackbarHostState = remember { SnackbarHostState() } - AppScaffold( + val libraries by produceLibraries() + LicenseContent( snackbarHostState = snackbarHostState, + libraries = libraries, onBack = { navController.popBackStack() } + ) +} + +@Composable +fun LicenseContent( + snackbarHostState: SnackbarHostState, + libraries: Libs?, + onBack: () -> Unit +) { + AppScaffold( + snackbarHostState = snackbarHostState, + onBack = onBack ) { - AndroidView( - modifier = Modifier.padding(it), - factory = { context -> - WebView(context).apply { - webViewClient = WebViewClient() - loadUrl("file:///android_asset/open_source_licenses.html") - } - }, + LibrariesContainer( + libraries, + Modifier.padding(it), + colors = LibraryDefaults.libraryColors( + libraryBackgroundColor = Color.Transparent, + dialogBackgroundColor = AlertDialogDefaults.containerColor, + dialogConfirmButtonColor = AlertDialogDefaults.textContentColor + ), + divider = { + Box( + Modifier + .fillMaxWidth() + .height(1.dp) + .padding(horizontal = 16.dp) + .background(MaterialTheme.colorScheme.secondaryContainer) + ) + } ) } } @@ -38,10 +75,62 @@ fun LicenseScreen(navController: NavController) { @Preview @Composable private fun LicensePreview() { - val navController = rememberNavController() + val snackbarHostState = remember { SnackbarHostState() } + val libs = Libs( + libraries = listOf( + Library( + uniqueId = "sample1", + artifactVersion = "1.2.3", + name = "sample1", + description = "test description", + website = "https://nya-n.me", + developers = listOf(Developer("kani", null)), + organization = null, + scm = Scm(null, null, null), + licenses = setOf( + License( + name = "Apache-2.0", + url = "https://www.apache.org/licenses/LICENSE-2.0", + hash = "abc123hash" + ) + ) + ), + Library( + uniqueId = "sample2", + artifactVersion = null, + name = "sample2", + description = null, + website = null, + developers = listOf(), + organization = null, + scm = Scm(null, null, null), + licenses = setOf( + License( + name = "MIT", + url = "https://opensource.org/licenses/MIT", + hash = "def456hash" + ) + ), + ), + Library( + uniqueId = "sample3", + artifactVersion = null, + name = "sample3", + description = null, + website = null, + developers = listOf(), + organization = null, + scm = null, + licenses = setOf() + ) + ), + licenses = setOf(), + ) AppTheme { - LicenseScreen( - navController = navController + LicenseContent( + snackbarHostState = snackbarHostState, + libraries = libs, + onBack = { } ) } } diff --git a/AndroidApp/ui/src/screenshotTest/kotlin/me/nya_n/notificationnotifier/ContentScreenshotTest.kt b/AndroidApp/ui/src/screenshotTest/kotlin/me/nya_n/notificationnotifier/ContentScreenshotTest.kt index 0440cefa..3ae4ebca 100644 --- a/AndroidApp/ui/src/screenshotTest/kotlin/me/nya_n/notificationnotifier/ContentScreenshotTest.kt +++ b/AndroidApp/ui/src/screenshotTest/kotlin/me/nya_n/notificationnotifier/ContentScreenshotTest.kt @@ -10,8 +10,14 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.tooling.preview.Preview import com.android.tools.screenshot.PreviewTest +import com.mikepenz.aboutlibraries.Libs +import com.mikepenz.aboutlibraries.entity.Developer +import com.mikepenz.aboutlibraries.entity.Library +import com.mikepenz.aboutlibraries.entity.License +import com.mikepenz.aboutlibraries.entity.Scm import me.nya_n.notificationnotifier.model.InstalledApp import me.nya_n.notificationnotifier.ui.screen.detail.DetailContent +import me.nya_n.notificationnotifier.ui.screen.license.LicenseContent import me.nya_n.notificationnotifier.ui.screen.main.MainContent import me.nya_n.notificationnotifier.ui.screen.main.TabItem import me.nya_n.notificationnotifier.ui.screen.selection.SelectionContent @@ -23,7 +29,7 @@ import me.nya_n.notificationnotifier.ui.util.Sample class ContentScreenshotTest { @PreviewTest - @Preview + @Preview(backgroundColor = 0xFFC7B5A8, showBackground = true) @Composable fun MainContentScreenshotTest() { val snackbarHostState = remember { SnackbarHostState() } @@ -111,4 +117,68 @@ class ContentScreenshotTest { ) } } + + @PreviewTest + @Preview(backgroundColor = 0xFFC7B5A8, showBackground = true) + @Composable + fun LicenseContentScreenshotTest() { + val snackbarHostState = remember { SnackbarHostState() } + val libs = Libs( + libraries = listOf( + Library( + uniqueId = "sample1", + artifactVersion = "1.2.3", + name = "sample1", + description = "test description", + website = "https://nya-n.me", + developers = listOf(Developer("kani", null)), + organization = null, + scm = Scm(null, null, null), + licenses = setOf( + License( + name = "Apache-2.0", + url = "https://www.apache.org/licenses/LICENSE-2.0", + hash = "abc123hash" + ) + ) + ), + Library( + uniqueId = "sample2", + artifactVersion = null, + name = "sample2", + description = null, + website = null, + developers = listOf(), + organization = null, + scm = Scm(null, null, null), + licenses = setOf( + License( + name = "MIT", + url = "https://opensource.org/licenses/MIT", + hash = "def456hash" + ) + ), + ), + Library( + uniqueId = "sample3", + artifactVersion = null, + name = "sample3", + description = null, + website = null, + developers = listOf(), + organization = null, + scm = null, + licenses = setOf() + ) + ), + licenses = setOf(), + ) + AppTheme { + LicenseContent( + snackbarHostState = snackbarHostState, + libraries = libs, + onBack = { } + ) + } + } } \ No newline at end of file diff --git a/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/LicenseContentScreenshotTest_a51312a5_0.png b/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/LicenseContentScreenshotTest_a51312a5_0.png new file mode 100644 index 00000000..f6d2caa1 Binary files /dev/null and b/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/LicenseContentScreenshotTest_a51312a5_0.png differ diff --git a/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_a51312a5_0.png b/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_a51312a5_0.png new file mode 100644 index 00000000..9a151270 Binary files /dev/null and b/AndroidApp/ui/src/screenshotTestDebug/reference/me/nya_n/notificationnotifier/ContentScreenshotTest/MainContentScreenshotTest_a51312a5_0.png differ