diff options
author | Parménides GV <parmegv@sdf.org> | 2015-04-16 13:02:06 +0200 |
---|---|---|
committer | Parménides GV <parmegv@sdf.org> | 2015-04-22 12:36:39 +0200 |
commit | cdeaf6c2ae2fa96a2ef1e0ae6c931c6d50b27271 (patch) | |
tree | 636af5c404a07142a4950ce770611ba20bb31cc3 /app/src/main/java | |
parent | e5e9ac6e43b9cdec0f362711bb33747ab73fc297 (diff) |
Button with circle progress, added.
Next step: a bit of UI design, removing the switch.
Diffstat (limited to 'app/src/main/java')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 24 |
1 files changed, 22 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 bfa67815..454530be 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -19,7 +19,6 @@ package se.leap.bitmaskclient; import android.app.*; import android.content.*; import android.os.*; -import android.util.*; import android.view.*; import android.widget.*; @@ -29,6 +28,7 @@ import java.util.*; import butterknife.*; import de.blinkt.openvpn.activities.*; +import mbanje.kurt.fabbutton.*; import se.leap.bitmaskclient.eip.*; public class EipFragment extends Fragment implements Observer { @@ -46,6 +46,8 @@ public class EipFragment extends Fragment implements Observer { TextView status_message; @InjectView(R.id.eipProgress) ProgressBar progress_bar; + @InjectView(R.id.vpn_Status_Image) + FabButton vpn_status_image; private static Dashboard dashboard; private static EIPReceiver mEIPReceiver; @@ -112,6 +114,16 @@ public class EipFragment extends Fragment implements Observer { Dashboard.preferences.edit().putBoolean(Dashboard.START_ON_BOOT, is_on).commit(); } + @OnClick(R.id.vpn_Status_Image) + void handleIcon() { + if (eip_status.isConnected() || eip_status.isConnecting()) + handleSwitchOff(); + else + handleSwitchOn(); + + saveStatus(); + } + void handleNewVpnCertificate() { handleSwitch(!eip_switch.isEnabled()); } @@ -298,11 +310,19 @@ public class EipFragment extends Fragment implements Observer { if (!eip_switch.isChecked()) { eip_switch.setChecked(true); } + if(eip_status.isConnecting()) { + vpn_status_image.showProgress(true); + vpn_status_image.setIcon(R.drawable.ic_stat_vpn_empty_halo, R.drawable.ic_stat_vpn_empty_halo); + } else { + vpn_status_image.showProgress(false); + vpn_status_image.setIcon(R.drawable.ic_stat_vpn, R.drawable.ic_stat_vpn); + } } else { - if (eip_switch.isChecked()) { eip_switch.setChecked(false); } + vpn_status_image.setIcon(R.drawable.ic_stat_vpn_offline, R.drawable.ic_stat_vpn_offline); + vpn_status_image.showProgress(false); } } |