diff options
author | Ben Murdoch <benm@google.com> | 2011-06-17 14:15:28 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-17 14:15:28 -0700 |
commit | 326ec50db7ed4da6e0473423591f56eb53b04cf3 (patch) | |
tree | 8085294156d506c5ae0b535a7ac1e5a7914b484b /src/com/android/browser | |
parent | 7dc444b4c3b70a09a33c0892fb8677922bdf1ecc (diff) | |
parent | 815752af4a61faac210150db4084944fa0f4af33 (diff) | |
download | packages_apps_Browser-326ec50db7ed4da6e0473423591f56eb53b04cf3.zip packages_apps_Browser-326ec50db7ed4da6e0473423591f56eb53b04cf3.tar.gz packages_apps_Browser-326ec50db7ed4da6e0473423591f56eb53b04cf3.tar.bz2 |
Merge "Fix up AutoFill profile editor UI in portrait mode"
Diffstat (limited to 'src/com/android/browser')
-rw-r--r-- | src/com/android/browser/AutoFillSettingsFragment.java | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/src/com/android/browser/AutoFillSettingsFragment.java b/src/com/android/browser/AutoFillSettingsFragment.java index e87645e..b282789 100644 --- a/src/com/android/browser/AutoFillSettingsFragment.java +++ b/src/com/android/browser/AutoFillSettingsFragment.java @@ -28,6 +28,9 @@ import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.inputmethod.InputMethodManager; import android.webkit.WebSettings.AutoFillProfile; import android.widget.Button; @@ -131,10 +134,41 @@ public class AutoFillSettingsFragment extends Fragment { @Override public void onCreate(Bundle savedState) { super.onCreate(savedState); + setHasOptionsMenu(true); mSettings = BrowserSettings.getInstance(); } @Override + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { + inflater.inflate(R.menu.autofill_profile_editor, menu); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.autofill_profile_editor_delete_profile_menu_id) { + // Clear the UI. + mFullNameEdit.setText(""); + mEmailEdit.setText(""); + mCompanyEdit.setText(""); + mAddressLine1Edit.setText(""); + mAddressLine2Edit.setText(""); + mCityEdit.setText(""); + mStateEdit.setText(""); + mZipEdit.setText(""); + mCountryEdit.setText(""); + mPhoneEdit.setText(""); + + // Update browser settings and native with a null profile. This will + // trigger the current profile to get deleted from the DB. + mSettings.setAutoFillProfile(null, + mHandler.obtainMessage(PROFILE_DELETED_MSG)); + updateButtonState(); + return true; + } + return false; + } + + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.autofill_settings_fragment, container, false); @@ -185,37 +219,6 @@ public class AutoFillSettingsFragment extends Fragment { } }); - Button deleteButton = (Button)v.findViewById(R.id.autofill_profile_editor_delete_button); - deleteButton.setOnClickListener(new OnClickListener() { - public void onClick(View button) { - // Clear the UI. - mFullNameEdit.setText(""); - mEmailEdit.setText(""); - mCompanyEdit.setText(""); - mAddressLine1Edit.setText(""); - mAddressLine2Edit.setText(""); - mCityEdit.setText(""); - mStateEdit.setText(""); - mZipEdit.setText(""); - mCountryEdit.setText(""); - mPhoneEdit.setText(""); - - // Update browser settings and native with a null profile. This will - // trigger the current profile to get deleted from the DB. - mSettings.setAutoFillProfile(null, - mHandler.obtainMessage(PROFILE_DELETED_MSG)); - - updateButtonState(); - } - }); - - Button cancelButton = (Button)v.findViewById(R.id.autofill_profile_editor_cancel_button); - cancelButton.setOnClickListener(new OnClickListener() { - public void onClick(View button) { - closeEditor(); - } - }); - // Populate the text boxes with any pre existing AutoFill data. AutoFillProfile activeProfile = mSettings.getAutoFillProfile(); if (activeProfile != null) { |