Commit f5b22007 authored by Max Lv's avatar Max Lv

update UI

parent ebc5c3f4
......@@ -33,7 +33,7 @@
<activity
android:name=".Shadowsocks"
android:label="@string/app_name"
android:theme="@style/Theme.GAEProxy"
android:theme="@style/Theme.Shadowsocks"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
......@@ -49,7 +49,7 @@
<activity
android:name=".AppManager"
android:theme="@style/Theme.GAEProxy"
android:theme="@style/Theme.AppManager"
android:label="@string/app_name">
<intent-filter>
<action android:name="com.github.shadowsocks.AppManager"/>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:duplicateParentState="false">
<ListView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/applistview"/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
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>
\ No newline at end of file
......@@ -35,7 +35,7 @@
<string name="proxied_apps">Individual Proxy</string>
<string name="proxied_apps_summary">Set individual proxy for apps
</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_summary">Enable this option to bypass selected apps</string>
<string name="auto_connect">Auto Connect</string>
......
......@@ -21,9 +21,13 @@
</style>
<!-- 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>
</style>
<style name="Theme.AppManager" parent="@style/Theme.Shadow">
<item name="switchStyle">@style/Widget.Holo.Light.CompoundButton.Switch</item>
</style>
</resources>
\ No newline at end of file
......@@ -14,13 +14,6 @@
android:summary="@string/auto_set_proxy_summary"
android:title="@string/auto_set_proxy">
</CheckBoxPreference>
<CheckBoxPreference
android:defaultValue="false"
android:dependency="isGlobalProxy"
android:key="isBypassApps"
android:summary="@string/bypass_apps_summary"
android:title="@string/bypass_apps">
</CheckBoxPreference>
<Preference
android:key="proxyedApps"
android:dependency="isGlobalProxy"
......
......@@ -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)
......
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