6.6.2 - Alpha4 - 修复代码编辑器页面菜单项图标及文字的着色异常

This commit is contained in:
SuperMonster003
2025-03-11 20:49:07 +08:00
parent d355964591
commit 0487cf2a60
13 changed files with 72 additions and 36 deletions

View File

@@ -146,10 +146,16 @@ public class TinySign {
// ! Rhino 1.8.1-SNAPSHOT requires dynamically loading services during initialization (e.g., org.mozilla.javascript.RegExpLoader). // ! Rhino 1.8.1-SNAPSHOT requires dynamically loading services during initialization (e.g., org.mozilla.javascript.RegExpLoader).
// ! When loading these services, it needs to read the service provider configuration files located in the META-INF/services/ directory. // ! When loading these services, it needs to read the service provider configuration files located in the META-INF/services/ directory.
// ! During signing, these configuration files need to be written into the ZipOutputStream. // ! During signing, these configuration files need to be written into the ZipOutputStream.
// !
// ! Refer to: https://stackoverflow.com/questions/4544899/java-meta-inf-services
// !
// ! zh-CN: // ! zh-CN:
// !
// ! Rhino 1.8.1-SNAPSHOT 在初始化时需要动态加载服务 (如 org.mozilla.javascript.RegExpLoader), // ! Rhino 1.8.1-SNAPSHOT 在初始化时需要动态加载服务 (如 org.mozilla.javascript.RegExpLoader),
// ! 这些服务加载时, 需要读取位于 META-INF/services/ 目录下的服务提供者配置文件 (Service Provider Configuration Files). // ! 这些服务加载时, 需要读取位于 META-INF/services/ 目录下的服务提供者配置文件 (Service Provider Configuration Files).
// ! 签名时, 需要将这些配置文件写入 ZipOutputStream 中. // ! 签名时, 需要将这些配置文件写入 ZipOutputStream 中.
// !
// ! 参阅: https://stackoverflow.com/questions/4544899/java-meta-inf-services
private static void writeServices(File dir, ZipOutputStream zos) throws IOException { private static void writeServices(File dir, ZipOutputStream zos) throws IOException {
File servicesDir = new File(dir, "META-INF/services"); File servicesDir = new File(dir, "META-INF/services");
if (!servicesDir.isDirectory()) { if (!servicesDir.isDirectory()) {

View File

@@ -274,8 +274,12 @@ public class DebugToolbarFragment extends ToolbarFragment implements DebugCallba
} }
String variable = findVariableOnCursor(line, ch); String variable = findVariableOnCursor(line, ch);
Log.d(LOG_TAG, "onCursorChange: variable = " + variable + ", ch = " + ch + ", line = " + line); Log.d(LOG_TAG, "onCursorChange: variable = " + variable + ", ch = " + ch + ", line = " + line);
String value = eval(variable); try {
mEditorView.debugBar.updateCurrentVariable(variable, value); String value = eval(variable);
mEditorView.debugBar.updateCurrentVariable(variable, value);
} catch (Exception e) {
e.printStackTrace();
}
} }
private String findVariableOnCursor(String line, int ch) { private String findVariableOnCursor(String line, int ch) {

View File

@@ -3,6 +3,7 @@ package org.autojs.autojs.ui.main.scripts
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.ClipData import android.content.ClipData
import android.content.ClipboardManager import android.content.ClipboardManager
import android.content.res.ColorStateList
import android.os.Bundle import android.os.Bundle
import android.text.SpannableStringBuilder import android.text.SpannableStringBuilder
import android.util.TypedValue import android.util.TypedValue
@@ -10,16 +11,20 @@ import android.view.KeyEvent
import android.view.ScaleGestureDetector import android.view.ScaleGestureDetector
import android.view.View import android.view.View
import android.widget.TextView import android.widget.TextView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import io.noties.markwon.syntax.Prism4jThemeBase import io.noties.markwon.syntax.Prism4jThemeBase
import io.noties.markwon.syntax.Prism4jThemeDarkula import io.noties.markwon.syntax.Prism4jThemeDarkula
import io.noties.markwon.syntax.Prism4jThemeDefault import io.noties.markwon.syntax.Prism4jThemeDefault
import io.noties.prism4j.GrammarLocator import io.noties.prism4j.GrammarLocator
import io.noties.prism4j.Prism4j import io.noties.prism4j.Prism4j
import kotlinx.coroutines.* import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock import kotlinx.coroutines.sync.withLock
import org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
import org.autojs.autojs.ui.BaseActivity import org.autojs.autojs.ui.BaseActivity
import org.autojs.autojs.util.ColorUtils
import org.autojs.autojs.util.DisplayUtils import org.autojs.autojs.util.DisplayUtils
import org.autojs.autojs.util.ViewUtils import org.autojs.autojs.util.ViewUtils
import org.autojs.autojs6.R import org.autojs.autojs6.R
@@ -28,14 +33,18 @@ import kotlin.math.floor
abstract class BaseDisplayContentActivity : BaseActivity() { abstract class BaseDisplayContentActivity : BaseActivity() {
override val handleStatusBarThemeColorAutomatically = false
abstract var internalMenuResource: Int abstract var internalMenuResource: Int
abstract var highlightGrammarLocator: GrammarLocator abstract var highlightGrammarLocator: GrammarLocator
abstract var highlightGrammarName: String abstract var highlightGrammarName: String
abstract var highlightThemeLanguage: String abstract var highlightThemeLanguage: String
open var themeColorDayNight = R.color.md_blue_grey_50 to R.color.md_blue_grey_900
private lateinit var internalTextView: TextView private lateinit var internalTextView: TextView
private lateinit var internalFabView: ThemeColorFloatingActionButton private lateinit var internalFabView: FloatingActionButton
protected val popMenuActionMap = mutableMapOf<Int, () -> Unit>() protected val popMenuActionMap = mutableMapOf<Int, () -> Unit>()
@@ -126,6 +135,27 @@ abstract class BaseDisplayContentActivity : BaseActivity() {
} }
} }
override fun onStart() {
super.onStart()
val (themeColorDayRes, themeColorNightRes) = themeColorDayNight
val themeColorDay = getColor(themeColorDayRes)
val themeColorNight = getColor(themeColorNightRes)
if (ViewUtils.isNightModeYes(this)) {
internalFabView.backgroundTintList = ColorStateList.valueOf(themeColorNight)
internalFabView.imageTintList = ColorStateList.valueOf(if (ColorUtils.isLuminanceDark(themeColorNight)) getColor(R.color.night) else getColor(R.color.day))
ViewUtils.setStatusBarBackgroundColor(this, themeColorNight)
ViewUtils.setStatusBarIconLight(this, ColorUtils.isLuminanceDark(themeColorNight))
} else {
internalFabView.backgroundTintList = ColorStateList.valueOf(themeColorDay)
internalFabView.imageTintList = ColorStateList.valueOf(if (ColorUtils.isLuminanceDark(themeColorDay)) getColor(R.color.night) else getColor(R.color.day))
ViewUtils.setStatusBarBackgroundColor(this, themeColorDay)
ViewUtils.setStatusBarIconLight(this, ColorUtils.isLuminanceDark(themeColorDay))
}
}
protected abstract suspend fun loadAndDisplayContent() protected abstract suspend fun loadAndDisplayContent()
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean { override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {

View File

@@ -1,13 +1,14 @@
package org.autojs.autojs.ui.widget package org.autojs.autojs.ui.widget
import android.content.Context import android.content.Context
import android.graphics.Color import android.content.res.ColorStateList
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.util.AttributeSet import android.util.AttributeSet
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import org.autojs.autojs.theme.ThemeColorManager
import org.autojs.autojs.util.DrawableUtils import org.autojs.autojs.util.DrawableUtils
import org.autojs.autojs6.R import org.autojs.autojs6.R
@@ -16,8 +17,17 @@ import org.autojs.autojs6.R
*/ */
class ToolbarMenuItem : LinearLayout { class ToolbarMenuItem : LinearLayout {
private val mColorDisabled: Int = ContextCompat.getColor(context, R.color.toolbar_disabled) private val mColorDisabled: Int
private val mColorEnabled: Int = ContextCompat.getColor(context, R.color.toolbar_text) get() = when (ThemeColorManager.isThemeColorLuminanceLight()) {
true -> ContextCompat.getColor(context, R.color.toolbar_menu_item_disabled_dark)
else -> ContextCompat.getColor(context, R.color.toolbar_menu_item_disabled_light)
}
private val mColorEnabled: Int
get() = when (ThemeColorManager.isThemeColorLuminanceLight()) {
true -> ContextCompat.getColor(context, R.color.toolbar_menu_item_enabled_dark)
else -> ContextCompat.getColor(context, R.color.toolbar_menu_item_enabled_light)
}
private var mImageView: ImageView private var mImageView: ImageView
private var mTextView: TextView private var mTextView: TextView
private var mEnabledDrawable: Drawable? = null private var mEnabledDrawable: Drawable? = null
@@ -30,15 +40,12 @@ class ToolbarMenuItem : LinearLayout {
val iconText = a.getString(R.styleable.ToolbarMenuItem_text) val iconText = a.getString(R.styleable.ToolbarMenuItem_text)
val iconResId = a.getResourceId(R.styleable.ToolbarMenuItem_icon, 0) val iconResId = a.getResourceId(R.styleable.ToolbarMenuItem_icon, 0)
val iconColor = a.getColor(R.styleable.ToolbarMenuItem_icon_color, Color.TRANSPARENT)
a.recycle() a.recycle()
mImageView = findViewById<ImageView?>(R.id.icon).apply { mImageView = findViewById<ImageView?>(R.id.icon).apply {
setImageResource(iconResId) setImageResource(iconResId)
if (iconColor != Color.TRANSPARENT) { imageTintList = ColorStateList.valueOf(mColorEnabled)
setImageDrawable(DrawableUtils.setDrawableColorFilterSrcIn(drawable, iconColor))
}
} }
mTextView = findViewById<TextView?>(R.id.text).apply { mTextView = findViewById<TextView?>(R.id.text).apply {
@@ -57,6 +64,7 @@ class ToolbarMenuItem : LinearLayout {
ensureEnabledDrawable() ensureEnabledDrawable()
ensureDisabledDrawable() ensureDisabledDrawable()
mImageView.setImageDrawable(if (enabled) mEnabledDrawable else mDisabledDrawable) mImageView.setImageDrawable(if (enabled) mEnabledDrawable else mDisabledDrawable)
mImageView.imageTintList = ColorStateList.valueOf(if (enabled) mColorEnabled else mColorDisabled)
mTextView.setTextColor(if (enabled) mColorEnabled else mColorDisabled) mTextView.setTextColor(if (enabled) mColorEnabled else mColorDisabled)
} }
} }

View File

@@ -33,7 +33,7 @@
</org.autojs.autojs.ui.common.NestedOuterScrollView> </org.autojs.autojs.ui.common.NestedOuterScrollView>
<org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab" android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -41,8 +41,6 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_margin="16dp" android:layout_margin="16dp"
android:contentDescription="@string/content_description_fab_for_display_manifest" android:contentDescription="@string/content_description_fab_for_display_manifest"
app:backgroundTint="?attr/colorPrimary"
android:tint="@color/toolbar_text"
android:src="@android:drawable/ic_menu_more" /> android:src="@android:drawable/ic_menu_more" />
</RelativeLayout> </RelativeLayout>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
@@ -15,8 +16,9 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="13dp" android:paddingEnd="6dp"
android:theme="@style/ToolBarStyle" /> android:theme="@style/ToolBarStyle"
tools:ignore="RtlSymmetry" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>

View File

@@ -11,7 +11,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_debug_step_over" app:icon="@drawable/ic_debug_step_over"
app:icon_color="@color/toolbar_text"
app:text="@string/text_debug_step_over"/> app:text="@string/text_debug_step_over"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -19,7 +18,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_debug_step_into" app:icon="@drawable/ic_debug_step_into"
app:icon_color="@color/toolbar_text"
app:text="@string/text_debug_step_into"/> app:text="@string/text_debug_step_into"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -27,7 +25,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_debug_step_out" app:icon="@drawable/ic_debug_step_out"
app:icon_color="@color/toolbar_text"
app:text="@string/text_debug_step_out"/> app:text="@string/text_debug_step_out"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -35,7 +32,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_play_arrow_white_48dp" app:icon="@drawable/ic_play_arrow_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_debug_resume_script"/> app:text="@string/text_debug_resume_script"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -43,7 +39,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_close_white_48dp" app:icon="@drawable/ic_close_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_stop"/> app:text="@string/text_stop"/>
</LinearLayout> </LinearLayout>

View File

@@ -11,7 +11,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_play_arrow_white_48dp" app:icon="@drawable/ic_play_arrow_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_run_simplified" /> app:text="@string/text_run_simplified" />
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -19,7 +18,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_undo_white_48dp" app:icon="@drawable/ic_undo_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_undo_simplified" /> app:text="@string/text_undo_simplified" />
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -27,7 +25,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_redo_white_48dp" app:icon="@drawable/ic_redo_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_redo_simplified" /> app:text="@string/text_redo_simplified" />
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -36,7 +33,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:enabled="false" android:enabled="false"
app:icon="@drawable/ic_save_white_48dp" app:icon="@drawable/ic_save_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_save_simplified" /> app:text="@string/text_save_simplified" />
</LinearLayout> </LinearLayout>

View File

@@ -11,7 +11,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_ali_replace" app:icon="@drawable/ic_ali_replace"
app:icon_color="@color/toolbar_text"
app:text="@string/text_replace_simplified"/> app:text="@string/text_replace_simplified"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -19,7 +18,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_ali_up" app:icon="@drawable/ic_ali_up"
app:icon_color="@color/toolbar_text"
app:text="@string/text_find_prev_simplified"/> app:text="@string/text_find_prev_simplified"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -27,7 +25,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_ali_down" app:icon="@drawable/ic_ali_down"
app:icon_color="@color/toolbar_text"
app:text="@string/text_find_next_simplified"/> app:text="@string/text_find_next_simplified"/>
<org.autojs.autojs.ui.widget.ToolbarMenuItem <org.autojs.autojs.ui.widget.ToolbarMenuItem
@@ -35,7 +32,6 @@
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
app:icon="@drawable/ic_close_white_48dp" app:icon="@drawable/ic_close_white_48dp"
app:icon_color="@color/toolbar_text"
app:text="@string/text_cancel_simplified"/> app:text="@string/text_cancel_simplified"/>
</LinearLayout> </LinearLayout>

View File

@@ -54,7 +54,6 @@
<color name="tab_selected_text">#111214</color> <color name="tab_selected_text">#111214</color>
<color name="toolbar_text">@color/night_day</color> <color name="toolbar_text">@color/night_day</color>
<color name="toolbar_disabled">#6E292929</color>
<color name="prefTextColorPrimary">#9A9A9A</color> <color name="prefTextColorPrimary">#9A9A9A</color>
<color name="prefTextColorSecondary">#808080</color> <color name="prefTextColorSecondary">#808080</color>

View File

@@ -47,7 +47,6 @@
<declare-styleable name="ToolbarMenuItem"> <declare-styleable name="ToolbarMenuItem">
<attr name="text" format="string|reference" /> <attr name="text" format="string|reference" />
<attr name="icon" /> <attr name="icon" />
<attr name="icon_color" format="color|reference" />
</declare-styleable> </declare-styleable>
<declare-styleable name="RoundCheckboxWithText"> <declare-styleable name="RoundCheckboxWithText">

View File

@@ -132,9 +132,12 @@
<color name="tab_selected_text_dark">#111214</color> <color name="tab_selected_text_dark">#111214</color>
<color name="toolbar_text">@color/night_day</color> <color name="toolbar_text">@color/night_day</color>
<color name="toolbar_menu_item_enabled_light">@color/night</color>
<color name="toolbar_menu_item_enabled_dark">@color/dawn</color>
<color name="toolbar_menu_item_disabled_light">#6EE0E0E0</color>
<color name="toolbar_menu_item_disabled_dark">#6E292929</color>
<color name="fab_tint_light">@color/night</color> <color name="fab_tint_light">@color/night</color>
<color name="fab_tint_dark">@color/day</color> <color name="fab_tint_dark">@color/day</color>
<color name="toolbar_disabled">#6EE0E0E0</color>
<color name="prefTextColorPrimary">#282C2F</color> <color name="prefTextColorPrimary">#282C2F</color>
<color name="prefTextColorSecondary">#9DA0A2</color> <color name="prefTextColorSecondary">#9DA0A2</color>

View File

@@ -1,5 +1,5 @@
#Tue Mar 11 15:15:22 CST 2025 #Tue Mar 11 20:47:13 CST 2025
BUILD_TIME=1741677322038 BUILD_TIME=1741697233189
COMPILE_SDK_VERSION=35 COMPILE_SDK_VERSION=35
JAVA_VERSION=23 JAVA_VERSION=23
JAVA_VERSION_MIN_RADICAL=0 JAVA_VERSION_MIN_RADICAL=0
@@ -17,6 +17,6 @@ RAPID_OCR_OPENCV_MOBILE_LABEL_VERSION=13
RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3 RAPID_OCR_OPENCV_MOBILE_VERSION=4.5.3
TARGET_SDK_VERSION=35 TARGET_SDK_VERSION=35
TARGET_SDK_VERSION_INRT=29 TARGET_SDK_VERSION_INRT=29
VERSION_BUILD=3011 VERSION_BUILD=3014
VERSION_NAME=6.6.2 Alpha4 VERSION_NAME=6.6.2 Alpha4
VSCODE_EXT_REQUIRED_VERSION=1.0.8 VSCODE_EXT_REQUIRED_VERSION=1.0.8