mirror of
https://github.com/YuleBest/LuminPro.git
synced 2026-12-04 00:54:42 +08:00
Compare commits
9
Commits
No files matched your search
@@ -1,5 +1,5 @@
|
||||
=======================================
|
||||
LuminPro V2.3 — 日用屏幕亮度强化
|
||||
=======================================
|
||||
LuminPro — 日用屏幕亮度强化
|
||||
作者: 酷安@Yule
|
||||
=======================================
|
||||
|
||||
|
||||
@@ -1,5 +1,22 @@
|
||||
# 更新日志
|
||||
|
||||
## V2.5.0-beta.5
|
||||
|
||||
- 修复: 导航栏容器阴影在手势条区域露出一条边(关闭该阴影,与色块填充保持一致)
|
||||
|
||||
## V2.5.0-beta.4
|
||||
|
||||
- 修复: 手势导航条区域未适配(改为色块填充:底栏背景延伸到屏幕底部,与导航栏同色)
|
||||
- 修复: edge-to-edge 在部分 KernelSU 版本未生效(改为探测全局 ksu 对象并兼容 enableInsets 命名)
|
||||
|
||||
## 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`),补全颜色/字阶/形状/动效令牌,支持涟漪与状态层反馈
|
||||
|
||||
@@ -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
@@ -1,7 +1,7 @@
|
||||
id=LuminPro
|
||||
name=LuminPro丨日用屏幕亮度强化
|
||||
version=V2.5.0-beta.2
|
||||
versionCode=2050052
|
||||
version=V2.5.0-beta.5
|
||||
versionCode=2050055
|
||||
author=酷安@Yule
|
||||
description=本模块旨在让你的 Android 设备随时可以使用高亮度显示屏幕内容。无论设备当前亮度如何,只要满足设定的前台触发亮度条件,模块便会自动且平滑地提升屏幕亮度至硬件支持的峰值状态,确保你在强光室外也能获得清晰的显示效果
|
||||
updateJson=https://raw.githubusercontent.com/YuleBest/LuminPro/main/update.json
|
||||
+3
-3
@@ -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": 2050055,
|
||||
"version": "V2.5.0-beta.5",
|
||||
"zipUrl": "https://github.com/YuleBest/LuminPro/releases/download/v2.5.0-beta.5/LuminPro_V2.5.0-beta.5.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/YuleBest/LuminPro/beta/changelog.md"
|
||||
}
|
||||
+1
-1
@@ -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>
|
||||
|
||||
@@ -41,6 +41,25 @@ export function shellQuote(value) {
|
||||
return `'${String(value).replace(/'/g, "'\\''")}'`
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用 edge-to-edge:内容延伸至状态栏/手势条区域,insets.css 的
|
||||
* --window-inset-* / --safe-area-inset-* 随之生效。
|
||||
*
|
||||
* 注意:不能直接调用从 npm 包 import 的 enableEdgeToEdge——该绑定总是存在,
|
||||
* 不支持时是包内部调用 ksu 对象时抛错,会打断后续脚本(FontMM 踩过同样的坑)。
|
||||
* 这里改为探测全局 ksu 对象,并兼容 KernelSU-Next 的 enableInsets 命名。
|
||||
*/
|
||||
export function applyEdgeToEdge() {
|
||||
try {
|
||||
const ksuApi = globalThis.ksu
|
||||
if (!ksuApi) return
|
||||
const fn = ksuApi.enableEdgeToEdge ?? ksuApi.enableInsets
|
||||
if (typeof fn === 'function') fn.call(ksuApi, true)
|
||||
} catch {
|
||||
/* 老版本没有该 API:布局仍可用,只是安全区取 0 */
|
||||
}
|
||||
}
|
||||
|
||||
/** 读取模块版本(module.prop 的 version) */
|
||||
export function moduleVersion() {
|
||||
try {
|
||||
|
||||
@@ -16,16 +16,18 @@ const tabs = [
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<md-navigation-bar>
|
||||
<md-navigation-tab
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
:label="tab.label"
|
||||
:active="modelValue === tab.key"
|
||||
@click="emit('update:modelValue', tab.key)"
|
||||
>
|
||||
<component :is="tab.icon" slot="active-icon" :size="24" />
|
||||
<component :is="tab.icon" slot="inactive-icon" :size="24" />
|
||||
</md-navigation-tab>
|
||||
</md-navigation-bar>
|
||||
<nav class="bottom-nav">
|
||||
<md-navigation-bar>
|
||||
<md-navigation-tab
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
:label="tab.label"
|
||||
:active="modelValue === tab.key"
|
||||
@click="emit('update:modelValue', tab.key)"
|
||||
>
|
||||
<component :is="tab.icon" slot="active-icon" :size="24" />
|
||||
<component :is="tab.icon" slot="inactive-icon" :size="24" />
|
||||
</md-navigation-tab>
|
||||
</md-navigation-bar>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -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')
|
||||
+12
-3
@@ -138,11 +138,20 @@
|
||||
}
|
||||
|
||||
/* ── M3 导航栏 ────────────────────────────────────────────────────── */
|
||||
md-navigation-bar {
|
||||
/* 底栏容器:色块填充法——容器背景延伸至屏幕最底部,手势导航条区域
|
||||
与导航栏同色;内边距把导航内容抬到手势条之上。
|
||||
安全区变量在不同 KernelSU 版本命名不同,最后兜底 env()。 */
|
||||
.bottom-nav {
|
||||
flex: 0 0 auto;
|
||||
/* 背景延伸到屏幕底部,内容抬到手势条之上 */
|
||||
padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, 0px));
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
padding-bottom: var(--safe-area-inset-bottom, var(--window-inset-bottom, env(safe-area-inset-bottom, 0px)));
|
||||
}
|
||||
|
||||
md-navigation-bar {
|
||||
--md-navigation-bar-container-color: var(--md-sys-color-surface-container);
|
||||
/* 去掉容器阴影:手势条区域用同色填充,阴影会在底部露出一条边 */
|
||||
--md-navigation-bar-container-elevation: 0;
|
||||
box-shadow: none;
|
||||
--md-navigation-bar-active-indicator-color: var(--md-sys-color-secondary-container);
|
||||
--md-navigation-bar-active-icon-color: var(--md-sys-color-on-secondary-container);
|
||||
--md-navigation-bar-active-label-text-color: var(--md-sys-color-on-surface);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user