mirror of
https://github.com/revanced/revanced-manager-compose.git
synced 2025-04-30 06:14:25 +02:00
feat: licenses screen (#47)
This commit is contained in:
parent
5c12fe546b
commit
5e71576701
@ -4,6 +4,7 @@ plugins {
|
|||||||
id("com.google.devtools.ksp")
|
id("com.google.devtools.ksp")
|
||||||
id("kotlin-parcelize")
|
id("kotlin-parcelize")
|
||||||
kotlin("plugin.serialization") version "1.8.21"
|
kotlin("plugin.serialization") version "1.8.21"
|
||||||
|
id("com.mikepenz.aboutlibraries.plugin") version "10.8.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
@ -116,6 +117,9 @@ dependencies {
|
|||||||
// Compose Navigation
|
// Compose Navigation
|
||||||
implementation("dev.olshevski.navigation:reimagined:1.4.0")
|
implementation("dev.olshevski.navigation:reimagined:1.4.0")
|
||||||
|
|
||||||
|
// Licenses
|
||||||
|
implementation("com.mikepenz:aboutlibraries-compose:10.8.0")
|
||||||
|
|
||||||
// Ktor
|
// Ktor
|
||||||
val ktorVersion = "2.3.0"
|
val ktorVersion = "2.3.0"
|
||||||
implementation("io.ktor:ktor-client-core:$ktorVersion")
|
implementation("io.ktor:ktor-client-core:$ktorVersion")
|
||||||
|
@ -29,4 +29,7 @@ sealed interface SettingsDestination : Parcelable {
|
|||||||
@Parcelize
|
@Parcelize
|
||||||
object Contributors: SettingsDestination
|
object Contributors: SettingsDestination
|
||||||
|
|
||||||
|
@Parcelize
|
||||||
|
object Licenses: SettingsDestination
|
||||||
|
|
||||||
}
|
}
|
@ -111,7 +111,8 @@ fun SettingsScreen(
|
|||||||
|
|
||||||
is SettingsDestination.About -> AboutSettingsScreen(
|
is SettingsDestination.About -> AboutSettingsScreen(
|
||||||
onBackClick = { navController.pop() },
|
onBackClick = { navController.pop() },
|
||||||
onContributorsClick = { navController.navigate(SettingsDestination.Contributors) }
|
onContributorsClick = { navController.navigate(SettingsDestination.Contributors) },
|
||||||
|
onLicensesClick = { navController.navigate(SettingsDestination.Licenses) }
|
||||||
)
|
)
|
||||||
|
|
||||||
is SettingsDestination.UpdateProgress -> UpdateProgressScreen(
|
is SettingsDestination.UpdateProgress -> UpdateProgressScreen(
|
||||||
@ -122,6 +123,10 @@ fun SettingsScreen(
|
|||||||
onBackClick = { navController.pop() },
|
onBackClick = { navController.pop() },
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is SettingsDestination.Licenses -> LicensesScreen(
|
||||||
|
onBackClick = { navController.pop() },
|
||||||
|
)
|
||||||
|
|
||||||
is SettingsDestination.Settings -> {
|
is SettingsDestination.Settings -> {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
|
@ -33,6 +33,7 @@ import dev.olshevski.navigation.reimagined.navigate
|
|||||||
fun AboutSettingsScreen(
|
fun AboutSettingsScreen(
|
||||||
onBackClick: () -> Unit,
|
onBackClick: () -> Unit,
|
||||||
onContributorsClick: () -> Unit,
|
onContributorsClick: () -> Unit,
|
||||||
|
onLicensesClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val icon = rememberDrawablePainter(context.packageManager.getApplicationIcon(context.packageName))
|
val icon = rememberDrawablePainter(context.packageManager.getApplicationIcon(context.packageName))
|
||||||
@ -62,6 +63,8 @@ fun AboutSettingsScreen(
|
|||||||
third = onContributorsClick),
|
third = onContributorsClick),
|
||||||
Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description),
|
Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description),
|
||||||
third = { /*TODO*/ }),
|
third = { /*TODO*/ }),
|
||||||
|
Triple(stringResource(R.string.opensource_licenses), stringResource(R.string.opensource_licenses_description),
|
||||||
|
third = onLicensesClick)
|
||||||
)
|
)
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
@ -79,7 +82,9 @@ fun AboutSettingsScreen(
|
|||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 16.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
verticalArrangement = Arrangement.spacedBy(4.dp)
|
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="general_description">General settings</string>
|
||||||
<string name="updates">Updates</string>
|
<string name="updates">Updates</string>
|
||||||
<string name="updates_description">Updates for ReVanced Manager</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">Downloads</string>
|
||||||
<string name="downloads_description">Manage downloaded content</string>
|
<string name="downloads_description">Manage downloaded content</string>
|
||||||
<string name="import_export">Import & export</string>
|
<string name="import_export">Import & export</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user