summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-06-12 11:25:49 +0200
committerParménides GV <parmegv@sdf.org>2014-06-12 11:25:49 +0200
commit4a020a0116f1d3b8ea2a87e64cc8e6a926c0c179 (patch)
tree5ea2bbb1c7d28c169020ada88dde9a684d9f108c /app
parentac43a914c9720e6950708d3c22d17f8f6cd0aae0 (diff)
Menu option to show the log window.
In case there is an error, user will not be prompted with a strange log window, but the app will provide it if s/he really wants to see it.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/Dashboard.java6
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java20
-rw-r--r--app/src/main/res/menu/client_dashboard.xml4
3 files changed, 16 insertions, 14 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
index 6f18b79a..f2763d84 100644
--- a/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
+++ b/app/src/main/java/se/leap/bitmaskclient/Dashboard.java
@@ -22,6 +22,7 @@ import org.json.JSONObject;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.ProviderAPIResultReceiver.Receiver;
import se.leap.bitmaskclient.SignUpDialog;
+import de.blinkt.openvpn.activities.LogWindow;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DialogFragment;
@@ -228,6 +229,11 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
intent = new Intent(this, AboutActivity.class);
startActivity(intent);
return true;
+ case R.id.log_window:
+ Intent startLW = new Intent(getAppContext(), LogWindow.class);
+ startLW.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
+ startActivity(startLW);
+ return true;
case R.id.switch_provider:
if (Provider.getInstance().hasEIP()){
if (getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE).getBoolean(EIP.AUTHED_EIP, false)){
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
index 89319ea1..b72f9ff9 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipServiceFragment.java
@@ -204,7 +204,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnChe
}
@Override
- public void updateState(final String state, final String logmessage, final int localizedResId, ConnectionStatus level) {
+ public void updateState(final String state, final String logmessage, final int localizedResId, final ConnectionStatus level) {
// Note: "states" are not organized anywhere...collected state strings:
// NOPROCESS,NONETWORK,BYTECOUNT,AUTH_FAILED + some parsing thing ( WAIT(?),AUTH,GET_CONFIG,ASSIGN_IP,CONNECTED,SIGINT )
getActivity().runOnUiThread(new Runnable() {
@@ -215,26 +215,17 @@ public class EipServiceFragment extends Fragment implements StateListener, OnChe
boolean switchState = true;
String statusMessage = "";
String prefix = getString(localizedResId);
- if (state.equals("CONNECTED")){
-
+ if (level == ConnectionStatus.LEVEL_CONNECTED){
statusMessage = getString(R.string.eip_state_connected);
getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
mEipStartPending = false;
- } else if (state.equals("BYTECOUNT")) {
- statusMessage = getString(R.string.eip_state_connected); getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
- mEipStartPending = false;
-
- } else if ( (state.equals("NOPROCESS") && !mEipStartPending ) || state.equals("EXITING") && !mEipStartPending || state.equals("FATAL")) {
+ } else if ( level == ConnectionStatus.LEVEL_NONETWORK || level == ConnectionStatus.LEVEL_NOTCONNECTED || level == ConnectionStatus.LEVEL_AUTH_FAILED) {
statusMessage = getString(R.string.eip_state_not_connected);
getActivity().findViewById(R.id.eipProgress).setVisibility(View.GONE);
mEipStartPending = false;
switchState = false;
- } else if (state.equals("NOPROCESS")){
- statusMessage = logmessage;
- } else if (state.equals("ASSIGN_IP")){ //don't show assigning message in eipStatus
- statusMessage = (String) eipStatus.getText();
- }
- else {
+ } else if (level == ConnectionStatus.LEVEL_CONNECTING_SERVER_REPLIED) {
+ if(state.equals("AUTH") || state.equals("GET_CONFIG"))
statusMessage = prefix + " " + logmessage;
}
@@ -279,6 +270,7 @@ public class EipServiceFragment extends Fragment implements StateListener, OnChe
switch (resultCode){
case Activity.RESULT_OK:
checked = true;
+ eipFragment.findViewById(R.id.eipProgress).setVisibility(View.VISIBLE);
break;
case Activity.RESULT_CANCELED:
checked = false;
diff --git a/app/src/main/res/menu/client_dashboard.xml b/app/src/main/res/menu/client_dashboard.xml
index 663231cd..9bc39d7b 100644
--- a/app/src/main/res/menu/client_dashboard.xml
+++ b/app/src/main/res/menu/client_dashboard.xml
@@ -4,6 +4,10 @@
android:orderInCategory="110"
android:title="@string/about"/>
<item
+ android:id="@+id/log_window"
+ android:title="@string/show_log_window"
+ android:visible="true"/>
+ <item
android:id="@+id/switch_provider"
android:orderInCategory="501"
android:title="@string/switch_provider_menu_option"/>