manager: Optimize color schemes for themes and module screens
- Remove unnecessary background color settings
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package com.sukisu.ultra.ui.screen
|
package com.sukisu.ultra.ui.screen
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
@@ -29,7 +28,6 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.layout.safeDrawing
|
import androidx.compose.foundation.layout.safeDrawing
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
@@ -63,7 +61,6 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.material3.TopAppBar
|
import androidx.compose.material3.TopAppBar
|
||||||
import androidx.compose.material3.TopAppBarDefaults
|
import androidx.compose.material3.TopAppBarDefaults
|
||||||
import androidx.compose.material3.TopAppBarScrollBehavior
|
import androidx.compose.material3.TopAppBarScrollBehavior
|
||||||
import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
|
||||||
import androidx.compose.material3.rememberTopAppBarState
|
import androidx.compose.material3.rememberTopAppBarState
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
@@ -75,12 +72,8 @@ import androidx.compose.runtime.rememberCoroutineScope
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.composed
|
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.draw.shadow
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalUriHandler
|
import androidx.compose.ui.platform.LocalUriHandler
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
@@ -97,7 +90,7 @@ import com.sukisu.ultra.Natives
|
|||||||
import com.sukisu.ultra.R
|
import com.sukisu.ultra.R
|
||||||
import com.sukisu.ultra.ui.component.KsuIsValid
|
import com.sukisu.ultra.ui.component.KsuIsValid
|
||||||
import com.sukisu.ultra.ui.component.rememberConfirmDialog
|
import com.sukisu.ultra.ui.component.rememberConfirmDialog
|
||||||
import com.sukisu.ultra.ui.theme.CardConfig
|
import com.sukisu.ultra.ui.theme.CardConfig.cardAlpha
|
||||||
import com.sukisu.ultra.ui.theme.CardConfig.cardElevation
|
import com.sukisu.ultra.ui.theme.CardConfig.cardElevation
|
||||||
import com.sukisu.ultra.ui.theme.getCardColors
|
import com.sukisu.ultra.ui.theme.getCardColors
|
||||||
import com.sukisu.ultra.ui.util.checkNewVersion
|
import com.sukisu.ultra.ui.util.checkNewVersion
|
||||||
@@ -257,7 +250,7 @@ fun UpdateCard() {
|
|||||||
val updateDialog = rememberConfirmDialog(onConfirm = { uriHandler.openUri(newVersionUrl) })
|
val updateDialog = rememberConfirmDialog(onConfirm = { uriHandler.openUri(newVersionUrl) })
|
||||||
WarningCard(
|
WarningCard(
|
||||||
message = stringResource(id = R.string.new_version_available).format(newVersionCode),
|
message = stringResource(id = R.string.new_version_available).format(newVersionCode),
|
||||||
color = MaterialTheme.colorScheme.surfaceVariant,
|
color = MaterialTheme.colorScheme.outlineVariant,
|
||||||
onClick = {
|
onClick = {
|
||||||
if (changelog.isEmpty()) {
|
if (changelog.isEmpty()) {
|
||||||
uriHandler.openUri(newVersionUrl)
|
uriHandler.openUri(newVersionUrl)
|
||||||
@@ -289,7 +282,6 @@ private fun TopBar(
|
|||||||
scrollBehavior: TopAppBarScrollBehavior? = null
|
scrollBehavior: TopAppBarScrollBehavior? = null
|
||||||
) {
|
) {
|
||||||
val cardColor = MaterialTheme.colorScheme.surfaceContainerLow
|
val cardColor = MaterialTheme.colorScheme.surfaceContainerLow
|
||||||
val cardAlpha = CardConfig.cardAlpha
|
|
||||||
|
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = {
|
title = {
|
||||||
@@ -342,16 +334,9 @@ private fun StatusCard(
|
|||||||
onClickInstall: () -> Unit = {}
|
onClickInstall: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.secondaryContainer),
|
colors = getCardColors( if (systemStatus.ksuVersion != null)MaterialTheme.colorScheme.secondaryContainer
|
||||||
|
else MaterialTheme.colorScheme.errorContainer),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.surface.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -394,7 +379,6 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = workingModeText,
|
text = workingModeText,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.width(8.dp))
|
Spacer(Modifier.width(8.dp))
|
||||||
@@ -408,13 +392,13 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = workingModeSurfaceText,
|
text = workingModeSurfaceText,
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSecondary,
|
|
||||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.width(6.dp))
|
Spacer(Modifier.width(6.dp))
|
||||||
|
|
||||||
|
// 架构标签
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(4.dp),
|
shape = RoundedCornerShape(4.dp),
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
@@ -423,7 +407,6 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = Os.uname().machine,
|
text = Os.uname().machine,
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSecondary,
|
|
||||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -443,7 +426,6 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_working_version, systemStatus.ksuVersion),
|
text = stringResource(R.string.home_working_version, systemStatus.ksuVersion),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,14 +434,12 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_superuser_count, getSuperuserCount()),
|
text = stringResource(R.string.home_superuser_count, getSuperuserCount()),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_module_count, getModuleCount()),
|
text = stringResource(R.string.home_module_count, getModuleCount()),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val kpmVersion = getKpmVersion()
|
val kpmVersion = getKpmVersion()
|
||||||
@@ -468,7 +448,6 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_kpm_module, getKpmModuleCount()),
|
text = stringResource(R.string.home_kpm_module, getKpmModuleCount()),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -487,14 +466,12 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_not_installed),
|
text = stringResource(R.string.home_not_installed),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.error
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_click_to_install),
|
text = stringResource(R.string.home_click_to_install),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,14 +488,12 @@ private fun StatusCard(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_unsupported),
|
text = stringResource(R.string.home_unsupported),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.error
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_unsupported_reason),
|
text = stringResource(R.string.home_unsupported_reason),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -536,13 +511,6 @@ fun WarningCard(
|
|||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(color),
|
colors = getCardColors(color),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -554,7 +522,6 @@ fun WarningCard(
|
|||||||
Text(
|
Text(
|
||||||
text = message,
|
text = message,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onErrorContainer
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -568,15 +535,6 @@ fun ContributionCard() {
|
|||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.wrapContentHeight()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.tertiary.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -592,14 +550,12 @@ fun ContributionCard() {
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_ContributionCard_kernelsu),
|
text = stringResource(R.string.home_ContributionCard_kernelsu),
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_click_to_ContributionCard_kernelsu),
|
text = stringResource(R.string.home_click_to_ContributionCard_kernelsu),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -613,15 +569,7 @@ fun LearnMoreCard() {
|
|||||||
|
|
||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -636,14 +584,12 @@ fun LearnMoreCard() {
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_learn_kernelsu),
|
text = stringResource(R.string.home_learn_kernelsu),
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_click_to_learn_kernelsu),
|
text = stringResource(R.string.home_click_to_learn_kernelsu),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -657,14 +603,6 @@ fun DonateCard() {
|
|||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.secondary.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -679,14 +617,12 @@ fun DonateCard() {
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_support_title),
|
text = stringResource(R.string.home_support_title),
|
||||||
style = MaterialTheme.typography.titleSmall,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(Modifier.height(4.dp))
|
Spacer(Modifier.height(4.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.home_support_content),
|
text = stringResource(R.string.home_support_content),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.8f)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -706,14 +642,6 @@ private fun InfoCard(
|
|||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainer),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.05f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -747,12 +675,10 @@ private fun InfoCard(
|
|||||||
Text(
|
Text(
|
||||||
text = label,
|
text = label,
|
||||||
style = MaterialTheme.typography.labelLarge,
|
style = MaterialTheme.typography.labelLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = content,
|
text = content,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
|
||||||
softWrap = true
|
softWrap = true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -904,12 +830,3 @@ private fun WarningCardPreview() {
|
|||||||
onClick = {})
|
onClick = {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("UnnecessaryComposedModifier")
|
|
||||||
fun Modifier.disableOverscroll(): Modifier = composed {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
||||||
this
|
|
||||||
} else {
|
|
||||||
this
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -112,7 +112,6 @@ fun KpmScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = kpmInstallMode,
|
text = kpmInstallMode,
|
||||||
style = MaterialTheme.typography.headlineSmall,
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
@@ -121,7 +120,6 @@ fun KpmScreen(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.kpm_install_mode_description, it),
|
text = stringResource(R.string.kpm_install_mode_description, it),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -146,9 +144,6 @@ fun KpmScreen(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Download,
|
imageVector = Icons.Filled.Download,
|
||||||
@@ -176,9 +171,6 @@ fun KpmScreen(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.secondary
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Inventory,
|
imageVector = Icons.Filled.Inventory,
|
||||||
@@ -209,7 +201,6 @@ fun KpmScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
|
||||||
shape = MaterialTheme.shapes.extraLarge
|
shape = MaterialTheme.shapes.extraLarge
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -309,10 +300,8 @@ fun KpmScreen(
|
|||||||
text = {
|
text = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.kpm_install),
|
text = stringResource(R.string.kpm_install),
|
||||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
|
||||||
expanded = true,
|
expanded = true,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -321,9 +310,6 @@ fun KpmScreen(
|
|||||||
Column(modifier = Modifier.padding(padding)) {
|
Column(modifier = Modifier.padding(padding)) {
|
||||||
if (!isNoticeClosed) {
|
if (!isNoticeClosed) {
|
||||||
Card(
|
Card(
|
||||||
colors = CardDefaults.cardColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.secondaryContainer
|
|
||||||
),
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(16.dp)
|
.padding(16.dp)
|
||||||
@@ -348,7 +334,6 @@ fun KpmScreen(
|
|||||||
text = stringResource(R.string.kernel_module_notice),
|
text = stringResource(R.string.kernel_module_notice),
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSecondaryContainer
|
|
||||||
)
|
)
|
||||||
|
|
||||||
IconButton(
|
IconButton(
|
||||||
@@ -357,9 +342,6 @@ fun KpmScreen(
|
|||||||
sharedPreferences.edit { putBoolean("is_notice_closed", true) }
|
sharedPreferences.edit { putBoolean("is_notice_closed", true) }
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(24.dp),
|
modifier = Modifier.size(24.dp),
|
||||||
colors = IconButtonDefaults.iconButtonColors(
|
|
||||||
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Close,
|
imageVector = Icons.Filled.Close,
|
||||||
@@ -391,7 +373,6 @@ fun KpmScreen(
|
|||||||
stringResource(R.string.kpm_empty),
|
stringResource(R.string.kpm_empty),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -585,7 +566,6 @@ private fun KpmModuleItem(
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.kpm_control),
|
text = stringResource(R.string.kpm_control),
|
||||||
style = MaterialTheme.typography.headlineSmall,
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
@@ -595,20 +575,14 @@ private fun KpmModuleItem(
|
|||||||
label = {
|
label = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.kpm_args),
|
text = stringResource(R.string.kpm_args),
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = module.args,
|
text = module.args,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.6f)
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
colors = OutlinedTextFieldDefaults.colors(
|
|
||||||
focusedBorderColor = MaterialTheme.colorScheme.primary,
|
|
||||||
unfocusedBorderColor = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
@@ -627,7 +601,6 @@ private fun KpmModuleItem(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.confirm),
|
text = stringResource(R.string.confirm),
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -635,26 +608,16 @@ private fun KpmModuleItem(
|
|||||||
TextButton(onClick = { viewModel.hideInputDialog() }) {
|
TextButton(onClick = { viewModel.hideInputDialog() }) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.cancel),
|
text = stringResource(R.string.cancel),
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
|
||||||
shape = MaterialTheme.shapes.extraLarge
|
shape = MaterialTheme.shapes.extraLarge
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Card(
|
Card(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.padding(20.dp)
|
modifier = Modifier.padding(20.dp)
|
||||||
@@ -668,7 +631,6 @@ private fun KpmModuleItem(
|
|||||||
Text(
|
Text(
|
||||||
text = module.name,
|
text = module.name,
|
||||||
style = MaterialTheme.typography.titleLarge,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(4.dp))
|
Spacer(modifier = Modifier.height(4.dp))
|
||||||
@@ -676,19 +638,16 @@ private fun KpmModuleItem(
|
|||||||
Text(
|
Text(
|
||||||
text = "${stringResource(R.string.kpm_version)}: ${module.version}",
|
text = "${stringResource(R.string.kpm_version)}: ${module.version}",
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "${stringResource(R.string.kpm_author)}: ${module.author}",
|
text = "${stringResource(R.string.kpm_author)}: ${module.author}",
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "${stringResource(R.string.kpm_args)}: ${module.args}",
|
text = "${stringResource(R.string.kpm_args)}: ${module.args}",
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -698,7 +657,6 @@ private fun KpmModuleItem(
|
|||||||
Text(
|
Text(
|
||||||
text = module.description,
|
text = module.description,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
@@ -711,10 +669,6 @@ private fun KpmModuleItem(
|
|||||||
onClick = { viewModel.showInputDialog(module.id) },
|
onClick = { viewModel.showInputDialog(module.id) },
|
||||||
enabled = module.hasAction,
|
enabled = module.hasAction,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.primary,
|
|
||||||
disabledContainerColor = MaterialTheme.colorScheme.surfaceVariant
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Settings,
|
imageVector = Icons.Filled.Settings,
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ import androidx.compose.material3.pulltorefresh.PullToRefreshBox
|
|||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.draw.rotate
|
import androidx.compose.ui.draw.rotate
|
||||||
import androidx.compose.ui.draw.shadow
|
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.platform.*
|
import androidx.compose.ui.platform.*
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
@@ -230,10 +228,6 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
Checkbox(
|
Checkbox(
|
||||||
checked = viewModel.sortActionFirst,
|
checked = viewModel.sortActionFirst,
|
||||||
onCheckedChange = null,
|
onCheckedChange = null,
|
||||||
colors = CheckboxDefaults.colors(
|
|
||||||
checkedColor = MaterialTheme.colorScheme.primary,
|
|
||||||
uncheckedColor = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -255,10 +249,6 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
Checkbox(
|
Checkbox(
|
||||||
checked = viewModel.sortEnabledFirst,
|
checked = viewModel.sortEnabledFirst,
|
||||||
onCheckedChange = null,
|
onCheckedChange = null,
|
||||||
colors = CheckboxDefaults.colors(
|
|
||||||
checkedColor = MaterialTheme.colorScheme.primary,
|
|
||||||
uncheckedColor = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -325,10 +315,8 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
text = {
|
text = {
|
||||||
Text(
|
Text(
|
||||||
text = moduleInstall,
|
text = moduleInstall,
|
||||||
color = MaterialTheme.colorScheme.onPrimaryContainer
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
|
||||||
expanded = true,
|
expanded = true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -353,7 +341,6 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.Warning,
|
imageVector = Icons.Outlined.Warning,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colorScheme.error,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(64.dp)
|
.size(64.dp)
|
||||||
.padding(bottom = 16.dp)
|
.padding(bottom = 16.dp)
|
||||||
@@ -362,7 +349,6 @@ fun ModuleScreen(navigator: DestinationsNavigator) {
|
|||||||
stringResource(R.string.module_magisk_conflict),
|
stringResource(R.string.module_magisk_conflict),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -640,7 +626,6 @@ private fun ModuleList(
|
|||||||
text = stringResource(R.string.module_empty),
|
text = stringResource(R.string.module_empty),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -727,14 +712,6 @@ fun ModuleItem(
|
|||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation),
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clip(MaterialTheme.shapes.large)
|
|
||||||
.shadow(
|
|
||||||
elevation = cardElevation,
|
|
||||||
shape = MaterialTheme.shapes.large,
|
|
||||||
spotColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
val textDecoration = if (!module.remove) null else TextDecoration.LineThrough
|
val textDecoration = if (!module.remove) null else TextDecoration.LineThrough
|
||||||
val interactionSource = remember { MutableInteractionSource() }
|
val interactionSource = remember { MutableInteractionSource() }
|
||||||
@@ -777,7 +754,6 @@ fun ModuleItem(
|
|||||||
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
||||||
fontFamily = MaterialTheme.typography.titleMedium.fontFamily,
|
fontFamily = MaterialTheme.typography.titleMedium.fontFamily,
|
||||||
textDecoration = textDecoration,
|
textDecoration = textDecoration,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
@@ -786,7 +762,6 @@ fun ModuleItem(
|
|||||||
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
||||||
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
||||||
textDecoration = textDecoration,
|
textDecoration = textDecoration,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
@@ -795,7 +770,6 @@ fun ModuleItem(
|
|||||||
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
||||||
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
||||||
textDecoration = textDecoration,
|
textDecoration = textDecoration,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,14 +784,6 @@ fun ModuleItem(
|
|||||||
checked = module.enabled,
|
checked = module.enabled,
|
||||||
onCheckedChange = onCheckChanged,
|
onCheckedChange = onCheckChanged,
|
||||||
interactionSource = if (!module.hasWebUi) interactionSource else null,
|
interactionSource = if (!module.hasWebUi) interactionSource else null,
|
||||||
colors = SwitchDefaults.colors(
|
|
||||||
checkedThumbColor = MaterialTheme.colorScheme.onPrimary,
|
|
||||||
checkedTrackColor = MaterialTheme.colorScheme.primary,
|
|
||||||
checkedIconColor = MaterialTheme.colorScheme.primary,
|
|
||||||
uncheckedThumbColor = MaterialTheme.colorScheme.outline,
|
|
||||||
uncheckedTrackColor = MaterialTheme.colorScheme.surfaceVariant,
|
|
||||||
uncheckedIconColor = MaterialTheme.colorScheme.surfaceVariant
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -833,7 +799,6 @@ fun ModuleItem(
|
|||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
maxLines = 4,
|
maxLines = 4,
|
||||||
textDecoration = textDecoration,
|
textDecoration = textDecoration,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
@@ -855,7 +820,6 @@ fun ModuleItem(
|
|||||||
viewModel.markNeedRefresh()
|
viewModel.markNeedRefresh()
|
||||||
},
|
},
|
||||||
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
||||||
colors = ButtonDefaults.filledTonalButtonColors()
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
@@ -872,7 +836,6 @@ fun ModuleItem(
|
|||||||
onClick = { onClick(module) },
|
onClick = { onClick(module) },
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
||||||
colors = ButtonDefaults.filledTonalButtonColors()
|
|
||||||
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
@@ -892,7 +855,6 @@ fun ModuleItem(
|
|||||||
onClick = { onUpdate(module) },
|
onClick = { onUpdate(module) },
|
||||||
shape = ButtonDefaults.textShape,
|
shape = ButtonDefaults.textShape,
|
||||||
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
||||||
colors = ButtonDefaults.filledTonalButtonColors()
|
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.size(20.dp),
|
modifier = Modifier.size(20.dp),
|
||||||
@@ -906,8 +868,6 @@ fun ModuleItem(
|
|||||||
modifier = Modifier.defaultMinSize(minWidth = 52.dp, minHeight = 32.dp),
|
modifier = Modifier.defaultMinSize(minWidth = 52.dp, minHeight = 32.dp),
|
||||||
onClick = { onUninstallClicked(module) },
|
onClick = { onUninstallClicked(module) },
|
||||||
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
contentPadding = ButtonDefaults.TextButtonContentPadding,
|
||||||
colors = ButtonDefaults.filledTonalButtonColors(
|
|
||||||
containerColor = if (!module.remove) MaterialTheme.colorScheme.secondaryContainer else MaterialTheme.colorScheme.errorContainer)
|
|
||||||
) {
|
) {
|
||||||
if (!module.remove) {
|
if (!module.remove) {
|
||||||
Icon(
|
Icon(
|
||||||
|
|||||||
@@ -49,11 +49,9 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
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.text.font.FontWeight
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import com.ramcosta.composedestinations.annotation.Destination
|
import com.ramcosta.composedestinations.annotation.Destination
|
||||||
@@ -66,8 +64,10 @@ import com.sukisu.ultra.ui.component.ImageEditorDialog
|
|||||||
import com.sukisu.ultra.ui.component.KsuIsValid
|
import com.sukisu.ultra.ui.component.KsuIsValid
|
||||||
import com.sukisu.ultra.ui.component.SwitchItem
|
import com.sukisu.ultra.ui.component.SwitchItem
|
||||||
import com.sukisu.ultra.ui.theme.CardConfig
|
import com.sukisu.ultra.ui.theme.CardConfig
|
||||||
|
import com.sukisu.ultra.ui.theme.CardConfig.cardElevation
|
||||||
import com.sukisu.ultra.ui.theme.ThemeColors
|
import com.sukisu.ultra.ui.theme.ThemeColors
|
||||||
import com.sukisu.ultra.ui.theme.ThemeConfig
|
import com.sukisu.ultra.ui.theme.ThemeConfig
|
||||||
|
import com.sukisu.ultra.ui.theme.getCardColors
|
||||||
import com.sukisu.ultra.ui.theme.saveAndApplyCustomBackground
|
import com.sukisu.ultra.ui.theme.saveAndApplyCustomBackground
|
||||||
import com.sukisu.ultra.ui.theme.saveCustomBackground
|
import com.sukisu.ultra.ui.theme.saveCustomBackground
|
||||||
import com.sukisu.ultra.ui.theme.saveDynamicColorState
|
import com.sukisu.ultra.ui.theme.saveDynamicColorState
|
||||||
@@ -331,11 +331,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
var showImageEditor by remember { mutableStateOf(false) }
|
var showImageEditor by remember { mutableStateOf(false) }
|
||||||
var selectedImageUri by remember { mutableStateOf<Uri?>(null) }
|
var selectedImageUri by remember { mutableStateOf<Uri?>(null) }
|
||||||
|
|
||||||
// 展开/折叠状态
|
|
||||||
var isCustomizeExpanded by remember { mutableStateOf(false) }
|
|
||||||
var isAppearanceExpanded by remember { mutableStateOf(true) }
|
|
||||||
var isAdvancedExpanded by remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
// DPI 设置
|
// DPI 设置
|
||||||
val systemDpi = remember { context.resources.displayMetrics.densityDpi }
|
val systemDpi = remember { context.resources.displayMetrics.densityDpi }
|
||||||
var currentDpi by remember {
|
var currentDpi by remember {
|
||||||
@@ -466,7 +461,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
onConfirm = { transformedUri ->
|
onConfirm = { transformedUri ->
|
||||||
context.saveAndApplyCustomBackground(transformedUri)
|
context.saveAndApplyCustomBackground(transformedUri)
|
||||||
isCustomBackgroundEnabled = true
|
isCustomBackgroundEnabled = true
|
||||||
CardConfig.cardElevation = 0.dp
|
cardElevation = 0.dp
|
||||||
CardConfig.isCustomBackgroundEnabled = true
|
CardConfig.isCustomBackgroundEnabled = true
|
||||||
saveCardConfig(context)
|
saveCardConfig(context)
|
||||||
showImageEditor = false
|
showImageEditor = false
|
||||||
@@ -483,7 +478,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val cardColor = MaterialTheme.colorScheme.surfaceContainerHigh
|
val cardColor = MaterialTheme.colorScheme.surfaceContainerHigh
|
||||||
val cardAlphaUse = CardConfig.cardAlpha
|
|
||||||
val isDarkTheme = isSystemInDarkTheme()
|
val isDarkTheme = isSystemInDarkTheme()
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
@@ -492,8 +486,8 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text(stringResource(R.string.more_settings)) },
|
title = { Text(stringResource(R.string.more_settings)) },
|
||||||
colors = TopAppBarDefaults.topAppBarColors(
|
colors = TopAppBarDefaults.topAppBarColors(
|
||||||
containerColor = cardColor.copy(alpha = cardAlphaUse),
|
containerColor = cardColor.copy(alpha = cardAlpha),
|
||||||
scrolledContainerColor = cardColor.copy(alpha = cardAlphaUse)),
|
scrolledContainerColor = cardColor.copy(alpha = cardAlpha)),
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
IconButton(onClick = { navigator.popBackStack() }) {
|
IconButton(onClick = { navigator.popBackStack() }) {
|
||||||
Icon(Icons.AutoMirrored.Filled.ArrowBack,
|
Icon(Icons.AutoMirrored.Filled.ArrowBack,
|
||||||
@@ -511,27 +505,19 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
) {
|
) {
|
||||||
// 外观设置部分
|
// 外观设置部分
|
||||||
SectionHeader(
|
|
||||||
title = stringResource(R.string.appearance_settings),
|
|
||||||
expanded = isAppearanceExpanded,
|
|
||||||
onToggle = { isAppearanceExpanded = !isAppearanceExpanded }
|
|
||||||
)
|
|
||||||
|
|
||||||
AnimatedVisibility(
|
|
||||||
visible = isAppearanceExpanded,
|
|
||||||
enter = fadeIn() + expandVertically(),
|
|
||||||
exit = fadeOut() + shrinkVertically()
|
|
||||||
) {
|
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 16.dp),
|
.padding(bottom = 16.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.appearance_settings),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
)
|
||||||
// 语言设置
|
// 语言设置
|
||||||
ListItem(
|
ListItem(
|
||||||
headlineContent = { Text(stringResource(R.string.language_setting)) },
|
headlineContent = { Text(stringResource(R.string.language_setting)) },
|
||||||
@@ -553,9 +539,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
colors = ListItemDefaults.colors(
|
|
||||||
containerColor = Color.Transparent
|
|
||||||
),
|
|
||||||
modifier = Modifier.clickable { showLanguageDialog = true }
|
modifier = Modifier.clickable { showLanguageDialog = true }
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -577,9 +560,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
colors = ListItemDefaults.colors(
|
|
||||||
containerColor = Color.Transparent
|
|
||||||
),
|
|
||||||
modifier = Modifier.clickable { showThemeModeDialog = true }
|
modifier = Modifier.clickable { showThemeModeDialog = true }
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -631,9 +611,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
colors = ListItemDefaults.colors(
|
|
||||||
containerColor = Color.Transparent
|
|
||||||
),
|
|
||||||
modifier = Modifier.clickable { showThemeColorDialog = true }
|
modifier = Modifier.clickable { showThemeColorDialog = true }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -654,12 +631,8 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
Text(
|
Text(
|
||||||
text = getDpiFriendlyName(tempDpi),
|
text = getDpiFriendlyName(tempDpi),
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
},
|
|
||||||
colors = ListItemDefaults.colors(
|
|
||||||
containerColor = Color.Transparent
|
|
||||||
)
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// DPI 滑动条
|
// DPI 滑动条
|
||||||
@@ -722,7 +695,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
else
|
else
|
||||||
"${getDpiFriendlyName(tempDpi)}: $tempDpi",
|
"${getDpiFriendlyName(tempDpi)}: $tempDpi",
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.padding(top = 4.dp)
|
modifier = Modifier.padding(top = 4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -739,7 +711,7 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
} else {
|
} else {
|
||||||
context.saveCustomBackground(null)
|
context.saveCustomBackground(null)
|
||||||
isCustomBackgroundEnabled = false
|
isCustomBackgroundEnabled = false
|
||||||
CardConfig.cardElevation
|
cardElevation
|
||||||
CardConfig.cardAlpha = 1f
|
CardConfig.cardAlpha = 1f
|
||||||
CardConfig.cardDim = 0f
|
CardConfig.cardDim = 0f
|
||||||
CardConfig.isCustomAlphaSet = false
|
CardConfig.isCustomAlphaSet = false
|
||||||
@@ -797,7 +769,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
Text(
|
Text(
|
||||||
text = "${(cardAlpha * 100).roundToInt()}%",
|
text = "${(cardAlpha * 100).roundToInt()}%",
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -846,7 +817,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
Text(
|
Text(
|
||||||
text = "${(cardDim * 100).roundToInt()}%",
|
text = "${(cardDim * 100).roundToInt()}%",
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,30 +848,21 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 自定义设置部分
|
// 自定义设置部分
|
||||||
SectionHeader(
|
|
||||||
title = stringResource(R.string.custom_settings),
|
|
||||||
expanded = isCustomizeExpanded,
|
|
||||||
onToggle = { isCustomizeExpanded = !isCustomizeExpanded }
|
|
||||||
)
|
|
||||||
|
|
||||||
AnimatedVisibility(
|
|
||||||
visible = isCustomizeExpanded,
|
|
||||||
enter = fadeIn() + expandVertically(),
|
|
||||||
exit = fadeOut() + shrinkVertically()
|
|
||||||
) {
|
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 16.dp),
|
.padding(bottom = 16.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column(Modifier.padding(vertical = 8.dp)) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.custom_settings),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
)
|
||||||
// 添加简洁模式开关
|
// 添加简洁模式开关
|
||||||
SwitchItem(
|
SwitchItem(
|
||||||
icon = Icons.Filled.Brush,
|
icon = Icons.Filled.Brush,
|
||||||
@@ -912,8 +873,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
onSimpleModeChange(it)
|
onSimpleModeChange(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 隐藏内核部分版本号
|
// 隐藏内核部分版本号
|
||||||
SwitchItem(
|
SwitchItem(
|
||||||
icon = Icons.Filled.VisibilityOff,
|
icon = Icons.Filled.VisibilityOff,
|
||||||
@@ -967,30 +926,21 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 高级设置部分
|
// 高级设置部分
|
||||||
SectionHeader(
|
|
||||||
title = stringResource(R.string.advanced_settings),
|
|
||||||
expanded = isAdvancedExpanded,
|
|
||||||
onToggle = { isAdvancedExpanded = !isAdvancedExpanded }
|
|
||||||
)
|
|
||||||
|
|
||||||
AnimatedVisibility(
|
|
||||||
visible = isAdvancedExpanded,
|
|
||||||
enter = fadeIn() + expandVertically(),
|
|
||||||
exit = fadeOut() + shrinkVertically()
|
|
||||||
) {
|
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(bottom = 16.dp),
|
.padding(bottom = 16.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column( Modifier.padding(vertical = 8.dp)) {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.advanced_settings),
|
||||||
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
|
)
|
||||||
// SELinux 开关
|
// SELinux 开关
|
||||||
KsuIsValid {
|
KsuIsValid {
|
||||||
SwitchItem(
|
SwitchItem(
|
||||||
@@ -1077,7 +1027,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 主题模式选择对话框
|
// 主题模式选择对话框
|
||||||
if (showThemeModeDialog) {
|
if (showThemeModeDialog) {
|
||||||
@@ -1173,7 +1122,6 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
Text(
|
Text(
|
||||||
stringResource(R.string.dpi_confirm_summary),
|
stringResource(R.string.dpi_confirm_summary),
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
modifier = Modifier.padding(top = 8.dp)
|
modifier = Modifier.padding(top = 8.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1252,35 +1200,3 @@ fun MoreSettingsScreen(navigator: DestinationsNavigator) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun SectionHeader(
|
|
||||||
title: String,
|
|
||||||
expanded: Boolean,
|
|
||||||
onToggle: () -> Unit
|
|
||||||
) {
|
|
||||||
Row(
|
|
||||||
modifier = Modifier
|
|
||||||
.fillMaxWidth()
|
|
||||||
.clickable { onToggle() }
|
|
||||||
.padding(vertical = 12.dp, horizontal = 4.dp),
|
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = title,
|
|
||||||
style = MaterialTheme.typography.titleMedium.copy(
|
|
||||||
fontWeight = FontWeight.Bold
|
|
||||||
),
|
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
|
||||||
Icon(
|
|
||||||
imageVector = if (expanded) Icons.Default.KeyboardArrowUp else Icons.Default.KeyboardArrowDown,
|
|
||||||
contentDescription = if (expanded)
|
|
||||||
stringResource(R.string.collapse)
|
|
||||||
else
|
|
||||||
stringResource(R.string.expand),
|
|
||||||
tint = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,6 @@ import androidx.compose.animation.fadeIn
|
|||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.animation.shrinkVertically
|
import androidx.compose.animation.shrinkVertically
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
@@ -64,6 +63,7 @@ import com.sukisu.ultra.ui.util.getBugreportFile
|
|||||||
import java.time.LocalDateTime
|
import java.time.LocalDateTime
|
||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import com.sukisu.ultra.ui.component.KsuIsValid
|
import com.sukisu.ultra.ui.component.KsuIsValid
|
||||||
|
import com.sukisu.ultra.ui.theme.CardConfig.cardElevation
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ShirkNeko
|
* @author ShirkNeko
|
||||||
@@ -126,16 +126,13 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.configuration),
|
text = stringResource(R.string.configuration),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -197,16 +194,13 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.app_settings),
|
text = stringResource(R.string.app_settings),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -345,16 +339,13 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.tools),
|
text = stringResource(R.string.tools),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -444,16 +435,13 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
colors = CardDefaults.cardColors(
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh.copy(alpha = cardAlpha)
|
elevation = CardDefaults.cardElevation(defaultElevation = cardElevation)
|
||||||
),
|
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp)
|
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
Column(modifier = Modifier.padding(vertical = 8.dp)) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.about),
|
text = stringResource(R.string.about),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -502,7 +490,6 @@ fun LogActionButton(
|
|||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -534,13 +521,11 @@ fun SettingItem(
|
|||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
if (summary != null) {
|
if (summary != null) {
|
||||||
Text(
|
Text(
|
||||||
text = summary,
|
text = summary,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,7 +627,6 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.settings_uninstall),
|
text = stringResource(R.string.settings_uninstall),
|
||||||
style = MaterialTheme.typography.headlineSmall,
|
style = MaterialTheme.typography.headlineSmall,
|
||||||
color = MaterialTheme.colorScheme.onSurface
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
text = {
|
text = {
|
||||||
@@ -670,11 +654,6 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clip(MaterialTheme.shapes.medium)
|
.clip(MaterialTheme.shapes.medium)
|
||||||
.background(backgroundColor)
|
.background(backgroundColor)
|
||||||
.border(
|
|
||||||
width = 1.dp,
|
|
||||||
color = borderColor,
|
|
||||||
shape = MaterialTheme.shapes.medium
|
|
||||||
)
|
|
||||||
.clickable {
|
.clickable {
|
||||||
selectedOption = option
|
selectedOption = option
|
||||||
}
|
}
|
||||||
@@ -684,10 +663,7 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = option.icon,
|
imageVector = option.icon,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = if (isSelected)
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
MaterialTheme.colorScheme.primary
|
|
||||||
else
|
|
||||||
MaterialTheme.colorScheme.primary,
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(end = 16.dp)
|
.padding(end = 16.dp)
|
||||||
.size(24.dp)
|
.size(24.dp)
|
||||||
@@ -698,7 +674,6 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
Text(
|
Text(
|
||||||
text = listOptions[index].titleText,
|
text = listOptions[index].titleText,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = contentColor
|
|
||||||
)
|
)
|
||||||
listOptions[index].subtitleText?.let {
|
listOptions[index].subtitleText?.let {
|
||||||
Text(
|
Text(
|
||||||
@@ -737,12 +712,6 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
dismiss()
|
dismiss()
|
||||||
},
|
},
|
||||||
enabled = selectedOption != null,
|
enabled = selectedOption != null,
|
||||||
colors = ButtonDefaults.buttonColors(
|
|
||||||
containerColor = MaterialTheme.colorScheme.primary,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimary,
|
|
||||||
disabledContainerColor = MaterialTheme.colorScheme.surfaceVariant,
|
|
||||||
disabledContentColor = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(android.R.string.ok)
|
text = stringResource(android.R.string.ok)
|
||||||
@@ -757,11 +726,9 @@ fun rememberUninstallDialog(onSelected: (UninstallType) -> Unit): DialogHandle {
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(android.R.string.cancel),
|
text = stringResource(android.R.string.cancel),
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
|
||||||
shape = MaterialTheme.shapes.extraLarge,
|
shape = MaterialTheme.shapes.extraLarge,
|
||||||
tonalElevation = 4.dp
|
tonalElevation = 4.dp
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.sukisu.ultra.ui.screen
|
package com.sukisu.ultra.ui.screen
|
||||||
|
|
||||||
|
import android.graphics.Color.alpha
|
||||||
import androidx.compose.animation.*
|
import androidx.compose.animation.*
|
||||||
import androidx.compose.animation.core.*
|
import androidx.compose.animation.core.*
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.border
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.gestures.detectTapGestures
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||||
import androidx.compose.foundation.interaction.collectIsPressedAsState
|
import androidx.compose.foundation.interaction.collectIsPressedAsState
|
||||||
@@ -22,7 +23,6 @@ import androidx.compose.runtime.*
|
|||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
import androidx.compose.ui.draw.shadow
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.input.pointer.pointerInput
|
import androidx.compose.ui.input.pointer.pointerInput
|
||||||
@@ -44,11 +44,9 @@ import com.ramcosta.composedestinations.navigation.DestinationsNavigator
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import com.sukisu.ultra.Natives
|
import com.sukisu.ultra.Natives
|
||||||
import com.sukisu.ultra.ui.component.SearchAppBar
|
import com.sukisu.ultra.ui.component.SearchAppBar
|
||||||
import com.sukisu.ultra.ui.theme.CardConfig
|
|
||||||
import com.sukisu.ultra.ui.util.ModuleModify
|
import com.sukisu.ultra.ui.util.ModuleModify
|
||||||
import com.sukisu.ultra.ui.viewmodel.SuperUserViewModel
|
import com.sukisu.ultra.ui.viewmodel.SuperUserViewModel
|
||||||
import com.dergoogler.mmrl.ui.component.LabelItem
|
import com.dergoogler.mmrl.ui.component.LabelItem
|
||||||
import com.dergoogler.mmrl.ui.component.LabelItemDefaults
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ShirkNeko
|
* @author ShirkNeko
|
||||||
@@ -195,8 +193,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
viewModel.showBatchActions = false
|
viewModel.showBatchActions = false
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isCancelPressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isCancelPressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.surfaceContainerHigh,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = cancelInteractionSource,
|
interactionSource = cancelInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -235,8 +231,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isUnauthorizePressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isUnauthorizePressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.errorContainer,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onErrorContainer,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = unauthorizeInteractionSource,
|
interactionSource = unauthorizeInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -275,8 +269,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isAuthorizePressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isAuthorizePressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = authorizeInteractionSource,
|
interactionSource = authorizeInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -325,8 +317,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isUmountEnablePressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isUmountEnablePressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onTertiaryContainer,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = umountEnableInteractionSource,
|
interactionSource = umountEnableInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -368,8 +358,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isUmountDisablePressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isUmountDisablePressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onTertiaryContainer,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = umountDisableInteractionSource,
|
interactionSource = umountDisableInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -411,8 +399,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isTopBtnPressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isTopBtnPressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 1f),
|
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = topBtnInteractionSource,
|
interactionSource = topBtnInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -454,8 +440,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.size(if (isBottomBtnPressed) 56.dp else 40.dp),
|
modifier = Modifier.size(if (isBottomBtnPressed) 56.dp else 40.dp),
|
||||||
containerColor = MaterialTheme.colorScheme.primaryContainer.copy(alpha = 1f),
|
|
||||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
interactionSource = bottomBtnInteractionSource,
|
interactionSource = bottomBtnInteractionSource,
|
||||||
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
elevation = FloatingActionButtonDefaults.elevation(4.dp, 6.dp)
|
||||||
@@ -638,7 +622,7 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
verticalArrangement = Arrangement.Center
|
verticalArrangement = Arrangement.Center
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Apps,
|
imageVector = Icons.Filled.Archive,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colorScheme.primary.copy(alpha = 0.6f),
|
tint = MaterialTheme.colorScheme.primary.copy(alpha = 0.6f),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -649,7 +633,6 @@ fun SuperUserScreen(navigator: DestinationsNavigator) {
|
|||||||
text = stringResource(R.string.no_apps_found),
|
text = stringResource(R.string.no_apps_found),
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.bodyLarge,
|
style = MaterialTheme.typography.bodyLarge,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -665,7 +648,6 @@ fun GroupHeader(title: String) {
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.background(MaterialTheme.colorScheme.surfaceContainerHighest.copy(alpha = 0.7f))
|
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
@@ -673,13 +655,12 @@ fun GroupHeader(title: String) {
|
|||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Bold,
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalLayoutApi::class)
|
@OptIn(ExperimentalLayoutApi::class, ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun AppItem(
|
private fun AppItem(
|
||||||
app: SuperUserViewModel.AppInfo,
|
app: SuperUserViewModel.AppInfo,
|
||||||
@@ -690,37 +671,10 @@ private fun AppItem(
|
|||||||
onLongClick: () -> Unit,
|
onLongClick: () -> Unit,
|
||||||
viewModel: SuperUserViewModel
|
viewModel: SuperUserViewModel
|
||||||
) {
|
) {
|
||||||
val cardAlpha = CardConfig.cardAlpha
|
|
||||||
|
|
||||||
val cardColor = if (app.allowSu)
|
|
||||||
MaterialTheme.colorScheme.surfaceVariant.copy(alpha = cardAlpha)
|
|
||||||
else if (app.hasCustomProfile)
|
|
||||||
MaterialTheme.colorScheme.secondaryContainer.copy(alpha = cardAlpha)
|
|
||||||
else
|
|
||||||
MaterialTheme.colorScheme.tertiaryContainer.copy(alpha = cardAlpha)
|
|
||||||
|
|
||||||
Card(
|
Card(
|
||||||
colors = CardDefaults.cardColors(containerColor = cardColor),
|
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surface.copy(alpha = 0f)),
|
||||||
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
elevation = CardDefaults.cardElevation(defaultElevation = 0.dp),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
|
||||||
.padding(horizontal = 8.dp, vertical = 4.dp)
|
|
||||||
.clip(MaterialTheme.shapes.medium)
|
|
||||||
.shadow(
|
|
||||||
elevation = 0.dp,
|
|
||||||
shape = MaterialTheme.shapes.medium,
|
|
||||||
spotColor = MaterialTheme.colorScheme.primary.copy(alpha = 0.1f)
|
|
||||||
)
|
|
||||||
.then(
|
|
||||||
if (isSelected)
|
|
||||||
Modifier.border(
|
|
||||||
width = 2.dp,
|
|
||||||
color = MaterialTheme.colorScheme.primary,
|
|
||||||
shape = MaterialTheme.shapes.medium
|
|
||||||
)
|
|
||||||
else
|
|
||||||
Modifier
|
|
||||||
)
|
|
||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
detectTapGestures(
|
detectTapGestures(
|
||||||
onLongPress = { onLongClick() },
|
onLongPress = { onLongClick() },
|
||||||
@@ -754,17 +708,13 @@ private fun AppItem(
|
|||||||
Text(
|
Text(
|
||||||
text = app.label,
|
text = app.label,
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurface,
|
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis
|
|
||||||
)
|
)
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = app.packageName,
|
text = app.packageName,
|
||||||
style = MaterialTheme.typography.bodySmall,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = androidx.compose.ui.text.style.TextOverflow.Ellipsis
|
|
||||||
)
|
)
|
||||||
|
|
||||||
FlowRow(
|
FlowRow(
|
||||||
@@ -772,21 +722,13 @@ private fun AppItem(
|
|||||||
horizontalArrangement = Arrangement.spacedBy(4.dp)
|
horizontalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
) {
|
) {
|
||||||
if (app.allowSu) {
|
if (app.allowSu) {
|
||||||
LabelItem(text = "ROOT",)
|
LabelItem(text = "ROOT")
|
||||||
}
|
}
|
||||||
if (Natives.uidShouldUmount(app.uid)) {
|
if (Natives.uidShouldUmount(app.uid)) {
|
||||||
LabelItem(text = "UNMOUNT", style = LabelItemDefaults.style.copy(
|
LabelItem(text = "UNMOUNT")
|
||||||
containerColor = MaterialTheme.colorScheme.secondaryContainer,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (app.hasCustomProfile) {
|
if (app.hasCustomProfile) {
|
||||||
LabelItem(text = "CUSTOM", style = LabelItemDefaults.style.copy(
|
LabelItem(text = "CUSTOM")
|
||||||
containerColor = MaterialTheme.colorScheme.onTertiary,
|
|
||||||
contentColor = MaterialTheme.colorScheme.onTertiaryContainer,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -808,7 +750,6 @@ private fun AppItem(
|
|||||||
Text(
|
Text(
|
||||||
text = if (app.allowSu) stringResource(R.string.authorized) else stringResource(R.string.unauthorized),
|
text = if (app.allowSu) stringResource(R.string.authorized) else stringResource(R.string.unauthorized),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = if (app.allowSu) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline,
|
|
||||||
modifier = Modifier.padding(end = 4.dp)
|
modifier = Modifier.padding(end = 4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -817,18 +758,9 @@ private fun AppItem(
|
|||||||
checked = app.allowSu,
|
checked = app.allowSu,
|
||||||
onCheckedChange = onSwitchChange,
|
onCheckedChange = onSwitchChange,
|
||||||
interactionSource = switchInteractionSource,
|
interactionSource = switchInteractionSource,
|
||||||
colors = SwitchDefaults.colors(
|
|
||||||
checkedThumbColor = MaterialTheme.colorScheme.onPrimary,
|
|
||||||
checkedTrackColor = MaterialTheme.colorScheme.primary,
|
|
||||||
checkedIconColor = MaterialTheme.colorScheme.primary,
|
|
||||||
uncheckedThumbColor = MaterialTheme.colorScheme.outline,
|
|
||||||
uncheckedTrackColor = MaterialTheme.colorScheme.surfaceVariant,
|
|
||||||
uncheckedIconColor = MaterialTheme.colorScheme.surfaceVariant
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 复选框交互源
|
|
||||||
val checkboxInteractionSource = remember { MutableInteractionSource() }
|
val checkboxInteractionSource = remember { MutableInteractionSource() }
|
||||||
val isCheckboxPressed by checkboxInteractionSource.collectIsPressedAsState()
|
val isCheckboxPressed by checkboxInteractionSource.collectIsPressedAsState()
|
||||||
|
|
||||||
@@ -844,19 +776,13 @@ private fun AppItem(
|
|||||||
Text(
|
Text(
|
||||||
text = if (isSelected) stringResource(R.string.selected) else stringResource(R.string.select),
|
text = if (isSelected) stringResource(R.string.selected) else stringResource(R.string.select),
|
||||||
style = MaterialTheme.typography.labelMedium,
|
style = MaterialTheme.typography.labelMedium,
|
||||||
color = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline,
|
|
||||||
modifier = Modifier.padding(end = 4.dp)
|
modifier = Modifier.padding(end = 4.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Checkbox(
|
Checkbox(
|
||||||
checked = isSelected,
|
checked = isSelected,
|
||||||
onCheckedChange = { onToggleSelection() },
|
onCheckedChange = { onToggleSelection() },
|
||||||
interactionSource = checkboxInteractionSource,
|
interactionSource = checkboxInteractionSource,
|
||||||
colors = CheckboxDefaults.colors(
|
|
||||||
checkedColor = MaterialTheme.colorScheme.primary,
|
|
||||||
uncheckedColor = MaterialTheme.colorScheme.outline
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -865,12 +791,12 @@ private fun AppItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LabelText(label: String, backgroundColor: Color) {
|
fun LabelText(label: String) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(top = 2.dp, end = 2.dp)
|
.padding(top = 2.dp, end = 2.dp)
|
||||||
.background(
|
.background(
|
||||||
backgroundColor,
|
Color.Black,
|
||||||
shape = RoundedCornerShape(4.dp)
|
shape = RoundedCornerShape(4.dp)
|
||||||
)
|
)
|
||||||
.clip(RoundedCornerShape(4.dp))
|
.clip(RoundedCornerShape(4.dp))
|
||||||
@@ -879,9 +805,8 @@ fun LabelText(label: String, backgroundColor: Color) {
|
|||||||
text = label,
|
text = label,
|
||||||
modifier = Modifier.padding(vertical = 2.dp, horizontal = 6.dp),
|
modifier = Modifier.padding(vertical = 2.dp, horizontal = 6.dp),
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontSize = 10.sp,
|
fontSize = 8.sp,
|
||||||
color = Color.White,
|
color = Color.White,
|
||||||
fontWeight = FontWeight.Medium
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,13 +207,13 @@ private fun TemplateItem(
|
|||||||
)
|
)
|
||||||
Text(template.description)
|
Text(template.description)
|
||||||
FlowRow {
|
FlowRow {
|
||||||
LabelText(label = "UID: ${template.uid}", backgroundColor = MaterialTheme.colorScheme.surface)
|
LabelText(label = "UID: ${template.uid}")
|
||||||
LabelText(label = "GID: ${template.gid}", backgroundColor = MaterialTheme.colorScheme.surface)
|
LabelText(label = "GID: ${template.gid}")
|
||||||
LabelText(label = template.context, backgroundColor = MaterialTheme.colorScheme.surface)
|
LabelText(label = template.context,)
|
||||||
if (template.local) {
|
if (template.local) {
|
||||||
LabelText(label = "local", backgroundColor = MaterialTheme.colorScheme.surface)
|
LabelText(label = "local")
|
||||||
} else {
|
} else {
|
||||||
LabelText(label = "remote", backgroundColor = MaterialTheme.colorScheme.surface)
|
LabelText(label = "remote")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,9 +290,7 @@ fun KernelSUTheme(
|
|||||||
private fun createDynamicDarkColorScheme(context: Context) =
|
private fun createDynamicDarkColorScheme(context: Context) =
|
||||||
dynamicDarkColorScheme(context).copy(
|
dynamicDarkColorScheme(context).copy(
|
||||||
background = Color.Transparent,
|
background = Color.Transparent,
|
||||||
surface = Color.Transparent,
|
surface = Color.Transparent
|
||||||
onBackground = Color.White,
|
|
||||||
onSurface = Color.White
|
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user