diff --git a/src/main/java/com/github/shadowsocks/aidl/Config.aidl b/src/main/java/com/github/shadowsocks/aidl/Config.aidl deleted file mode 100644 index 667e8d16..00000000 --- a/src/main/java/com/github/shadowsocks/aidl/Config.aidl +++ /dev/null @@ -1,3 +0,0 @@ -package com.github.shadowsocks.aidl; - -parcelable Config; \ No newline at end of file diff --git a/src/main/java/com/github/shadowsocks/aidl/Config.java b/src/main/java/com/github/shadowsocks/aidl/Config.java deleted file mode 100644 index f0afc982..00000000 --- a/src/main/java/com/github/shadowsocks/aidl/Config.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.github.shadowsocks.aidl; - -import android.os.Parcel; -import android.os.Parcelable; - -public class Config implements Parcelable { - - public boolean isGlobalProxy = true; - public boolean isGFWList = true; - public boolean isBypassApps = false; - public boolean isTrafficStat = false; - public boolean isUdpDns = false; - - public String profileName = "Untitled"; - public String proxy = "127.0.0.1"; - public String sitekey = "null"; - - public String encMethod = "rc4"; - public String proxiedAppString = ""; - - public int remotePort = 1984; - public int localPort = 1080; - - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { - public Config createFromParcel(Parcel in) { - return new Config(in); - } - - public Config[] newArray(int size) { - return new Config[size]; - } - }; - - public Config(boolean isGlobalProxy, boolean isGFWList, boolean isBypassApps, - boolean isTrafficStat, boolean isUdpDns, String profileName, String proxy, String sitekey, - String encMethod, String proxiedAppString, int remotePort, int localPort) { - this.isGlobalProxy = isGlobalProxy; - this.isGFWList = isGFWList; - this.isBypassApps = isBypassApps; - this.isTrafficStat = isTrafficStat; - this.isUdpDns = isUdpDns; - this.profileName = profileName; - this.proxy = proxy; - this.sitekey = sitekey; - this.encMethod = encMethod; - this.proxiedAppString = proxiedAppString; - this.remotePort = remotePort; - this.localPort = localPort; - } - - private Config(Parcel in) { - readFromParcel(in); - } - - public void readFromParcel(Parcel in) { - isGlobalProxy = in.readInt() == 1; - isGFWList = in.readInt() == 1; - isBypassApps = in.readInt() == 1; - isTrafficStat = in.readInt() == 1; - isUdpDns = in.readInt() == 1; - profileName = in.readString(); - proxy = in.readString(); - sitekey = in.readString(); - encMethod = in.readString(); - proxiedAppString = in.readString(); - remotePort = in.readInt(); - localPort = in.readInt(); - } - - @Override public int describeContents() { - return 0; - } - - @Override public void writeToParcel(Parcel out, int flags) { - out.writeInt(isGlobalProxy ? 1 : 0); - out.writeInt(isGFWList ? 1 : 0); - out.writeInt(isBypassApps ? 1 : 0); - out.writeInt(isTrafficStat ? 1 : 0); - out.writeInt(isUdpDns ? 1 : 0); - out.writeString(profileName); - out.writeString(proxy); - out.writeString(sitekey); - out.writeString(encMethod); - out.writeString(proxiedAppString); - out.writeInt(remotePort); - out.writeInt(localPort); - } -} diff --git a/src/main/java/com/github/shadowsocks/aidl/IShadowsocksService.aidl b/src/main/java/com/github/shadowsocks/aidl/IShadowsocksService.aidl deleted file mode 100644 index 70667310..00000000 --- a/src/main/java/com/github/shadowsocks/aidl/IShadowsocksService.aidl +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.shadowsocks.aidl; - -import com.github.shadowsocks.aidl.Config; -import com.github.shadowsocks.aidl.IShadowsocksServiceCallback; - -interface IShadowsocksService { - int getMode(); - int getState(); - - oneway void registerCallback(IShadowsocksServiceCallback cb); - oneway void unregisterCallback(IShadowsocksServiceCallback cb); - - oneway void start(in Config config); - oneway void stop(); -} diff --git a/src/main/java/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl b/src/main/java/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl deleted file mode 100644 index d079a20c..00000000 --- a/src/main/java/com/github/shadowsocks/aidl/IShadowsocksServiceCallback.aidl +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.shadowsocks.aidl; - -interface IShadowsocksServiceCallback { - oneway void stateChanged(int state, String msg); -} diff --git a/src/main/res/xml/pref_feature.xml b/src/main/res/xml/pref_feature.xml index 630de01e..a9dadc18 100755 --- a/src/main/res/xml/pref_feature.xml +++ b/src/main/res/xml/pref_feature.xml @@ -26,7 +26,7 @@ android:defaultValue="true" android:summary="@string/traffic_stat_summary" android:title="@string/traffic_stat"> - + - +
+ android:fragment="com.github.shadowsocks.Shadowsocks$ProxyFragment" + android:title="@string/proxy_cat" />
+ android:fragment="com.github.shadowsocks.Shadowsocks$FeatureFragment" + android:title="@string/feature_cat" /> - - \ No newline at end of file + diff --git a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala index 2cc592dc..82a068a0 100644 --- a/src/main/scala/com/github/shadowsocks/Shadowsocks.scala +++ b/src/main/scala/com/github/shadowsocks/Shadowsocks.scala @@ -50,8 +50,8 @@ import android.widget._ import com.google.analytics.tracking.android.{MapBuilder, EasyTracker} import de.keyboardsurfer.android.widget.crouton.{Crouton, Style, Configuration} import java.util.Hashtable -import net.saik0.android.unifiedpreference.UnifiedPreferenceFragment -import net.saik0.android.unifiedpreference.UnifiedSherlockPreferenceActivity +import android.preference.PreferenceFragment +import com.actionbarsherlock.app.SherlockPreferenceActivity import org.jraf.android.backport.switchwidget.Switch import android.content.pm.{PackageInfo, PackageManager} import android.net.{Uri, VpnService} @@ -175,7 +175,7 @@ object Shadowsocks { } } - class ProxyFragment extends UnifiedPreferenceFragment { + class ProxyFragment extends PreferenceFragment { var receiver: BroadcastReceiver = null @@ -200,6 +200,7 @@ object Shadowsocks { override def onCreate(bundle: Bundle) { super.onCreate(bundle) + addPreferencesFromResource(R.xml.pref_proxy) val filter = new IntentFilter() filter.addAction(Action.UPDATE_FRAGMENT) receiver = new BroadcastReceiver { @@ -226,7 +227,7 @@ object Shadowsocks { } } - class FeatureFragment extends UnifiedPreferenceFragment { + class FeatureFragment extends PreferenceFragment { var receiver: BroadcastReceiver = null @@ -258,6 +259,7 @@ object Shadowsocks { override def onCreate(bundle: Bundle) { super.onCreate(bundle) + addPreferencesFromResource(R.xml.pref_feature) val filter = new IntentFilter() filter.addAction(Action.UPDATE_FRAGMENT) receiver = new BroadcastReceiver { @@ -287,7 +289,7 @@ object Shadowsocks { } class Shadowsocks - extends UnifiedSherlockPreferenceActivity + extends SherlockPreferenceActivity with CompoundButton.OnCheckedChangeListener with MenuAdapter.MenuListener { @@ -547,12 +549,23 @@ class Shadowsocks onContentChanged() } + override def onBuildHeaders(target: java.util.List[PreferenceActivity.Header]) { + loadHeadersFromResource(R.xml.shadowsocks_headers, target); + } + + def isSinglePane: Boolean = { + Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB + } + override def onCreate(savedInstanceState: Bundle) { - // Initialize the preference - setHeaderRes(R.xml.shadowsocks_headers) super.onCreate(savedInstanceState) + if (isSinglePane) { + // Load the legacy preferences headers + addPreferencesFromResource(R.xml.pref_all); + } + // Initialize the profile currentProfile = { profileManager.getProfile(settings.getInt(Key.profileId, -1)) getOrElse currentProfile