@@ -37,15 +37,16 @@ FloatBallAppWM.prototype.createSettingsHomeEntry = function(parent, title, desc,
var self = this ;
var self = this ;
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var cardColor = isDark ? C . cardDark : android . graphics . Color . WHITE ;
var T = this . getAnimalIslandTheme ( ) ;
var text Color = isDark ? C . textPriDark : C . textPriLight ;
var card Color = T . card ;
var subT extColor = isDark ? C . textSecDark : C . textSecLigh t;
var t extColor = T . tex t;
var subTextColor = T . sub ;
var row = new android . widget . LinearLayout ( context ) ;
var row = new android . widget . LinearLayout ( context ) ;
row . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
row . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
row . setGravity ( android . view . Gravity . CENTER _VERTICAL ) ;
row . setGravity ( android . view . Gravity . CENTER _VERTICAL ) ;
row . setPadding ( this . dp ( 16 ) , this . dp ( 14 ) , this . dp ( 14 ) , this . dp ( 14 ) ) ;
row . setPadding ( this . dp ( 16 ) , this . dp ( 14 ) , this . dp ( 14 ) , this . dp ( 14 ) ) ;
row . setBackground ( this . ui . createRippleDrawable ( cardColor , isDark ? this . withAlpha ( C . primary , 0.16 ) : this . withAlpha ( C . primary , 0.10 ) , this . dp ( 18 ) ) ) ;
row . setBackground ( this . ui . createRippleDrawable ( cardColor , this . withAlpha ( T . primary , isDark ? 0.20 : 0.14 ) , this . dp ( 20 ) ) ) ;
try { row . setElevation ( this . dp ( 3 ) ) ; } catch ( eElev ) { safeLog ( null , 'e' , "catch " + String ( eElev ) ) ; }
try { row . setElevation ( this . dp ( 4 ) ) ; } catch ( eElev ) { safeLog ( null , 'e' , "catch " + String ( eElev ) ) ; }
var badge = new android . widget . TextView ( context ) ;
var badge = new android . widget . TextView ( context ) ;
var icon = "⚙" ;
var icon = "⚙" ;
@@ -57,11 +58,11 @@ FloatBallAppWM.prototype.createSettingsHomeEntry = function(parent, title, desc,
else if ( String ( title ) . indexOf ( "动画" ) >= 0 ) icon = "↝" ;
else if ( String ( title ) . indexOf ( "动画" ) >= 0 ) icon = "↝" ;
else if ( String ( title ) . indexOf ( "日志" ) >= 0 ) icon = "⌁" ;
else if ( String ( title ) . indexOf ( "日志" ) >= 0 ) icon = "⌁" ;
badge . setText ( icon ) ;
badge . setText ( icon ) ;
badge . setTextColor ( C . primary ) ;
badge . setTextColor ( T . primaryDeep ) ;
badge . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 19 ) ;
badge . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 19 ) ;
badge . setGravity ( android . view . Gravity . CENTER ) ;
badge . setGravity ( android . view . Gravity . CENTER ) ;
badge . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
badge . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
badge . setBackground ( this . ui . createRound Drawable ( this . withAlpha ( C . primary , isDark ? 0.18 : 0.1 2 ) , this . dp ( 15 ) ) ) ;
badge . setBackground ( this . ui . createStroke Drawable ( T . primarySoft , this . withAlpha ( T . primaryDeep , isDark ? 0.36 : 0.28 ) , this . dp ( 1) , this . dp ( 16 ) ) ) ;
var badgeLp = new android . widget . LinearLayout . LayoutParams ( this . dp ( 46 ) , this . dp ( 46 ) ) ;
var badgeLp = new android . widget . LinearLayout . LayoutParams ( this . dp ( 46 ) , this . dp ( 46 ) ) ;
badgeLp . setMargins ( 0 , 0 , this . dp ( 14 ) , 0 ) ;
badgeLp . setMargins ( 0 , 0 , this . dp ( 14 ) , 0 ) ;
row . addView ( b adge , badgeLp ) ;
row . addView ( b adge , badgeLp ) ;
@@ -87,12 +88,12 @@ FloatBallAppWM.prototype.createSettingsHomeEntry = function(parent, title, desc,
var tvGo = new android . widget . TextView ( context ) ;
var tvGo = new android . widget . TextView ( context ) ;
tvGo . setText ( String ( actionText || "进入" ) + " › " ) ;
tvGo . setText ( String ( actionText || "进入" ) + " › " ) ;
tvGo . setTextColor ( C . p rimary) ;
tvGo . setTextColor ( T . onP rimary) ;
tvGo . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 13 ) ;
tvGo . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 13 ) ;
tvGo . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
tvGo . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
tvGo . setGravity ( android . view . Gravity . CENTER ) ;
tvGo . setGravity ( android . view . Gravity . CENTER ) ;
tvGo . setPadding ( this . dp ( 10 ) , this . dp ( 5 ) , this . dp ( 10 ) , this . dp ( 5 ) ) ;
tvGo . setPadding ( this . dp ( 10 ) , this . dp ( 5 ) , this . dp ( 10 ) , this . dp ( 5 ) ) ;
tvGo . setBackground ( this . ui . createRound Drawable ( this . withAlpha ( C . primary , isDark ? 0.16 : 0.10 ) , this . dp ( 14 ) ) ) ;
tvGo . setBackground ( this . ui . createRipple Drawable ( T . primary , T . primaryDeep , this . dp ( 15 ) ) ) ;
row . addView ( tvGo ) ;
row . addView ( tvGo ) ;
row . setOnClickListener ( new android . view . View . OnClickListener ( { onClick : function ( v ) {
row . setOnClickListener ( new android . view . View . OnClickListener ( { onClick : function ( v ) {
try { self . touchActivity ( ) ; } catch ( eT ) { }
try { self . touchActivity ( ) ; } catch ( eT ) { }
@@ -108,9 +109,11 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() {
var self = this ;
var self = this ;
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var bgColor = isDark ? C . bgDark : C . bgLight ;
var T = this . getAnimalIslandTheme ( ) ;
var subText Color = isDark ? C . textSecDark : C . textSecLight ;
var bg Color = T . bg ;
var subTextColor = T . sub ;
var panel = this . ui . createStyledPanel ( this , 16 ) ;
var panel = this . ui . createStyledPanel ( this , 16 ) ;
try { panel . setBackground ( this . ui . createRoundDrawable ( T . bg , this . dp ( 18 ) ) ) ; } catch ( ePanelBg ) { }
var quick = new android . widget . LinearLayout ( context ) ;
var quick = new android . widget . LinearLayout ( context ) ;
quick . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
quick . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
@@ -135,7 +138,7 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() {
quick . addView ( memTv ) ;
quick . addView ( memTv ) ;
quick . addView ( this . ui . createSpacer ( this ) ) ;
quick . addView ( this . ui . createSpacer ( this ) ) ;
var btnDoc = this . ui . createFlatButton ( this , "文档" , C . primary , function ( ) {
var btnDoc = this . ui . createFlatButton ( this , "文档" , T . brown , function ( ) {
try {
try {
var intent = new android . content . Intent ( android . content . Intent . ACTION _VIEW ) ;
var intent = new android . content . Intent ( android . content . Intent . ACTION _VIEW ) ;
intent . setData ( android . net . Uri . parse ( "https://xin-blog.com/114.html" ) ) ;
intent . setData ( android . net . Uri . parse ( "https://xin-blog.com/114.html" ) ) ;
@@ -145,7 +148,7 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() {
} ) ;
} ) ;
quick . addView ( btnDoc ) ;
quick . addView ( btnDoc ) ;
var btnSave = this . ui . createSolidButton ( this , "保存" , C . primary , android . graphics . Color . WHITE , function ( ) {
var btnSave = this . ui . createSolidButton ( this , "保存" , T . primary , T . onPrimary , function ( ) {
try {
try {
self . touchActivity ( ) ;
self . touchActivity ( ) ;
var r = self . commitPendingUserCfg ( ) ;
var r = self . commitPendingUserCfg ( ) ;
@@ -179,17 +182,17 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() {
titleCard . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
titleCard . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
titleCard . setGravity ( android . view . Gravity . CENTER ) ;
titleCard . setGravity ( android . view . Gravity . CENTER ) ;
titleCard . setPadding ( this . dp ( 12 ) , 0 , this . dp ( 12 ) , 0 ) ;
titleCard . setPadding ( this . dp ( 12 ) , 0 , this . dp ( 12 ) , 0 ) ;
titleCard . setBackground ( this . ui . createRound Drawable ( isDark ? this . withAlpha ( C . primary , 0.20 ) : this . withAlpha ( C . primary , 0.14 ) , this . dp ( 18 ) ) ) ;
titleCard . setBackground ( this . ui . createStroke Drawable ( T . card , this . withAlpha ( T . stroke , isDark ? 0.34 : 0.55 ) , this . dp ( 1 ) , this . dp ( 20 ) ) ) ;
var titleMain = new android . widget . TextView ( context ) ;
var titleMain = new android . widget . TextView ( context ) ;
titleMain . setText ( "ToolHub" ) ;
titleMain . setText ( "ToolHub 岛屿 " ) ;
titleMain . setTextColor ( isDark ? C . textPriDark : C . textPriLigh t) ;
titleMain . setTextColor ( T . tex t) ;
titleMain . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 22 ) ;
titleMain . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 22 ) ;
titleMain . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
titleMain . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
titleMain . setGravity ( android . view . Gravity . CENTER ) ;
titleMain . setGravity ( android . view . Gravity . CENTER ) ;
titleCard . addView ( titleMain , new android . widget . LinearLayout . LayoutParams ( - 1 , - 2 ) ) ;
titleCard . addView ( titleMain , new android . widget . LinearLayout . LayoutParams ( - 1 , - 2 ) ) ;
var titleSub = new android . widget . TextView ( context ) ;
var titleSub = new android . widget . TextView ( context ) ;
titleSub . setText ( "悬浮球 控制中心" ) ;
titleSub . setText ( "温暖风格 控制中心" ) ;
titleSub . setTextColor ( subTextColor ) ;
titleSub . setTextColor ( T . sub ) ;
titleSub . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
titleSub . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
titleSub . setGravity ( android . view . Gravity . CENTER ) ;
titleSub . setGravity ( android . view . Gravity . CENTER ) ;
titleCard . addView ( titleSub , new android . widget . LinearLayout . LayoutParams ( - 1 , - 2 ) ) ;
titleCard . addView ( titleSub , new android . widget . LinearLayout . LayoutParams ( - 1 , - 2 ) ) ;
@@ -201,16 +204,16 @@ FloatBallAppWM.prototype.buildSettingsHomePanelView = function() {
statCard . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
statCard . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
statCard . setGravity ( android . view . Gravity . CENTER ) ;
statCard . setGravity ( android . view . Gravity . CENTER ) ;
statCard . setPadding ( this . dp ( 10 ) , 0 , this . dp ( 10 ) , 0 ) ;
statCard . setPadding ( this . dp ( 10 ) , 0 , this . dp ( 10 ) , 0 ) ;
statCard . setBackground ( this . ui . createRound Drawable ( isDark ? C . cardDark : android . grap hic s. Color . WHITE , this . dp ( 18 ) ) ) ;
statCard . setBackground ( this . ui . createStroke Drawable ( T . primarySoft , this . withAlpha ( T . primaryDeep , isDark ? 0.34 : 0.24 ) , t his. dp ( 1 ) , this . dp ( 20 ) ) ) ;
var statLabel = new android . widget . TextView ( context ) ;
var statLabel = new android . widget . TextView ( context ) ;
statLabel . setText ( "按钮启用" ) ;
statLabel . setText ( "按钮启用" ) ;
statLabel . setTextColor ( subTextColor ) ;
statLabel . setTextColor ( T . sub ) ;
statLabel . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
statLabel . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
statLabel . setGravity ( android . view . Gravity . CENTER ) ;
statLabel . setGravity ( android . view . Gravity . CENTER ) ;
statCard . addView ( statLabel , new android . widget . LinearLayout . LayoutParams ( - 1 , - 2 ) ) ;
statCard . addView ( statLabel , new android . widget . LinearLayout . LayoutParams ( - 1 , - 2 ) ) ;
var statVal = new android . widget . TextView ( context ) ;
var statVal = new android . widget . TextView ( context ) ;
statVal . setText ( String ( enabledButtons ) + " / " + String ( totalButtons ) ) ;
statVal . setText ( String ( enabledButtons ) + " / " + String ( totalButtons ) ) ;
statVal . setTextColor ( isDark ? C . textPriDark : C . textPriLigh t) ;
statVal . setTextColor ( T . tex t) ;
statVal . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 25 ) ;
statVal . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 25 ) ;
statVal . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
statVal . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
statVal . setGravity ( android . view . Gravity . CENTER ) ;
statVal . setGravity ( android . view . Gravity . CENTER ) ;
@@ -589,22 +592,23 @@ FloatBallAppWM.prototype.matchesButtonManagerQuery = function(btnCfg, query) {
FloatBallAppWM . prototype . createButtonManagerSummaryCard = function ( parent , totalCount , enabledCount , disabledCount ) {
FloatBallAppWM . prototype . createButtonManagerSummaryCard = function ( parent , totalCount , enabledCount , disabledCount ) {
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var T = this . getAnimalIslandTheme ( ) ;
var card = new android . widget . LinearLayout ( context ) ;
var card = new android . widget . LinearLayout ( context ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setPadding ( this . dp ( 14 ) , this . dp ( 10 ) , this . dp ( 14 ) , this . dp ( 10 ) ) ;
card . setPadding ( this . dp ( 14 ) , this . dp ( 10 ) , this . dp ( 14 ) , this . dp ( 10 ) ) ;
card . setBackground ( this . ui . createRound Drawable ( isDark ? this . withAlpha ( C . card Dark, 0.88 ) : this . withAlpha ( C . cardLight , 0.92 ) , this . dp ( 14 ) ) ) ;
card . setBackground ( this . ui . createStroke Drawable ( T . card , this . withAlpha ( T . stroke , is Dark ? 0.34 : 0.50 ) , this . dp ( 1 ) , this . dp ( 18 ) ) ) ;
try { card . setElevation ( this . dp ( 2 ) ) ; } catch ( eElev ) { safeLog ( null , 'e' , "catch " + String ( eElev ) ) ; }
try { card . setElevation ( this . dp ( 3 ) ) ; } catch ( eElev ) { safeLog ( null , 'e' , "catch " + String ( eElev ) ) ; }
var title = new android . widget . TextView ( context ) ;
var title = new android . widget . TextView ( context ) ;
title . setText ( "按钮统计" ) ;
title . setText ( "按钮统计" ) ;
title . setTextColor ( isDark ? C . textPriDark : C . textPriLigh t) ;
title . setTextColor ( T . tex t) ;
title . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 15 ) ;
title . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 15 ) ;
title . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
title . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
card . addView ( title ) ;
card . addView ( title ) ;
var sub = new android . widget . TextView ( context ) ;
var sub = new android . widget . TextView ( context ) ;
sub . setText ( "共 " + totalCount + " 个 · 已启用 " + enabledCount + " · 已禁用 " + disabledCount ) ;
sub . setText ( "共 " + totalCount + " 个 · 已启用 " + enabledCount + " · 已禁用 " + disabledCount ) ;
sub . setTextColor ( isDark ? C . textSecDark : C . textSecLight ) ;
sub . setTextColor ( T . sub ) ;
sub . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
sub . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
sub . setPadding ( 0 , this . dp ( 4 ) , 0 , 0 ) ;
sub . setPadding ( 0 , this . dp ( 4 ) , 0 , 0 ) ;
card . addView ( sub ) ;
card . addView ( sub ) ;
@@ -615,6 +619,7 @@ FloatBallAppWM.prototype.createButtonManagerSummaryCard = function(parent, total
} ;
} ;
FloatBallAppWM . prototype . createButtonManagerActionChip = function ( text , textColor , strokeColor , onClickFn ) {
FloatBallAppWM . prototype . createButtonManagerActionChip = function ( text , textColor , strokeColor , onClickFn ) {
var T = this . getAnimalIslandTheme ( ) ;
var tv = new android . widget . TextView ( context ) ;
var tv = new android . widget . TextView ( context ) ;
tv . setText ( String ( text || "" ) ) ;
tv . setText ( String ( text || "" ) ) ;
tv . setGravity ( android . view . Gravity . CENTER ) ;
tv . setGravity ( android . view . Gravity . CENTER ) ;
@@ -625,10 +630,11 @@ FloatBallAppWM.prototype.createButtonManagerActionChip = function(text, textColo
tv . setPadding ( this . dp ( 10 ) , 0 , this . dp ( 10 ) , 0 ) ;
tv . setPadding ( this . dp ( 10 ) , 0 , this . dp ( 10 ) , 0 ) ;
try {
try {
var bg = new android . graphics . drawable . GradientDrawable ( ) ;
var bg = new android . graphics . drawable . GradientDrawable ( ) ;
bg . setColor ( android . grap hic s. Color . TRANSPARENT ) ;
bg . setColor ( this . withAlpha ( T . primarySoft , t his. isDarkTheme ( ) ? 0.62 : 0.95 ) ) ;
bg . setCornerRadius ( this . dp ( 12 ) ) ;
bg . setCornerRadius ( this . dp ( 14 ) ) ;
bg . setStroke ( this . dp ( 1 ) , strokeColor ) ;
bg . setStroke ( this . dp ( 1 ) , strokeColor || this . withAlpha ( T . primaryDeep , 0.32 ) ) ;
tv . setBackground ( bg ) ;
tv . setBackground ( bg ) ;
try { tv . setElevation ( this . dp ( 1 ) ) ; } catch ( eElev ) { }
} catch ( eBg ) { safeLog ( null , 'e' , "catch " + String ( eBg ) ) ; }
} catch ( eBg ) { safeLog ( null , 'e' , "catch " + String ( eBg ) ) ; }
if ( onClickFn ) {
if ( onClickFn ) {
tv . setOnClickListener ( new android . view . View . OnClickListener ( { onClick : function ( ) {
tv . setOnClickListener ( new android . view . View . OnClickListener ( { onClick : function ( ) {
@@ -658,25 +664,26 @@ FloatBallAppWM.prototype.createButtonManagerTextAction = function(text, textColo
FloatBallAppWM . prototype . createButtonManagerPolishedCard = function ( parent , title , subtitle , statText ) {
FloatBallAppWM . prototype . createButtonManagerPolishedCard = function ( parent , title , subtitle , statText ) {
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var T = this . getAnimalIslandTheme ( ) ;
var card = new android . widget . LinearLayout ( context ) ;
var card = new android . widget . LinearLayout ( context ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setPadding ( this . dp ( 14 ) , this . dp ( 12 ) , this . dp ( 14 ) , this . dp ( 12 ) ) ;
card . setPadding ( this . dp ( 14 ) , this . dp ( 12 ) , this . dp ( 14 ) , this . dp ( 12 ) ) ;
card . setBackground ( this . ui . createRound Drawable ( isDark ? this . withAlpha ( C . card Dark, 0.74 ) : this . withAlpha ( C . cardLight , 0.78 ) , this . dp ( 18 ) ) ) ;
card . setBackground ( this . ui . createStroke Drawable ( T . card , this . withAlpha ( T . stroke , is Dark ? 0.32 : 0.48 ) , this . dp ( 1 ) , this . dp ( 20 ) ) ) ;
try { card . setElevation ( this . dp ( 2 ) ) ; } catch ( eElev ) { }
try { card . setElevation ( this . dp ( 3 ) ) ; } catch ( eElev ) { }
var tv = new android . widget . TextView ( context ) ;
var tv = new android . widget . TextView ( context ) ;
tv . setText ( String ( title || "" ) ) ;
tv . setText ( String ( title || "" ) ) ;
tv . setTextColor ( isDark ? C . textPriDark : C . textPriLigh t) ;
tv . setTextColor ( T . tex t) ;
tv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 15 ) ;
tv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 15 ) ;
tv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
tv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
card . addView ( tv ) ;
card . addView ( tv ) ;
var sub = new android . widget . TextView ( context ) ;
var sub = new android . widget . TextView ( context ) ;
sub . setText ( String ( subtitle || "" ) ) ;
sub . setText ( String ( subtitle || "" ) ) ;
sub . setTextColor ( isDark ? C . textSecDark : C . textSecLight ) ;
sub . setTextColor ( T . sub ) ;
sub . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
sub . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
sub . setPadding ( 0 , this . dp ( 4 ) , 0 , 0 ) ;
sub . setPadding ( 0 , this . dp ( 4 ) , 0 , 0 ) ;
card . addView ( sub ) ;
card . addView ( sub ) ;
if ( statText ) {
if ( statText ) {
var chip = this . createButtonManagerActionChip ( String ( statText ) , C . primary , this . withAlpha ( C . primary , 0.32 ) , null ) ;
var chip = this . createButtonManagerActionChip ( String ( statText ) , T . primaryDeep , this . withAlpha ( T . primaryDeep , 0.32 ) , null ) ;
var chipLp = new android . widget . LinearLayout . LayoutParams ( android . widget . LinearLayout . LayoutParams . WRAP _CONTENT , android . widget . LinearLayout . LayoutParams . WRAP _CONTENT ) ;
var chipLp = new android . widget . LinearLayout . LayoutParams ( android . widget . LinearLayout . LayoutParams . WRAP _CONTENT , android . widget . LinearLayout . LayoutParams . WRAP _CONTENT ) ;
chipLp . setMargins ( 0 , this . dp ( 10 ) , 0 , 0 ) ;
chipLp . setMargins ( 0 , this . dp ( 10 ) , 0 , 0 ) ;
card . addView ( chip , chipLp ) ;
card . addView ( chip , chipLp ) ;
@@ -700,20 +707,21 @@ FloatBallAppWM.prototype.addButtonEditorField = function(parent, view) {
FloatBallAppWM . prototype . createButtonEditorSectionCard = function ( parent , title , desc ) {
FloatBallAppWM . prototype . createButtonEditorSectionCard = function ( parent , title , desc ) {
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var T = this . getAnimalIslandTheme ( ) ;
var box = new android . widget . LinearLayout ( context ) ;
var box = new android . widget . LinearLayout ( context ) ;
box . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
box . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
box . setPadding ( this . dp ( 12 ) , this . dp ( 10 ) , this . dp ( 12 ) , this . dp ( 10 ) ) ;
box . setPadding ( this . dp ( 12 ) , this . dp ( 10 ) , this . dp ( 12 ) , this . dp ( 10 ) ) ;
box . setBackground ( this . ui . createRound Drawable ( isDark ? this . withAlpha ( C . card Dark, 0.72 ) : this . withAlpha ( C . cardLight , 0.78 ) , this . dp ( 14 ) ) ) ;
box . setBackground ( this . ui . createStroke Drawable ( T . card , this . withAlpha ( T . stroke , is Dark ? 0.30 : 0.46 ) , this . dp ( 1 ) , this . dp ( 18 ) ) ) ;
var tv = new android . widget . TextView ( context ) ;
var tv = new android . widget . TextView ( context ) ;
tv . setText ( String ( title || "" ) ) ;
tv . setText ( String ( title || "" ) ) ;
tv . setTextColor ( isDark ? C . textPriDark : C . textPriLigh t) ;
tv . setTextColor ( T . tex t) ;
tv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 14 ) ;
tv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 14 ) ;
tv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
tv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
box . addView ( tv ) ;
box . addView ( tv ) ;
if ( desc ) {
if ( desc ) {
var dv = new android . widget . TextView ( context ) ;
var dv = new android . widget . TextView ( context ) ;
dv . setText ( String ( desc ) ) ;
dv . setText ( String ( desc ) ) ;
dv . setTextColor ( isDark ? C . textSecDark : C . textSecLight ) ;
dv . setTextColor ( T . sub ) ;
dv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 11 ) ;
dv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 11 ) ;
dv . setPadding ( 0 , this . dp ( 3 ) , 0 , 0 ) ;
dv . setPadding ( 0 , this . dp ( 3 ) , 0 , 0 ) ;
box . addView ( dv ) ;
box . addView ( dv ) ;
@@ -729,11 +737,13 @@ FloatBallAppWM.prototype.createButtonEditorCollapsibleSection = function(parent,
var self = this ;
var self = this ;
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var T = this . getAnimalIslandTheme ( ) ;
var expanded = defaultExpanded !== false ;
var expanded = defaultExpanded !== false ;
var card = new android . widget . LinearLayout ( context ) ;
var card = new android . widget . LinearLayout ( context ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setPadding ( this . dp ( 12 ) , this . dp ( 10 ) , this . dp ( 12 ) , this . dp ( 10 ) ) ;
card . setPadding ( this . dp ( 12 ) , this . dp ( 10 ) , this . dp ( 12 ) , this . dp ( 10 ) ) ;
card . setBackground ( this . ui . createRound Drawable ( isDark ? this . withAlpha ( C . card Dark, 0.72 ) : this . withAlpha ( C . cardLight , 0.78 ) , this . dp ( 14 ) ) ) ;
card . setBackground ( this . ui . createStroke Drawable ( T . card , this . withAlpha ( T . stroke , is Dark ? 0.30 : 0.46 ) , this . dp ( 1 ) , this . dp ( 18 ) ) ) ;
try { card . setElevation ( this . dp ( 2 ) ) ; } catch ( eCardElev ) { }
var header = new android . widget . LinearLayout ( context ) ;
var header = new android . widget . LinearLayout ( context ) ;
header . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
header . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
@@ -742,14 +752,14 @@ FloatBallAppWM.prototype.createButtonEditorCollapsibleSection = function(parent,
titleBox . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
titleBox . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
var tv = new android . widget . TextView ( context ) ;
var tv = new android . widget . TextView ( context ) ;
tv . setText ( String ( title || "" ) ) ;
tv . setText ( String ( title || "" ) ) ;
tv . setTextColor ( isDark ? C . textPriDark : C . textPriLigh t) ;
tv . setTextColor ( T . tex t) ;
tv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 14 ) ;
tv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 14 ) ;
tv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
tv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
titleBox . addView ( tv ) ;
titleBox . addView ( tv ) ;
if ( desc ) {
if ( desc ) {
var dv = new android . widget . TextView ( context ) ;
var dv = new android . widget . TextView ( context ) ;
dv . setText ( String ( desc ) ) ;
dv . setText ( String ( desc ) ) ;
dv . setTextColor ( isDark ? C . textSecDark : C . textSecLight ) ;
dv . setTextColor ( T . sub ) ;
dv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 11 ) ;
dv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 11 ) ;
dv . setPadding ( 0 , this . dp ( 3 ) , this . dp ( 8 ) , 0 ) ;
dv . setPadding ( 0 , this . dp ( 3 ) , this . dp ( 8 ) , 0 ) ;
titleBox . addView ( dv ) ;
titleBox . addView ( dv ) ;
@@ -759,7 +769,7 @@ FloatBallAppWM.prototype.createButtonEditorCollapsibleSection = function(parent,
header . addView ( titleBox , titleLp ) ;
header . addView ( titleBox , titleLp ) ;
var toggleTv = new android . widget . TextView ( context ) ;
var toggleTv = new android . widget . TextView ( context ) ;
toggleTv . setText ( expanded ? "折叠 ▲" : "展开 ▼" ) ;
toggleTv . setText ( expanded ? "折叠 ▲" : "展开 ▼" ) ;
toggleTv . setTextColor ( C . primary ) ;
toggleTv . setTextColor ( T . primaryDeep ) ;
toggleTv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
toggleTv . setTextSize ( android . util . TypedValue . COMPLEX _UNIT _SP , 12 ) ;
toggleTv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
toggleTv . setTypeface ( null , android . graphics . Typeface . BOLD ) ;
header . addView ( toggleTv ) ;
header . addView ( toggleTv ) ;
@@ -805,16 +815,18 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
var isEditing = ( this . state . editingButtonIndex !== null ) ;
var isEditing = ( this . state . editingButtonIndex !== null ) ;
var isDark = this . isDarkTheme ( ) ;
var isDark = this . isDarkTheme ( ) ;
var C = this . ui . colors ;
var C = this . ui . colors ;
var T = this . getAnimalIslandTheme ( ) ;
// 颜色配置
// 颜色配置
var bgColor = isDark ? C . bgDark : C . bgLight ;
var bgColor = T . bg ;
var cardColor = isDark ? C . cardDark : C . cardLight ;
var cardColor = T . card ;
var textColor = isDark ? C . textPriDark : C . textPriLigh t;
var textColor = T . tex t;
var subTextColor = isDark ? C . textSecDark : C . textSecLight ;
var subTextColor = T . sub ;
var dividerColor = isDark ? C . dividerDark : C . dividerLight ;
var dividerColor = T . stroke ;
var inputBgColor = isDark ? C . inputBgDark : C . inputBgLight ;
var inputBgColor = T . card2 ;
var panel = this . ui . createStyledPanel ( this , 16 ) ;
var panel = this . ui . createStyledPanel ( this , 16 ) ;
try { panel . setBackground ( this . ui . createRoundDrawable ( bgColor , this . dp ( 18 ) ) ) ; } catch ( ePanelBg ) { }
// --- 标题栏 ---
// --- 标题栏 ---
var header = this . ui . createStyledHeader ( this , 12 ) ;
var header = this . ui . createStyledHeader ( this , 12 ) ;
@@ -855,7 +867,7 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
header . addView ( self . ui . createSpacer ( self ) ) ;
header . addView ( self . ui . createSpacer ( self ) ) ;
// 新增按钮 (右侧)
// 新增按钮 (右侧)
var btnAdd = self . ui . createSolidButton ( self , "新增" , C . primary , android . graphics . Color . WHITE , function ( ) {
var btnAdd = self . ui . createSolidButton ( self , "新增" , T . primary , T . onPrimary , function ( ) {
self . state . editingButtonIndex = - 1 ;
self . state . editingButtonIndex = - 1 ;
if ( self . state . toolAppActive && self . pushToolAppPage ) self . pushToolAppPage ( "btn_editor" ) ;
if ( self . state . toolAppActive && self . pushToolAppPage ) self . pushToolAppPage ( "btn_editor" ) ;
else refreshPanel ( ) ;
else refreshPanel ( ) ;
@@ -882,7 +894,7 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
var searchSurface = new android . widget . LinearLayout ( context ) ;
var searchSurface = new android . widget . LinearLayout ( context ) ;
searchSurface . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
searchSurface . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
searchSurface . setPadding ( self . dp ( 12 ) , self . dp ( 10 ) , self . dp ( 12 ) , self . dp ( 10 ) ) ;
searchSurface . setPadding ( self . dp ( 12 ) , self . dp ( 10 ) , self . dp ( 12 ) , self . dp ( 10 ) ) ;
searchSurface . setBackground ( self . ui . createRound Drawable ( isDark ? self . withAlpha ( C . card Dark, 0.58 ) : self . withAlpha ( C . cardLight , 0.62 ) , self . dp ( 16 ) ) ) ;
searchSurface . setBackground ( self . ui . createStroke Drawable ( T . card , self . withAlpha ( T . stroke , is Dark ? 0.30 : 0.46 ) , self . dp ( 1 ) , self . dp ( 18 ) ) ) ;
var searchRow = new android . widget . LinearLayout ( context ) ;
var searchRow = new android . widget . LinearLayout ( context ) ;
searchRow . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
searchRow . setOrientation ( android . widget . LinearLayout . HORIZONTAL ) ;
searchRow . setGravity ( android . view . Gravity . CENTER _VERTICAL ) ;
searchRow . setGravity ( android . view . Gravity . CENTER _VERTICAL ) ;
@@ -890,7 +902,7 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
var searchInputLp = new android . widget . LinearLayout . LayoutParams ( 0 , android . widget . LinearLayout . LayoutParams . WRAP _CONTENT ) ;
var searchInputLp = new android . widget . LinearLayout . LayoutParams ( 0 , android . widget . LinearLayout . LayoutParams . WRAP _CONTENT ) ;
searchInputLp . weight = 1 ;
searchInputLp . weight = 1 ;
searchRow . addView ( searchInput . view , searchInputLp ) ;
searchRow . addView ( searchInput . view , searchInputLp ) ;
var btnSearch = self . createButtonManagerActionChip ( "搜索" , C . primary , self . withAlpha ( C . primary , 0.32 ) , function ( ) {
var btnSearch = self . createButtonManagerActionChip ( "搜索" , T . primaryDeep , self . withAlpha ( T . primaryDeep , 0.32 ) , function ( ) {
try { self . state . buttonManagerQuery = String ( searchInput . getValue ? searchInput . getValue ( ) : "" ) ; } catch ( eQ ) { self . state . buttonManagerQuery = "" ; }
try { self . state . buttonManagerQuery = String ( searchInput . getValue ? searchInput . getValue ( ) : "" ) ; } catch ( eQ ) { self . state . buttonManagerQuery = "" ; }
self . state . btnEditorListScrollY = 0 ;
self . state . btnEditorListScrollY = 0 ;
refreshPanel ( ) ;
refreshPanel ( ) ;
@@ -937,8 +949,8 @@ FloatBallAppWM.prototype.buildButtonEditorPanelView = function() {
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setOrientation ( android . widget . LinearLayout . VERTICAL ) ;
card . setGravity ( android . view . Gravity . CENTER _VERTICAL ) ;
card . setGravity ( android . view . Gravity . CENTER _VERTICAL ) ;
// 使用稍微不同的背景色以突出卡片
// 使用稍微不同的背景色以突出卡片
var cardBgColor = isDark ? self . withAlpha ( C . cardDark , 0.8 ) : self . withAlpha ( C . cardLight , 0.8 ) ;
var cardBgColor = cardColor ;
card . setBackground ( self . ui . createRound Drawable ( cardBgColor , self . dp ( 16 ) ) ) ;
card . setBackground ( self . ui . createStroke Drawable ( cardBgColor , self . withAlpha ( T . stroke , isDark ? 0.28 : 0.45 ) , self . dp ( 1 ) , self . dp ( 18 ) ) ) ;
try { card . setElevation ( self . dp ( 4 ) ) ; } catch ( e ) { safeLog ( null , 'e' , "catch " + String ( e ) ) ; }
try { card . setElevation ( self . dp ( 4 ) ) ; } catch ( e ) { safeLog ( null , 'e' , "catch " + String ( e ) ) ; }
var cardLp = new android . widget . LinearLayout . LayoutParams ( android . widget . LinearLayout . LayoutParams . MATCH _PARENT , android . widget . LinearLayout . LayoutParams . WRAP _CONTENT ) ;
var cardLp = new android . widget . LinearLayout . LayoutParams ( android . widget . LinearLayout . LayoutParams . MATCH _PARENT , android . widget . LinearLayout . LayoutParams . WRAP _CONTENT ) ;