修复 任务管理崩溃的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>
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = function(__runtime__, scope){
|
||||
}
|
||||
|
||||
engines.myEngine = function(){
|
||||
var engine = rtEngines.myEngine();
|
||||
var engine = Object.create(rtEngines.myEngine());
|
||||
if(!execArgv){
|
||||
execArgv = {};
|
||||
var iter = engine.getTag("execution.config").getArguments().entrySet().iterator();
|
||||
@@ -26,8 +26,8 @@ module.exports = function(__runtime__, scope){
|
||||
var entry = iter.next();
|
||||
execArgv[entry.getKey()] = entry.getValue();
|
||||
}
|
||||
engine.execArgv = execArgv;
|
||||
}
|
||||
engine.execArgv = execArgv;
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.view.View;
|
||||
|
||||
import com.stardust.autojs.BuildConfig;
|
||||
import com.stardust.autojs.core.ui.ViewExtras;
|
||||
import com.stardust.autojs.rhino.NativeJavaObjectWithPrototype;
|
||||
import com.stardust.autojs.rhino.RhinoAndroidHelper;
|
||||
import com.stardust.autojs.rhino.TopLevelScope;
|
||||
import com.stardust.autojs.runtime.ScriptRuntime;
|
||||
|
||||
@@ -105,7 +105,7 @@ open class UiObject(info: Any?, private val allocator: AccessibilityNodeInfoAllo
|
||||
return drawingOrder
|
||||
}
|
||||
|
||||
open fun id(): String {
|
||||
open fun id(): String? {
|
||||
return viewIdResourceName
|
||||
}
|
||||
|
||||
@@ -145,21 +145,21 @@ open class UiObject(info: Any?, private val allocator: AccessibilityNodeInfoAllo
|
||||
}
|
||||
|
||||
override fun performAction(action: Int, bundle: Bundle): Boolean {
|
||||
try {
|
||||
return super.performAction(action, bundle)
|
||||
return try {
|
||||
super.performAction(action, bundle)
|
||||
} catch (e: IllegalStateException) {
|
||||
// FIXME: 2017/5/5
|
||||
return false
|
||||
false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun performAction(action: Int): Boolean {
|
||||
try {
|
||||
return super.performAction(action)
|
||||
return try {
|
||||
super.performAction(action)
|
||||
} catch (e: IllegalStateException) {
|
||||
// FIXME: 2017/5/5
|
||||
return false
|
||||
false
|
||||
}
|
||||
|
||||
|
||||
@@ -374,7 +374,8 @@ open class UiObject(info: Any?, private val allocator: AccessibilityNodeInfoAllo
|
||||
}
|
||||
|
||||
override fun findAccessibilityNodeInfosByViewId(viewId: String): List<AccessibilityNodeInfoCompat> {
|
||||
return allocator?.findAccessibilityNodeInfosByViewId(this, viewId) ?: super.findAccessibilityNodeInfosByViewId(viewId)
|
||||
return allocator?.findAccessibilityNodeInfosByViewId(this, viewId)
|
||||
?: super.findAccessibilityNodeInfosByViewId(viewId)
|
||||
}
|
||||
|
||||
fun findByViewId(viewId: String): List<UiObject> {
|
||||
|
||||
@@ -34,7 +34,7 @@ class AccessibilityInfoProvider(private val context: Context) : AccessibilityDel
|
||||
var latestActivity = ""
|
||||
private set
|
||||
|
||||
var useUsageStats: Boolean = true
|
||||
var useUsageStats: Boolean = false
|
||||
|
||||
override val eventTypes: Set<Int>?
|
||||
get() = AccessibilityDelegate.ALL_EVENT_TYPES
|
||||
@@ -59,7 +59,7 @@ class AccessibilityInfoProvider(private val context: Context) : AccessibilityDel
|
||||
val current = System.currentTimeMillis()
|
||||
val usageStats = usageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, current - 60 * 60 * 1000, current)
|
||||
return if (usageStats.isEmpty()) {
|
||||
""
|
||||
mLatestPackage
|
||||
} else {
|
||||
usageStats.sortBy {
|
||||
it.lastTimeStamp
|
||||
|
||||
@@ -1 +1 @@
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":440,"versionName":"4.0.4 Alpha11","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha11.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha11.apk","properties":{}}]
|
||||
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":441,"versionName":"4.0.4 Alpha12","enabled":true,"outputFile":"commonRelease-4.0.4 Alpha12.apk","fullName":"commonRelease","baseName":"common-release"},"path":"commonRelease-4.0.4 Alpha12.apk","properties":{}}]
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"appVersionCode": 440,
|
||||
"appVersionName": "4.0.4 Alpha11",
|
||||
"appVersionCode": 441,
|
||||
"appVersionName": "4.0.4 Alpha12",
|
||||
"target": 28,
|
||||
"mini": 17,
|
||||
"compile": 28,
|
||||
|
||||
Reference in New Issue
Block a user