am 09cda9cf
: Add VPN connection lost dialog.
Merge commit '09cda9cfaf658d85a5316cf6f07d5f8c038a942e' * commit '09cda9cfaf658d85a5316cf6f07d5f8c038a942e': Add VPN connection lost dialog.
This commit is contained in:
@@ -1860,6 +1860,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_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_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_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_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_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>
|
<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_SECRET_NOT_SET = 5;
|
||||||
private static final int DIALOG_CHALLENGE_ERROR = 6;
|
private static final int DIALOG_CHALLENGE_ERROR = 6;
|
||||||
private static final int DIALOG_REMOTE_HUNG_UP_ERROR = 7;
|
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;
|
private static final int NO_ERROR = 0;
|
||||||
|
|
||||||
@@ -218,6 +219,9 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
case DIALOG_SECRET_NOT_SET:
|
case DIALOG_SECRET_NOT_SET:
|
||||||
return createSecretNotSetDialog();
|
return createSecretNotSetDialog();
|
||||||
|
|
||||||
|
case DIALOG_CONNECTION_LOST:
|
||||||
|
return createConnectionLostDialog();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return super.onCreateDialog(id);
|
return super.onCreateDialog(id);
|
||||||
}
|
}
|
||||||
@@ -227,7 +231,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
return new AlertDialog.Builder(this)
|
return new AlertDialog.Builder(this)
|
||||||
.setView(mConnectingActor.createConnectView())
|
.setView(mConnectingActor.createConnectView())
|
||||||
.setTitle(String.format(getString(R.string.vpn_connect_to),
|
.setTitle(String.format(getString(R.string.vpn_connect_to),
|
||||||
mConnectingActor.getProfile().getName()))
|
mActiveProfile.getName()))
|
||||||
.setPositiveButton(getString(R.string.vpn_connect_button),
|
.setPositiveButton(getString(R.string.vpn_connect_button),
|
||||||
this)
|
this)
|
||||||
.setNegativeButton(getString(android.R.string.cancel),
|
.setNegativeButton(getString(android.R.string.cancel),
|
||||||
@@ -277,8 +281,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
.setPositiveButton(R.string.vpn_yes_button,
|
.setPositiveButton(R.string.vpn_yes_button,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int w) {
|
public void onClick(DialogInterface dialog, int w) {
|
||||||
VpnProfile p = mConnectingActor.getProfile();
|
startVpnEditor(mActiveProfile);
|
||||||
startVpnEditor(p);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
@@ -289,13 +292,19 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
.setPositiveButton(R.string.vpn_yes_button,
|
.setPositiveButton(R.string.vpn_yes_button,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int w) {
|
public void onClick(DialogInterface dialog, int w) {
|
||||||
VpnProfile p = mConnectingActor.getProfile();
|
VpnProfile p = mActiveProfile;
|
||||||
onIdle();
|
onIdle();
|
||||||
startVpnEditor(p);
|
startVpnEditor(p);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Dialog createConnectionLostDialog() {
|
||||||
|
return createCommonDialogBuilder()
|
||||||
|
.setMessage(R.string.vpn_reconnect_from_lost)
|
||||||
|
.create();
|
||||||
|
}
|
||||||
|
|
||||||
private AlertDialog.Builder createCommonDialogBuilder() {
|
private AlertDialog.Builder createCommonDialogBuilder() {
|
||||||
return new AlertDialog.Builder(this)
|
return new AlertDialog.Builder(this)
|
||||||
.setTitle(android.R.string.dialog_alert_title)
|
.setTitle(android.R.string.dialog_alert_title)
|
||||||
@@ -303,7 +312,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
.setPositiveButton(R.string.vpn_yes_button,
|
.setPositiveButton(R.string.vpn_yes_button,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int w) {
|
public void onClick(DialogInterface dialog, int w) {
|
||||||
connectOrDisconnect(mConnectingActor.getProfile());
|
connectOrDisconnect(mActiveProfile);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.vpn_no_button,
|
.setNegativeButton(R.string.vpn_no_button,
|
||||||
@@ -442,7 +451,7 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
Dialog d = (Dialog) dialog;
|
Dialog d = (Dialog) dialog;
|
||||||
String error = mConnectingActor.validateInputs(d);
|
String error = mConnectingActor.validateInputs(d);
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
changeState(mConnectingActor.getProfile(), VpnState.CONNECTING);
|
changeState(mActiveProfile, VpnState.CONNECTING);
|
||||||
mConnectingActor.connect(d);
|
mConnectingActor.connect(d);
|
||||||
removeDialog(DIALOG_CONNECT);
|
removeDialog(DIALOG_CONNECT);
|
||||||
return;
|
return;
|
||||||
@@ -760,6 +769,10 @@ public class VpnSettings extends PreferenceActivity implements
|
|||||||
showDialog(DIALOG_UNKNOWN_SERVER);
|
showDialog(DIALOG_UNKNOWN_SERVER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case VpnManager.VPN_ERROR_CONNECTION_LOST:
|
||||||
|
showDialog(DIALOG_CONNECTION_LOST);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
showDialog(DIALOG_RECONNECT);
|
showDialog(DIALOG_RECONNECT);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user