summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-07-21 15:03:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2009-07-21 15:03:43 -0700
commit53a1e445443865ef98f16652c7b403eee17499e8 (patch)
tree65e5bece434f338b8eaa4e6b537f91adbca17dd6
parentef2c5ac2e4c42d0280c4c4839ec7286180fe4be8 (diff)
parent19dc9e690fd974eb4a951ccdf4a74bee17da4e8f (diff)
downloadpackages_apps_Settings-53a1e445443865ef98f16652c7b403eee17499e8.zip
packages_apps_Settings-53a1e445443865ef98f16652c7b403eee17499e8.tar.gz
packages_apps_Settings-53a1e445443865ef98f16652c7b403eee17499e8.tar.bz2
Merge change 8077 into donut
* changes: Implement the Back button handler to save a VPN.
-rw-r--r--src/com/android/settings/vpn/VpnEditor.java16
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());