Skip to content

Commit 848c75f

Browse files
committed
feat(app): 为模块卡片添加横幅背景功能
- 数据层:LocalModule/ModuleInfo 新增 banner 字段,解析 module.prop 的 banner 属性 (URL 直接存储,相对路径解析为 /data/adb/modules/{id}/{banner} 绝对路径) - UI 层:ModuleItem 使用 onSizeChanged 动态匹配外层 Box 高度,banner 以 18% 透明度 + 垂直渐变遮罩铺满卡片(insideMargin=0dp,内容 Column 自带 16dp padding) - 图片加载:LaunchedEffect + BitmapFactory 异步加载,本地文件通过 RootUtils.fs 读取 - 偏好设置:Config.useBanner 默认关闭,开关位于设置页主题二级页面 ColorPaletteScreen - 资源:新增中英文字符串(settings_banner / settings_banner_summary)
1 parent 21f696b commit 848c75f

7 files changed

Lines changed: 366 additions & 243 deletions

File tree

app/apk/src/main/java/io/github/seyud/weave/ui/colorpalette/ColorPaletteScreen.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import androidx.compose.material.icons.rounded.CallToAction
2626
import androidx.compose.material.icons.rounded.Colorize
2727
import androidx.compose.material.icons.rounded.Palette
2828
import androidx.compose.material.icons.rounded.WaterDrop
29+
import androidx.compose.material.icons.rounded.ViewCarousel
2930
import androidx.compose.runtime.Composable
3031
import androidx.compose.runtime.getValue
3132
import androidx.compose.runtime.mutableFloatStateOf
@@ -79,6 +80,7 @@ fun ColorPaletteScreen(
7980
var enableBlurState by rememberSaveable { mutableStateOf(Config.enableBlur) }
8081
var enableFloatingBottomBar by rememberSaveable { mutableStateOf(Config.enableFloatingBottomBar) }
8182
var enableFloatingBottomBarBlur by rememberSaveable { mutableStateOf(Config.enableFloatingBottomBarBlur) }
83+
var useBanner by rememberSaveable { mutableStateOf(Config.useBanner) }
8284
var sliderValue by rememberSaveable { mutableFloatStateOf(Config.pageScale) }
8385
val showScaleDialog = rememberSaveable { mutableStateOf(false) }
8486

@@ -310,6 +312,24 @@ fun ColorPaletteScreen(
310312
}
311313
)
312314
}
315+
316+
SwitchPreference(
317+
title = stringResource(id = CoreR.string.settings_banner),
318+
summary = stringResource(id = CoreR.string.settings_banner_summary),
319+
startAction = {
320+
Icon(
321+
Icons.Rounded.ViewCarousel,
322+
modifier = Modifier.padding(end = 6.dp),
323+
contentDescription = stringResource(id = CoreR.string.settings_banner),
324+
tint = colorScheme.onBackground
325+
)
326+
},
327+
checked = useBanner,
328+
onCheckedChange = {
329+
Config.useBanner = it
330+
useBanner = it
331+
}
332+
)
313333
}
314334

315335
// Predictive back / Page scale section

app/apk/src/main/java/io/github/seyud/weave/ui/module/ModuleInfo.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ data class ModuleInfo(
3232
val actionIconPath: String?,
3333
val webUiIconPath: String?,
3434
val outdated: Boolean,
35+
val banner: String = "",
3536
) {
3637
/**
3738
* 是否显示警告信息
@@ -112,6 +113,7 @@ data class ModuleInfo(
112113
actionIconPath = localModule.actionIconPath,
113114
webUiIconPath = localModule.webUiIconPath,
114115
outdated = localModule.outdated,
116+
banner = localModule.banner,
115117
)
116118
}
117119
}

0 commit comments

Comments
 (0)