style: refine button icon appearance editor

This commit is contained in:
7015725
2026-05-12 20:32:08 +08:00
parent 53967f77d2
commit c4b886f83d
3 changed files with 41 additions and 13 deletions

View File

@@ -1115,17 +1115,29 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
iconRadioGroup.setPadding(0, self.dp(4), 0, self.dp(8)); iconRadioGroup.setPadding(0, self.dp(4), 0, self.dp(8));
var rbIconFile = new android.widget.RadioButton(context); var rbIconFile = new android.widget.RadioButton(context);
rbIconFile.setText("文件路径"); rbIconFile.setText("本地图片\nPNG/JPG 绝对路径");
rbIconFile.setTextColor(textColor); rbIconFile.setTextColor(textColor);
rbIconFile.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 12);
rbIconFile.setTag("file"); rbIconFile.setTag("file");
rbIconFile.setPadding(self.dp(10), self.dp(8), self.dp(10), self.dp(8));
try { rbIconFile.setButtonDrawable(null); } catch(eRbFileStyle0) { safeLog(null, 'e', "catch " + String(eRbFileStyle0)); }
var rbIconShortX = new android.widget.RadioButton(context); var rbIconShortX = new android.widget.RadioButton(context);
rbIconShortX.setText("ShortX图标"); rbIconShortX.setText("ShortX 内置\n可点选图标 + 调色");
rbIconShortX.setTextColor(textColor); rbIconShortX.setTextColor(textColor);
rbIconShortX.setTextSize(android.util.TypedValue.COMPLEX_UNIT_SP, 12);
rbIconShortX.setTag("shortx"); rbIconShortX.setTag("shortx");
rbIconShortX.setPadding(self.dp(10), self.dp(8), self.dp(10), self.dp(8));
try { rbIconShortX.setButtonDrawable(null); } catch(eRbShortStyle0) { safeLog(null, 'e', "catch " + String(eRbShortStyle0)); }
iconRadioGroup.addView(rbIconFile); var iconSourceOptionLp1 = new android.widget.RadioGroup.LayoutParams(0, android.widget.RadioGroup.LayoutParams.WRAP_CONTENT);
iconRadioGroup.addView(rbIconShortX); iconSourceOptionLp1.weight = 1;
iconSourceOptionLp1.rightMargin = self.dp(6);
var iconSourceOptionLp2 = new android.widget.RadioGroup.LayoutParams(0, android.widget.RadioGroup.LayoutParams.WRAP_CONTENT);
iconSourceOptionLp2.weight = 1;
iconSourceOptionLp2.leftMargin = self.dp(6);
iconRadioGroup.addView(rbIconFile, iconSourceOptionLp1);
iconRadioGroup.addView(rbIconShortX, iconSourceOptionLp2);
iconSelectWrap.addView(iconRadioGroup); iconSelectWrap.addView(iconRadioGroup);
iconSectionBody.addView(iconSelectWrap); iconSectionBody.addView(iconSelectWrap);
@@ -1323,8 +1335,8 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
shortxQuickRow.addView(shortxPreviewCard, shortxPreviewLp); shortxQuickRow.addView(shortxPreviewCard, shortxPreviewLp);
var shortxPreviewIv = new android.widget.ImageView(context); var shortxPreviewIv = new android.widget.ImageView(context);
var shortxPreviewIvLp = new android.widget.LinearLayout.LayoutParams(self.dp(20), self.dp(20)); var shortxPreviewIvLp = new android.widget.LinearLayout.LayoutParams(self.dp(34), self.dp(34));
shortxPreviewIvLp.rightMargin = self.dp(8); shortxPreviewIvLp.rightMargin = self.dp(10);
shortxPreviewIv.setLayoutParams(shortxPreviewIvLp); shortxPreviewIv.setLayoutParams(shortxPreviewIvLp);
shortxPreviewCard.addView(shortxPreviewIv); shortxPreviewCard.addView(shortxPreviewIv);
shortxPickerState.previewIv = shortxPreviewIv; shortxPickerState.previewIv = shortxPreviewIv;
@@ -1362,10 +1374,14 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
shortxBtnGap2.setLayoutParams(new android.widget.LinearLayout.LayoutParams(self.dp(8), 1)); shortxBtnGap2.setLayoutParams(new android.widget.LinearLayout.LayoutParams(self.dp(8), 1));
shortxQuickRow.addView(shortxBtnGap2); shortxQuickRow.addView(shortxBtnGap2);
var btnClearShortXIcon = self.ui.createFlatButton(self, "\u6e05\u7a7a", subTextColor, function() { function clearShortXIconOnly() {
self.touchActivity();
currentShortXIconName = ""; currentShortXIconName = "";
updateShortXIconPreview(); updateShortXIconPreview();
}
var btnClearShortXIcon = self.ui.createFlatButton(self, "\u6e05\u7a7a", subTextColor, function() {
self.touchActivity();
clearShortXIconOnly();
}); });
shortxPickerState.clearBtn = btnClearShortXIcon; shortxPickerState.clearBtn = btnClearShortXIcon;
shortxQuickRow.addView(btnClearShortXIcon); shortxQuickRow.addView(btnClearShortXIcon);
@@ -1625,7 +1641,7 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
// # ShortX 图标颜色(留空跟随主题) // # ShortX 图标颜色(留空跟随主题)
var defaultTint = targetBtn.iconTint ? String(targetBtn.iconTint) : ""; var defaultTint = targetBtn.iconTint ? String(targetBtn.iconTint) : "";
var currentShortXIconTint = defaultTint; var currentShortXIconTint = defaultTint;
var inputShortXIconTint = self.ui.createInputGroup(self, "图标颜色 (留空跟随主题)", defaultTint, false, "支持 #RRGGBB / #AARRGGBB下方可展开完整调色板"); var inputShortXIconTint = self.ui.createInputGroup(self, "图标颜色 (留空 = 跟随主题)", defaultTint, false, "支持 #RRGGBB / #AARRGGBB下方可展开完整调色板");
iconSectionBody.addView(inputShortXIconTint.view); iconSectionBody.addView(inputShortXIconTint.view);
// # 避免 Rhino 闭包问题:将输入框引用存储到 self.state供颜色选择器回调使用 // # 避免 Rhino 闭包问题:将输入框引用存储到 self.state供颜色选择器回调使用
self.state._btnEditorTintInput = inputShortXIconTint; self.state._btnEditorTintInput = inputShortXIconTint;
@@ -2216,8 +2232,20 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
} }
})); }));
} catch(eTintCommonLayout0) { safeLog(null, 'e', "catch " + String(eTintCommonLayout0)); } } catch(eTintCommonLayout0) { safeLog(null, 'e', "catch " + String(eTintCommonLayout0)); }
function setIconSourceCardSelected(type) {
try {
var fileSelected = (type === "file");
var shortxSelected = (type === "shortx");
rbIconFile.setTextColor(fileSelected ? C.primary : textColor);
rbIconShortX.setTextColor(shortxSelected ? C.primary : textColor);
rbIconFile.setBackground(self.ui.createStrokeDrawable(self.withAlpha(fileSelected ? C.primary : cardColor, fileSelected ? 0.16 : 0.80), fileSelected ? C.primary : dividerColor, self.dp(1), self.dp(12)));
rbIconShortX.setBackground(self.ui.createStrokeDrawable(self.withAlpha(shortxSelected ? C.primary : cardColor, shortxSelected ? 0.16 : 0.80), shortxSelected ? C.primary : dividerColor, self.dp(1), self.dp(12)));
} catch(eIconSourceStyle0) { safeLog(null, 'e', "catch " + String(eIconSourceStyle0)); }
}
// 图标类型切换函数 // 图标类型切换函数
function updateIconInputs(type) { function updateIconInputs(type) {
setIconSourceCardSelected(type);
if (type === "file") { if (type === "file") {
inputIconPath.view.setVisibility(android.view.View.VISIBLE); inputIconPath.view.setVisibility(android.view.View.VISIBLE);
shortxQuickRow.setVisibility(android.view.View.GONE); shortxQuickRow.setVisibility(android.view.View.GONE);

View File

@@ -54,8 +54,8 @@
"size": 20386 "size": 20386
}, },
"th_14_panels.js": { "th_14_panels.js": {
"sha256": "d4feca93a07646e39eb3c6be5067e02ecbc621af01a505252aaef68deed94770", "sha256": "1bb02639a6700605af1e98e63ea6fb55a46d46b85822e15178f5a861437e7661",
"size": 235051 "size": 237123
}, },
"th_15_extra.js": { "th_15_extra.js": {
"sha256": "b48c16ea5cbe5b9033d593eb18ef3028c0d661c65cbf2ad8f3f650ee55bbe2e4", "sha256": "b48c16ea5cbe5b9033d593eb18ef3028c0d661c65cbf2ad8f3f650ee55bbe2e4",
@@ -68,5 +68,5 @@
}, },
"keyId": "toolhub-targets-2026-rsa3072", "keyId": "toolhub-targets-2026-rsa3072",
"schema": 2, "schema": 2,
"version": 20260512121643 "version": 20260512123028
} }

View File

@@ -1 +1 @@
T7fLDXlMfshFhc7sDZ+9KvkgYpaH1gcTZvSbuKCD3JI43+8qAP9ecprlEajPfvLg59LzEZrZSGo7wG8z8JTSJ2zAKXhAWfmA73W9dohCvdcTcdGLQcQurCOXMYC8qIvB6b1UcUryeQ/2k+5loGOkP77jbOU/qe3/STfz7Al081idVKwSmRmcyqYRszgG2Xy88y3WMgAS1As+tP/sJ4NlOEYjAG/GJr6PmFHMk9t5tqbcUQyWoYhU1rbvbzaPsKCYXycctxvqayidWXMYlpp2+1J/0QRDOSKd/ha2VJfrty+I+e4Sy4mQUYdrTLnjzTyhg5ZGQANqCEvW9RguATwPNxAZfZZwyZiNUfJEJtYjC9nGDAmVIVDCuv8kH0bIPwjsbtn7LBvFR0WE6HVw29jpYpriAy0jQPoYypZDlWsq49X0W6Np4dufXawgSlOvMzrSBk8yr9dgcgsH7QCvp8Yf/oz47JY+9sUqSsRZCrRDld5oLRlD9ZznJkld6wxjJ2dk gwwFWHnXNU/QJ+BfqHacNXHFLowDLZ4izcO8S+z4+q25HkClwIazJNMr9LbkXPSszY/1pO82MiIjTVw+ubzHrD1caoml0AoOTUJBRKNVMxqlXqepdodfmmvcg3g3BxC8WmtCONKjnvdX1EI6faYRbkA61gtsy8qQNUDPAR0pre8OqPBvgYc8eo4ZFyR+E+kDE8na5Vl+fsMG2anPUvEUi3ivSUlijTaYWxo4ZLUfIs3oEZxy0b/6leFX+8QhbvtkJcwkq3Jfrycl0Lu8ENTToGheWZqBjLV1TcihR3uOSMJqMoIdTWg01iCK0XOsyZva7Fpa/yQQU4DZYVOrLpBA6nWdmutAwOQ+/JcswCVlmdgogoUu7EmY1v8b/WKVvwaRNXc9LdKMkoveW7sJr3HtArb9qiNqyxoZr/88+/e93F408s3XkB9o43BhrMBMXi7lUp58DCODtBMnyb6eq/5Iu+xYw4xdRVXGDDCudVMtNFp2yc0x1EuG/6l3Ten7EMgv