尝试修复某些设备上死机和重启的问题。修复在4.4上无法显示悬浮窗的问题。增加英文语言。增加获取WebView内容。
This commit is contained in:
@@ -4,16 +4,35 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.stardust.automator.AccessibilityEventCommandHost;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/1/31.
|
||||
*/
|
||||
public class Pref {
|
||||
|
||||
private static final SharedPreferences DISPOSABLE_BOOLEAN = App.getApp().getSharedPreferences("DISPOSABLE_BOOLEAN", Context.MODE_PRIVATE);
|
||||
public static final String SAMPLE_SCRIPTS_COPIED = "SAMPLE_SCRIPTS_COPIED";
|
||||
private static final String KEY_MAX_TEXT_LENGTH_FOR_CODE_COMPLETION = "KEY_MAX_TEXT_LENGTH_FOR_CODE_COMPLETION";
|
||||
public static final String KEY_DRAWER_HEADER_IMAGE_PATH = "KEY_DRAWER_HEADER_IMAGE_PATH";
|
||||
public static final String KEY_APP_BAR_IMAGE_PATH = "KEY_APP_BAR_IMAGE_PATH";
|
||||
private static SharedPreferences.OnSharedPreferenceChangeListener onSharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
if (key.equals(App.getResString(R.string.key_run_mode))) {
|
||||
AccessibilityEventCommandHost.getInstance().setRunMode(getRunModeFromValue(sharedPreferences.getString(key, null)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static int getRunModeFromValue(String value) {
|
||||
switch (value) {
|
||||
case "KEY_THREAD_POOL":
|
||||
return AccessibilityEventCommandHost.RUN_MODE_THREAD_POOL;
|
||||
case "KEY_NEW_THREAD_EVERY_TIME":
|
||||
return AccessibilityEventCommandHost.RUN_MODE_NEW_THREAD_EVERY_TIME;
|
||||
default:
|
||||
return AccessibilityEventCommandHost.RUN_MODE_SINGLE_THREAD;
|
||||
}
|
||||
}
|
||||
|
||||
public static SharedPreferences def() {
|
||||
return PreferenceManager.getDefaultSharedPreferences(App.getApp());
|
||||
@@ -64,4 +83,23 @@ public class Pref {
|
||||
return getDisposableBoolean("isFirstUsing", true);
|
||||
}
|
||||
|
||||
public static String getDrawerHeaderImagePath() {
|
||||
return def().getString(KEY_DRAWER_HEADER_IMAGE_PATH, null);
|
||||
}
|
||||
|
||||
public static void setDrawerHeaderImagePath(String path) {
|
||||
def().edit().putString(KEY_DRAWER_HEADER_IMAGE_PATH, path).apply();
|
||||
}
|
||||
|
||||
public static String getAppBarImagePath() {
|
||||
return def().getString(KEY_APP_BAR_IMAGE_PATH, null);
|
||||
}
|
||||
|
||||
public static void setAppBarImagePath(String path) {
|
||||
def().edit().putString(KEY_APP_BAR_IMAGE_PATH, path).apply();
|
||||
}
|
||||
|
||||
static {
|
||||
def().registerOnSharedPreferenceChangeListener(onSharedPreferenceChangeListener);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user