Add the ability to display more module information, support copying the update configuration address to the clipboard
This commit is contained in:
@@ -2,6 +2,8 @@ package com.sukisu.ultra.ui.screen
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.Activity.*
|
import android.app.Activity.*
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
@@ -37,6 +39,7 @@ import androidx.compose.ui.Modifier
|
|||||||
import androidx.compose.ui.draw.rotate
|
import androidx.compose.ui.draw.rotate
|
||||||
import androidx.compose.ui.draw.scale
|
import androidx.compose.ui.draw.scale
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||||
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.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
@@ -898,6 +901,12 @@ fun ModuleItem(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val prefs = context.getSharedPreferences("settings", MODE_PRIVATE)
|
val prefs = context.getSharedPreferences("settings", MODE_PRIVATE)
|
||||||
val isHideTagRow = prefs.getBoolean("is_hide_tag_row", false)
|
val isHideTagRow = prefs.getBoolean("is_hide_tag_row", false)
|
||||||
|
// 获取显示更多模块信息的设置
|
||||||
|
val showMoreModuleInfo = prefs.getBoolean("show_more_module_info", false)
|
||||||
|
|
||||||
|
// 剪贴板管理器和触觉反馈
|
||||||
|
val clipboardManager = context.getSystemService(CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
|
val hapticFeedback = LocalHapticFeedback.current
|
||||||
|
|
||||||
ElevatedCard(
|
ElevatedCard(
|
||||||
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
colors = getCardColors(MaterialTheme.colorScheme.surfaceContainerHigh),
|
||||||
@@ -966,6 +975,43 @@ fun ModuleItem(
|
|||||||
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
||||||
textDecoration = textDecoration,
|
textDecoration = textDecoration,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 显示更多模块信息时添加updateJson
|
||||||
|
if (showMoreModuleInfo && module.updateJson.isNotEmpty()) {
|
||||||
|
val updateJsonLabel = stringResource(R.string.module_update_json)
|
||||||
|
Text(
|
||||||
|
text = "$updateJsonLabel: ${module.updateJson}",
|
||||||
|
fontSize = MaterialTheme.typography.bodySmall.fontSize,
|
||||||
|
lineHeight = MaterialTheme.typography.bodySmall.lineHeight,
|
||||||
|
fontFamily = MaterialTheme.typography.bodySmall.fontFamily,
|
||||||
|
textDecoration = textDecoration,
|
||||||
|
color = MaterialTheme.colorScheme.primary,
|
||||||
|
maxLines = 5,
|
||||||
|
overflow = TextOverflow.Ellipsis,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.combinedClickable(
|
||||||
|
onClick = {
|
||||||
|
},
|
||||||
|
onLongClick = {
|
||||||
|
// 长按复制updateJson地址
|
||||||
|
val clipData = ClipData.newPlainText(
|
||||||
|
"Update JSON URL",
|
||||||
|
module.updateJson
|
||||||
|
)
|
||||||
|
clipboardManager.setPrimaryClip(clipData)
|
||||||
|
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
|
|
||||||
|
// 显示复制成功的提示
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
context.getString(R.string.module_update_json_copied),
|
||||||
|
Toast.LENGTH_SHORT
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
@@ -995,17 +1041,15 @@ fun ModuleItem(
|
|||||||
maxLines = 4,
|
maxLines = 4,
|
||||||
textDecoration = textDecoration,
|
textDecoration = textDecoration,
|
||||||
)
|
)
|
||||||
|
if (!isHideTagRow) {
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(12.dp))
|
Spacer(modifier = Modifier.height(12.dp))
|
||||||
|
// 文件夹名称和大小标签
|
||||||
// 标签行
|
|
||||||
if (!isHideTagRow) {
|
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
// 文件夹名称标签
|
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(4.dp),
|
shape = RoundedCornerShape(4.dp),
|
||||||
color = MaterialTheme.colorScheme.primary,
|
color = MaterialTheme.colorScheme.primary,
|
||||||
@@ -1020,8 +1064,6 @@ fun ModuleItem(
|
|||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 大小标签
|
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(4.dp),
|
shape = RoundedCornerShape(4.dp),
|
||||||
color = MaterialTheme.colorScheme.secondaryContainer,
|
color = MaterialTheme.colorScheme.secondaryContainer,
|
||||||
@@ -1036,9 +1078,9 @@ fun ModuleItem(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(16.dp))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
}
|
|
||||||
|
|
||||||
HorizontalDivider(thickness = Dp.Hairline)
|
HorizontalDivider(thickness = Dp.Hairline)
|
||||||
|
|
||||||
|
|||||||
@@ -238,6 +238,11 @@ fun MoreSettingsScreen(
|
|||||||
mutableStateOf(prefs.getBoolean("is_hide_tag_row", false))
|
mutableStateOf(prefs.getBoolean("is_hide_tag_row", false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 显示更多模块信息开关状态
|
||||||
|
var showMoreModuleInfo by remember {
|
||||||
|
mutableStateOf(prefs.getBoolean("show_more_module_info", false))
|
||||||
|
}
|
||||||
|
|
||||||
// SELinux状态
|
// SELinux状态
|
||||||
var selinuxEnabled by remember {
|
var selinuxEnabled by remember {
|
||||||
mutableStateOf(Shell.cmd("getenforce").exec().out.firstOrNull() == "Enforcing")
|
mutableStateOf(Shell.cmd("getenforce").exec().out.firstOrNull() == "Enforcing")
|
||||||
@@ -326,6 +331,12 @@ fun MoreSettingsScreen(
|
|||||||
isHideTagRow = newValue
|
isHideTagRow = newValue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 显示更多模块信息开关状态
|
||||||
|
val onShowMoreModuleInfoChange = { newValue: Boolean ->
|
||||||
|
prefs.edit { putBoolean("show_more_module_info", newValue) }
|
||||||
|
showMoreModuleInfo = newValue
|
||||||
|
}
|
||||||
|
|
||||||
// 备用图标开关状态
|
// 备用图标开关状态
|
||||||
val onUseAltIconChange = { newValue: Boolean ->
|
val onUseAltIconChange = { newValue: Boolean ->
|
||||||
prefs.edit { putBoolean("use_alt_icon", newValue) }
|
prefs.edit { putBoolean("use_alt_icon", newValue) }
|
||||||
@@ -1036,6 +1047,15 @@ fun MoreSettingsScreen(
|
|||||||
onChange = onUseAltIconChange
|
onChange = onUseAltIconChange
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 显示更多模块信息开关
|
||||||
|
SwitchSettingItem(
|
||||||
|
icon = Icons.Filled.Info,
|
||||||
|
title = stringResource(R.string.show_more_module_info),
|
||||||
|
summary = stringResource(R.string.show_more_module_info_summary),
|
||||||
|
checked = showMoreModuleInfo,
|
||||||
|
onChange = onShowMoreModuleInfoChange
|
||||||
|
)
|
||||||
|
|
||||||
// 添加简洁模式开关
|
// 添加简洁模式开关
|
||||||
SwitchSettingItem(
|
SwitchSettingItem(
|
||||||
icon = Icons.Filled.Brush,
|
icon = Icons.Filled.Brush,
|
||||||
|
|||||||
@@ -513,4 +513,12 @@
|
|||||||
<string name="susfs_log_config_title">SuSFS 日志配置</string>
|
<string name="susfs_log_config_title">SuSFS 日志配置</string>
|
||||||
<string name="susfs_log_enabled">启用 SuSFS 日志</string>
|
<string name="susfs_log_enabled">启用 SuSFS 日志</string>
|
||||||
<string name="susfs_log_disabled">关闭 SuSFS 日志</string>
|
<string name="susfs_log_disabled">关闭 SuSFS 日志</string>
|
||||||
|
<string name="module_update_json">更新配置</string>
|
||||||
|
<string name="module_update_json_copied">更新配置地址已复制到剪贴板</string>
|
||||||
|
<string name="module_update_json_not_available">更新配置不可用</string>
|
||||||
|
<!-- 设置相关字符串 -->
|
||||||
|
<string name="show_module_update_json">显示模块更新配置</string>
|
||||||
|
<string name="show_module_update_json_summary">在模块详情中显示更新配置URL</string>
|
||||||
|
<string name="show_more_module_info">显示更多模块信息</string>
|
||||||
|
<string name="show_more_module_info_summary">显示额外的模块信息,如更新配置URL等</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -515,4 +515,12 @@
|
|||||||
<string name="susfs_log_config_title">SuSFS Logging Configuration</string>
|
<string name="susfs_log_config_title">SuSFS Logging Configuration</string>
|
||||||
<string name="susfs_log_enabled">Enabling SuSFS Logging</string>
|
<string name="susfs_log_enabled">Enabling SuSFS Logging</string>
|
||||||
<string name="susfs_log_disabled">Turn off SuSFS logging</string>
|
<string name="susfs_log_disabled">Turn off SuSFS logging</string>
|
||||||
|
<string name="module_update_json">Update JSON</string>
|
||||||
|
<string name="module_update_json_copied">Update JSON URL copied to clipboard</string>
|
||||||
|
<string name="module_update_json_not_available">Update JSON not available</string>
|
||||||
|
<!-- Settings related strings -->
|
||||||
|
<string name="show_module_update_json">Show Module Update JSON</string>
|
||||||
|
<string name="show_module_update_json_summary">Display update JSON URL in module details</string>
|
||||||
|
<string name="show_more_module_info">Show More Module Info</string>
|
||||||
|
<string name="show_more_module_info_summary">Display additional module information like update JSON URLs</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user