Commit 1403ef8a authored by Max Lv's avatar Max Lv

refine UI

parent 7157990f
...@@ -140,7 +140,7 @@ object Shadowsocks { ...@@ -140,7 +140,7 @@ object Shadowsocks {
val isGlobalProxy: Boolean = settings.getBoolean(Key.isGlobalProxy, false) val isGlobalProxy: Boolean = settings.getBoolean(Key.isGlobalProxy, false)
pref.setEnabled(enabled && !isGlobalProxy) pref.setEnabled(enabled && !isGlobalProxy)
} else if (name == Key.isAutoConnect) { } else if (name == Key.isAutoConnect) {
pref.setEnabled(if (Shadowsocks.vpnEnabled == 1) false else true) pref.setEnabled(settings.getBoolean(Key.isRoot, false))
} else { } else {
pref.setEnabled(enabled) pref.setEnabled(enabled)
} }
...@@ -376,7 +376,7 @@ class Shadowsocks ...@@ -376,7 +376,7 @@ class Shadowsocks
progressDialog = ProgressDialog.show(this, "", getString(R.string.initializing), true, true) progressDialog = ProgressDialog.show(this, "", getString(R.string.initializing), true, true)
} }
spawn { spawn {
Utils.getRoot settings.edit().putBoolean(Key.isRoot, Utils.getRoot).commit()
val update = getSharedPreferences(Key.update, Context.MODE_WORLD_WRITEABLE) val update = getSharedPreferences(Key.update, Context.MODE_WORLD_WRITEABLE)
if (!update.getBoolean(getVersionName, false)) { if (!update.getBoolean(getVersionName, false)) {
update.edit.putBoolean(getVersionName, true).apply() update.edit.putBoolean(getVersionName, true).apply()
...@@ -486,7 +486,7 @@ class Shadowsocks ...@@ -486,7 +486,7 @@ class Shadowsocks
val isGlobalProxy: Boolean = settings.getBoolean("isGlobalProxy", false) val isGlobalProxy: Boolean = settings.getBoolean("isGlobalProxy", false)
pref.setEnabled(enabled && !isGlobalProxy) pref.setEnabled(enabled && !isGlobalProxy)
} else if (name == Key.isAutoConnect) { } else if (name == Key.isAutoConnect) {
pref.setEnabled(if (Shadowsocks.vpnEnabled == 1) false else true) pref.setEnabled(settings.getBoolean(Key.isRoot, false))
} else { } else {
pref.setEnabled(enabled) pref.setEnabled(enabled)
} }
......
...@@ -53,6 +53,7 @@ import android.graphics.{Canvas, Bitmap} ...@@ -53,6 +53,7 @@ import android.graphics.{Canvas, Bitmap}
import android.app.ActivityManager import android.app.ActivityManager
object Key { object Key {
val isRoot = "isRoot"
val update = "update" val update = "update"
val proxyedApps = "proxyedApps" val proxyedApps = "proxyedApps"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment