feat: licenses screen (#47)

This commit is contained in:
Ax333l 2023-06-29 22:05:43 +02:00 committed by GitHub
parent 5c12fe546b
commit 5e71576701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 2 deletions

View File

@ -4,6 +4,7 @@ plugins {
id("com.google.devtools.ksp")
id("kotlin-parcelize")
kotlin("plugin.serialization") version "1.8.21"
id("com.mikepenz.aboutlibraries.plugin") version "10.8.0"
}
android {
@ -116,6 +117,9 @@ dependencies {
// Compose Navigation
implementation("dev.olshevski.navigation:reimagined:1.4.0")
// Licenses
implementation("com.mikepenz:aboutlibraries-compose:10.8.0")
// Ktor
val ktorVersion = "2.3.0"
implementation("io.ktor:ktor-client-core:$ktorVersion")

View File

@ -29,4 +29,7 @@ sealed interface SettingsDestination : Parcelable {
@Parcelize
object Contributors: SettingsDestination
@Parcelize
object Licenses: SettingsDestination
}

View File

@ -111,7 +111,8 @@ fun SettingsScreen(
is SettingsDestination.About -> AboutSettingsScreen(
onBackClick = { navController.pop() },
onContributorsClick = { navController.navigate(SettingsDestination.Contributors) }
onContributorsClick = { navController.navigate(SettingsDestination.Contributors) },
onLicensesClick = { navController.navigate(SettingsDestination.Licenses) }
)
is SettingsDestination.UpdateProgress -> UpdateProgressScreen(
@ -122,6 +123,10 @@ fun SettingsScreen(
onBackClick = { navController.pop() },
)
is SettingsDestination.Licenses -> LicensesScreen(
onBackClick = { navController.pop() },
)
is SettingsDestination.Settings -> {
Scaffold(
topBar = {

View File

@ -33,6 +33,7 @@ import dev.olshevski.navigation.reimagined.navigate
fun AboutSettingsScreen(
onBackClick: () -> Unit,
onContributorsClick: () -> Unit,
onLicensesClick: () -> Unit,
) {
val context = LocalContext.current
val icon = rememberDrawablePainter(context.packageManager.getApplicationIcon(context.packageName))
@ -62,6 +63,8 @@ fun AboutSettingsScreen(
third = onContributorsClick),
Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description),
third = { /*TODO*/ }),
Triple(stringResource(R.string.opensource_licenses), stringResource(R.string.opensource_licenses_description),
third = onLicensesClick)
)
Scaffold(
@ -79,7 +82,9 @@ fun AboutSettingsScreen(
.verticalScroll(rememberScrollState())
) {
Column(
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(4.dp)
) {

View File

@ -0,0 +1,41 @@
package app.revanced.manager.ui.screen.settings
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import app.revanced.manager.R
import app.revanced.manager.ui.component.AppScaffold
import app.revanced.manager.ui.component.AppTopBar
import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun LicensesScreen(
onBackClick: () -> Unit,
) {
AppScaffold(
topBar = { scrollBehavior ->
AppTopBar(
title = stringResource(R.string.opensource_licenses),
scrollBehavior = scrollBehavior,
onBackClick = onBackClick
)
}
) { paddingValues ->
Column(modifier = Modifier.padding(paddingValues)) {
LibrariesContainer(
modifier = Modifier
.fillMaxSize(),
colors = LibraryDefaults.libraryColors(
backgroundColor = MaterialTheme.colorScheme.background,
contentColor = MaterialTheme.colorScheme.onBackground,
badgeBackgroundColor = MaterialTheme.colorScheme.primary,
badgeContentColor = MaterialTheme.colorScheme.onPrimary,
)
)
}
}
}

View File

@ -15,6 +15,8 @@
<string name="general_description">General settings</string>
<string name="updates">Updates</string>
<string name="updates_description">Updates for ReVanced Manager</string>
<string name="opensource_licenses">Open source licenses</string>
<string name="opensource_licenses_description">View all the libraries used to make this application</string>
<string name="downloads">Downloads</string>
<string name="downloads_description">Manage downloaded content</string>
<string name="import_export">Import &amp; export</string>