diff options
Diffstat (limited to 'app/src/main')
-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 |
3 files changed, 43 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); } } 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 |