diff options
-rw-r--r-- | AndroidManifest.xml | 11 | ||||
-rw-r--r-- | res/drawable-hdpi/ic_vpn_disconnected.png | bin | 0 -> 801 bytes | |||
-rw-r--r-- | res/drawable-ldpi/ic_vpn_disconnected.png | bin | 0 -> 455 bytes | |||
-rw-r--r-- | res/drawable-mdpi/ic_vpn_disconnected.png | bin | 0 -> 586 bytes | |||
-rw-r--r-- | res/drawable-xhdpi/ic_vpn_disconnected.png | bin | 0 -> 1091 bytes | |||
-rwxr-xr-x | res/values/strings.xml | 3 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/EipServiceFragment.java | 12 | ||||
-rw-r--r-- | src/se/leap/openvpn/OpenVpnService.java | 26 |
8 files changed, 27 insertions, 25 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index df0eba0f..3f774183 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -124,17 +124,6 @@ </intent-filter> </activity> - <activity-alias - android:name="se.leap.openvpn.app.CreateShortcuts" - android:label="@string/vpn_shortcut" - android:targetActivity="se.leap.openvpn.LaunchVPN" > - <intent-filter> - <action android:name="android.intent.action.CREATE_SHORTCUT" /> - - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - </activity-alias> - <provider android:name="se.leap.openvpn.FileProvider" android:authorities="se.leap.openvpn.FileProvider" diff --git a/res/drawable-hdpi/ic_vpn_disconnected.png b/res/drawable-hdpi/ic_vpn_disconnected.png Binary files differnew file mode 100644 index 00000000..dfb962b9 --- /dev/null +++ b/res/drawable-hdpi/ic_vpn_disconnected.png diff --git a/res/drawable-ldpi/ic_vpn_disconnected.png b/res/drawable-ldpi/ic_vpn_disconnected.png Binary files differnew file mode 100644 index 00000000..22f3497e --- /dev/null +++ b/res/drawable-ldpi/ic_vpn_disconnected.png diff --git a/res/drawable-mdpi/ic_vpn_disconnected.png b/res/drawable-mdpi/ic_vpn_disconnected.png Binary files differnew file mode 100644 index 00000000..f8b02bfb --- /dev/null +++ b/res/drawable-mdpi/ic_vpn_disconnected.png diff --git a/res/drawable-xhdpi/ic_vpn_disconnected.png b/res/drawable-xhdpi/ic_vpn_disconnected.png Binary files differnew file mode 100644 index 00000000..7f44c46f --- /dev/null +++ b/res/drawable-xhdpi/ic_vpn_disconnected.png diff --git a/res/values/strings.xml b/res/values/strings.xml index 8281be25..91e72a60 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -321,5 +321,6 @@ <string name="eip_cancel_connect_text">There is a connection attempt in progress. Do you wish to cancel it?</string> <string name="eip_cancel_connect_cancel">Yes</string> <string name="eip_cancel_connect_false">No</string> - + <string name="eip_state_not_connected">"Not running! Connection not secure!"</string> + <string name="eip_state_connected">Connection Secure.</string> </resources> diff --git a/src/se/leap/bitmaskclient/EipServiceFragment.java b/src/se/leap/bitmaskclient/EipServiceFragment.java index daf446a5..1b2cfb20 100644 --- a/src/se/leap/bitmaskclient/EipServiceFragment.java +++ b/src/se/leap/bitmaskclient/EipServiceFragment.java @@ -132,6 +132,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli @Override public void onClick(DialogInterface dialog, int which) { eipCommand(EIP.ACTION_STOP_EIP); + mEipStartPending = false; } }) .setNegativeButton(getResources().getString(R.string.eip_cancel_connect_false), new DialogInterface.OnClickListener() { @@ -177,18 +178,21 @@ public class EipServiceFragment extends Fragment implements StateListener, OnCli String statusMessage = ""; String prefix = getString(localizedResId); if (state.equals("CONNECTED")){ - statusMessage = "Connection Secure"; + statusMessage = getString(R.string.eip_state_connected); getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE); mEipStartPending = false; } else if (state.equals("BYTECOUNT")) { statusMessage = logmessage; } else if ( (state.equals("NOPROCESS") && !mEipStartPending ) || state.equals("EXITING")) { - statusMessage = "Not running! Connection not secure!"; + statusMessage = getString(R.string.eip_state_not_connected); getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE); mEipStartPending = false; switchState = false; - } else { - statusMessage = prefix + logmessage; + } else if (state.equals("NOPROCESS")){ + statusMessage = logmessage; + } + else { + statusMessage = prefix + " " + logmessage; } eipAutoSwitched = true; diff --git a/src/se/leap/openvpn/OpenVpnService.java b/src/se/leap/openvpn/OpenVpnService.java index bec7dcee..620de204 100644 --- a/src/se/leap/openvpn/OpenVpnService.java +++ b/src/se/leap/openvpn/OpenVpnService.java @@ -7,7 +7,6 @@ import java.util.Vector; import se.leap.bitmaskclient.Dashboard; import se.leap.bitmaskclient.R; - import android.annotation.TargetApi; import android.app.Notification; import android.app.NotificationManager; @@ -103,12 +102,16 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac } } - private void showNotification(String msg, String tickerText, boolean lowpriority, long when, boolean persistant) { + private void showNotification(String state, String msg, String tickerText, boolean lowpriority, long when, boolean persistant) { String ns = Context.NOTIFICATION_SERVICE; mNotificationManager = (NotificationManager) getSystemService(ns); - - - int icon = R.drawable.ic_stat_vpn; + int icon; + if (state.equals("NOPROCESS") || state.equals("AUTH_FAILED") || state.equals("NONETWORK")){ + icon = R.drawable.ic_vpn_disconnected; + }else{ + icon = R.drawable.ic_stat_vpn; + } + android.app.Notification.Builder nbuilder = new Notification.Builder(this); nbuilder.setContentTitle(getString(R.string.notifcation_title,mProfile.mName)); @@ -465,8 +468,7 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // If the process is not running, ignore any state, // Notification should be invisible in this state if(mProcessThread==null) - return; - + return; if("CONNECTED".equals(state)) { mNotificationManager.cancel(OPENVPN_STATUS); } else if(!"BYTECOUNT".equals(state)) { @@ -475,8 +477,14 @@ public class OpenVpnService extends VpnService implements StateListener, Callbac // This also mean we are no longer connected, ignore bytecount messages until next // CONNECTED String ticker = getString(resid); - boolean persist = ("NOPROCESS".equals(state)) ? false : true; - showNotification(getString(resid) +" " + logmessage,ticker,false,0,persist); + boolean persist = false; + if (("NOPROCESS".equals(state) ) || ("EXIT").equals(state)){ + showNotification(state, getString(R.string.eip_state_not_connected), ticker, false, 0, persist); + } + else{ + persist = true; + showNotification(state, getString(resid) +" " + logmessage,ticker,false,0,persist); + } } } |