style: soften balloon settings page
This commit is contained in:
@@ -778,17 +778,17 @@ var ConfigManager = {
|
||||
{ key: "PANEL_BG_ALPHA", name: "面板背景透明度(0.1~1.0)", type: "float", min: 0.1, max: 1.0, step: 0.05 },
|
||||
|
||||
{ type: "section", name: "悬浮球" },
|
||||
{ key: "BALL_SIZE_DP", name: "悬浮球大小(dp)", type: "int", min: 28, max: 120, step: 1 },
|
||||
{ key: "BALL_PANEL_GAP_DP", name: "球与面板间距(dp)", type: "int", min: 0, max: 60, step: 1 },
|
||||
{ key: "BALL_ICON_TYPE", name: "图标类型", type: "single_choice", options: [
|
||||
{ label: "应用图标 (app)", value: "app" },
|
||||
{ label: "文件图标 (file)", value: "file" },
|
||||
{ label: "ShortX内置 (shortx)", value: "shortx" }
|
||||
{ key: "BALL_SIZE_DP", name: "气球大小", type: "int", min: 28, max: 120, step: 1 },
|
||||
{ key: "BALL_PANEL_GAP_DP", name: "离小屋的距离", type: "int", min: 0, max: 60, step: 1 },
|
||||
{ key: "BALL_ICON_TYPE", name: "气球徽章", type: "single_choice", options: [
|
||||
{ label: "应用头像", value: "app" },
|
||||
{ label: "从文件选择", value: "file" },
|
||||
{ label: "岛上图标库", value: "shortx" }
|
||||
]},
|
||||
{ key: "BALL_ICON_FILE_PATH", name: "图标路径(file模式)", type: "text" },
|
||||
{ key: "BALL_ICON_RES_NAME", name: "ShortX图标", type: "ball_shortx_icon" },
|
||||
{ key: "BALL_ICON_TINT_HEX", name: "图标颜色", type: "ball_color" },
|
||||
{ key: "BALL_IDLE_ALPHA", name: "闲置不透明度(0.1~1.0)", type: "float", min: 0.1, max: 1.0, step: 0.05 },
|
||||
{ key: "BALL_ICON_FILE_PATH", name: "已选择的图标文件", type: "text" },
|
||||
{ key: "BALL_ICON_RES_NAME", name: "岛上图标", type: "ball_shortx_icon" },
|
||||
{ key: "BALL_ICON_TINT_HEX", name: "气球颜色", type: "ball_color" },
|
||||
{ key: "BALL_IDLE_ALPHA", name: "安静时透明度", type: "float", min: 0.1, max: 1.0, step: 0.05 },
|
||||
|
||||
{ type: "section", name: "面板布局" },
|
||||
{ key: "PANEL_ROWS", name: "面板可视行数(超出滚动)", type: "int", min: 1, max: 12, step: 1 },
|
||||
|
||||
@@ -407,7 +407,7 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi
|
||||
}
|
||||
refreshBallShortXPreview();
|
||||
|
||||
var btnPick = self.ui.createFlatButton(self, "选择图标", primary, function() {
|
||||
var btnPick = self.ui.createFlatButton(self, "换一个", primary, function() {
|
||||
self.touchActivity();
|
||||
self.showShortXIconPickerPopup({
|
||||
currentName: String(self.getPendingValue(item.key) || ""),
|
||||
@@ -430,7 +430,7 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi
|
||||
gapView.setLayoutParams(new android.widget.LinearLayout.LayoutParams(self.dp(8), 1));
|
||||
iconRow.addView(gapView);
|
||||
|
||||
var btnClear = self.ui.createFlatButton(self, "清空", secColor, function() {
|
||||
var btnClear = self.ui.createFlatButton(self, "不用图标", secColor, function() {
|
||||
self.touchActivity();
|
||||
try {
|
||||
self.setPendingValue(item.key, "");
|
||||
@@ -484,7 +484,7 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi
|
||||
}
|
||||
refreshBallColorPreview();
|
||||
|
||||
var btnColor = self.ui.createFlatButton(self, "选择颜色", primary, function() {
|
||||
var btnColor = self.ui.createFlatButton(self, "换颜色", primary, function() {
|
||||
self.touchActivity();
|
||||
self.showColorPickerPopup({
|
||||
currentColor: String(self.getPendingValue(item.key) || ""),
|
||||
@@ -505,7 +505,7 @@ FloatBallAppWM.prototype.createSettingItemView = function(item, parent, needDivi
|
||||
gapColorView.setLayoutParams(new android.widget.LinearLayout.LayoutParams(self.dp(8), 1));
|
||||
colorRow.addView(gapColorView);
|
||||
|
||||
var btnClearColor = self.ui.createFlatButton(self, "清空", secColor, function() {
|
||||
var btnClearColor = self.ui.createFlatButton(self, "恢复默认", secColor, function() {
|
||||
self.touchActivity();
|
||||
try {
|
||||
self.setPendingValue(item.key, "");
|
||||
|
||||
@@ -254,35 +254,15 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() {
|
||||
|
||||
var isDark = this.isDarkTheme();
|
||||
var C = this.ui.colors;
|
||||
var bgColor = isDark ? C.bgDark : C.bgLight;
|
||||
var cardColor = isDark ? C.cardDark : C.cardLight;
|
||||
var textColor = isDark ? C.textPriDark : C.textPriLight;
|
||||
var T = this.getAnimalIslandTheme();
|
||||
var bgColor = T.bg;
|
||||
var cardColor = T.card;
|
||||
var textColor = T.text;
|
||||
|
||||
var panel = this.ui.createStyledPanel(this, 16);
|
||||
try { panel.setBackground(this.ui.createRoundDrawable(T.bg, this.dp(18))); } catch(ePanelBg) {}
|
||||
var header = this.ui.createStyledHeader(this, 8);
|
||||
|
||||
// 内存显示
|
||||
var memTv = new android.widget.TextView(context);
|
||||
memTv.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 10);
|
||||
memTv.setTextColor(isDark ? C.textSecDark : C.textSecLight);
|
||||
memTv.setPadding(0, 0, this.dp(8), 0);
|
||||
|
||||
function updateMem() {
|
||||
try {
|
||||
var rt = java.lang.Runtime.getRuntime();
|
||||
var total = rt.totalMemory() / 1024 / 1024;
|
||||
var free = rt.freeMemory() / 1024 / 1024;
|
||||
var used = total - free;
|
||||
var max = rt.maxMemory() / 1024 / 1024;
|
||||
memTv.setText("Mem: " + used.toFixed(0) + "/" + max.toFixed(0) + "M");
|
||||
} catch(e) { memTv.setText("Mem: ?"); }
|
||||
}
|
||||
updateMem();
|
||||
memTv.setOnClickListener(new android.view.View.OnClickListener({
|
||||
onClick: function() { updateMem(); self.toast("内存已刷新"); }
|
||||
}));
|
||||
header.addView(memTv);
|
||||
|
||||
// 占位 View 顶替标题位置,让右侧按钮靠右
|
||||
header.addView(this.ui.createSpacer(this));
|
||||
|
||||
@@ -295,11 +275,11 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() {
|
||||
previewBox.setOrientation(android.widget.LinearLayout.HORIZONTAL);
|
||||
previewBox.setGravity(android.view.Gravity.CENTER_VERTICAL);
|
||||
previewBox.setPadding(this.dp(8), this.dp(2), this.dp(4), this.dp(2));
|
||||
previewBox.setBackground(self.ui.createRoundDrawable(self.withAlpha(C.accent, 0.1), self.dp(16))); // 浅色背景提示
|
||||
previewBox.setBackground(self.ui.createRoundDrawable(self.withAlpha(T.primarySoft, isDark ? 0.70 : 0.95), self.dp(16))); // 浅色背景提示
|
||||
|
||||
var tvPreview = new android.widget.TextView(context);
|
||||
tvPreview.setText("实时预览");
|
||||
tvPreview.setTextColor(C.accent);
|
||||
tvPreview.setText("边调边看");
|
||||
tvPreview.setTextColor(T.primaryDeep);
|
||||
tvPreview.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 12);
|
||||
tvPreview.setTypeface(null, android.graphics.Typeface.BOLD);
|
||||
tvPreview.setPadding(0, 0, this.dp(4), 0);
|
||||
@@ -309,8 +289,8 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() {
|
||||
try { switchPreview.setTextOn(""); switchPreview.setTextOff(""); } catch(eT) { safeLog(null, 'e', "catch " + String(eT)); }
|
||||
try {
|
||||
var states = [[android.R.attr.state_checked], [-android.R.attr.state_checked]];
|
||||
var thumbColors = [C.accent, isDark ? (0xFF555555 | 0) : (0xFFCCCCCC | 0)];
|
||||
var trackColors = [self.withAlpha(C.accent, 0.5), self.withAlpha(isDark ? (0xFF555555 | 0) : (0xFFCCCCCC | 0), 0.5)];
|
||||
var thumbColors = [T.primary, isDark ? T.card2 : (0xFFCCCCCC | 0)];
|
||||
var trackColors = [self.withAlpha(T.primary, 0.5), self.withAlpha(isDark ? T.card2 : (0xFFCCCCCC | 0), 0.5)];
|
||||
switchPreview.setThumbTintList(new android.content.res.ColorStateList(states, thumbColors));
|
||||
switchPreview.setTrackTintList(new android.content.res.ColorStateList(states, trackColors));
|
||||
} catch(e) { safeLog(null, 'e', "catch " + String(e)); }
|
||||
@@ -321,9 +301,9 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() {
|
||||
self.touchActivity();
|
||||
self.state.previewMode = !!checked;
|
||||
if (checked) {
|
||||
self.toast("预览模式已开启:修改配置实时生效");
|
||||
tvPreview.setTextColor(C.accent);
|
||||
previewBox.setBackground(self.ui.createRoundDrawable(self.withAlpha(C.accent, 0.1), self.dp(16)));
|
||||
self.toast("边调边看已开启");
|
||||
tvPreview.setTextColor(T.primaryDeep);
|
||||
previewBox.setBackground(self.ui.createRoundDrawable(self.withAlpha(T.primarySoft, isDark ? 0.70 : 0.95), self.dp(16)));
|
||||
self.refreshPreview();
|
||||
} else {
|
||||
self.toast("预览模式已关闭");
|
||||
@@ -339,7 +319,7 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() {
|
||||
header.addView(previewBox);
|
||||
|
||||
// [恢复] 保存按钮(放在最后一位)
|
||||
var btnOk = this.ui.createSolidButton(this, "保存", C.primary, android.graphics.Color.WHITE, function() {
|
||||
var btnOk = this.ui.createSolidButton(this, "保存装扮", T.primary, T.onPrimary, function() {
|
||||
try {
|
||||
self.touchActivity();
|
||||
if (self.L) self.L.i("settings confirm click");
|
||||
@@ -387,7 +367,7 @@ FloatBallAppWM.prototype.buildSettingsGroupPanelView = function() {
|
||||
function createCard() {
|
||||
var c = new android.widget.LinearLayout(context);
|
||||
c.setOrientation(android.widget.LinearLayout.VERTICAL);
|
||||
c.setBackground(self.ui.createRoundDrawable(cardColor, self.dp(12)));
|
||||
c.setBackground(self.ui.createStrokeDrawable(cardColor, self.withAlpha(T.stroke, isDark ? 0.28 : 0.46), self.dp(1), self.dp(16)));
|
||||
try { c.setElevation(self.dp(2)); } catch(e) { safeLog(null, 'e', "catch " + String(e)); }
|
||||
try { c.setClipToOutline(true); } catch(e) { safeLog(null, 'e', "catch " + String(e)); }
|
||||
var lp = new android.widget.LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams.MATCH_PARENT, android.widget.LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
Reference in New Issue
Block a user