Fix the retry the vpn connection issue.

Fix the issue of vpn connection retry if back button is pressed
and the profile state is still in connecting.

bug: 3278489
Change-Id: I8b51fdd65b2fdd8cbe4fb43afd916f1966b77b67
This commit is contained in:
Chung-yih Wang
2010-12-13 17:18:43 +08:00
parent eab1186a74
commit 844c54d11e

View File

@@ -216,23 +216,27 @@ public class VpnSettings extends SettingsPreferenceFragment
}
}
private Dialog createConnectDialog() {
final Activity activity = getActivity();
return new AlertDialog.Builder(activity)
.setView(mConnectingActor.createConnectView())
.setTitle(String.format(activity.getString(R.string.vpn_connect_to),
mActiveProfile.getName()))
.setPositiveButton(activity.getString(R.string.vpn_connect_button),
this)
.setNegativeButton(activity.getString(android.R.string.cancel),
this)
.setOnCancelListener(new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
removeDialog(DIALOG_CONNECT);
changeState(mActiveProfile, VpnState.IDLE);
private class ConnectDialog extends AlertDialog {
public ConnectDialog(Context context) {
super(context);
setTitle(String.format(getString(R.string.vpn_connect_to),
mActiveProfile.getName()));
setButton(DialogInterface.BUTTON_POSITIVE,
getString(R.string.vpn_connect_button),
VpnSettings.this);
setButton(DialogInterface.BUTTON_NEGATIVE,
getString(android.R.string.cancel),
VpnSettings.this);
setView(mConnectingActor.createConnectView());
}
})
.create();
public void onBackPressed() {
changeState(mActiveProfile, VpnState.IDLE);
super.onBackPressed();
}
}
private Dialog createConnectDialog() {
return new ConnectDialog(getActivity());
}
private Dialog createReconnectDialog(int id) {