diff options
Diffstat (limited to 'src/com/android/settings/vpn/VpnEditor.java')
-rw-r--r-- | src/com/android/settings/vpn/VpnEditor.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/settings/vpn/VpnEditor.java b/src/com/android/settings/vpn/VpnEditor.java index 1d419ea..b4dc2b6 100644 --- a/src/com/android/settings/vpn/VpnEditor.java +++ b/src/com/android/settings/vpn/VpnEditor.java @@ -31,6 +31,7 @@ import android.os.Parcelable; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.text.TextUtils; +import android.view.KeyEvent; import android.view.Menu; import android.view.MenuItem; import android.view.View; @@ -85,10 +86,9 @@ public class VpnEditor extends PreferenceActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case MENU_SAVE: - if (validateAndSetResult()) { - finish(); - } + if (validateAndSetResult()) finish(); return true; + case MENU_CANCEL: showCancellationConfirmDialog(); return true; @@ -96,6 +96,16 @@ public class VpnEditor extends PreferenceActivity { return super.onOptionsItemSelected(item); } + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + switch (keyCode) { + case KeyEvent.KEYCODE_BACK: + if (validateAndSetResult()) finish(); + return true; + } + return super.onKeyDown(keyCode, event); + } + private void initViewFor(VpnProfile profile) { setTitle(profile); mProfileEditor.loadPreferencesTo(getPreferenceScreen()); |