diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-27 18:08:59 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-27 18:08:59 +0200 |
commit | bd68fe662af7734d94a8853b38f418f19879e389 (patch) | |
tree | b64b135dfaa099ba27a8e20fc3835af4d885ba3d /app/src/main/java | |
parent | 8707f9e9a07f8c53955df14ef9b26d13a0eb60da (diff) |
Added a button to the UI
Turn on VPN touching that button, and leave the image as a mere indicator.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 19 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java | 1 |
2 files changed, 18 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 6decacb7..30147f65 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -20,6 +20,7 @@ import android.app.*; import android.content.*; import android.os.*; import android.view.*; +import android.widget.*; import org.jetbrains.annotations.*; @@ -37,10 +38,11 @@ public class EipFragment extends Fragment implements Observer { protected static final String IS_PENDING = TAG + ".is_pending"; protected static final String IS_CONNECTED = TAG + ".is_connected"; public static final String START_ON_BOOT = "start on boot"; - private static final String SHOWED_LOG = TAG + ".showed_log"; @InjectView(R.id.vpn_Status_Image) FabButton vpn_status_image; + @InjectView(R.id.vpn_main_button) + Button main_button; private static Dashboard dashboard; private static EIPReceiver mEIPReceiver; @@ -101,7 +103,7 @@ public class EipFragment extends Fragment implements Observer { Dashboard.preferences.edit().putBoolean(Dashboard.START_ON_BOOT, is_on).commit(); } - @OnClick(R.id.vpn_Status_Image) + @OnClick(R.id.vpn_main_button) void handleIcon() { if (eip_status.isConnected() || eip_status.isConnecting()) handleSwitchOff(); @@ -244,6 +246,7 @@ public class EipFragment extends Fragment implements Observer { VoidVpnService.stop(); } updateIcon(); + updateButton(); } private void updateIcon() { @@ -261,6 +264,18 @@ public class EipFragment extends Fragment implements Observer { } } + private void updateButton() { + if (eip_status.isConnected() || eip_status.isConnecting()) { + if(eip_status.isConnecting()) { + main_button.setText(dashboard.getString(android.R.string.cancel)); + } else { + main_button.setText(dashboard.getString(R.string.vpn_button_turn_off)); + } + } else { + main_button.setText(dashboard.getString(R.string.vpn_button_turn_on)); + } + } + protected class EIPReceiver extends ResultReceiver { protected EIPReceiver(Handler handler) { diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java index 1c64328e..171035d1 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -20,6 +20,7 @@ import android.content.*; import com.google.gson.*; import com.google.gson.reflect.*; +import com.google.gson.stream.JsonWriter; import org.json.*; |