update UI

This commit is contained in:
Max Lv
2013-08-10 09:53:36 +08:00
parent ebc5c3f43b
commit f5b2200728
7 changed files with 55 additions and 19 deletions
@@ -69,6 +69,7 @@ import java.io.{ByteArrayOutputStream, ByteArrayInputStream, InputStream}
import com.nostra13.universalimageloader.core.{DisplayImageOptions, ImageLoader, ImageLoaderConfiguration}
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer
import com.google.analytics.tracking.android.EasyTracker
import org.jraf.android.backport.switchwidget.Switch
case class ProxiedApp(uid: Int, name: String, var proxied: Boolean)
@@ -231,6 +232,15 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl
.imageDownloader(new AppIconDownloader(this))
.build()
ImageLoader.getInstance().init(config)
val bypassSwitch: Switch = findViewById(R.id.bypassSwitch).asInstanceOf[Switch]
val prefs: SharedPreferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext)
bypassSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener {
def onCheckedChanged(button: CompoundButton, checked: Boolean) {
prefs.edit().putBoolean(Key.isBypassApps, checked).commit()
}
})
bypassSwitch.setChecked(prefs.getBoolean(Key.isBypassApps, false))
}
protected override def onResume() {
@@ -72,7 +72,7 @@ object Shadowsocks {
val PREFS_NAME = "Shadowsocks"
val PROXY_PREFS = Array(Key.proxy, Key.remotePort, Key.localPort, Key.sitekey, Key.encMethod)
val FEATRUE_PREFS = Array(Key.isGFWList, Key.isGlobalProxy, Key.isBypassApps, Key.proxyedApps,
val FEATRUE_PREFS = Array(Key.isGFWList, Key.isGlobalProxy, Key.proxyedApps,
Key.isTrafficStat, Key.isAutoConnect)
val TAG = "Shadowsocks"
val REQUEST_CONNECT = 1
@@ -138,7 +138,7 @@ object Shadowsocks {
val status = getActivity.getSharedPreferences(Key.status, Context.MODE_PRIVATE)
val isRoot = status.getBoolean(Key.isRoot, false)
if (Seq(Key.isAutoConnect, Key.isGlobalProxy, Key.isTrafficStat,
Key.isBypassApps, Key.proxyedApps).contains(name)) {
Key.proxyedApps).contains(name)) {
pref.setEnabled(enabled && isRoot)
} else {
pref.setEnabled(enabled)
@@ -517,7 +517,7 @@ class Shadowsocks
val pref = findPreference(name)
if (pref != null) {
if (Seq(Key.isAutoConnect, Key.isGlobalProxy, Key.isTrafficStat,
Key.isBypassApps, Key.proxyedApps).contains(name)) {
Key.proxyedApps).contains(name)) {
pref.setEnabled(enabled && isRoot)
} else {
pref.setEnabled(enabled)