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 | |
parent | e5e9ac6e43b9cdec0f362711bb33747ab73fc297 (diff) |
Button with circle progress, added.
Next step: a bit of UI design, removing the switch.
-rw-r--r-- | app/build.gradle | 1 | ||||
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/EipFragment.java | 24 | ||||
-rw-r--r-- | app/src/main/res/layout/eip_service_fragment.xml | 20 | ||||
-rw-r--r-- | app/src/main/res/values/dimens.xml | 1 | ||||
-rw-r--r-- | build.gradle | 1 |
5 files changed, 45 insertions, 2 deletions
diff --git a/app/build.gradle b/app/build.gradle index c4286d29..77769989 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -46,6 +46,7 @@ dependencies { compile 'com.intellij:annotations:12.0' compile 'com.google.code.gson:gson:2+' compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0' + compile 'mbanje.kurt:fabbutton:1.0.9' } def processFileInplace(file, Closure processText) { 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); } } diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml index 6adcfab0..0cc1df7d 100644 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ b/app/src/main/res/layout/eip_service_fragment.xml @@ -48,4 +48,24 @@ android:layout_toRightOf="@+id/status_message" android:layout_toEndOf="@+id/status_message" /> + <view + android:id="@+id/vpn.Status.Image" + android:layout_width="@dimen/progress_button" + android:color="@android:color/holo_blue_dark" + android:layout_height="@dimen/progress_button" + class="mbanje.kurt.fabbutton.FabButton" + android:layout_gravity="center" + android:visibility="visible" + android:layout_centerInParent="true" + android:indeterminate="true" + android:max="100" + fbb_autoStart="true" + fbb_progressColor="#ff170aff" + fbb_progressWidthRatio="0.1" + fbb_showEndBitmap="true" + android:layout_toRightOf="@id/eipSwitch" + android:layout_toEndOf="@id/eipSwitch" + android:layout_alignTop="@id/eipSwitch" + /> + </RelativeLayout> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 727f5a78..4e8dad45 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -17,4 +17,5 @@ <dimen name="round_button_diameter">56dp</dimen> <dimen name="switchbar_pad">16dp</dimen> <dimen name="vpn_setting_padding">16dp</dimen> + <dimen name="progress_button">32dp</dimen> </resources>
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 0b8e4725..51725d4c 100644 --- a/build.gradle +++ b/build.gradle @@ -14,5 +14,6 @@ buildscript { allprojects { repositories { mavenCentral() + jcenter() } }
\ No newline at end of file |