refactor: tiny cleanup

This commit is contained in:
Ushie 2022-11-13 23:07:58 +03:00
parent cc231367f4
commit 2eb37b81c8
No known key found for this signature in database
GPG Key ID: 0EF73F1CA38B2D5F
14 changed files with 39 additions and 37 deletions

View File

@ -62,13 +62,7 @@ fun ContributorsCard(
.combinedClickable( .combinedClickable(
onClick = { vm.openUserProfile(contributor.username) }, onClick = { vm.openUserProfile(contributor.username) },
onLongClick = { onLongClick = {
Toast Toast.makeText(context, contributor.username, Toast.LENGTH_SHORT).show()
.makeText(
context,
contributor.username,
Toast.LENGTH_SHORT
)
.show()
} }
) )
) )

View File

@ -16,7 +16,6 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import app.revanced.manager.R import app.revanced.manager.R
@OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun ExpandableCard( fun ExpandableCard(
content: @Composable (arrowButton: @Composable () -> Unit) -> Unit, content: @Composable (arrowButton: @Composable () -> Unit) -> Unit,

View File

@ -31,4 +31,4 @@ fun GroupHeader(
fontWeight = FontWeight.SemiBold fontWeight = FontWeight.SemiBold
) )
} }
} }

View File

@ -22,6 +22,8 @@ fun HeadlineWithCard(
modifier = Modifier modifier = Modifier
.padding(top = 12.dp) .padding(top = 12.dp)
.fillMaxWidth(), .fillMaxWidth(),
) { content() } ) {
content()
}
} }
} }

View File

@ -124,4 +124,4 @@ fun PatchCard(patchClass: PatchClass, isSelected: Boolean, onSelected: () -> Uni
} }
} }
} }
} }

View File

@ -17,24 +17,30 @@ import org.koin.androidx.compose.get
@Composable @Composable
fun PatchCompatibilityDialog( fun PatchCompatibilityDialog(
patchClass: PatchClass, patcherUtils: PatcherUtils = get(), onClose: () -> Unit patchClass: PatchClass,
patcherUtils: PatcherUtils = get(),
onClose: () -> Unit
) { ) {
val patch = patchClass.patch val patch = patchClass.patch
val packageName = patcherUtils.getSelectedPackageInfo()?.packageName val packageName = patcherUtils.getSelectedPackageInfo()?.packageName
AlertDialog(onDismissRequest = onClose, shape = RoundedCornerShape(12.dp), title = { AlertDialog(
Text(stringResource(id = R.string.unsupported), textAlign = TextAlign.Center) onDismissRequest = onClose,
}, text = { shape = RoundedCornerShape(12.dp),
(patch.compatiblePackages!!.forEach { p: Package -> title = { Text(stringResource(R.string.unsupported), textAlign = TextAlign.Center) },
if (p.name == packageName) { text = {
Text( patch.compatiblePackages!!.forEach { p: Package ->
stringResource(id = R.string.only_compatible) + p.versions.reversed() if (p.name == packageName) {
.joinToString(", ") Text(
) stringResource(id = R.string.only_compatible) + p.versions.reversed()
.joinToString(", ")
)
}
}
},
confirmButton = {
TextButton(onClick = onClose) {
Text(text = "Dismiss")
} }
})
}, confirmButton = {
TextButton(onClick = onClose) {
Text(text = "Dismiss")
} }
}) )
} }

View File

@ -15,7 +15,11 @@ import androidx.compose.ui.res.stringResource
@OptIn(ExperimentalMaterial3Api::class) @OptIn(ExperimentalMaterial3Api::class)
@Composable @Composable
fun SocialItem(@StringRes label: Int, imageVector: ImageVector? = null, onClick: () -> Unit) { fun SocialItem(
@StringRes label: Int,
imageVector: ImageVector? = null,
onClick: () -> Unit
) {
ListItem( ListItem(
modifier = Modifier.clickable { onClick() }, modifier = Modifier.clickable { onClick() },
leadingContent = { leadingContent = {

View File

@ -1,6 +1,5 @@
package app.revanced.manager.ui.component package app.revanced.manager.ui.component
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
@ -20,7 +19,6 @@ import androidx.compose.ui.unit.dp
import app.revanced.manager.R import app.revanced.manager.R
import coil.compose.AsyncImage import coil.compose.AsyncImage
@OptIn(ExperimentalFoundationApi::class)
@Composable @Composable
fun SourceItem() { fun SourceItem() {
Row( Row(

View File

@ -18,7 +18,7 @@ fun SplitAPKDialog(
) { ) {
AlertDialog(onDismissRequest = onDismiss, shape = RoundedCornerShape(12.dp), AlertDialog(onDismissRequest = onDismiss, shape = RoundedCornerShape(12.dp),
title = { title = {
Text(stringResource(id = R.string.warning), textAlign = TextAlign.Center) Text(stringResource(R.string.warning), textAlign = TextAlign.Center)
}, },
text = { text = {
Text(stringResource(R.string.split_apk_warning)) Text(stringResource(R.string.split_apk_warning))
@ -30,12 +30,12 @@ fun SplitAPKDialog(
onDismiss() onDismiss()
} }
) { ) {
Text(text = "OK") Text(stringResource(R.string.text_continue))
} }
}, },
dismissButton = { dismissButton = {
OutlinedButton(onClick = onDismiss) { OutlinedButton(onClick = onDismiss) {
Text(text = "Cancel") Text(stringResource(R.string.cancel))
} }
} }
) )

View File

@ -68,8 +68,6 @@ fun DashboardScreen(viewModel: DashboardViewModel = getViewModel()) {
} }
} }
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) { Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {
Text( Text(
text = "Patched Applications", text = "Patched Applications",
style = MaterialTheme.typography.headlineSmall style = MaterialTheme.typography.headlineSmall

View File

@ -89,4 +89,4 @@ fun ContributorsSubscreen(
) )
} }
} }
} }

View File

@ -50,7 +50,7 @@ fun LicensesSubscreen(
contentColor = MaterialTheme.colorScheme.onBackground, contentColor = MaterialTheme.colorScheme.onBackground,
badgeBackgroundColor = MaterialTheme.colorScheme.primary, badgeBackgroundColor = MaterialTheme.colorScheme.primary,
badgeContentColor = MaterialTheme.colorScheme.onPrimary, badgeContentColor = MaterialTheme.colorScheme.onPrimary,
), )
) )
} }
} }

View File

@ -59,7 +59,6 @@ fun SourceSelectorSubscreen(
Toast.makeText(context, "Couldn't load local patch bundle.", Toast.LENGTH_SHORT).show() Toast.makeText(context, "Couldn't load local patch bundle.", Toast.LENGTH_SHORT).show()
} }
Scaffold( Scaffold(
modifier = Modifier modifier = Modifier
.nestedScroll(scrollBehavior.nestedScrollConnection), .nestedScroll(scrollBehavior.nestedScrollConnection),

View File

@ -36,4 +36,6 @@
<string name="select_sources">Select sources</string> <string name="select_sources">Select sources</string>
<string name="sentry">Sentry</string> <string name="sentry">Sentry</string>
<string name="select_bundle_from_storage">Select a bundle from storage</string> <string name="select_bundle_from_storage">Select a bundle from storage</string>
<string name="text_continue">Continue</string>
<string name="cancel">Cancel</string>
</resources> </resources>