summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java19
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java1
-rw-r--r--app/src/main/res/layout/eip_service_fragment.xml6
-rw-r--r--app/src/main/res/values-es/strings.xml3
-rw-r--r--app/src/main/res/values/strings.xml2
5 files changed, 28 insertions, 3 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.*;
diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml
index e013c7b4..b3651b51 100644
--- a/app/src/main/res/layout/eip_service_fragment.xml
+++ b/app/src/main/res/layout/eip_service_fragment.xml
@@ -15,6 +15,12 @@
android:text="@string/eip_service_label"
android:textAppearance="?android:attr/textAppearanceMedium" />
+ <Button
+ android:id="@+id/vpn.main.button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ />
+
<view
android:id="@+id/vpn.Status.Image"
android:layout_width="@dimen/progress_button"
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 42b8cce4..063c3f8b 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -77,5 +77,6 @@
<string name="logging_in_user_status">está iniciando sesión.</string>
<string name="logging_out_user_status">está cerrando sesión.</string>
<string name="signingup_message">está siendo registrado.</string>
-
+ <string name="vpn.button.turn.on">Iniciar VPN</string>
+ <string name="vpn.button.turn.off">Apagar VPN</string>
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 07bc4770..674bb7c8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -75,4 +75,6 @@
<string name="logging_in_user_status">is logging in.</string>
<string name="logging_out_user_status">is logging out.</string>
<string name="signingup_message">is being registered.</string>
+ <string name="vpn.button.turn.on">Turn on VPN</string>
+ <string name="vpn.button.turn.off">Turn off VPN</string>
</resources>