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(
onClick = { vm.openUserProfile(contributor.username) },
onLongClick = {
Toast
.makeText(
context,
contributor.username,
Toast.LENGTH_SHORT
)
.show()
Toast.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 app.revanced.manager.R
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ExpandableCard(
content: @Composable (arrowButton: @Composable () -> Unit) -> Unit,

View File

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

View File

@ -22,6 +22,8 @@ fun HeadlineWithCard(
modifier = Modifier
.padding(top = 12.dp)
.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
fun PatchCompatibilityDialog(
patchClass: PatchClass, patcherUtils: PatcherUtils = get(), onClose: () -> Unit
patchClass: PatchClass,
patcherUtils: PatcherUtils = get(),
onClose: () -> Unit
) {
val patch = patchClass.patch
val packageName = patcherUtils.getSelectedPackageInfo()?.packageName
AlertDialog(onDismissRequest = onClose, shape = RoundedCornerShape(12.dp), title = {
Text(stringResource(id = R.string.unsupported), textAlign = TextAlign.Center)
}, text = {
(patch.compatiblePackages!!.forEach { p: Package ->
if (p.name == packageName) {
Text(
stringResource(id = R.string.only_compatible) + p.versions.reversed()
.joinToString(", ")
)
AlertDialog(
onDismissRequest = onClose,
shape = RoundedCornerShape(12.dp),
title = { Text(stringResource(R.string.unsupported), textAlign = TextAlign.Center) },
text = {
patch.compatiblePackages!!.forEach { p: Package ->
if (p.name == packageName) {
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)
@Composable
fun SocialItem(@StringRes label: Int, imageVector: ImageVector? = null, onClick: () -> Unit) {
fun SocialItem(
@StringRes label: Int,
imageVector: ImageVector? = null,
onClick: () -> Unit
) {
ListItem(
modifier = Modifier.clickable { onClick() },
leadingContent = {

View File

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

View File

@ -18,7 +18,7 @@ fun SplitAPKDialog(
) {
AlertDialog(onDismissRequest = onDismiss, shape = RoundedCornerShape(12.dp),
title = {
Text(stringResource(id = R.string.warning), textAlign = TextAlign.Center)
Text(stringResource(R.string.warning), textAlign = TextAlign.Center)
},
text = {
Text(stringResource(R.string.split_apk_warning))
@ -30,12 +30,12 @@ fun SplitAPKDialog(
onDismiss()
}
) {
Text(text = "OK")
Text(stringResource(R.string.text_continue))
}
},
dismissButton = {
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)) {
Text(
text = "Patched Applications",
style = MaterialTheme.typography.headlineSmall

View File

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

View File

@ -50,7 +50,7 @@ fun LicensesSubscreen(
contentColor = MaterialTheme.colorScheme.onBackground,
badgeBackgroundColor = MaterialTheme.colorScheme.primary,
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()
}
Scaffold(
modifier = Modifier
.nestedScroll(scrollBehavior.nestedScrollConnection),

View File

@ -36,4 +36,6 @@
<string name="select_sources">Select sources</string>
<string name="sentry">Sentry</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>