diff --git a/zeapp/android/build.gradle.kts b/zeapp/android/build.gradle.kts index 401c4f5f..903afc1f 100644 --- a/zeapp/android/build.gradle.kts +++ b/zeapp/android/build.gradle.kts @@ -11,6 +11,7 @@ plugins { alias(libs.plugins.kotlin.kapt) alias(libs.plugins.license.report.gradle) alias(libs.plugins.baselineprofile) + alias(libs.plugins.aboutlibraries.gradle) } val isCi = System.getenv("CI") == "true" @@ -183,6 +184,7 @@ dependencies { implementation(libs.coil.compose) implementation(libs.coil.transformations) implementation(libs.timber) + implementation(libs.aboutlibraries.compose) debugImplementation(libs.androidx.compose.ui.tooling) debugImplementation(libs.androidx.compose.ui.test.manifest) diff --git a/zeapp/android/src/main/java/de/berlindroid/zeapp/ZeMainActivity.kt b/zeapp/android/src/main/java/de/berlindroid/zeapp/ZeMainActivity.kt index 0614ef4c..037a4776 100644 --- a/zeapp/android/src/main/java/de/berlindroid/zeapp/ZeMainActivity.kt +++ b/zeapp/android/src/main/java/de/berlindroid/zeapp/ZeMainActivity.kt @@ -6,6 +6,7 @@ import android.graphics.Bitmap import android.net.Uri import android.os.Bundle import androidx.activity.ComponentActivity +import androidx.activity.compose.BackHandler import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.compose.animation.core.animateFloatAsState @@ -91,6 +92,8 @@ import androidx.compose.ui.unit.sp import androidx.compose.ui.window.DialogProperties import androidx.compose.ui.zIndex import com.ban.autosizetextfield.AutoSizeTextField +import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer +import com.mikepenz.aboutlibraries.ui.compose.m3.LibraryDefaults.libraryColors import dagger.hilt.android.AndroidEntryPoint import de.berlindroid.zeapp.zemodels.ZeConfiguration import de.berlindroid.zeapp.zemodels.ZeEditor @@ -208,6 +211,7 @@ class ZeMainActivity : ComponentActivity() { private fun ZeScreen(vm: ZeBadgeViewModel, modifier: Modifier = Modifier) { val lazyListState = rememberLazyListState() var isShowingAbout by remember { mutableStateOf(false) } + var isShowingOpenSource by remember { mutableStateOf(false) } val context = LocalContext.current val goToReleases: () -> Unit = remember { { @@ -229,6 +233,10 @@ private fun ZeScreen(vm: ZeBadgeViewModel, modifier: Modifier = Modifier) { val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed) val scope = rememberCoroutineScope() + BackHandler(isShowingOpenSource || isShowingAbout) { + isShowingOpenSource = false + isShowingAbout = false + } ZeBadgeAppTheme( content = { @@ -240,6 +248,7 @@ private fun ZeScreen(vm: ZeBadgeViewModel, modifier: Modifier = Modifier) { onGetStoredPages = vm::getStoredPages, onSaveAllClick = vm::saveAll, onGotoReleaseClick = goToReleases, + onGotoOpenSourceClick = { isShowingOpenSource = !isShowingOpenSource }, onUpdateConfig = vm::listConfiguration, onCloseDrawer = { scope.launch { @@ -275,6 +284,8 @@ private fun ZeScreen(vm: ZeBadgeViewModel, modifier: Modifier = Modifier) { content = { paddingValues -> if (isShowingAbout) { ZeAbout(paddingValues, vm, LocalContext.current) + } else if (isShowingOpenSource) { + ZeOpenSource(paddingValues) } else { ZePages( paddingValues = paddingValues, @@ -297,6 +308,7 @@ private fun ZeDrawerContent( onSaveAllClick: () -> Unit = {}, onGetStoredPages: () -> Unit = {}, onGotoReleaseClick: () -> Unit = {}, + onGotoOpenSourceClick: () -> Unit = {}, onUpdateConfig: () -> Unit = {}, onCloseDrawer: () -> Unit = {}, onTitleClick: () -> Unit = {}, @@ -407,6 +419,14 @@ private fun ZeDrawerContent( onClick = onGotoReleaseClick, ) } + + item { + NavDrawerItem( + text = stringResource(id = R.string.ze_navdrawer_open_source), + painter = painterResource(id = R.drawable.ic_open_source_initiative), + onClick = onGotoOpenSourceClick, + ) + } } } } @@ -465,6 +485,22 @@ private fun ZeAbout( } } +@Composable +private fun ZeOpenSource( + paddingValues: PaddingValues, +) { + ZeSurface { + LibrariesContainer( + Modifier.fillMaxSize(), + contentPadding = paddingValues, + colors = libraryColors( + backgroundColor = ZeBlack, + badgeBackgroundColor = ZeWhite, + ), + ) + } +} + @Composable @OptIn(ExperimentalMaterial3Api::class) private fun ZeTopBar( diff --git a/zeapp/android/src/main/res/drawable/ic_open_source_initiative.xml b/zeapp/android/src/main/res/drawable/ic_open_source_initiative.xml new file mode 100644 index 00000000..b89dec0c --- /dev/null +++ b/zeapp/android/src/main/res/drawable/ic_open_source_initiative.xml @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/zeapp/android/src/main/res/values/strings.xml b/zeapp/android/src/main/res/values/strings.xml index 2dd5fbbc..b3d8a344 100644 --- a/zeapp/android/src/main/res/values/strings.xml +++ b/zeapp/android/src/main/res/values/strings.xml @@ -58,6 +58,7 @@ Update config on badge Send random page to badge Open release page + Open Source Select Content Not added by you yet, please feel free to contribute this editor diff --git a/zeapp/build.gradle.kts b/zeapp/build.gradle.kts index dd8ef1fe..7296864b 100644 --- a/zeapp/build.gradle.kts +++ b/zeapp/build.gradle.kts @@ -7,6 +7,7 @@ plugins { alias(libs.plugins.detekt.gradle) apply false alias(libs.plugins.dagger.hilt) apply false alias(libs.plugins.license.report.gradle) apply false + alias(libs.plugins.aboutlibraries.gradle) apply false id("com.android.test") version "8.0.2" apply false kotlin("multiplatform") version "1.9.10" apply false } diff --git a/zeapp/gradle/libs.versions.toml b/zeapp/gradle/libs.versions.toml index de89e03f..c580befb 100644 --- a/zeapp/gradle/libs.versions.toml +++ b/zeapp/gradle/libs.versions.toml @@ -11,6 +11,7 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" } ktlint-gradle = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint-gradle" } license-report-gradle = { id = "com.jaredsburrows.license", version.ref = "license-report-gradle" } +aboutlibraries-gradle = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutlibraries" } [versions] @@ -50,9 +51,11 @@ ktor = "2.3.9" uiTestManifest = "1.6.4" mockk = "1.13.11" kotlinxCoroutinesTest = "1.7.3" +aboutlibraries = "11.2.2" [libraries] +aboutlibraries-compose = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutlibraries" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmarkMacroJunit4" } androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "androidx-compose-bom" }