android: Switch to AppCompat/Material theme for dialogs
[strongswan.git] / src / frontends / android / app / src / main / java / org / strongswan / android / ui / VpnStateFragment.java
index 160ba95..f385999 100644 (file)
 
 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;
-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;
 import android.app.ProgressDialog;
 import android.app.Service;
@@ -40,6 +27,7 @@ import android.content.Intent;
 import android.content.ServiceConnection;
 import android.os.Bundle;
 import android.os.IBinder;
+import android.support.v7.app.AlertDialog;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -47,6 +35,18 @@ import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.TextView;
 
+import org.strongswan.android.R;
+import org.strongswan.android.data.VpnProfile;
+import org.strongswan.android.logic.VpnStateService;
+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 java.util.ArrayList;
+import java.util.List;
+
 public class VpnStateFragment extends Fragment implements VpnStateListener
 {
        private static final String KEY_ERROR_CONNECTION_ID = "error_connection_id";
@@ -64,7 +64,8 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
        private long mErrorConnectionID;
        private long mDismissedConnectionID;
        private VpnStateService mService;
-       private final ServiceConnection mServiceConnection = new ServiceConnection() {
+       private final ServiceConnection mServiceConnection = new ServiceConnection()
+       {
                @Override
                public void onServiceDisconnected(ComponentName name)
                {
@@ -334,18 +335,18 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
                mConnectDialog.setIndeterminate(true);
                mConnectDialog.setCancelable(false);
                mConnectDialog.setButton(DialogInterface.BUTTON_NEGATIVE,
-                         getString(android.R.string.cancel),
-                         new DialogInterface.OnClickListener()
-                         {
-                                 @Override
-                                 public void onClick(DialogInterface dialog, int which)
-                                 {
-                                         if (mService != null)
-                                         {
-                                                 mService.disconnect();
-                                         }
-                                 }
-                         });
+                                                                getString(android.R.string.cancel),
+                                                                new DialogInterface.OnClickListener()
+                                                                {
+                                                                        @Override
+                                                                        public void onClick(DialogInterface dialog, int which)
+                                                                        {
+                                                                                if (mService != null)
+                                                                                {
+                                                                                        mService.disconnect();
+                                                                                }
+                                                                        }
+                                                                });
                mConnectDialog.show();
                mProgressDialog = mConnectDialog;
        }
@@ -374,7 +375,8 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
                mErrorDialog = new AlertDialog.Builder(getActivity())
                        .setMessage(getString(R.string.error_introduction) + " " + getString(textid))
                        .setCancelable(false)
-                       .setNeutralButton(text, new DialogInterface.OnClickListener() {
+                       .setNeutralButton(text, new DialogInterface.OnClickListener()
+                       {
                                @Override
                                public void onClick(DialogInterface dialog, int which)
                                {
@@ -394,7 +396,8 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
                                        startActivity(intent);
                                }
                        })
-                       .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+                       .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
+                       {
                                @Override
                                public void onClick(DialogInterface dialog, int id)
                                {
@@ -402,7 +405,8 @@ public class VpnStateFragment extends Fragment implements VpnStateListener
                                        dialog.dismiss();
                                }
                        }).create();
-               mErrorDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+               mErrorDialog.setOnDismissListener(new DialogInterface.OnDismissListener()
+               {
                        @Override
                        public void onDismiss(DialogInterface dialog)
                        {