feat(about screen): complete about screen

This commit is contained in:
Aunali321 2023-05-22 03:23:14 +05:30
parent 9b585c73fb
commit fec8c0cc14
2 changed files with 135 additions and 24 deletions

View File

@ -1,19 +1,28 @@
package app.revanced.manager.compose.ui.screen.settings package app.revanced.manager.compose.ui.screen.settings
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Code
import androidx.compose.material.icons.outlined.FavoriteBorder
import androidx.compose.material.icons.outlined.Language
import androidx.compose.material.icons.outlined.MailOutline
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import app.revanced.manager.compose.BuildConfig
import app.revanced.manager.compose.R import app.revanced.manager.compose.R
import app.revanced.manager.compose.ui.component.AppTopBar import app.revanced.manager.compose.ui.component.AppTopBar
import app.revanced.manager.compose.util.openUrl
import com.google.accompanist.drawablepainter.rememberDrawablePainter import com.google.accompanist.drawablepainter.rememberDrawablePainter
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@ -24,6 +33,30 @@ fun AboutSettingsScreen(
val context = LocalContext.current val context = LocalContext.current
val icon = rememberDrawablePainter(context.packageManager.getApplicationIcon(context.packageName)) val icon = rememberDrawablePainter(context.packageManager.getApplicationIcon(context.packageName))
val filledButton = listOf(
Triple(Icons.Outlined.FavoriteBorder, stringResource(R.string.donate)) {
context.openUrl("https://github.com/sponsors/ReVanced")
},
Triple(Icons.Outlined.Language, stringResource(R.string.website), third = {
context.openUrl("https://revanced.app")
}),
)
val outlinedButton = listOf(
Triple(Icons.Outlined.Code, stringResource(R.string.github), third = {
context.openUrl("https://revanced.app/github")
}),
Triple(Icons.Outlined.MailOutline, stringResource(R.string.contact), third = {
context.openUrl("mailto:contact@revanced.app")
}),
)
val listItems = listOf(
Triple(stringResource(R.string.submit_feedback), stringResource(R.string.submit_feedback_description), third = { /*TODO*/ }),
Triple(stringResource(R.string.contributors), stringResource(R.string.contributors_description), third = { /*TODO*/ }),
Triple(stringResource(R.string.developer_options), stringResource(R.string.developer_options_description), third = { /*TODO*/ }),
)
Scaffold( Scaffold(
topBar = { topBar = {
AppTopBar( AppTopBar(
@ -38,45 +71,112 @@ fun AboutSettingsScreen(
.padding(paddingValues) .padding(paddingValues)
.verticalScroll(rememberScrollState()) .verticalScroll(rememberScrollState())
) { ) {
Column( Column(
modifier = Modifier.fillMaxWidth().padding(vertical = 15.dp), modifier = Modifier.fillMaxWidth().padding(vertical = 16.dp),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(4.dp)
) { ) {
Image(painter = icon, contentDescription = null) Image(painter = icon, contentDescription = null)
Text(stringResource(R.string.app_name), style = MaterialTheme.typography.titleLarge) Text(stringResource(R.string.app_name), style = MaterialTheme.typography.titleLarge)
Text("Version 1.0.0 (100000000)", style = MaterialTheme.typography.labelMedium) Text( text = stringResource(R.string.version) + " " + BuildConfig.VERSION_NAME + " (" + BuildConfig.VERSION_CODE + ")", style = MaterialTheme.typography.bodyMedium)
Row( Row(
horizontalArrangement = Arrangement.spacedBy(10.dp) modifier = Modifier.padding(top = 12.dp)
) { ) {
FilledTonalButton(onClick = { /*TODO*/ }) { filledButton.forEach { (icon, text, onClick) ->
Text("Website") FilledTonalButton(
} onClick = onClick,
FilledTonalButton(onClick = { /*TODO*/ }) { modifier = Modifier.padding(end = 8.dp)
Text("Donate") ) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
icon,
contentDescription = null,
modifier = Modifier
.size(28.dp)
.padding(end = 8.dp),
tint = MaterialTheme.colorScheme.primary
)
Text(
text,
style = MaterialTheme.typography.labelLarge,
)
}
}
} }
} }
Row( Row(
horizontalArrangement = Arrangement.spacedBy(10.dp) modifier = Modifier.padding(top = 12.dp)
) { ) {
OutlinedButton(onClick = { /*TODO*/ }) { outlinedButton.forEach { (icon, text, onClick) ->
Text("GitHub") Button(
} onClick = onClick,
OutlinedButton(onClick = { /*TODO*/ }) { modifier = Modifier.padding(end = 8.dp),
Text("Contact") colors = ButtonDefaults.buttonColors(
} containerColor = Color.Transparent,
OutlinedButton(onClick = { /*TODO*/ }) { contentColor = MaterialTheme.colorScheme.onSecondaryContainer
Text("License") ),
border = ButtonDefaults.outlinedButtonBorder
) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Icon(
icon,
contentDescription = null,
modifier = Modifier
.size(28.dp)
.padding(end = 8.dp),
tint = MaterialTheme.colorScheme.primary
)
Text(
text,
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.primary
)
}
}
} }
} }
} }
ListItem( Box(
modifier = Modifier.clickable { }, modifier = Modifier
headlineContent = { Text(stringResource(R.string.contributors)) }, .padding(vertical = 8.dp, horizontal = 16.dp)
supportingContent = { Text(stringResource(R.string.contributors_description)) } .border(
) width = 1.dp,
color = MaterialTheme.colorScheme.outlineVariant,
shape = MaterialTheme.shapes.medium
)
.padding(16.dp)
) {
Column {
Text(
text = stringResource(R.string.about_revanced_manager),
style = MaterialTheme.typography.titleMedium,
modifier = Modifier.padding(bottom = 8.dp),
)
Text(
text = stringResource(R.string.revanced_manager_description),
style = MaterialTheme.typography.bodyMedium,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
}
}
listItems.forEach { (title, description, onClick) ->
ListItem(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
.clickable { onClick() },
headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) },
supportingContent = { Text(description, style = MaterialTheme.typography.bodyMedium) }
)
}
} }
} }
} }

View File

@ -73,4 +73,15 @@
<string name="patcher_step_group_patching">Patching</string> <string name="patcher_step_group_patching">Patching</string>
<string name="patcher_step_group_saving">Saving</string> <string name="patcher_step_group_saving">Saving</string>
<string name="patcher_step_write_patched">Write patched Apk</string> <string name="patcher_step_write_patched">Write patched Apk</string>
<string name="donate">Donate</string>
<string name="website">Website</string>
<string name="github">GitHub</string>
<string name="contact">Contact</string>
<string name="version">Version</string>
<string name="submit_feedback">Submit issue or feedback</string>
<string name="submit_feedback_description">Help us improve this application</string>
<string name="developer_options">Developer options</string>
<string name="developer_options_description">Options for debugging issues</string>
<string name="about_revanced_manager">About ReVanced Manager</string>
<string name="revanced_manager_description">ReVanced Manager is an application designed to work with ReVanced Patcher, which allows for long-lasting patches to be created for Android apps. The patching system is designed to automatically work with new versions of apps with minimal maintenance.</string>
</resources> </resources>