<activity
android:name=".ui.TrustedCertificateImportActivity"
android:label="@string/import_certificate"
- android:theme="@style/Theme.AppCompat.Dialog" >
+ android:theme="@style/AlertDialogTheme" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
package org.strongswan.android.ui;
-import org.strongswan.android.R;
-
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
+import android.support.v7.app.AlertDialog;
+import android.support.v7.app.AppCompatDialogFragment;
+
+import org.strongswan.android.R;
/**
* Class that displays a confirmation dialog to delete a selected local
* certificate.
*/
-public class CertificateDeleteConfirmationDialog extends DialogFragment
+public class CertificateDeleteConfirmationDialog extends AppCompatDialogFragment
{
public static final String ALIAS = "alias";
OnCertificateDeleteListener mListener;
package org.strongswan.android.ui;
-import android.app.Activity;
-import android.app.AlertDialog.Builder;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v7.app.ActionBar;
+import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.app.AppCompatDialogFragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
ConfirmationDialog dialog = new ConfirmationDialog();
dialog.setArguments(profileInfo);
- dialog.show(this.getFragmentManager(), DIALOG_TAG);
+ dialog.show(this.getSupportFragmentManager(), DIALOG_TAG);
return;
}
startVpnProfile(profileInfo);
{
LoginDialog login = new LoginDialog();
login.setArguments(profileInfo);
- login.show(getFragmentManager(), DIALOG_TAG);
+ login.show(getSupportFragmentManager(), DIALOG_TAG);
return;
}
prepareVpnService(profileInfo);
* Class that displays a confirmation dialog if a VPN profile is already connected
* and then initiates the selected VPN profile if the user confirms the dialog.
*/
- public static class ConfirmationDialog extends DialogFragment
+ public static class ConfirmationDialog extends AppCompatDialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
button = R.string.reconnect;
}
- return new Builder(getActivity())
+ return new AlertDialog.Builder(getActivity())
.setIcon(icon)
.setTitle(String.format(getString(title), profileInfo.getString(PROFILE_NAME)))
.setMessage(message)
* Class that displays a login dialog and initiates the selected VPN
* profile if the user confirms the dialog.
*/
- public static class LoginDialog extends DialogFragment
+ public static class LoginDialog extends AppCompatDialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
username.setText(profileInfo.getString(VpnProfileDataSource.KEY_USERNAME));
final EditText password = (EditText)view.findViewById(R.id.password);
- Builder adb = new Builder(getActivity());
+ AlertDialog.Builder adb = new AlertDialog.Builder(getActivity());
adb.setView(view);
adb.setTitle(getString(R.string.login_title));
adb.setPositiveButton(R.string.login_confirm, new DialogInterface.OnClickListener()
* Class representing an error message which is displayed if VpnService is
* not supported on the current device.
*/
- public static class VpnNotSupportedError extends DialogFragment
+ public static class VpnNotSupportedError extends AppCompatDialogFragment
{
static final String ERROR_MESSAGE_ID = "org.strongswan.android.VpnNotSupportedError.MessageId";
- public static void showWithMessage(Activity activity, int messageId)
+ public static void showWithMessage(AppCompatActivity activity, int messageId)
{
Bundle bundle = new Bundle();
bundle.putInt(ERROR_MESSAGE_ID, messageId);
VpnNotSupportedError dialog = new VpnNotSupportedError();
dialog.setArguments(bundle);
- dialog.show(activity.getFragmentManager(), DIALOG_TAG);
+ dialog.show(activity.getSupportFragmentManager(), DIALOG_TAG);
}
@Override
{
final Bundle arguments = getArguments();
final int messageId = arguments.getInt(ERROR_MESSAGE_ID);
- return new Builder(getActivity())
+ return new AlertDialog.Builder(getActivity())
.setTitle(R.string.vpn_not_supported_title)
.setMessage(messageId)
.setCancelable(false)
import android.annotation.TargetApi;
import android.app.Activity;
-import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.DialogFragment;
-import android.app.FragmentTransaction;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.app.AppCompatDialogFragment;
import android.widget.Toast;
import org.strongswan.android.R;
Bundle args = new Bundle();
args.putSerializable(VpnProfileDataSource.KEY_CERTIFICATE, certificate);
dialog.setArguments(args);
- FragmentTransaction ft = getFragmentManager().beginTransaction();
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(dialog, DIALOG_TAG);
ft.commit();
}
* Class that displays a confirmation dialog when a certificate should get
* imported. If the user confirms the import we try to store it.
*/
- public static class ConfirmImportDialog extends DialogFragment
+ public static class ConfirmImportDialog extends AppCompatDialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
args.putString(CertificateDeleteConfirmationDialog.ALIAS, selected.getAlias());
CertificateDeleteConfirmationDialog dialog = new CertificateDeleteConfirmationDialog();
dialog.setArguments(args);
- dialog.show(this.getFragmentManager(), DIALOG_TAG);
+ dialog.show(getSupportFragmentManager(), DIALOG_TAG);
}
}
}
package org.strongswan.android.ui;
-import android.app.AlertDialog;
import android.app.Dialog;
-import android.app.DialogFragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.security.KeyChain;
import android.security.KeyChainAliasCallback;
import android.security.KeyChainException;
+import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
+import android.support.v7.app.AppCompatDialogFragment;
import android.text.Html;
import android.util.Log;
import android.view.Menu;
@Override
public void onClick(View v)
{
- new TncNoticeDialog().show(VpnProfileDetailActivity.this.getFragmentManager(), "TncNotice");
+ new TncNoticeDialog().show(VpnProfileDetailActivity.this.getSupportFragmentManager(), "TncNotice");
}
});
/**
* Dialog with notification message if EAP-TNC is used.
*/
- public static class TncNoticeDialog extends DialogFragment
+ public static class TncNoticeDialog extends AppCompatDialogFragment
{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
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;
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;
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";
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)
{
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;
}
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)
{
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)
{
dialog.dismiss();
}
}).create();
- mErrorDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
+ mErrorDialog.setOnDismissListener(new DialogInterface.OnDismissListener()
+ {
@Override
public void onDismiss(DialogInterface dialog)
{
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 Tobias Brunner
+ HSR Hochschule fuer Technik Rapperswil
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+-->
+<resources>
+
+ <style name="ApplicationTheme" parent="ApplicationTheme.Base">
+ </style>
+
+ <style name="AlertDialogTheme" parent="AlertDialogTheme.Base">
+ <item name="android:windowBackground">@android:color/transparent</item>
+ </style>
+
+</resources>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2016 Tobias Brunner
+ HSR Hochschule fuer Technik Rapperswil
+
+ This program is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by the
+ Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+-->
+<resources>
+
+ <style name="ApplicationTheme" parent="ApplicationTheme.Base">
+ </style>
+
+ <style name="AlertDialogTheme" parent="AlertDialogTheme.Base">
+ </style>
+
+</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
- Copyright (C) 2012 Tobias Brunner
- Hochschule fuer Technik Rapperswil
+ Copyright (C) 2012-2016 Tobias Brunner
+ HSR Hochschule fuer Technik Rapperswil
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="ApplicationTheme" parent="Theme.AppCompat">
+ <style name="ApplicationTheme.Base" parent="Theme.AppCompat">
+ <item name="android:alertDialogTheme">@style/AlertDialogTheme</item>
+ </style>
+
+ <style name="AlertDialogTheme.Base" parent="Theme.AppCompat.Dialog.Alert">
</style>
</resources>