mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: licenses screen (#47)
This commit is contained in:
parent
7e4ee00cb2
commit
6b7143dd8f
@ -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")
|
||||
|
@ -29,4 +29,7 @@ sealed interface SettingsDestination : Parcelable {
|
||||
@Parcelize
|
||||
object Contributors: SettingsDestination
|
||||
|
||||
@Parcelize
|
||||
object Licenses: SettingsDestination
|
||||
|
||||
}
|
@ -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 = {
|
||||
|
@ -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)
|
||||
) {
|
||||
|
@ -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,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
@ -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 & export</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user