6.6.2 - Alpha4 - 修复代码编辑器页面菜单项图标及文字的着色异常
This commit is contained in:
@@ -146,10 +146,16 @@ public class TinySign {
|
||||
// ! 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.
|
||||
// ! 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:
|
||||
// !
|
||||
// ! Rhino 1.8.1-SNAPSHOT 在初始化时需要动态加载服务 (如 org.mozilla.javascript.RegExpLoader),
|
||||
// ! 这些服务加载时, 需要读取位于 META-INF/services/ 目录下的服务提供者配置文件 (Service Provider Configuration Files).
|
||||
// ! 签名时, 需要将这些配置文件写入 ZipOutputStream 中.
|
||||
// !
|
||||
// ! 参阅: https://stackoverflow.com/questions/4544899/java-meta-inf-services
|
||||
private static void writeServices(File dir, ZipOutputStream zos) throws IOException {
|
||||
File servicesDir = new File(dir, "META-INF/services");
|
||||
if (!servicesDir.isDirectory()) {
|
||||
|
||||
@@ -274,8 +274,12 @@ public class DebugToolbarFragment extends ToolbarFragment implements DebugCallba
|
||||
}
|
||||
String variable = findVariableOnCursor(line, ch);
|
||||
Log.d(LOG_TAG, "onCursorChange: variable = " + variable + ", ch = " + ch + ", line = " + line);
|
||||
String value = eval(variable);
|
||||
mEditorView.debugBar.updateCurrentVariable(variable, value);
|
||||
try {
|
||||
String value = eval(variable);
|
||||
mEditorView.debugBar.updateCurrentVariable(variable, value);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private String findVariableOnCursor(String line, int ch) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.autojs.autojs.ui.main.scripts
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Bundle
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.util.TypedValue
|
||||
@@ -10,16 +11,20 @@ import android.view.KeyEvent
|
||||
import android.view.ScaleGestureDetector
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
import io.noties.markwon.syntax.Prism4jThemeBase
|
||||
import io.noties.markwon.syntax.Prism4jThemeDarkula
|
||||
import io.noties.markwon.syntax.Prism4jThemeDefault
|
||||
import io.noties.prism4j.GrammarLocator
|
||||
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.withLock
|
||||
import org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
|
||||
import org.autojs.autojs.ui.BaseActivity
|
||||
import org.autojs.autojs.util.ColorUtils
|
||||
import org.autojs.autojs.util.DisplayUtils
|
||||
import org.autojs.autojs.util.ViewUtils
|
||||
import org.autojs.autojs6.R
|
||||
@@ -28,14 +33,18 @@ import kotlin.math.floor
|
||||
|
||||
abstract class BaseDisplayContentActivity : BaseActivity() {
|
||||
|
||||
override val handleStatusBarThemeColorAutomatically = false
|
||||
|
||||
abstract var internalMenuResource: Int
|
||||
|
||||
abstract var highlightGrammarLocator: GrammarLocator
|
||||
abstract var highlightGrammarName: 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 internalFabView: ThemeColorFloatingActionButton
|
||||
private lateinit var internalFabView: FloatingActionButton
|
||||
|
||||
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()
|
||||
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package org.autojs.autojs.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.util.AttributeSet
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import org.autojs.autojs.theme.ThemeColorManager
|
||||
import org.autojs.autojs.util.DrawableUtils
|
||||
import org.autojs.autojs6.R
|
||||
|
||||
@@ -16,8 +17,17 @@ import org.autojs.autojs6.R
|
||||
*/
|
||||
class ToolbarMenuItem : LinearLayout {
|
||||
|
||||
private val mColorDisabled: Int = ContextCompat.getColor(context, R.color.toolbar_disabled)
|
||||
private val mColorEnabled: Int = ContextCompat.getColor(context, R.color.toolbar_text)
|
||||
private val mColorDisabled: Int
|
||||
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 mTextView: TextView
|
||||
private var mEnabledDrawable: Drawable? = null
|
||||
@@ -30,15 +40,12 @@ class ToolbarMenuItem : LinearLayout {
|
||||
|
||||
val iconText = a.getString(R.styleable.ToolbarMenuItem_text)
|
||||
val iconResId = a.getResourceId(R.styleable.ToolbarMenuItem_icon, 0)
|
||||
val iconColor = a.getColor(R.styleable.ToolbarMenuItem_icon_color, Color.TRANSPARENT)
|
||||
|
||||
a.recycle()
|
||||
|
||||
mImageView = findViewById<ImageView?>(R.id.icon).apply {
|
||||
setImageResource(iconResId)
|
||||
if (iconColor != Color.TRANSPARENT) {
|
||||
setImageDrawable(DrawableUtils.setDrawableColorFilterSrcIn(drawable, iconColor))
|
||||
}
|
||||
imageTintList = ColorStateList.valueOf(mColorEnabled)
|
||||
}
|
||||
|
||||
mTextView = findViewById<TextView?>(R.id.text).apply {
|
||||
@@ -57,6 +64,7 @@ class ToolbarMenuItem : LinearLayout {
|
||||
ensureEnabledDrawable()
|
||||
ensureDisabledDrawable()
|
||||
mImageView.setImageDrawable(if (enabled) mEnabledDrawable else mDisabledDrawable)
|
||||
mImageView.imageTintList = ColorStateList.valueOf(if (enabled) mColorEnabled else mColorDisabled)
|
||||
mTextView.setTextColor(if (enabled) mColorEnabled else mColorDisabled)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
</org.autojs.autojs.ui.common.NestedOuterScrollView>
|
||||
|
||||
<org.autojs.autojs.theme.widget.ThemeColorFloatingActionButton
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -41,8 +41,6 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="16dp"
|
||||
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" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@@ -15,8 +16,9 @@
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="13dp"
|
||||
android:theme="@style/ToolBarStyle" />
|
||||
android:paddingEnd="6dp"
|
||||
android:theme="@style/ToolBarStyle"
|
||||
tools:ignore="RtlSymmetry" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_debug_step_over"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_debug_step_over"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -19,7 +18,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_debug_step_into"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_debug_step_into"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -27,7 +25,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_debug_step_out"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_debug_step_out"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -35,7 +32,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_play_arrow_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_debug_resume_script"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -43,7 +39,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_close_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_stop"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -11,7 +11,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_play_arrow_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_run_simplified" />
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -19,7 +18,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_undo_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_undo_simplified" />
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -27,7 +25,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_redo_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_redo_simplified" />
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -36,7 +33,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:enabled="false"
|
||||
app:icon="@drawable/ic_save_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_save_simplified" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -11,7 +11,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_ali_replace"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_replace_simplified"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -19,7 +18,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_ali_up"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_find_prev_simplified"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -27,7 +25,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_ali_down"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_find_next_simplified"/>
|
||||
|
||||
<org.autojs.autojs.ui.widget.ToolbarMenuItem
|
||||
@@ -35,7 +32,6 @@
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
app:icon="@drawable/ic_close_white_48dp"
|
||||
app:icon_color="@color/toolbar_text"
|
||||
app:text="@string/text_cancel_simplified"/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -54,7 +54,6 @@
|
||||
<color name="tab_selected_text">#111214</color>
|
||||
|
||||
<color name="toolbar_text">@color/night_day</color>
|
||||
<color name="toolbar_disabled">#6E292929</color>
|
||||
|
||||
<color name="prefTextColorPrimary">#9A9A9A</color>
|
||||
<color name="prefTextColorSecondary">#808080</color>
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
<declare-styleable name="ToolbarMenuItem">
|
||||
<attr name="text" format="string|reference" />
|
||||
<attr name="icon" />
|
||||
<attr name="icon_color" format="color|reference" />
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="RoundCheckboxWithText">
|
||||
|
||||
@@ -132,9 +132,12 @@
|
||||
<color name="tab_selected_text_dark">#111214</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_dark">@color/day</color>
|
||||
<color name="toolbar_disabled">#6EE0E0E0</color>
|
||||
|
||||
<color name="prefTextColorPrimary">#282C2F</color>
|
||||
<color name="prefTextColorSecondary">#9DA0A2</color>
|
||||
|
||||
Reference in New Issue
Block a user