From: Tobias Brunner Date: Thu, 30 May 2013 10:04:59 +0000 (+0200) Subject: android: Show remediation instructions instead of log on failure X-Git-Tag: 5.1.0dr2~2^2~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=254d8679c656beda8442122ee31a588c5d6e2eb3;p=thirdparty%2Fstrongswan.git android: Show remediation instructions instead of log on failure --- diff --git a/src/frontends/android/res/values-de/strings.xml b/src/frontends/android/res/values-de/strings.xml index 6414f11c00..7682b3bc7b 100644 --- a/src/frontends/android/res/values-de/strings.xml +++ b/src/frontends/android/res/values-de/strings.xml @@ -90,6 +90,7 @@ Assessment: Eingeschränkt Fehlgeschlagen + Korrekturanweisungen anzeigen Korrekturanweisungen diff --git a/src/frontends/android/res/values-pl/strings.xml b/src/frontends/android/res/values-pl/strings.xml index 722bc10d3c..18f886f3f7 100644 --- a/src/frontends/android/res/values-pl/strings.xml +++ b/src/frontends/android/res/values-pl/strings.xml @@ -90,6 +90,7 @@ Assessment: Restricted Failed + View remediation instructions Remediation instructions diff --git a/src/frontends/android/res/values-ru/strings.xml b/src/frontends/android/res/values-ru/strings.xml index c82350bdf8..fdb72b5491 100644 --- a/src/frontends/android/res/values-ru/strings.xml +++ b/src/frontends/android/res/values-ru/strings.xml @@ -87,6 +87,7 @@ Assessment: Restricted Failed + View remediation instructions Remediation instructions diff --git a/src/frontends/android/res/values-ua/strings.xml b/src/frontends/android/res/values-ua/strings.xml index 3d82008c72..7c9e124e32 100644 --- a/src/frontends/android/res/values-ua/strings.xml +++ b/src/frontends/android/res/values-ua/strings.xml @@ -88,6 +88,7 @@ Assessment: Restricted Failed + View remediation instructions Remediation instructions diff --git a/src/frontends/android/res/values/strings.xml b/src/frontends/android/res/values/strings.xml index b275cd5e7a..94d246416d 100644 --- a/src/frontends/android/res/values/strings.xml +++ b/src/frontends/android/res/values/strings.xml @@ -90,6 +90,7 @@ Assessment: Restricted Failed + View remediation instructions Remediation instructions diff --git a/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java b/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java index d745d8344a..3219bba7aa 100644 --- a/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java +++ b/src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java @@ -17,6 +17,9 @@ package org.strongswan.android.ui; +import java.util.ArrayList; +import java.util.List; + import org.strongswan.android.R; import org.strongswan.android.data.VpnProfile; import org.strongswan.android.logic.VpnStateService; @@ -24,6 +27,7 @@ import org.strongswan.android.logic.VpnStateService.ErrorState; import org.strongswan.android.logic.VpnStateService.State; import org.strongswan.android.logic.VpnStateService.VpnStateListener; import org.strongswan.android.logic.imc.ImcState; +import org.strongswan.android.logic.imc.RemediationInstruction; import android.app.AlertDialog; import android.app.Fragment; @@ -362,17 +366,31 @@ public class VpnStateFragment extends Fragment implements VpnStateListener private void showErrorDialog(int textid) { + final List instructions = mService.getRemediationInstructions(); + final boolean show_instructions = mImcState == ImcState.BLOCK && !instructions.isEmpty(); + int text = show_instructions ? R.string.show_remediation_instructions : R.string.show_log; + mErrorDialog = new AlertDialog.Builder(getActivity()) .setMessage(getString(R.string.error_introduction) + " " + getString(textid)) .setCancelable(false) - .setNeutralButton(R.string.show_log, new DialogInterface.OnClickListener() { + .setNeutralButton(text, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { clearError(); dialog.dismiss(); - Intent logIntent = new Intent(getActivity(), LogActivity.class); - startActivity(logIntent); + Intent intent; + if (show_instructions) + { + intent = new Intent(getActivity(), RemediationInstructionsActivity.class); + intent.putParcelableArrayListExtra(RemediationInstructionsFragment.EXTRA_REMEDIATION_INSTRUCTIONS, + new ArrayList(instructions)); + } + else + { + intent = new Intent(getActivity(), LogActivity.class); + } + startActivity(intent); } }) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {