summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-06-16 19:47:08 +0100
committerBen Murdoch <benm@google.com>2011-06-17 22:04:27 +0100
commit815752af4a61faac210150db4084944fa0f4af33 (patch)
treec498410c2c8b58f585dc87575678d705526ce8b4 /src/com/android/browser
parentf43990eed0a2b97f181c44fd03271f1844a8d133 (diff)
downloadpackages_apps_Browser-815752af4a61faac210150db4084944fa0f4af33.zip
packages_apps_Browser-815752af4a61faac210150db4084944fa0f4af33.tar.gz
packages_apps_Browser-815752af4a61faac210150db4084944fa0f4af33.tar.bz2
Fix up AutoFill profile editor UI in portrait mode
Create layout-port version of the autofill profile editor that extends vertically rather than horizontally. In both portrait and landscape, make the "Save profile" button always visible, remove the "cancel" button as there are already several ways to leave the activity without saving changes and move the "Delete profile" button to the options menu. Change-Id: I3b03c998bc8cb005f066733a3b6979a03396f31f
Diffstat (limited to 'src/com/android/browser')
-rw-r--r--src/com/android/browser/AutoFillSettingsFragment.java65
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) {