11 changed files with 183 additions and 17 deletions

No files matched your search

+2 -2
View File
@@ -1,5 +1,5 @@
=======================================
LuminPro V2.3 — 日用屏幕亮度强化
=======================================
LuminPro — 日用屏幕亮度强化
作者: 酷安@Yule
=======================================
+8
View File
@@ -1,5 +1,13 @@
# 更新日志
## V2.5.0-beta.3
- 修复: 底部导航栏未适配手势导航条(补 viewport-fit=cover 与 edge-to-edge,安全区变量此前恒为 0)
- 修复: 文档预览不渲染 HTML 与 GitHub 提示块(`> [!TIP]` 等)
- 修复: 活动抓取会误抓到系统桌面,现忽略桌面/系统界面/输入法
- 优化: 亮度滑条改为拖动中按 3% 变化实时应用,松手再应用最终值
- 优化: NOTE.txt 去掉过期的版本号
## V2.5.0-beta.2
- 重构: WebUI 全量重写为 **Material Design 3**(基于 `@material/web`),补全颜色/字阶/形状/动效令牌,支持涟漪与状态层反馈
+7 -3
View File
@@ -211,6 +211,10 @@ func TestReadModuleInfo(t *testing.T) {
}
}
// fixedNow 是状态聚合测试的基准时间:运行时长等字段依赖「当前时间」,
// 必须与写入 state 的 startedAt 用同一基准,否则测试会随执行时机漂移。
var fixedNow = time.Date(2026, 9, 10, 12, 0, 0, 0, time.Local)
func TestBuildStatus(t *testing.T) {
dir := t.TempDir()
paths := DefaultPaths(dir)
@@ -247,9 +251,9 @@ func TestBuildStatus(t *testing.T) {
}
if err := WriteState(paths.StateFile, DaemonState{
PID: os.Getpid(),
StartedAt: time.Now().Add(-90 * time.Second).Unix(),
StartedAt: fixedNow.Add(-90 * time.Second).Unix(),
Mode: "event",
Ratio: &RatioInfo{Value: 1.08, At: time.Now().Unix()},
Ratio: &RatioInfo{Value: 1.08, At: fixedNow.Unix()},
HdrSleep: true,
}); err != nil {
t.Fatal(err)
@@ -265,7 +269,7 @@ func TestBuildStatus(t *testing.T) {
status := BuildStatus(paths, cfg, StatusDeps{
AutoBrightness: system.AutoBrightness{Runner: runner},
HDR: system.HdrRatio{Runner: runner},
Now: func() time.Time { return time.Date(2026, 9, 10, 12, 0, 0, 0, time.Local) },
Now: func() time.Time { return fixedNow },
}, StatusOptions{IncludeDisplay: true})
if status.Module.Version != "" && status.Module.Channel != "stable" {
+2 -2
View File
@@ -1,7 +1,7 @@
id=LuminPro
name=LuminPro丨日用屏幕亮度强化
version=V2.5.0-beta.2
versionCode=2050052
version=V2.5.0-beta.3
versionCode=2050053
author=酷安@Yule
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
updateJson=https://raw.githubusercontent.com/YuleBest/LuminPro/main/update.json
+3 -3
View File
@@ -1,6 +1,6 @@
{
"versionCode": 2050052,
"version": "V2.5.0-beta.2",
"zipUrl": "https://github.com/YuleBest/LuminPro/releases/download/v2.5.0-beta.2/LuminPro_V2.5.0-beta.2.zip",
"versionCode": 2050053,
"version": "V2.5.0-beta.3",
"zipUrl": "https://github.com/YuleBest/LuminPro/releases/download/v2.5.0-beta.3/LuminPro_V2.5.0-beta.3.zip",
"changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/beta/changelog.md"
}
+1 -1
View File
@@ -2,7 +2,7 @@
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover" />
<title>LuminPro</title>
<link rel="stylesheet" type="text/css" href="/internal/insets.css" />
</head>
+14 -1
View File
@@ -1,4 +1,4 @@
import { exec, moduleInfo } from 'kernelsu'
import { exec, moduleInfo, enableEdgeToEdge } from 'kernelsu'
import { devMock } from './devMock.js'
export const MODULE_DIR = '/data/adb/modules/LuminPro'
@@ -41,6 +41,19 @@ export function shellQuote(value) {
return `'${String(value).replace(/'/g, "'\\''")}'`
}
/**
* 启用 edge-to-edge:内容延伸至状态栏/手势条区域,
* insets.css 的 --window-inset-* 随之生效,顶栏/底栏据此避让。
* 不同 KernelSU 版本的命名不同,逐个尝试,全部不可用则忽略。
*/
export function applyEdgeToEdge() {
try {
enableEdgeToEdge(true)
} catch {
/* 老版本没有该 API:布局仍可用,只是安全区取 0 */
}
}
/** 读取模块版本(module.prop 的 version) */
export function moduleVersion() {
try {
+2
View File
@@ -1,4 +1,5 @@
import { createApp } from 'vue'
import { applyEdgeToEdge } from './api/ksu.js'
import './mwc.js'
import './theme/tokens.css'
@@ -8,4 +9,5 @@ import './theme/app.css'
import App from './App.vue'
applyEdgeToEdge()
createApp(App).mount('#app')
+99 -1
View File
@@ -12,11 +12,58 @@ let renderMarkdown = null
async function ensureMarkdown() {
if (renderMarkdown) return renderMarkdown
const { default: MarkdownIt } = await import('markdown-it')
const md = new MarkdownIt({ html: false, linkify: true, breaks: true })
// README 使用了 HTML 与 GitHub 提示块(> [!TIP]),需要一并支持
const md = new MarkdownIt({ html: true, linkify: true, breaks: true })
md.core.ruler.push('github-alerts', (state) => {
const tokens = state.tokens
for (let i = 0; i < tokens.length; i++) {
const token = tokens[i]
if (token.type !== 'blockquote_open') continue
const inline = tokens[i + 2]
if (!inline || inline.type !== 'inline') continue
const match = /^\[!([A-Z]+)\]\s*/.exec(inline.content)
if (!match) continue
const kind = match[1].toLowerCase()
const label = ALERT_LABELS[kind]
if (!label) continue
token.attrJoin('class', `md-alert md-alert--${kind}`)
inline.content = inline.content.replace(match[0], '')
inline.children[0].content = inline.children[0].content.replace(match[0], '')
const marker = new state.Token('html_block', '', 0)
marker.content = `<p class="md-alert__title">${label}</p>`
const closeIdx = findBlockquoteClose(tokens, i)
if (closeIdx > 0) tokens.splice(closeIdx, 0, marker)
}
return true
})
renderMarkdown = (text) => md.render(text)
return renderMarkdown
}
/** GitHub 提示块的标题文案 */
const ALERT_LABELS = {
note: '备注',
tip: '提示',
important: '重要',
warning: '警告',
caution: '注意',
}
/** 找到与 openIdx 配对的 blockquote_close 下标 */
function findBlockquoteClose(tokens, openIdx) {
let depth = 0
for (let i = openIdx; i < tokens.length; i++) {
if (tokens[i].type === 'blockquote_open') depth++
else if (tokens[i].type === 'blockquote_close') {
depth--
if (depth === 0) return i
}
}
return -1
}
const docs = [
{ key: 'README.md', label: '模块说明', icon: BookOpen },
{ key: 'changelog.md', label: '更新日志', icon: ScrollText },
@@ -144,6 +191,57 @@ async function openLink(url) {
</template>
<style scoped>
/* GitHub 提示块(> [!TIP] 等) */
.markdown :deep(.md-alert) {
margin: 0 0 var(--md-sys-spacing-3);
padding: var(--md-sys-spacing-3);
border-radius: var(--md-sys-shape-corner-small);
border-inline-start: 4px solid var(--md-sys-color-primary);
background-color: var(--md-sys-color-surface-container);
}
.markdown :deep(.md-alert__title) {
margin: 0 0 4px;
font-weight: 600;
color: var(--md-sys-color-primary);
}
.markdown :deep(.md-alert--tip) {
border-inline-start-color: var(--lp-color-success);
}
.markdown :deep(.md-alert--tip .md-alert__title) {
color: var(--lp-color-success);
}
.markdown :deep(.md-alert--warning),
.markdown :deep(.md-alert--caution) {
border-inline-start-color: var(--lp-color-warning);
}
.markdown :deep(.md-alert--warning .md-alert__title),
.markdown :deep(.md-alert--caution .md-alert__title) {
color: var(--lp-color-warning);
}
.markdown :deep(.md-alert--important) {
border-inline-start-color: var(--md-sys-color-error);
}
.markdown :deep(.md-alert--important .md-alert__title) {
color: var(--md-sys-color-error);
}
/* README 的居中容器与徽章 */
.markdown :deep([align='center']) {
text-align: center;
}
.markdown :deep(img) {
max-width: 100%;
height: auto;
}
.about-meta {
display: flex;
flex-wrap: wrap;
+22 -1
View File
@@ -156,6 +156,26 @@ function stopPolling() {
}
}
/**
* 需要忽略的前台活动:WebUI 自身、系统桌面(切换应用的瞬间会被抓到)、
* 输入法、权限弹窗等系统界面。
*/
const IGNORED_ACTIVITY_PATTERNS = [
/webui/i,
// 系统桌面(各厂商 launcher)
/(^|\.)launcher/i,
/com\.android\.systemui/i,
/\/com\.android\.internal\.app\.Launcher/i,
// 输入法与系统弹窗
/\.inputmethod\./i,
/com\.android\.permissioncontroller/i,
/com\.android\.settings\/com\.android\.settings\.(FallbackHome|Settings)/i,
]
function isIgnoredActivity(activity) {
return IGNORED_ACTIVITY_PATTERNS.some((pattern) => pattern.test(activity))
}
function startPolling() {
pickerPolling.value = true
pickerStatus.value = '检测中,请切换到目标界面...'
@@ -164,7 +184,8 @@ function startPolling() {
try {
const res = await fetchFocus()
const activity = (res.focus || '').trim()
if (!activity || activity.toLowerCase().includes('webui')) return
// 空值、WebUI 自身、桌面等系统界面都继续等待
if (!activity || isIgnoredActivity(activity)) return
stopPolling()
pickerPolling.value = false
pickerResult.value = activity
+23 -3
View File
@@ -44,15 +44,33 @@ async function refresh() {
snackbar('已刷新')
}
async function applyBrightness(value) {
let lastApplied = null
/** 拖动中节流:距上次应用超过 3% 才写一次节点,避免每个像素都 exec */
const DRAG_APPLY_STEP_PERCENT = 3
async function applyBrightness(value, { silent = false } = {}) {
try {
await status.setBrightness(value)
snackbar(`亮度已设为 ${value}`)
lastApplied = value
if (!silent) snackbar(`亮度已设为 ${value}`)
} catch (e) {
snackbar(`设置失败: ${e.message}`)
if (!silent) snackbar(`设置失败: ${e.message}`)
}
}
/** 拖动过程中(input 事件)按比例阈值应用 */
async function onSliderInput(event) {
const value = Number(event.target.value)
const max = maxBrightness.value || 255
if (lastApplied === null) {
lastApplied = currentBrightness.value
}
const step = (max * DRAG_APPLY_STEP_PERCENT) / 100
if (Math.abs(value - lastApplied) < step) return
await applyBrightness(value, { silent: true })
}
async function onSliderChange(event) {
const value = Number(event.target.value)
const pct = Math.round((value / maxBrightness.value) * 100)
@@ -62,6 +80,7 @@ async function onSliderChange(event) {
return
}
await applyBrightness(value)
lastApplied = value
}
function cancelLow() {
@@ -118,6 +137,7 @@ async function confirmLow() {
:max="maxBrightness"
:value="currentBrightness"
labeled
@input="onSliderInput"
@change="onSliderChange"
></md-slider>
</div>