Add VPN connection lost dialog.
This commit is contained in:
@@ -1847,6 +1847,7 @@ found in the list of installed applications.</string>
|
||||
<string name="vpn_confirm_add_profile_cancellation">Are you sure you don\'t want to create this profile?</string>
|
||||
<string name="vpn_confirm_edit_profile_cancellation">Are you sure you want to discard the changes made to this profile?</string>
|
||||
<string name="vpn_confirm_reconnect">Unable to connect to the network. Do you want to try again?</string>
|
||||
<string name="vpn_reconnect_from_lost">Connection lost. Do you want to connect again?</string>
|
||||
<string name="vpn_unknown_server_dialog_msg">Server name cannot be resolved. Do you want to check your server name setting?</string>
|
||||
<string name="vpn_challenge_error_dialog_msg">Challenge error. Do you want to check your secret setting?</string>
|
||||
<string name="vpn_secret_not_set_dialog_msg">One or more secrets are missing in this VPN configuration. Do you want to check your secret setting?</string>
|
||||
|
@@ -111,6 +111,7 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
private static final int DIALOG_SECRET_NOT_SET = 5;
|
||||
private static final int DIALOG_CHALLENGE_ERROR = 6;
|
||||
private static final int DIALOG_REMOTE_HUNG_UP_ERROR = 7;
|
||||
private static final int DIALOG_CONNECTION_LOST = 8;
|
||||
|
||||
private static final int NO_ERROR = 0;
|
||||
|
||||
@@ -218,6 +219,9 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
case DIALOG_SECRET_NOT_SET:
|
||||
return createSecretNotSetDialog();
|
||||
|
||||
case DIALOG_CONNECTION_LOST:
|
||||
return createConnectionLostDialog();
|
||||
|
||||
default:
|
||||
return super.onCreateDialog(id);
|
||||
}
|
||||
@@ -227,7 +231,7 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
return new AlertDialog.Builder(this)
|
||||
.setView(mConnectingActor.createConnectView())
|
||||
.setTitle(String.format(getString(R.string.vpn_connect_to),
|
||||
mConnectingActor.getProfile().getName()))
|
||||
mActiveProfile.getName()))
|
||||
.setPositiveButton(getString(R.string.vpn_connect_button),
|
||||
this)
|
||||
.setNegativeButton(getString(android.R.string.cancel),
|
||||
@@ -277,8 +281,7 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
.setPositiveButton(R.string.vpn_yes_button,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int w) {
|
||||
VpnProfile p = mConnectingActor.getProfile();
|
||||
startVpnEditor(p);
|
||||
startVpnEditor(mActiveProfile);
|
||||
}
|
||||
})
|
||||
.create();
|
||||
@@ -289,13 +292,19 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
.setPositiveButton(R.string.vpn_yes_button,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int w) {
|
||||
VpnProfile p = mConnectingActor.getProfile();
|
||||
VpnProfile p = mActiveProfile;
|
||||
onIdle();
|
||||
startVpnEditor(p);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Dialog createConnectionLostDialog() {
|
||||
return createCommonDialogBuilder()
|
||||
.setMessage(R.string.vpn_reconnect_from_lost)
|
||||
.create();
|
||||
}
|
||||
|
||||
private AlertDialog.Builder createCommonDialogBuilder() {
|
||||
return new AlertDialog.Builder(this)
|
||||
.setTitle(android.R.string.dialog_alert_title)
|
||||
@@ -303,7 +312,7 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
.setPositiveButton(R.string.vpn_yes_button,
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int w) {
|
||||
connectOrDisconnect(mConnectingActor.getProfile());
|
||||
connectOrDisconnect(mActiveProfile);
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.vpn_no_button,
|
||||
@@ -442,7 +451,7 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
Dialog d = (Dialog) dialog;
|
||||
String error = mConnectingActor.validateInputs(d);
|
||||
if (error == null) {
|
||||
changeState(mConnectingActor.getProfile(), VpnState.CONNECTING);
|
||||
changeState(mActiveProfile, VpnState.CONNECTING);
|
||||
mConnectingActor.connect(d);
|
||||
removeDialog(DIALOG_CONNECT);
|
||||
return;
|
||||
@@ -760,6 +769,10 @@ public class VpnSettings extends PreferenceActivity implements
|
||||
showDialog(DIALOG_UNKNOWN_SERVER);
|
||||
break;
|
||||
|
||||
case VpnManager.VPN_ERROR_CONNECTION_LOST:
|
||||
showDialog(DIALOG_CONNECTION_LOST);
|
||||
break;
|
||||
|
||||
default:
|
||||
showDialog(DIALOG_RECONNECT);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user