Added a button to the error dialog that allows to view the log file
authorTobias Brunner <tobias@strongswan.org>
Sat, 11 Aug 2012 14:16:45 +0000 (16:16 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 13 Aug 2012 09:28:08 +0000 (11:28 +0200)
src/frontends/android/src/org/strongswan/android/ui/VpnStateFragment.java

index b86fd18..738ed11 100644 (file)
@@ -341,16 +341,31 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
                mErrorDialog = new AlertDialog.Builder(getActivity())
                        .setMessage(getString(R.string.error_introduction) + " " + getString(textid))
                        .setCancelable(false)
+                       .setNeutralButton(R.string.show_log, new DialogInterface.OnClickListener() {
+                               @Override
+                               public void onClick(DialogInterface dialog, int which)
+                               {
+                                       dialog.dismiss();
+                                       Intent logIntent = new Intent(getActivity(), LogActivity.class);
+                                       startActivity(logIntent);
+                               }
+                       })
                        .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int id)
-                               {       /* clear the error */
-                                       mError = ErrorState.NO_ERROR;
-                                       mErrorDialog = null;
-                                       updateView();
+                               {
                                        dialog.dismiss();
                                }
                        }).create();
+               mErrorDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+                       @Override
+                       public void onDismiss(DialogInterface dialog)
+                       {       /* clear the error */
+                               mError = ErrorState.NO_ERROR;
+                               mErrorDialog = null;
+                               updateView();
+                       }
+               });
                mErrorDialog.show();
        }
 }