Commit 3d664377 authored by Max Lv's avatar Max Lv

clean up

parent a74c3fde
...@@ -18,10 +18,10 @@ ...@@ -18,10 +18,10 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" <item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_shadow" /> android:drawable="@drawable/btn_cab_done_pressed_shadow"/>
<item android:state_focused="true" android:state_enabled="true" <item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/btn_cab_done_focused_shadow" /> android:drawable="@drawable/btn_cab_done_focused_shadow"/>
<item android:state_enabled="true" <item android:state_enabled="true"
android:drawable="@drawable/btn_cab_done_default_shadow" /> android:drawable="@drawable/btn_cab_done_default_shadow"/>
</selector> </selector>
...@@ -18,5 +18,5 @@ ...@@ -18,5 +18,5 @@
--> -->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="@color/pressed_shadow" /> <solid android:color="@color/pressed_shadow"/>
</shape> </shape>
...@@ -19,17 +19,17 @@ ...@@ -19,17 +19,17 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background" <item android:id="@android:id/background"
android:drawable="@drawable/progress_bg_shadow" /> android:drawable="@drawable/progress_bg_shadow"/>
<item android:id="@android:id/secondaryProgress"> <item android:id="@android:id/secondaryProgress">
<scale android:scaleWidth="100%" <scale android:scaleWidth="100%"
android:drawable="@drawable/progress_secondary_shadow" /> android:drawable="@drawable/progress_secondary_shadow"/>
</item> </item>
<item android:id="@android:id/progress"> <item android:id="@android:id/progress">
<scale android:scaleWidth="100%" <scale android:scaleWidth="100%"
android:drawable="@drawable/progress_primary_shadow" /> android:drawable="@drawable/progress_primary_shadow"/>
</item> </item>
</layer-list> </layer-list>
...@@ -18,8 +18,9 @@ ...@@ -18,8 +18,9 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android" <selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime" > android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/list_focused_shadow" /> <item android:state_pressed="false" android:state_focused="true"
<item android:state_pressed="true" android:drawable="@drawable/pressed_background_shadow" /> android:drawable="@drawable/list_focused_shadow"/>
<item android:drawable="@android:color/transparent" /> <item android:state_pressed="true" android:drawable="@drawable/pressed_background_shadow"/>
<item android:drawable="@android:color/transparent"/>
</selector> </selector>
\ No newline at end of file
...@@ -18,11 +18,11 @@ ...@@ -18,11 +18,11 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" <item android:state_enabled="false"
android:drawable="@drawable/spinner_ab_disabled_shadow" /> android:drawable="@drawable/spinner_ab_disabled_shadow"/>
<item android:state_pressed="true" <item android:state_pressed="true"
android:drawable="@drawable/spinner_ab_pressed_shadow" /> android:drawable="@drawable/spinner_ab_pressed_shadow"/>
<item android:state_pressed="false" android:state_focused="true" <item android:state_pressed="false" android:state_focused="true"
android:drawable="@drawable/spinner_ab_focused_shadow" /> android:drawable="@drawable/spinner_ab_focused_shadow"/>
<item android:drawable="@drawable/spinner_ab_default_shadow" /> <item android:drawable="@drawable/spinner_ab_default_shadow"/>
</selector> </selector>
...@@ -18,20 +18,28 @@ ...@@ -18,20 +18,28 @@
--> -->
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states --> <!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@android:color/transparent" /> <item android:state_focused="false" android:state_selected="false" android:state_pressed="false"
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_shadow" /> android:drawable="@android:color/transparent"/>
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false"
android:drawable="@drawable/tab_selected_shadow"/>
<!-- Focused states --> <!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused_shadow" /> <item android:state_focused="true" android:state_selected="false" android:state_pressed="false"
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused_shadow" /> android:drawable="@drawable/tab_unselected_focused_shadow"/>
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false"
android:drawable="@drawable/tab_selected_focused_shadow"/>
<!-- Pressed --> <!-- Pressed -->
<!-- Non focused states --> <!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_shadow" /> <item android:state_focused="false" android:state_selected="false" android:state_pressed="true"
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_shadow" /> android:drawable="@drawable/tab_unselected_pressed_shadow"/>
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true"
android:drawable="@drawable/tab_selected_pressed_shadow"/>
<!-- Focused states --> <!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_shadow" /> <item android:state_focused="true" android:state_selected="false" android:state_pressed="true"
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_shadow" /> android:drawable="@drawable/tab_unselected_pressed_shadow"/>
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true"
android:drawable="@drawable/tab_selected_pressed_shadow"/>
</selector> </selector>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent" <LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:duplicateParentState="false"> android:orientation="vertical" android:duplicateParentState="false">
<TextView android:text="@string/proxied_help" <TextView android:text="@string/proxied_help"
android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textSize="16sp" android:padding="3dp"/> android:textSize="16sp" android:padding="3dp"/>
<ListView android:layout_width="fill_parent" <ListView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/applistview"/> android:layout_height="wrap_content" android:id="@+id/applistview"/>
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:stretchColumns="1"> android:stretchColumns="1">
<TableRow> <TableRow>
<ImageView <ImageView
android:id="@+id/itemicon" android:id="@+id/itemicon"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:scaleType="fitCenter" android:scaleType="fitCenter"
android:padding="3dp"/> android:padding="3dp"/>
<TextView <TextView
android:id="@+id/itemtext" android:id="@+id/itemtext"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:text="uid:packages" android:text="uid:packages"
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxLength="25" android:maxLength="25"
android:textSize="18sp" android:textSize="18sp"
android:padding="3dp"/> android:padding="3dp"/>
<CheckBox <CheckBox
android:id="@+id/itemcheck" android:id="@+id/itemcheck"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:layout_marginRight="6dp"/> android:layout_marginRight="6dp"/>
</TableRow> </TableRow>
</TableLayout> </TableLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:textSize="28sp" android:textSize="28sp"
android:textColor="@color/title" android:textColor="@color/title"
android:text="@string/app_name" android:text="@string/app_name"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
<org.jraf.android.backport.switchwidget.Switch <org.jraf.android.backport.switchwidget.Switch
android:id="@+id/switchButton" android:id="@+id/switchButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
</RelativeLayout> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="80dp" android:maxWidth="80dp" android:gravity="center" android:minWidth="80dp" android:maxWidth="80dp" android:gravity="center"
android:textSize="70sp" android:textColor="#ffffffff" android:textSize="70sp" android:textColor="#ffffffff"
android:background="#99000088" android:padding="10dp" android:background="#99000088" android:padding="10dp"
android:visibility="invisible" /> android:visibility="invisible"/>
\ No newline at end of file \ No newline at end of file
...@@ -19,38 +19,39 @@ ...@@ -19,38 +19,39 @@
<resources> <resources>
<style name="Theme.Shadow" parent="@style/Theme.Sherlock.Light.DarkActionBar"> <style name="Theme.Shadow" parent="@style/Theme.Sherlock.Light.DarkActionBar">
<item name="android:actionBarItemBackground">@drawable/selectable_background_shadow</item> <item name="android:actionBarItemBackground">@drawable/selectable_background_shadow</item>
<item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item> <item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item>
<item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item> <item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item>
<item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Shadow</item> <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Shadow</item>
<item name="android:actionDropDownStyle">@style/DropDownNav.Shadow</item> <item name="android:actionDropDownStyle">@style/DropDownNav.Shadow</item>
<item name="android:actionBarStyle">@style/ActionBar.Solid.Shadow</item> <item name="android:actionBarStyle">@style/ActionBar.Solid.Shadow</item>
<item name="android:actionModeBackground">@drawable/cab_background_top_shadow</item> <item name="android:actionModeBackground">@drawable/cab_background_top_shadow</item>
<item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_shadow</item> <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_shadow</item>
<item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Shadow</item> <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Shadow</item>
<!-- Light.DarkActionBar specific --> <!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">@style/Theme.Shadow.Widget</item> <item name="android:actionBarWidgetTheme">@style/Theme.Shadow.Widget</item>
</style> </style>
<style name="ActionBar.Solid.Shadow" parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse"> <style name="ActionBar.Solid.Shadow"
<item name="android:background">@drawable/ab_solid_shadow</item> parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="android:backgroundStacked">@drawable/ab_stacked_solid_shadow</item> <item name="android:background">@drawable/ab_solid_shadow</item>
<item name="android:backgroundSplit">@drawable/ab_bottom_solid_shadow</item> <item name="android:backgroundStacked">@drawable/ab_stacked_solid_shadow</item>
<item name="android:progressBarStyle">@style/ProgressBar.Shadow</item> <item name="android:backgroundSplit">@drawable/ab_bottom_solid_shadow</item>
</style> <item name="android:progressBarStyle">@style/ProgressBar.Shadow</item>
</style>
<style name="ActionBar.Transparent.Shadow" parent="@style/Widget.Sherlock.ActionBar">
<item name="android:background">@drawable/ab_transparent_shadow</item> <style name="ActionBar.Transparent.Shadow" parent="@style/Widget.Sherlock.ActionBar">
<item name="android:progressBarStyle">@style/ProgressBar.Shadow</item> <item name="android:background">@drawable/ab_transparent_shadow</item>
</style> <item name="android:progressBarStyle">@style/ProgressBar.Shadow</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Shadow.Widget" parent="@style/Theme.Sherlock"> <!-- this style is only referenced in a Light.DarkActionBar based theme -->
<item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item> <style name="Theme.Shadow.Widget" parent="@style/Theme.Sherlock">
<item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item> <item name="android:popupMenuStyle">@style/PopupMenu.Shadow</item>
</style> <item name="android:dropDownListViewStyle">@style/DropDownListView.Shadow</item>
</style>
</resources> </resources>
\ No newline at end of file
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
<resources> <resources>
<color name="title_background">#ff5e5e5e</color> <color name="title_background">#ff5e5e5e</color>
<color name="dialog_title_background">#17170443</color> <color name="dialog_title_background">#17170443</color>
<color name="black">#000000</color> <color name="black">#000000</color>
<color name="grey1">#646464</color> <color name="grey1">#646464</color>
<color name="grey2">#c8c8c8</color> <color name="grey2">#c8c8c8</color>
<color name="grey3">#323232</color> <color name="grey3">#323232</color>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="app_name">shadowsocks</string> <string name="app_name">shadowsocks</string>
<!-- function category --> <!-- function category -->
<string name="function_cat">Service Controller</string> <string name="function_cat">Service Controller</string>
<string name="service_controller">Proxy Switch</string> <string name="service_controller">Proxy Switch</string>
<string name="service_summary">Enable / Disable Proxy</string> <string name="service_summary">Enable / Disable Proxy</string>
<!-- proxy category --> <!-- proxy category -->
<string name="proxy_cat">Shadowsocks Settings</string> <string name="proxy_cat">Shadowsocks Settings</string>
<string name="proxy">Server</string> <string name="proxy">Server</string>
<string name="proxy_summary">Hostname of your Shadowsocks server</string> <string name="proxy_summary">Hostname of your Shadowsocks server</string>
<string name="remote_port">Remote Port</string> <string name="remote_port">Remote Port</string>
<string name="remote_port_summary">Remote port of shadowsocks server.</string> <string name="remote_port_summary">Remote port of shadowsocks server.</string>
<string name="port">Local Port</string> <string name="port">Local Port</string>
<string name="port_summary">Local port listening on</string> <string name="port_summary">Local port listening on</string>
<string name="sitekey">Password</string> <string name="sitekey">Password</string>
<string name="sitekey_summary">Password of your Shadowsocks server</string> <string name="sitekey_summary">Password of your Shadowsocks server</string>
<string name="enc_method">Encrypt Method</string> <string name="enc_method">Encrypt Method</string>
<array name="enc_method_entry"> <array name="enc_method_entry">
<item>Table</item> <item>Table</item>
<item>RC4</item> <item>RC4</item>
</array> </array>
<array name="enc_method_value"> <array name="enc_method_value">
<item>table</item> <item>table</item>
<item>rc4</item> <item>rc4</item>
</array> </array>
<!-- feature category --> <!-- feature category -->
<string name="feature_cat">Feature Settings</string> <string name="feature_cat">Feature Settings</string>
<string name="http_proxy">HTTP Proxy</string> <string name="http_proxy">HTTP Proxy</string>
<string name="http_proxy_summary">Local HTTP Proxy</string> <string name="http_proxy_summary">Local HTTP Proxy</string>
<string name="dns_proxy">DNS Proxy</string> <string name="dns_proxy">DNS Proxy</string>
<string name="dns_proxy_summary">Redirect DNS queries to remote server.</string> <string name="dns_proxy_summary">Redirect DNS queries to remote server.</string>
<string name="auto_set_gfwlist">CHN Route</string> <string name="auto_set_gfwlist">CHN Route</string>
<string name="auto_set_gfwlist_summary">Bypass all sites located in China <string name="auto_set_gfwlist_summary">Bypass all sites located in China
</string> </string>
<string name="auto_set_proxy">Global Proxy</string> <string name="auto_set_proxy">Global Proxy</string>
<string name="auto_set_proxy_summary">Set up system wide proxy <string name="auto_set_proxy_summary">Set up system wide proxy
</string> </string>
<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 to use with Shadowsocks:</string> <string name="proxied_help">Select apps to use with Shadowsocks:</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>
<string name="auto_connect_summary">Start Shadowsocks at the startup</string> <string name="auto_connect_summary">Start Shadowsocks at the startup</string>
<!-- notification category --> <!-- notification category -->
<string name="forward_success">Shadowsocks started</string> <string name="forward_success">Shadowsocks started</string>
<string name="service_running">Running in the background</string> <string name="service_running">Running in the background</string>
<string name="forward_fail">Shadowsocks failed to start</string> <string name="forward_fail">Shadowsocks failed to start</string>
<string name="service_stopped">Shadowsocks stopped</string> <string name="service_stopped">Shadowsocks stopped</string>
<string name="forward_stop">Shadowsocks stopped</string> <string name="forward_stop">Shadowsocks stopped</string>
<string name="service_failed">Please check your network status and try again.</string> <string name="service_failed">Please check your network status and try again.</string>
<!-- alert category --> <!-- alert category -->
<string name="ok_iknow">OK</string> <string name="ok_iknow">OK</string>
<string name="port_alert">The port number should be greater than 1024</string> <string name="port_alert">The port number should be greater than 1024</string>
<string name="port_empty">Port should not be empty</string> <string name="port_empty">Port should not be empty</string>
<string name="proxy_empty">Proxy should not be empty</string> <string name="proxy_empty">Proxy should not be empty</string>
<string name="crash_alert">An unexpected exit detected, context has been recovered <string name="crash_alert">An unexpected exit detected, context has been recovered
</string> </string>
<string name="connecting">Connecting…</string> <string name="connecting">Connecting…</string>
<string name="initializing">Initializing…</string> <string name="initializing">Initializing…</string>
<string name="recovering">Reseting…</string> <string name="recovering">Reseting…</string>
<string name="loading">Loading app list…</string> <string name="loading">Loading app list…</string>
<!-- menu category --> <!-- menu category -->
<string name="recovery">Reset</string> <string name="recovery">Reset</string>
<string name="about">About</string> <string name="about">About</string>
<string name="copy_rights">Shadowsocks is an open source socks proxy.\n\nYou can find more details <string name="copy_rights">Shadowsocks is an open source socks proxy.\n\nYou can find more details
here:\ngithub.com/shadowsocks here:\ngithub.com/shadowsocks
</string> </string>
<!-- array category --> <!-- array category -->
<string-array name="chn_list"> <string-array name="chn_list">
<item>0.0.0.0/7</item> <item>0.0.0.0/7</item>
<item>10.0.0.0/8</item> <item>10.0.0.0/8</item>
<item>14.0.0.0/8</item> <item>14.0.0.0/8</item>
<item>27.0.0.0/8</item> <item>27.0.0.0/8</item>
<item>36.0.0.0/8</item> <item>36.0.0.0/8</item>
<item>39.0.0.0/8</item> <item>39.0.0.0/8</item>
<item>42.0.0.0/7</item> <item>42.0.0.0/7</item>
<item>49.0.0.0/8</item> <item>49.0.0.0/8</item>
<item>58.0.0.0/7</item> <item>58.0.0.0/7</item>
<item>60.0.0.0/7</item> <item>60.0.0.0/7</item>
<item>101.0.0.0/8</item> <item>101.0.0.0/8</item>
<item>103.0.0.0/8</item> <item>103.0.0.0/8</item>
<item>106.0.0.0/8</item> <item>106.0.0.0/8</item>
<item>110.0.0.0/7</item> <item>110.0.0.0/7</item>
<item>112.0.0.0/4</item> <item>112.0.0.0/4</item>
<item>134.128.0.0/9</item> <item>134.128.0.0/9</item>
<item>139.0.0.0/9</item> <item>139.0.0.0/9</item>
<item>139.128.0.0/9</item> <item>139.128.0.0/9</item>
<item>140.0.0.0/9</item> <item>140.0.0.0/9</item>
<item>140.128.0.0/9</item> <item>140.128.0.0/9</item>
<item>144.0.0.0/9</item> <item>144.0.0.0/9</item>
<item>144.128.0.0/9</item> <item>144.128.0.0/9</item>
<item>150.0.0.0/8</item> <item>150.0.0.0/8</item>
<item>153.0.0.0/8</item> <item>153.0.0.0/8</item>
<item>157.0.0.0/9</item> <item>157.0.0.0/9</item>
<item>157.128.0.0/9</item> <item>157.128.0.0/9</item>
<item>159.128.0.0/9</item> <item>159.128.0.0/9</item>
<item>161.128.0.0/9</item> <item>161.128.0.0/9</item>
<item>162.0.0.0/9</item> <item>162.0.0.0/9</item>
<item>163.0.0.0/8</item> <item>163.0.0.0/8</item>
<item>166.0.0.0/9</item> <item>166.0.0.0/9</item>
<item>167.128.0.0/9</item> <item>167.128.0.0/9</item>
<item>168.128.0.0/9</item> <item>168.128.0.0/9</item>
<item>171.0.0.0/8</item> <item>171.0.0.0/8</item>
<item>172.0.0.0/12</item> <item>172.0.0.0/12</item>
<item>175.0.0.0/8</item> <item>175.0.0.0/8</item>
<item>180.0.0.0/8</item> <item>180.0.0.0/8</item>
<item>182.0.0.0/7</item> <item>182.0.0.0/7</item>
<item>192.112.0.0/12</item> <item>192.112.0.0/12</item>
<item>192.128.0.0/9</item> <item>192.128.0.0/9</item>
<item>202.0.0.0/7</item> <item>202.0.0.0/7</item>
<item>210.0.0.0/7</item> <item>210.0.0.0/7</item>
<item>218.0.0.0/7</item> <item>218.0.0.0/7</item>
<item>220.0.0.0/6</item> <item>220.0.0.0/6</item>
</string-array> </string-array>
</resources> </resources>
...@@ -19,64 +19,66 @@ ...@@ -19,64 +19,66 @@
<resources> <resources>
<style name="Theme.Shadow" parent="@style/Theme.Sherlock.Light.DarkActionBar"> <style name="Theme.Shadow" parent="@style/Theme.Sherlock.Light.DarkActionBar">
<item name="actionBarItemBackground">@drawable/selectable_background_shadow</item> <item name="actionBarItemBackground">@drawable/selectable_background_shadow</item>
<item name="popupMenuStyle">@style/PopupMenu.Shadow</item> <item name="popupMenuStyle">@style/PopupMenu.Shadow</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Shadow</item> <item name="dropDownListViewStyle">@style/DropDownListView.Shadow</item>
<item name="actionBarTabStyle">@style/ActionBarTabStyle.Shadow</item> <item name="actionBarTabStyle">@style/ActionBarTabStyle.Shadow</item>
<item name="actionDropDownStyle">@style/DropDownNav.Shadow</item> <item name="actionDropDownStyle">@style/DropDownNav.Shadow</item>
<item name="actionBarStyle">@style/ActionBar.Solid.Shadow</item> <item name="actionBarStyle">@style/ActionBar.Solid.Shadow</item>
<item name="actionModeBackground">@drawable/cab_background_top_shadow</item> <item name="actionModeBackground">@drawable/cab_background_top_shadow</item>
<item name="actionModeSplitBackground">@drawable/cab_background_bottom_shadow</item> <item name="actionModeSplitBackground">@drawable/cab_background_bottom_shadow</item>
<item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Shadow</item> <item name="actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Shadow</item>
<!-- Light.DarkActionBar specific --> <!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">@style/Theme.Shadow.Widget</item> <item name="actionBarWidgetTheme">@style/Theme.Shadow.Widget</item>
</style> </style>
<style name="ActionBar.Solid.Shadow" parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse"> <style name="ActionBar.Solid.Shadow"
<item name="background">@drawable/ab_solid_shadow</item> parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="backgroundStacked">@drawable/ab_stacked_solid_shadow</item> <item name="background">@drawable/ab_solid_shadow</item>
<item name="backgroundSplit">@drawable/ab_bottom_solid_shadow</item> <item name="backgroundStacked">@drawable/ab_stacked_solid_shadow</item>
<item name="progressBarStyle">@style/ProgressBar.Shadow</item> <item name="backgroundSplit">@drawable/ab_bottom_solid_shadow</item>
</style> <item name="progressBarStyle">@style/ProgressBar.Shadow</item>
</style>
<style name="ActionBar.Transparent.Shadow" parent="@style/Widget.Sherlock.ActionBar">
<item name="background">@drawable/ab_transparent_shadow</item> <style name="ActionBar.Transparent.Shadow" parent="@style/Widget.Sherlock.ActionBar">
<item name="progressBarStyle">@style/ProgressBar.Shadow</item> <item name="background">@drawable/ab_transparent_shadow</item>
</style> <item name="progressBarStyle">@style/ProgressBar.Shadow</item>
</style>
<style name="PopupMenu.Shadow" parent="@style/Widget.Sherlock.ListPopupWindow">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item> <style name="PopupMenu.Shadow" parent="@style/Widget.Sherlock.ListPopupWindow">
</style> <item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item>
</style>
<style name="DropDownListView.Shadow" parent="@style/Widget.Sherlock.ListView.DropDown">
<item name="android:listSelector">@drawable/selectable_background_shadow</item> <style name="DropDownListView.Shadow" parent="@style/Widget.Sherlock.ListView.DropDown">
</style> <item name="android:listSelector">@drawable/selectable_background_shadow</item>
</style>
<style name="ActionBarTabStyle.Shadow" parent="@style/Widget.Sherlock.ActionBar.TabView">
<item name="android:background">@drawable/tab_indicator_ab_shadow</item> <style name="ActionBarTabStyle.Shadow" parent="@style/Widget.Sherlock.ActionBar.TabView">
</style> <item name="android:background">@drawable/tab_indicator_ab_shadow</item>
</style>
<style name="DropDownNav.Shadow" parent="@style/Widget.Sherlock.Spinner.DropDown.ActionBar">
<item name="android:background">@drawable/spinner_background_ab_shadow</item> <style name="DropDownNav.Shadow" parent="@style/Widget.Sherlock.Spinner.DropDown.ActionBar">
<item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item> <item name="android:background">@drawable/spinner_background_ab_shadow</item>
<item name="android:dropDownSelector">@drawable/selectable_background_shadow</item> <item name="android:popupBackground">@drawable/menu_dropdown_panel_shadow</item>
</style> <item name="android:dropDownSelector">@drawable/selectable_background_shadow</item>
</style>
<style name="ProgressBar.Shadow" parent="@style/Widget.Sherlock.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_horizontal_shadow</item> <style name="ProgressBar.Shadow" parent="@style/Widget.Sherlock.ProgressBar.Horizontal">
</style> <item name="android:progressDrawable">@drawable/progress_horizontal_shadow</item>
</style>
<style name="ActionButton.CloseMode.Shadow" parent="@style/Widget.Sherlock.ActionButton.CloseMode">
<item name="android:background">@drawable/btn_cab_done_shadow</item> <style name="ActionButton.CloseMode.Shadow"
</style> parent="@style/Widget.Sherlock.ActionButton.CloseMode">
<item name="android:background">@drawable/btn_cab_done_shadow</item>
<!-- this style is only referenced in a Light.DarkActionBar based theme --> </style>
<style name="Theme.Shadow.Widget" parent="@style/Theme.Sherlock">
<item name="popupMenuStyle">@style/PopupMenu.Shadow</item> <!-- this style is only referenced in a Light.DarkActionBar based theme -->
<item name="dropDownListViewStyle">@style/DropDownListView.Shadow</item> <style name="Theme.Shadow.Widget" parent="@style/Theme.Sherlock">
</style> <item name="popupMenuStyle">@style/PopupMenu.Shadow</item>
<item name="dropDownListViewStyle">@style/DropDownListView.Shadow</item>
</style>
</resources> </resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:key="isHTTPProxy" android:key="isHTTPProxy"
android:summary="@string/http_proxy_summary" android:summary="@string/http_proxy_summary"
android:title="@string/http_proxy"> android:title="@string/http_proxy">
</CheckBoxPreference> </CheckBoxPreference>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="isDNSProxy" android:key="isDNSProxy"
android:summary="@string/dns_proxy_summary" android:summary="@string/dns_proxy_summary"
android:title="@string/dns_proxy"> android:title="@string/dns_proxy">
</CheckBoxPreference> </CheckBoxPreference>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="isGFWList" android:key="isGFWList"
android:summary="@string/auto_set_gfwlist_summary" android:summary="@string/auto_set_gfwlist_summary"
android:title="@string/auto_set_gfwlist"> android:title="@string/auto_set_gfwlist">
</CheckBoxPreference> </CheckBoxPreference>
<CheckBoxPreference <CheckBoxPreference
android:defaultValue="true" android:defaultValue="true"
android:key="isGlobalProxy" android:key="isGlobalProxy"
android:disableDependentsState="true" android:disableDependentsState="true"
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 <CheckBoxPreference
android:defaultValue="false" android:defaultValue="false"
android:dependency="isGlobalProxy" android:dependency="isGlobalProxy"
android:key="isBypassApps" android:key="isBypassApps"
android:summary="@string/bypass_apps_summary" android:summary="@string/bypass_apps_summary"
android:title="@string/bypass_apps"> android:title="@string/bypass_apps">
</CheckBoxPreference> </CheckBoxPreference>
<Preference <Preference
android:key="proxyedApps" android:key="proxyedApps"
android:dependency="isGlobalProxy" android:dependency="isGlobalProxy"
android:summary="@string/proxied_apps_summary" android:summary="@string/proxied_apps_summary"
android:title="@string/proxied_apps"> android:title="@string/proxied_apps">
<intent android:action="com.github.shadowsocks.AppManager"/> <intent android:action="com.github.shadowsocks.AppManager"/>
</Preference> </Preference>
<CheckBoxPreference <CheckBoxPreference
android:key="isAutoConnect" android:key="isAutoConnect"
android:summary="@string/auto_connect_summary" android:summary="@string/auto_connect_summary"
android:title="@string/auto_connect"> android:title="@string/auto_connect">
</CheckBoxPreference> </CheckBoxPreference>
</PreferenceScreen> </PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.shadowsocks.preferences.SummaryEditTextPreference <com.github.shadowsocks.preferences.SummaryEditTextPreference
android:defaultValue="198.199.101.152" android:defaultValue="198.199.101.152"
android:key="proxy" android:key="proxy"
android:summary="@string/proxy_summary" android:summary="@string/proxy_summary"
android:title="@string/proxy"> android:title="@string/proxy">
</com.github.shadowsocks.preferences.SummaryEditTextPreference> </com.github.shadowsocks.preferences.SummaryEditTextPreference>
<com.github.shadowsocks.preferences.SummaryEditTextPreference <com.github.shadowsocks.preferences.SummaryEditTextPreference
android:defaultValue="443" android:defaultValue="443"
android:key="remotePort" android:key="remotePort"
android:summary="@string/remote_port_summary" android:summary="@string/remote_port_summary"
android:title="@string/remote_port"> android:title="@string/remote_port">
</com.github.shadowsocks.preferences.SummaryEditTextPreference> </com.github.shadowsocks.preferences.SummaryEditTextPreference>
<com.github.shadowsocks.preferences.SummaryEditTextPreference <com.github.shadowsocks.preferences.SummaryEditTextPreference
android:defaultValue="1080" android:defaultValue="1080"
android:key="port" android:key="port"
android:summary="@string/port_summary" android:summary="@string/port_summary"
android:title="@string/port"> android:title="@string/port">
</com.github.shadowsocks.preferences.SummaryEditTextPreference> </com.github.shadowsocks.preferences.SummaryEditTextPreference>
<com.github.shadowsocks.preferences.SummaryEditTextPreference <com.github.shadowsocks.preferences.SummaryEditTextPreference
android:defaultValue="u1rRWTssNv0p" android:defaultValue="u1rRWTssNv0p"
android:key="sitekey" android:key="sitekey"
android:summary="@string/sitekey_summary" android:summary="@string/sitekey_summary"
android:title="@string/sitekey"> android:title="@string/sitekey">
</com.github.shadowsocks.preferences.SummaryEditTextPreference> </com.github.shadowsocks.preferences.SummaryEditTextPreference>
<ListPreference <ListPreference
android:defaultValue="rc4" android:defaultValue="rc4"
android:key="encMethod" android:key="encMethod"
android:entries="@array/enc_method_entry" android:entries="@array/enc_method_entry"
android:entryValues="@array/enc_method_value" android:entryValues="@array/enc_method_value"
android:title="@string/enc_method"> android:title="@string/enc_method">
</ListPreference> </ListPreference>
</PreferenceScreen> </PreferenceScreen>
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android" <preference-headers
xmlns:unified="http://schemas.android.com/apk/res-auto"> xmlns:unified="http://schemas.android.com/apk/res-auto">
<header <header
unified:fragment="com.github.shadowsocks.Shadowsocks$ProxyFragment" unified:fragment="com.github.shadowsocks.Shadowsocks$ProxyFragment"
unified:title="@string/proxy_cat" unified:title="@string/proxy_cat"
unified:preferenceRes="@xml/pref_proxy"/> unified:preferenceRes="@xml/pref_proxy"/>
<header <header
unified:fragment="com.github.shadowsocks.Shadowsocks$FeatureFragment" unified:fragment="com.github.shadowsocks.Shadowsocks$FeatureFragment"
unified:title="@string/feature_cat" unified:title="@string/feature_cat"
unified:preferenceRes="@xml/pref_feature"/> unified:preferenceRes="@xml/pref_feature"/>
</preference-headers> </preference-headers>
\ No newline at end of file
This diff is collapsed.
...@@ -27,46 +27,41 @@ import java.io.FileDescriptor; ...@@ -27,46 +27,41 @@ import java.io.FileDescriptor;
*/ */
public class Exec { public class Exec {
static { static {
java.lang.System.loadLibrary("exec"); java.lang.System.loadLibrary("exec");
} }
/** /** Close a given file descriptor. */
* Close a given file descriptor. public static native void close(FileDescriptor fd);
*/
public static native void close(FileDescriptor fd);
/** /**
* Create a subprocess. Differs from java.lang.ProcessBuilder in that a pty * Create a subprocess. Differs from java.lang.ProcessBuilder in that a pty
* is used to communicate with the subprocess. * is used to communicate with the subprocess.
* <p/> * <p/>
* Callers are responsible for calling Exec.close() on the returned file * Callers are responsible for calling Exec.close() on the returned file
* descriptor. * descriptor.
* *
* @param rdt Whether redirect stdout and stderr * @param rdt Whether redirect stdout and stderr
* @param cmd The command to execute. * @param cmd The command to execute.
* @param args An array of arguments to the command. * @param args An array of arguments to the command.
* @param envVars An array of strings of the form "VAR=value" to be added to the * @param envVars An array of strings of the form "VAR=value" to be added to the
* environment of the process. * environment of the process.
* @param scripts The scripts to execute. * @param scripts The scripts to execute.
* @param processId A one-element array to which the process ID of the started * @param processId A one-element array to which the process ID of the started
* process will be written. * process will be written.
* @return File descriptor * @return File descriptor
*/ */
public static native FileDescriptor createSubprocess(int rdt, String cmd, public static native FileDescriptor createSubprocess(int rdt, String cmd, String[] args,
String[] args, String[] envVars, String[] envVars, String scripts, int[] processId);
String scripts, int[] processId);
/** /** Send SIGHUP to a process group. */
* Send SIGHUP to a process group. public static native void hangupProcessGroup(int processId);
*/
public static native void hangupProcessGroup(int processId);
/** /**
* Causes the calling thread to wait for the process associated with the * Causes the calling thread to wait for the process associated with the
* receiver to finish executing. * receiver to finish executing.
* *
* @return The exit value of the Process being waited on * @return The exit value of the Process being waited on
*/ */
public static native int waitFor(int processId); public static native int waitFor(int processId);
} }
This diff is collapsed.
...@@ -42,12 +42,12 @@ import android.content.Context; ...@@ -42,12 +42,12 @@ import android.content.Context;
public class ImageLoaderFactory { public class ImageLoaderFactory {
private static ImageLoader il = null; private static ImageLoader il = null;
public static ImageLoader getImageLoader(Context context) { public static ImageLoader getImageLoader(Context context) {
if (il == null) { if (il == null) {
il = new ImageLoader(context); il = new ImageLoader(context);
}
return il;
} }
return il;
}
} }
...@@ -40,94 +40,70 @@ package com.github.shadowsocks; ...@@ -40,94 +40,70 @@ package com.github.shadowsocks;
public class ProxyedApp { public class ProxyedApp {
private boolean enabled; private boolean enabled;
private int uid; private int uid;
private String username; private String username;
private String procname; private String procname;
private String name; private String name;
private boolean proxyed = false; private boolean proxyed = false;
/** /** @return the name */
* @return the name public String getName() {
*/ return name;
public String getName() { }
return name;
}
/** /** @param name the name to set */
* @param name the name to set public void setName(String name) {
*/ this.name = name;
public void setName(String name) { }
this.name = name;
}
/** /** @return the procname */
* @return the procname public String getProcname() {
*/ return procname;
public String getProcname() { }
return procname;
}
/** /** @param procname the procname to set */
* @param procname the procname to set public void setProcname(String procname) {
*/ this.procname = procname;
public void setProcname(String procname) { }
this.procname = procname;
}
/** /** @return the uid */
* @return the uid public int getUid() {
*/ return uid;
public int getUid() { }
return uid;
}
/** /** @param uid the uid to set */
* @param uid the uid to set public void setUid(int uid) {
*/ this.uid = uid;
public void setUid(int uid) { }
this.uid = uid;
}
/** /** @return the username */
* @return the username public String getUsername() {
*/ return username;
public String getUsername() { }
return username;
}
/** /** @param username the username to set */
* @param username the username to set public void setUsername(String username) {
*/ this.username = username;
public void setUsername(String username) { }
this.username = username;
}
/** /** @return the enabled */
* @return the enabled public boolean isEnabled() {
*/ return enabled;
public boolean isEnabled() { }
return enabled;
}
/** /** @param enabled the enabled to set */
* @param enabled the enabled to set public void setEnabled(boolean enabled) {
*/ this.enabled = enabled;
public void setEnabled(boolean enabled) { }
this.enabled = enabled;
}
/** /** @return the proxyed */
* @return the proxyed public boolean isProxyed() {
*/ return proxyed;
public boolean isProxyed() { }
return proxyed;
}
/** /** @param proxyed the proxyed to set */
* @param proxyed the proxyed to set public void setProxyed(boolean proxyed) {
*/ this.proxyed = proxyed;
public void setProxyed(boolean proxyed) { }
this.proxyed = proxyed;
}
} }
This diff is collapsed.
...@@ -43,16 +43,15 @@ import com.google.analytics.tracking.android.EasyTracker; ...@@ -43,16 +43,15 @@ import com.google.analytics.tracking.android.EasyTracker;
public class ShadowsocksApplication extends Application { public class ShadowsocksApplication extends Application {
private static String sTmpDir; private static String sTmpDir;
public static String getTmpDir() { public static String getTmpDir() {
return sTmpDir; return sTmpDir;
} }
@Override
public void onCreate() {
EasyTracker.getInstance().setContext(this);
sTmpDir = getCacheDir().getAbsolutePath();
}
@Override
public void onCreate() {
EasyTracker.getInstance().setContext(this);
sTmpDir = getCacheDir().getAbsolutePath();
}
} }
...@@ -47,47 +47,47 @@ import android.preference.PreferenceManager; ...@@ -47,47 +47,47 @@ import android.preference.PreferenceManager;
public class ShadowsocksReceiver extends BroadcastReceiver { public class ShadowsocksReceiver extends BroadcastReceiver {
private static final String TAG = "Shadowsocks"; private static final String TAG = "Shadowsocks";
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (intent != null) { if (intent != null) {
final String action = intent.getAction(); final String action = intent.getAction();
if (action.equals(Intent.ACTION_SHUTDOWN)) { if (action.equals(Intent.ACTION_SHUTDOWN)) {
context.stopService(new Intent(context, ShadowsocksService.class)); context.stopService(new Intent(context, ShadowsocksService.class));
return; return;
} }
} }
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
String versionName;
try {
versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
versionName = "NONE";
}
final boolean isAutoConnect = settings.getBoolean("isAutoConnect", false); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
final boolean isInstalled = settings.getBoolean(versionName, false); String versionName;
try {
versionName =
context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
versionName = "NONE";
}
if (isAutoConnect && isInstalled) { final boolean isAutoConnect = settings.getBoolean("isAutoConnect", false);
final String portText = settings.getString("port", ""); final boolean isInstalled = settings.getBoolean(versionName, false);
if (portText == null || portText.length() <= 0) {
return;
}
try {
int port = Integer.valueOf(portText);
if (port <= 1024) {
return;
}
} catch (Exception e) {
return;
}
Intent it = new Intent(context, ShadowsocksService.class); if (isAutoConnect && isInstalled) {
context.startService(it); final String portText = settings.getString("port", "");
if (portText == null || portText.length() <= 0) {
return;
}
try {
int port = Integer.valueOf(portText);
if (port <= 1024) {
return;
} }
} } catch (Exception e) {
return;
}
Intent it = new Intent(context, ShadowsocksService.class);
context.startService(it);
}
}
} }
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
package com.github.shadowsocks; package com.github.shadowsocks;
public class System { public class System {
static { static {
java.lang.System.loadLibrary("system"); java.lang.System.loadLibrary("system");
} }
public static native void exec(String cmd); public static native void exec(String cmd);
} }
This diff is collapsed.
...@@ -3,36 +3,31 @@ package com.github.shadowsocks.preferences; ...@@ -3,36 +3,31 @@ package com.github.shadowsocks.preferences;
import android.content.Context; import android.content.Context;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
import android.util.AttributeSet; import android.util.AttributeSet;
import com.github.shadowsocks.R;
public class SummaryEditTextPreference extends EditTextPreference { public class SummaryEditTextPreference extends EditTextPreference {
private CharSequence mDefaultSummary; private CharSequence mDefaultSummary;
public SummaryEditTextPreference(Context context, AttributeSet attrs, int defStyle) { public SummaryEditTextPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
mDefaultSummary = getSummary(); mDefaultSummary = getSummary();
} }
public SummaryEditTextPreference(Context context, AttributeSet attrs) { public SummaryEditTextPreference(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mDefaultSummary = getSummary(); mDefaultSummary = getSummary();
} }
public SummaryEditTextPreference(Context context) { public SummaryEditTextPreference(Context context) {
super(context); super(context);
} }
@Override @Override
public void onDialogClosed(boolean positiveResult) { public void setSummary(CharSequence summary) {
super.onDialogClosed(positiveResult); if (summary.toString().isEmpty()) {
if (positiveResult) { super.setSummary(mDefaultSummary);
String value = getEditText().getText().toString(); } else {
if (value.isEmpty()) { super.setSummary(summary);
setSummary(mDefaultSummary);
} else {
setSummary(value);
}
}
} }
}
} }
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