add a bridge toggle button

This commit is contained in:
Nathan Freitas 2015-02-14 02:30:02 -05:00
parent ee82b5afb1
commit a1ba41ce0b
3 changed files with 36 additions and 5 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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();
}
});
}