commit a1ba41ce0b183f8524bc99e2b9267e5adec9b5cb Author: Nathan Freitas nathan@freitas.net Date: Sat Feb 14 02:30:02 2015 -0500
add a bridge toggle button --- res/layout/layout_main.xml | 16 ++++++++++---- res/values/strings.xml | 2 +- src/org/torproject/android/OrbotMainActivity.java | 23 +++++++++++++++++++++ 3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/res/layout/layout_main.xml b/res/layout/layout_main.xml index 7abd037..5f48818 100644 --- a/res/layout/layout_main.xml +++ b/res/layout/layout_main.xml @@ -146,7 +146,7 @@ android:textSize="14sp" android:gravity="center_vertical" android:fontFamily="sans-serif-light" - android:text="status" + android:text="" android:background="#aa333333" android:layout_gravity="center_horizontal|bottom" android:layout_margin="10dp" @@ -167,15 +167,23 @@ android:id="@+id/btnBrowser" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Open Browser" + android:text="@string/menu_verify_browser" /> <ToggleButton + android:id="@+id/btnBridges" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textOff="@string/bridges" + android:textOn="@string/bridges" + /> + + <ToggleButton android:id="@+id/btnVPN" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textOff="VPN Off" - android:textOn="VPN On" + android:textOff="@string/menu_vpn" + android:textOn="@string/menu_vpn" /> </LinearLayout> diff --git a/res/values/strings.xml b/res/values/strings.xml index f699314..d3bf0dd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -301,5 +301,5 @@ <string name="you_do_not_have_root_access_enabled">You do not have ROOT access enabled</string> <string name="you_may_need_to_stop_and_start_orbot_for_settings_change_to_be_enabled_">You may need to stop and start Orbot for settings change to be enabled.</string>
- <string name="menu_vpn">Start VPN</string> + <string name="menu_vpn">VPN</string> </resources> diff --git a/src/org/torproject/android/OrbotMainActivity.java b/src/org/torproject/android/OrbotMainActivity.java index f0ba484..af5c2e5 100644 --- a/src/org/torproject/android/OrbotMainActivity.java +++ b/src/org/torproject/android/OrbotMainActivity.java @@ -75,6 +75,8 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC
private Button mBtnBrowser = null; private ToggleButton mBtnVPN = null; + private ToggleButton mBtnBridges = null; +
private DrawerLayout mDrawer; private ActionBarDrawerToggle mDrawerToggle; @@ -267,6 +269,27 @@ public class OrbotMainActivity extends Activity implements TorConstants, OnLongC }); + mBtnBridges = (ToggleButton)findViewById(R.id.btnBridges); + boolean useBridges = mPrefs.getBoolean("pref_bridges_enabled", false); + mBtnBridges.setChecked(useBridges); + + mBtnBridges.setOnClickListener(new View.OnClickListener () + { + + @Override + public void onClick(View v) { + + Editor edit = mPrefs.edit(); + edit.putBoolean("pref_bridges_enabled", mBtnBridges.isChecked()); + edit.commit(); + + updateSettings(); + + } + + + }); +
}