Optimize the logic of badge display in the bottom navigation bar
Add support for settings to hide other information README: add notice about stuck device solution (#134) Co-authored-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com> Co-authored-by: =?UTF-8?q?=E7=B1=B3=E5=87=9BMiRin?= <148533509+MiRinChan@users.noreply.github.com> Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
@@ -120,6 +120,9 @@ KPM 模板地址: https://github.com/udochina/KPM-Build-Anywhere
|
|||||||
5. 更多自定义功能
|
5. 更多自定义功能
|
||||||
6. 对 KPM 内核模块的支持
|
6. 对 KPM 内核模块的支持
|
||||||
|
|
||||||
|
## 疑难解答
|
||||||
|
1. 卸载 KernelSU 管理器设备卡死。→ 卸载包名为 com.sony.playmemories.mobile 的应用。
|
||||||
|
|
||||||
## 许可证
|
## 许可证
|
||||||
|
|
||||||
- `kernel` 目录下的文件是 [GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)。
|
- `kernel` 目录下的文件是 [GPL-2.0-only](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)。
|
||||||
|
|||||||
@@ -324,6 +324,9 @@ private fun BottomBar(navController: NavHostController) {
|
|||||||
val showKpmInfo = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
val showKpmInfo = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
.getBoolean("show_kpm_info", true)
|
.getBoolean("show_kpm_info", true)
|
||||||
|
|
||||||
|
val isHideOtherInfo = LocalContext.current.getSharedPreferences("settings", Context.MODE_PRIVATE)
|
||||||
|
.getBoolean("is_hide_other_info", false)
|
||||||
|
|
||||||
NavigationBar(
|
NavigationBar(
|
||||||
modifier = Modifier.windowInsetsPadding(
|
modifier = Modifier.windowInsetsPadding(
|
||||||
WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal)
|
WindowInsets.navigationBars.only(WindowInsetsSides.Horizontal)
|
||||||
@@ -356,7 +359,7 @@ private fun BottomBar(navController: NavHostController) {
|
|||||||
icon = {
|
icon = {
|
||||||
BadgedBox(
|
BadgedBox(
|
||||||
badge = {
|
badge = {
|
||||||
if (kpmModuleCount > 0) {
|
if (kpmModuleCount > 0 && !isHideOtherInfo) {
|
||||||
Badge(
|
Badge(
|
||||||
containerColor = MaterialTheme.colorScheme.secondary
|
containerColor = MaterialTheme.colorScheme.secondary
|
||||||
) {
|
) {
|
||||||
@@ -400,7 +403,7 @@ private fun BottomBar(navController: NavHostController) {
|
|||||||
icon = {
|
icon = {
|
||||||
BadgedBox(
|
BadgedBox(
|
||||||
badge = {
|
badge = {
|
||||||
if (superuserCount > 0) {
|
if (superuserCount > 0 && !isHideOtherInfo) {
|
||||||
Badge(
|
Badge(
|
||||||
containerColor = MaterialTheme.colorScheme.secondary
|
containerColor = MaterialTheme.colorScheme.secondary
|
||||||
) {
|
) {
|
||||||
@@ -443,7 +446,7 @@ private fun BottomBar(navController: NavHostController) {
|
|||||||
icon = {
|
icon = {
|
||||||
BadgedBox(
|
BadgedBox(
|
||||||
badge = {
|
badge = {
|
||||||
if (moduleCount > 0) {
|
if (moduleCount > 0 && !isHideOtherInfo) {
|
||||||
Badge(
|
Badge(
|
||||||
containerColor = MaterialTheme.colorScheme.secondary ) {
|
containerColor = MaterialTheme.colorScheme.secondary ) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -33,15 +33,7 @@ import androidx.compose.foundation.shape.RoundedCornerShape
|
|||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.ExperimentalMaterialApi
|
import androidx.compose.material.ExperimentalMaterialApi
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Android
|
import androidx.compose.material.icons.filled.*
|
||||||
import androidx.compose.material.icons.filled.Archive
|
|
||||||
import androidx.compose.material.icons.filled.Info
|
|
||||||
import androidx.compose.material.icons.filled.Memory
|
|
||||||
import androidx.compose.material.icons.filled.PhoneAndroid
|
|
||||||
import androidx.compose.material.icons.filled.Refresh
|
|
||||||
import androidx.compose.material.icons.filled.Security
|
|
||||||
import androidx.compose.material.icons.filled.SettingsSuggest
|
|
||||||
import androidx.compose.material.icons.filled.Storage
|
|
||||||
import androidx.compose.material.icons.outlined.Block
|
import androidx.compose.material.icons.outlined.Block
|
||||||
import androidx.compose.material.icons.outlined.TaskAlt
|
import androidx.compose.material.icons.outlined.TaskAlt
|
||||||
import androidx.compose.material.icons.outlined.Warning
|
import androidx.compose.material.icons.outlined.Warning
|
||||||
@@ -96,10 +88,6 @@ 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.theme.getCardElevation
|
import com.sukisu.ultra.ui.theme.getCardElevation
|
||||||
import com.sukisu.ultra.ui.util.checkNewVersion
|
import com.sukisu.ultra.ui.util.checkNewVersion
|
||||||
import com.sukisu.ultra.ui.util.getKpmModuleCount
|
|
||||||
import com.sukisu.ultra.ui.util.getKpmVersion
|
|
||||||
import com.sukisu.ultra.ui.util.getModuleCount
|
|
||||||
import com.sukisu.ultra.ui.util.getSuperuserCount
|
|
||||||
import com.sukisu.ultra.ui.util.module.LatestVersionInfo
|
import com.sukisu.ultra.ui.util.module.LatestVersionInfo
|
||||||
import com.sukisu.ultra.ui.util.reboot
|
import com.sukisu.ultra.ui.util.reboot
|
||||||
import com.sukisu.ultra.ui.viewmodel.HomeViewModel
|
import com.sukisu.ultra.ui.viewmodel.HomeViewModel
|
||||||
@@ -138,8 +126,6 @@ fun HomeScreen(navigator: DestinationsNavigator) {
|
|||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopBar(
|
TopBar(
|
||||||
kernelVersion = viewModel.systemStatus.kernelVersion,
|
|
||||||
onInstallClick = { navigator.navigate(InstallScreenDestination) },
|
|
||||||
scrollBehavior = scrollBehavior
|
scrollBehavior = scrollBehavior
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -200,8 +186,6 @@ fun HomeScreen(navigator: DestinationsNavigator) {
|
|||||||
InfoCard(
|
InfoCard(
|
||||||
systemInfo = viewModel.systemInfo,
|
systemInfo = viewModel.systemInfo,
|
||||||
isSimpleMode = viewModel.isSimpleMode,
|
isSimpleMode = viewModel.isSimpleMode,
|
||||||
isHideVersion = viewModel.isHideVersion,
|
|
||||||
isHideOtherInfo = viewModel.isHideOtherInfo,
|
|
||||||
isHideSusfsStatus = viewModel.isHideSusfsStatus,
|
isHideSusfsStatus = viewModel.isHideSusfsStatus,
|
||||||
showKpmInfo = viewModel.showKpmInfo,
|
showKpmInfo = viewModel.showKpmInfo,
|
||||||
lkmMode = viewModel.systemStatus.lkmMode,
|
lkmMode = viewModel.systemStatus.lkmMode,
|
||||||
@@ -279,8 +263,6 @@ fun RebootDropdownItem(@StringRes id: Int, reason: String = "") {
|
|||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun TopBar(
|
private fun TopBar(
|
||||||
kernelVersion: KernelVersion,
|
|
||||||
onInstallClick: () -> Unit,
|
|
||||||
scrollBehavior: TopAppBarScrollBehavior? = null
|
scrollBehavior: TopAppBarScrollBehavior? = null
|
||||||
) {
|
) {
|
||||||
val colorScheme = MaterialTheme.colorScheme
|
val colorScheme = MaterialTheme.colorScheme
|
||||||
@@ -308,7 +290,7 @@ private fun TopBar(
|
|||||||
showDropdown = true
|
showDropdown = true
|
||||||
}) {
|
}) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Filled.Refresh,
|
imageVector = Icons.Filled.PowerSettingsNew,
|
||||||
contentDescription = stringResource(id = R.string.reboot)
|
contentDescription = stringResource(id = R.string.reboot)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -636,8 +618,6 @@ fun DonateCard() {
|
|||||||
private fun InfoCard(
|
private fun InfoCard(
|
||||||
systemInfo: HomeViewModel.SystemInfo,
|
systemInfo: HomeViewModel.SystemInfo,
|
||||||
isSimpleMode: Boolean,
|
isSimpleMode: Boolean,
|
||||||
isHideVersion: Boolean,
|
|
||||||
isHideOtherInfo: Boolean,
|
|
||||||
isHideSusfsStatus: Boolean,
|
isHideSusfsStatus: Boolean,
|
||||||
showKpmInfo: Boolean,
|
showKpmInfo: Boolean,
|
||||||
lkmMode: Boolean?
|
lkmMode: Boolean?
|
||||||
@@ -655,7 +635,7 @@ private fun InfoCard(
|
|||||||
fun InfoCardItem(
|
fun InfoCardItem(
|
||||||
label: String,
|
label: String,
|
||||||
content: String,
|
content: String,
|
||||||
icon: ImageVector = Icons.Default.Info
|
icon: ImageVector? = null,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.Top,
|
verticalAlignment = Alignment.Top,
|
||||||
@@ -663,14 +643,15 @@ private fun InfoCard(
|
|||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(vertical = 8.dp)
|
.padding(vertical = 8.dp)
|
||||||
) {
|
) {
|
||||||
Icon(
|
if (icon != null) {
|
||||||
imageVector = icon,
|
Icon(
|
||||||
contentDescription = label,
|
imageVector = icon,
|
||||||
modifier = Modifier
|
contentDescription = label,
|
||||||
.size(28.dp)
|
modifier = Modifier
|
||||||
.padding(vertical = 4.dp),
|
.size(28.dp)
|
||||||
tint = MaterialTheme.colorScheme.primary,
|
.padding(vertical = 4.dp),
|
||||||
)
|
)
|
||||||
|
}
|
||||||
Spacer(modifier = Modifier.width(16.dp))
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
Reference in New Issue
Block a user