6.0.0 - 部分插件及工具版本更新
This commit is contained in:
@@ -30,18 +30,18 @@ class App : Application() {
|
||||
Drawables.setDefaultImageLoader(object : ImageLoader {
|
||||
override fun loadInto(imageView: ImageView, uri: Uri) {
|
||||
Glide.with(this@App)
|
||||
.load(uri)
|
||||
.into(imageView)
|
||||
.load(uri)
|
||||
.into(imageView)
|
||||
}
|
||||
|
||||
override fun loadIntoBackground(view: View, uri: Uri) {
|
||||
Glide.with(this@App)
|
||||
.load(uri)
|
||||
.into(object : SimpleTarget<Drawable>() {
|
||||
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>) {
|
||||
view.background = resource
|
||||
}
|
||||
})
|
||||
.load(uri)
|
||||
.into(object : SimpleTarget<Drawable>() {
|
||||
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
|
||||
view.background = resource
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun load(view: View, uri: Uri): Drawable {
|
||||
@@ -50,23 +50,23 @@ class App : Application() {
|
||||
|
||||
override fun load(view: View, uri: Uri, drawableCallback: ImageLoader.DrawableCallback) {
|
||||
Glide.with(this@App)
|
||||
.load(uri)
|
||||
.into(object : SimpleTarget<Drawable>() {
|
||||
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>) {
|
||||
drawableCallback.onLoaded(resource)
|
||||
}
|
||||
})
|
||||
.load(uri)
|
||||
.into(object : SimpleTarget<Drawable>() {
|
||||
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
|
||||
drawableCallback.onLoaded(resource)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
override fun load(view: View, uri: Uri, bitmapCallback: ImageLoader.BitmapCallback) {
|
||||
Glide.with(this@App)
|
||||
.asBitmap()
|
||||
.load(uri)
|
||||
.into(object : SimpleTarget<Bitmap>() {
|
||||
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>) {
|
||||
bitmapCallback.onLoaded(resource)
|
||||
}
|
||||
})
|
||||
.asBitmap()
|
||||
.load(uri)
|
||||
.into(object : SimpleTarget<Bitmap>() {
|
||||
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
|
||||
bitmapCallback.onLoaded(resource)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.stardust.auojs.inrt
|
||||
|
||||
import android.content.SharedPreferences
|
||||
import android.preference.PreferenceManager
|
||||
import androidx.preference.PreferenceManager
|
||||
|
||||
import com.stardust.app.GlobalAppContext
|
||||
|
||||
@@ -14,13 +14,13 @@ object Pref {
|
||||
private const val KEY_FIRST_USING = "key_first_using"
|
||||
private var sPreferences: SharedPreferences? = null
|
||||
|
||||
val preferences: SharedPreferences
|
||||
private val preferences: SharedPreferences
|
||||
get() {
|
||||
return sPreferences ?: {
|
||||
return sPreferences ?: run {
|
||||
val pref = PreferenceManager.getDefaultSharedPreferences(GlobalAppContext.get())
|
||||
sPreferences = pref
|
||||
pref
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
val isFirstUsing: Boolean
|
||||
@@ -37,11 +37,11 @@ object Pref {
|
||||
}
|
||||
|
||||
fun shouldEnableAccessibilityServiceByRoot(): Boolean {
|
||||
return preferences.getBoolean(getString(R.string.key_enable_accessibility_service_by_root), false)
|
||||
return preferences.getBoolean(getString(R.string.key_enable_accessibility_service_by_root), true)
|
||||
}
|
||||
|
||||
fun shouldHideLogs(): Boolean {
|
||||
return preferences.getBoolean(getString(R.string.key_dont_show_main_activity), false)
|
||||
return preferences.getBoolean(getString(R.string.key_not_show_main_activity), false)
|
||||
}
|
||||
|
||||
fun shouldStopAllScriptsWhenVolumeUp(): Boolean {
|
||||
|
||||
@@ -5,14 +5,11 @@ import androidx.annotation.Nullable
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/12/8.
|
||||
*/
|
||||
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
|
||||
|
||||
override fun onCreate(@Nullable savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setupViews()
|
||||
@@ -28,11 +25,15 @@ class SettingsActivity : AppCompatActivity() {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
}
|
||||
|
||||
class PreferenceFragment : android.preference.PreferenceFragment() {
|
||||
class PreferenceFragment : androidx.preference.PreferenceFragment() {
|
||||
|
||||
override fun onCreate(@Nullable savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
addPreferencesFromResource(R.xml.preference)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class SplashActivity : AppCompatActivity() {
|
||||
runOnUiThread {
|
||||
Toast.makeText(this@SplashActivity, e.message, Toast.LENGTH_LONG).show()
|
||||
startActivity(Intent(this@SplashActivity, LogActivity::class.java))
|
||||
AutoJs.instance!!.globalConsole.printAllStackTrace(e)
|
||||
AutoJs.instance.globalConsole.printAllStackTrace(e)
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
@@ -64,13 +64,9 @@ class SplashActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun checkPermission(vararg permissions: String) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
val requestPermissions = getRequestPermissions(permissions)
|
||||
if (requestPermissions.isNotEmpty()) {
|
||||
requestPermissions(requestPermissions, PERMISSION_REQUEST_CODE)
|
||||
} else {
|
||||
runScript()
|
||||
}
|
||||
val requestPermissions = getRequestPermissions(permissions)
|
||||
if (requestPermissions.isNotEmpty()) {
|
||||
requestPermissions(requestPermissions, PERMISSION_REQUEST_CODE)
|
||||
} else {
|
||||
runScript()
|
||||
}
|
||||
@@ -91,7 +87,7 @@ class SplashActivity : AppCompatActivity() {
|
||||
companion object {
|
||||
|
||||
private const val PERMISSION_REQUEST_CODE = 11186
|
||||
private const val INIT_TIMEOUT: Long = 2500
|
||||
private const val INIT_TIMEOUT: Long = 1000
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class GlobalKeyObserver internal constructor() : OnKeyListener, ShellKeyObserver
|
||||
|
||||
init {
|
||||
AccessibilityService.stickOnKeyObserver
|
||||
.addListener(this)
|
||||
.addListener(this)
|
||||
val observer = ShellKeyObserver()
|
||||
observer.setKeyListener(this)
|
||||
InputEventObserver.getGlobal(GlobalAppContext.get()).addListener(observer)
|
||||
@@ -31,7 +31,7 @@ class GlobalKeyObserver internal constructor() : OnKeyListener, ShellKeyObserver
|
||||
fun onVolumeUp() {
|
||||
Log.d(LOG_TAG, "onVolumeUp at " + System.currentTimeMillis())
|
||||
if (Pref.shouldStopAllScriptsWhenVolumeUp()) {
|
||||
AutoJs.instance!!.scriptEngineService.stopAllAndToast()
|
||||
AutoJs.instance.scriptEngineService.stopAllAndToast()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,9 +83,7 @@ class GlobalKeyObserver internal constructor() : OnKeyListener, ShellKeyObserver
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
|
||||
private val LOG_TAG = "GlobalKeyObserver"
|
||||
private const val LOG_TAG = "GlobalKeyObserver"
|
||||
private val sSingleton = GlobalKeyObserver()
|
||||
|
||||
fun init() {
|
||||
|
||||
@@ -5,19 +5,18 @@
|
||||
<string name="text_enable_accessibility_service_by_root_timeout">使用root权限启用无障碍服务失败</string>
|
||||
<string name="text_settings">设置</string>
|
||||
<string name="text_script_running">脚本运行</string>
|
||||
|
||||
<string name="key_use_volume_control_running">key_use_volume_control_running</string>
|
||||
<string name="key_enable_accessibility_service_by_root">key_enable_accessibility_service_by_root</string>
|
||||
<string name="text_use_volume_to_stop_running">音量上键停止所有脚本</string>
|
||||
<string name="summary_enable_accessibility_service_by_root">开启后运行脚本会使用Root权限自动开启无障碍服务</string>
|
||||
<string name="text_enable_accessibility_service_by_root">使用Root权限自动启用服务</string>
|
||||
<string name="summary_enable_accessibility_service_by_root">开启后运行脚本会使用 Root 权限自动开启无障碍服务</string>
|
||||
<string name="text_enable_accessibility_service_by_root">使用 Root 权限自动启用服务</string>
|
||||
<string name="key_stable_mode">key_stable_mode</string>
|
||||
<string name="summary_stable_mode">开启后布局分析更稳定,但小部分脚本可能无法正常运行。重启无障碍服务生效</string>
|
||||
<string name="text_stable_mode">稳定模式</string>
|
||||
<string name="text_accessibility_service">无障碍服务</string>
|
||||
<string name="text_dont_show_main_activity">不显示主界面</string>
|
||||
<string name="key_dont_show_main_activity">key_dont_show_main_activity</string>
|
||||
<string name="summary_dont_show_main_activity">打开应用后直接运行脚本</string>
|
||||
<string name="text_not_show_main_activity">不显示主界面</string>
|
||||
<string name="key_not_show_main_activity">key_not_show_main_activity</string>
|
||||
<string name="summary_not_show_main_activity">打开应用后直接运行脚本</string>
|
||||
<string name="text_others">其他</string>
|
||||
<string name="powered_by_autojs">Powered by Auto.js</string>
|
||||
<string name="text_execution_finished" formatted="false">\n------------\n[%s]运行结束,用时%f秒</string>
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="@string/key_dont_show_main_activity"
|
||||
android:summary="@string/summary_dont_show_main_activity"
|
||||
android:title="@string/text_dont_show_main_activity"/>
|
||||
android:key="@string/key_not_show_main_activity"
|
||||
android:summary="@string/summary_not_show_main_activity"
|
||||
android:title="@string/text_not_show_main_activity"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user