修复 任务管理崩溃的Bug
修复 id有关选择器报错的Bug 修复 engines.myEngine()报错的Bug
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
package androidx.recyclerview.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build.VERSION
|
||||
import android.util.AttributeSet
|
||||
import android.widget.EdgeEffect
|
||||
import androidx.annotation.Nullable
|
||||
import androidx.core.widget.EdgeEffectCompat
|
||||
import com.stardust.theme.ThemeColor
|
||||
import com.stardust.theme.ThemeColorManager
|
||||
import com.stardust.theme.ThemeColorMutable
|
||||
import java.lang.reflect.Field
|
||||
|
||||
open class ThemeColorRecyclerView : RecyclerView, ThemeColorMutable {
|
||||
private var mLeftGlowField: Field? = null
|
||||
private var mTopGlowField: Field? = null
|
||||
private var mRightGlowField: Field? = null
|
||||
private var mBottomGlowField: Field? = null
|
||||
private var mEdgeEffectField: Field? = null
|
||||
private var mColorPrimary: Int = 0
|
||||
private var hasAppliedThemeColorLeft: Boolean = false
|
||||
private var hasAppliedThemeColorTop: Boolean = false
|
||||
private var hasAppliedThemeColorRight: Boolean = false
|
||||
private var hasAppliedThemeColorBottom: Boolean = false
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
this.init()
|
||||
}
|
||||
|
||||
constructor(context: Context, @Nullable attrs: AttributeSet) : super(context, attrs) {
|
||||
this.init()
|
||||
}
|
||||
|
||||
constructor(context: Context, @Nullable attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle) {
|
||||
this.init()
|
||||
}
|
||||
|
||||
private fun applyThemeColor(edgeEffectCompatField: Field?): Boolean {
|
||||
try {
|
||||
val edgeEffectCompat = edgeEffectCompatField?.get(this) as EdgeEffectCompat?
|
||||
if (edgeEffectCompat != null) {
|
||||
return this.setEdgeEffectColor(edgeEffectCompat, this.mColorPrimary)
|
||||
}
|
||||
} catch (var3: Exception) {
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun init() {
|
||||
try {
|
||||
this.mEdgeEffectField = EdgeEffectCompat::class.java.getDeclaredField("mEdgeEffect")
|
||||
this.mEdgeEffectField!!.isAccessible = true
|
||||
this.mLeftGlowField = RecyclerView::class.java.getDeclaredField("mLeftGlow")
|
||||
this.mLeftGlowField!!.isAccessible = true
|
||||
this.mRightGlowField = RecyclerView::class.java.getDeclaredField("mRightGlow")
|
||||
this.mRightGlowField!!.isAccessible = true
|
||||
this.mTopGlowField = RecyclerView::class.java.getDeclaredField("mTopGlow")
|
||||
this.mTopGlowField!!.isAccessible = true
|
||||
this.mBottomGlowField = RecyclerView::class.java.getDeclaredField("mBottomGlow")
|
||||
this.mBottomGlowField!!.isAccessible = true
|
||||
} catch (var2: Exception) {
|
||||
var2.printStackTrace()
|
||||
}
|
||||
|
||||
ThemeColorManager.add(this)
|
||||
}
|
||||
|
||||
private fun setEdgeEffectColor(compat: EdgeEffectCompat?, color: Int): Boolean {
|
||||
return if (compat == null) {
|
||||
false
|
||||
} else {
|
||||
try {
|
||||
if (VERSION.SDK_INT >= 21) {
|
||||
val edgeEffect = this.mEdgeEffectField!!.get(compat) as EdgeEffect
|
||||
edgeEffect.color = color
|
||||
}
|
||||
|
||||
true
|
||||
} catch (var4: Exception) {
|
||||
true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun setThemeColor(color: ThemeColor) {
|
||||
if (color.colorPrimary != this.mColorPrimary) {
|
||||
this.mColorPrimary = color.colorPrimary
|
||||
this.invalidateGlows()
|
||||
}
|
||||
}
|
||||
|
||||
internal override fun invalidateGlows() {
|
||||
super.invalidateGlows()
|
||||
this.hasAppliedThemeColorTop = false
|
||||
this.hasAppliedThemeColorRight = this.hasAppliedThemeColorTop
|
||||
this.hasAppliedThemeColorLeft = this.hasAppliedThemeColorRight
|
||||
this.hasAppliedThemeColorBottom = this.hasAppliedThemeColorLeft
|
||||
}
|
||||
|
||||
internal override fun ensureLeftGlow() {
|
||||
super.ensureLeftGlow()
|
||||
if (!this.hasAppliedThemeColorLeft) {
|
||||
this.hasAppliedThemeColorLeft = this.applyThemeColor(this.mLeftGlowField)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal override fun ensureRightGlow() {
|
||||
super.ensureLeftGlow()
|
||||
if (!this.hasAppliedThemeColorRight) {
|
||||
this.hasAppliedThemeColorRight = this.applyThemeColor(this.mRightGlowField)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal override fun ensureTopGlow() {
|
||||
super.ensureTopGlow()
|
||||
if (!this.hasAppliedThemeColorTop) {
|
||||
this.hasAppliedThemeColorTop = this.applyThemeColor(this.mTopGlowField)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal override fun ensureBottomGlow() {
|
||||
super.ensureBottomGlow()
|
||||
if (!this.hasAppliedThemeColorBottom) {
|
||||
this.hasAppliedThemeColorBottom = this.applyThemeColor(this.mBottomGlowField)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import android.graphics.drawable.GradientDrawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.appcompat.widget.ThemeColorRecyclerView;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -34,6 +33,7 @@ import org.autojs.autojs.ui.timing.TimedTaskSettingActivity_;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.ThemeColorRecyclerView;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
@@ -3,7 +3,8 @@ package org.autojs.autojs.ui.widget;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.appcompat.widget.ThemeColorRecyclerView;
|
||||
import androidx.recyclerview.widget.ThemeColorRecyclerView;
|
||||
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
@@ -25,9 +25,6 @@
|
||||
<string name="air_dialog_description_failed_issues_not_available">Issues不可用,请联系软件开发者.</string>
|
||||
<string name="air_dialog_description_failed_unknown">未知错误</string>
|
||||
<string name="air_dialog_action_failed">OK</string>
|
||||
<plurals name="air_error_short_description" key="air_error_short_description">
|
||||
<item quantity="one">描述至少要 %d 个字.</item>
|
||||
<item quantity="other">描述至少要 %d 个字.</item>
|
||||
</plurals>
|
||||
|
||||
<string name="theme_color_red">R</string>
|
||||
</resources>
|
||||
|
||||
@@ -431,4 +431,8 @@
|
||||
<string name="text_run_on_startup">Auto.js启动时</string>
|
||||
<string name="text_usage_stats_permission">查看使用统计权限</string>
|
||||
<string name="description_usage_stats_permission">通过\"查看使用统计\"权限可以获取本设备过去使用应用的情况,从而使获取当前应用(currentPackage)时更准确。</string>
|
||||
<plurals name="air_error_short_description" key="air_error_short_description">
|
||||
<item quantity="one">描述至少要 %d 个字.</item>
|
||||
<item quantity="other">描述至少要 %d 个字.</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user