Commit f5b22007 authored by Max Lv's avatar Max Lv

update UI

parent ebc5c3f4
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<activity <activity
android:name=".Shadowsocks" android:name=".Shadowsocks"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/Theme.GAEProxy" android:theme="@style/Theme.Shadowsocks"
android:launchMode="singleTask"> android:launchMode="singleTask">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<activity <activity
android:name=".AppManager" android:name=".AppManager"
android:theme="@style/Theme.GAEProxy" android:theme="@style/Theme.AppManager"
android:label="@string/app_name"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="com.github.shadowsocks.AppManager"/> <action android:name="com.github.shadowsocks.AppManager"/>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent" <LinearLayout
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:duplicateParentState="false"> android:layout_width="fill_parent"
<ListView android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_height="wrap_content" android:id="@+id/applistview"/> android:orientation="vertical"
android:duplicateParentState="false">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:id="@+id/bypassLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginLeft="16dp"
android:textSize="22sp"
android:text="@string/bypass_apps"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"/>
<org.jraf.android.backport.switchwidget.Switch
android:id="@+id/bypassSwitch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dp"/>
</RelativeLayout>
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/applistview"/>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
<string name="proxied_apps">Individual Proxy</string> <string name="proxied_apps">Individual Proxy</string>
<string name="proxied_apps_summary">Set individual proxy for apps <string name="proxied_apps_summary">Set individual proxy for apps
</string> </string>
<string name="proxied_help">Select Apps</string> <string name="proxied_help">Individual Proxy</string>
<string name="bypass_apps">Bypass Mode</string> <string name="bypass_apps">Bypass Mode</string>
<string name="bypass_apps_summary">Enable this option to bypass selected apps</string> <string name="bypass_apps_summary">Enable this option to bypass selected apps</string>
<string name="auto_connect">Auto Connect</string> <string name="auto_connect">Auto Connect</string>
......
...@@ -21,9 +21,13 @@ ...@@ -21,9 +21,13 @@
</style> </style>
<!-- Variation on the Light theme that turns off the title --> <!-- Variation on the Light theme that turns off the title -->
<style name="Theme.GAEProxy" parent="@style/Theme.Shadow"> <style name="Theme.Shadowsocks" parent="@style/Theme.Shadow">
<item name="switchStyle">@style/Widget.Shadow.Switch</item> <item name="switchStyle">@style/Widget.Shadow.Switch</item>
</style> </style>
<style name="Theme.AppManager" parent="@style/Theme.Shadow">
<item name="switchStyle">@style/Widget.Holo.Light.CompoundButton.Switch</item>
</style>
</resources> </resources>
\ No newline at end of file
...@@ -14,13 +14,6 @@ ...@@ -14,13 +14,6 @@
android:summary="@string/auto_set_proxy_summary" android:summary="@string/auto_set_proxy_summary"
android:title="@string/auto_set_proxy"> android:title="@string/auto_set_proxy">
</CheckBoxPreference> </CheckBoxPreference>
<CheckBoxPreference
android:defaultValue="false"
android:dependency="isGlobalProxy"
android:key="isBypassApps"
android:summary="@string/bypass_apps_summary"
android:title="@string/bypass_apps">
</CheckBoxPreference>
<Preference <Preference
android:key="proxyedApps" android:key="proxyedApps"
android:dependency="isGlobalProxy" android:dependency="isGlobalProxy"
......
...@@ -69,6 +69,7 @@ import java.io.{ByteArrayOutputStream, ByteArrayInputStream, InputStream} ...@@ -69,6 +69,7 @@ import java.io.{ByteArrayOutputStream, ByteArrayInputStream, InputStream}
import com.nostra13.universalimageloader.core.{DisplayImageOptions, ImageLoader, ImageLoaderConfiguration} import com.nostra13.universalimageloader.core.{DisplayImageOptions, ImageLoader, ImageLoaderConfiguration}
import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer import com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer
import com.google.analytics.tracking.android.EasyTracker import com.google.analytics.tracking.android.EasyTracker
import org.jraf.android.backport.switchwidget.Switch
case class ProxiedApp(uid: Int, name: String, var proxied: Boolean) case class ProxiedApp(uid: Int, name: String, var proxied: Boolean)
...@@ -231,6 +232,15 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl ...@@ -231,6 +232,15 @@ class AppManager extends SherlockActivity with OnCheckedChangeListener with OnCl
.imageDownloader(new AppIconDownloader(this)) .imageDownloader(new AppIconDownloader(this))
.build() .build()
ImageLoader.getInstance().init(config) 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() { protected override def onResume() {
......
...@@ -72,7 +72,7 @@ object Shadowsocks { ...@@ -72,7 +72,7 @@ object Shadowsocks {
val PREFS_NAME = "Shadowsocks" val PREFS_NAME = "Shadowsocks"
val PROXY_PREFS = Array(Key.proxy, Key.remotePort, Key.localPort, Key.sitekey, Key.encMethod) 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) Key.isTrafficStat, Key.isAutoConnect)
val TAG = "Shadowsocks" val TAG = "Shadowsocks"
val REQUEST_CONNECT = 1 val REQUEST_CONNECT = 1
...@@ -138,7 +138,7 @@ object Shadowsocks { ...@@ -138,7 +138,7 @@ object Shadowsocks {
val status = getActivity.getSharedPreferences(Key.status, Context.MODE_PRIVATE) val status = getActivity.getSharedPreferences(Key.status, Context.MODE_PRIVATE)
val isRoot = status.getBoolean(Key.isRoot, false) val isRoot = status.getBoolean(Key.isRoot, false)
if (Seq(Key.isAutoConnect, Key.isGlobalProxy, Key.isTrafficStat, if (Seq(Key.isAutoConnect, Key.isGlobalProxy, Key.isTrafficStat,
Key.isBypassApps, Key.proxyedApps).contains(name)) { Key.proxyedApps).contains(name)) {
pref.setEnabled(enabled && isRoot) pref.setEnabled(enabled && isRoot)
} else { } else {
pref.setEnabled(enabled) pref.setEnabled(enabled)
...@@ -517,7 +517,7 @@ class Shadowsocks ...@@ -517,7 +517,7 @@ class Shadowsocks
val pref = findPreference(name) val pref = findPreference(name)
if (pref != null) { if (pref != null) {
if (Seq(Key.isAutoConnect, Key.isGlobalProxy, Key.isTrafficStat, if (Seq(Key.isAutoConnect, Key.isGlobalProxy, Key.isTrafficStat,
Key.isBypassApps, Key.proxyedApps).contains(name)) { Key.proxyedApps).contains(name)) {
pref.setEnabled(enabled && isRoot) pref.setEnabled(enabled && isRoot)
} else { } else {
pref.setEnabled(enabled) pref.setEnabled(enabled)
......
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