mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
app: improve Material 3 component conformance
- Replace custom dividers with VerticalDivider / HorizontalDivider - Use standard Material 3 search styling for DenyList - Remove redundant button / FAB shape overrides and card clip modifiers - Convert custom warning and notice boxes to Material 3 Card - Align PrimaryTabRow to full width in LogScreen Assisted-by: Gemini 3.7 Flash
This commit is contained in:
@@ -43,7 +43,10 @@ import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.OutlinedTextFieldDefaults
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.SearchBarDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextField
|
||||
import androidx.compose.material3.TextFieldDefaults
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.TriStateCheckbox
|
||||
@@ -55,6 +58,7 @@ import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.state.ToggleableState
|
||||
@@ -241,13 +245,14 @@ fun DenyListScreen(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
private fun SearchInput(
|
||||
query: String,
|
||||
onQueryChange: (String) -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
OutlinedTextField(
|
||||
TextField(
|
||||
value = query,
|
||||
onValueChange = onQueryChange,
|
||||
modifier = modifier,
|
||||
@@ -270,13 +275,14 @@ private fun SearchInput(
|
||||
}
|
||||
}
|
||||
} else null,
|
||||
shape = RoundedCornerShape(28.dp),
|
||||
shape = SearchBarDefaults.inputFieldShape,
|
||||
singleLine = true,
|
||||
colors = OutlinedTextFieldDefaults.colors(
|
||||
colors = TextFieldDefaults.colors(
|
||||
focusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
focusedBorderColor = MaterialTheme.colorScheme.primary,
|
||||
unfocusedBorderColor = MaterialTheme.colorScheme.outlineVariant,
|
||||
unfocusedContainerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
||||
focusedIndicatorColor = Color.Transparent,
|
||||
unfocusedIndicatorColor = Color.Transparent,
|
||||
disabledIndicatorColor = Color.Transparent,
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -385,16 +385,13 @@ private fun NoticeCard(
|
||||
onHide: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.background(
|
||||
MaterialTheme.colorScheme.tertiaryContainer,
|
||||
RoundedCornerShape(20.dp)
|
||||
)
|
||||
.padding(start = 16.dp, top = 6.dp, bottom = 6.dp, end = 6.dp)
|
||||
Card(
|
||||
modifier = modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.tertiaryContainer)
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(start = 16.dp, top = 6.dp, bottom = 6.dp, end = 6.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
@@ -440,7 +437,6 @@ private fun InstallButton(
|
||||
if (isPrimary) {
|
||||
Button(
|
||||
onClick = onClick,
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp),
|
||||
modifier = modifier,
|
||||
) {
|
||||
@@ -449,7 +445,6 @@ private fun InstallButton(
|
||||
} else {
|
||||
FilledTonalButton(
|
||||
onClick = onClick,
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp),
|
||||
modifier = modifier,
|
||||
) {
|
||||
|
||||
@@ -122,9 +122,7 @@ fun LogScreen(
|
||||
) {
|
||||
PrimaryTabRow(
|
||||
selectedTabIndex = pagerState.currentPage,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
tabTitles.forEachIndexed { index, title ->
|
||||
Tab(
|
||||
|
||||
@@ -151,7 +151,6 @@ fun ModuleScreen(
|
||||
floatingActionButton = {
|
||||
FloatingActionButton(
|
||||
onClick = { filePicker.launch("application/zip") },
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
content = {
|
||||
@@ -255,7 +254,6 @@ private fun ModuleCard(
|
||||
Card(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(20.dp))
|
||||
.clickable(enabled = hasDescription) { expanded = !expanded },
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = colorScheme.surfaceContainerLow)
|
||||
@@ -328,10 +326,7 @@ private fun ModuleCard(
|
||||
}
|
||||
}
|
||||
|
||||
HorizontalDivider(
|
||||
modifier = Modifier.padding(vertical = 12.dp),
|
||||
thickness = 0.5.dp,
|
||||
)
|
||||
HorizontalDivider(modifier = Modifier.padding(vertical = 12.dp))
|
||||
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
AnimatedVisibility(
|
||||
@@ -342,7 +337,6 @@ private fun ModuleCard(
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
if (item.showAction) {
|
||||
FilledTonalButton(
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
contentPadding = PaddingValues(horizontal = 14.dp, vertical = 8.dp),
|
||||
onClick = { viewModel.runAction(item.module.id, item.module.name) },
|
||||
) {
|
||||
@@ -373,7 +367,6 @@ private fun ModuleCard(
|
||||
exit = fadeOut()
|
||||
) {
|
||||
FilledTonalButton(
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
modifier = Modifier.padding(end = 8.dp),
|
||||
colors = ButtonDefaults.filledTonalButtonColors(
|
||||
containerColor = colorScheme.tertiaryContainer,
|
||||
@@ -400,7 +393,6 @@ private fun ModuleCard(
|
||||
}
|
||||
|
||||
FilledTonalButton(
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
colors = if (item.isRemoved) {
|
||||
ButtonDefaults.filledTonalButtonColors()
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.VerticalDivider
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
@@ -151,7 +152,6 @@ private fun PolicyCard(
|
||||
Card(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(20.dp))
|
||||
.alpha(if (item.isEnabled) 1f else 0.5f),
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerLow)
|
||||
@@ -196,13 +196,7 @@ private fun PolicyCard(
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxHeight()
|
||||
.padding(vertical = 12.dp)
|
||||
.width(0.5.dp)
|
||||
.background(MaterialTheme.colorScheme.outlineVariant)
|
||||
)
|
||||
VerticalDivider(modifier = Modifier.padding(vertical = 12.dp))
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -16,6 +16,8 @@ import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Card
|
||||
import androidx.compose.material3.CardDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Slider
|
||||
import androidx.compose.material3.Text
|
||||
@@ -160,12 +162,10 @@ fun SuRequestScreen(
|
||||
modifier = Modifier.verticalScroll(rememberScrollState()),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(RoundedCornerShape(12.dp))
|
||||
.background(MaterialTheme.colorScheme.errorContainer)
|
||||
.padding(12.dp)
|
||||
Card(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
shape = RoundedCornerShape(12.dp),
|
||||
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.errorContainer)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(CoreR.string.su_warning),
|
||||
@@ -173,7 +173,9 @@ fun SuRequestScreen(
|
||||
color = MaterialTheme.colorScheme.onErrorContainer,
|
||||
fontWeight = FontWeight.Medium,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(12.dp)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user