summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/AutoFillSettingsFragment.java
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-10-14 07:48:43 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-14 07:48:43 -0700
commitdaece2e96475d269ea54cd92a290a787071e7298 (patch)
tree076100cbe30aa8575bcabf830f120765daae6153 /src/com/android/browser/AutoFillSettingsFragment.java
parent5a49c5977c23f720aa70266e99b93f931869d16c (diff)
parent36a23dd3e46167507070bd9f0e6237570d721b2f (diff)
downloadpackages_apps_Browser-daece2e96475d269ea54cd92a290a787071e7298.zip
packages_apps_Browser-daece2e96475d269ea54cd92a290a787071e7298.tar.gz
packages_apps_Browser-daece2e96475d269ea54cd92a290a787071e7298.tar.bz2
Merge "Full profile editor and syncing with WebSettings."
Diffstat (limited to 'src/com/android/browser/AutoFillSettingsFragment.java')
-rw-r--r--src/com/android/browser/AutoFillSettingsFragment.java84
1 files changed, 62 insertions, 22 deletions
diff --git a/src/com/android/browser/AutoFillSettingsFragment.java b/src/com/android/browser/AutoFillSettingsFragment.java
index e41ca56..608c3de 100644
--- a/src/com/android/browser/AutoFillSettingsFragment.java
+++ b/src/com/android/browser/AutoFillSettingsFragment.java
@@ -26,11 +26,23 @@ import android.view.LayoutInflater;
import android.webkit.WebSettings.AutoFillProfile;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.Toast;
public class AutoFillSettingsFragment extends Fragment {
private static final String LOGTAG = "AutoFillSettingsFragment";
+ private EditText mFullNameEdit;
+ private EditText mEmailEdit;
+ private EditText mCompanyEdit;
+ private EditText mAddressLine1Edit;
+ private EditText mAddressLine2Edit;
+ private EditText mCityEdit;
+ private EditText mStateEdit;
+ private EditText mZipEdit;
+ private EditText mCountryEdit;
+ private EditText mPhoneEdit;
+
public AutoFillSettingsFragment() {
}
@@ -42,41 +54,69 @@ public class AutoFillSettingsFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.autofill_settings_fragment, container, false);
+ mFullNameEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_name_edit);
+ mEmailEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_email_address_edit);
+ mCompanyEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_company_name_edit);
+ mAddressLine1Edit = (EditText)v.findViewById(
+ R.id.autofill_profile_editor_address_line_1_edit);
+ mAddressLine2Edit = (EditText)v.findViewById(
+ R.id.autofill_profile_editor_address_line_2_edit);
+ mCityEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_city_edit);
+ mStateEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_state_edit);
+ mZipEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_zip_code_edit);
+ mCountryEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_country_edit);
+ mPhoneEdit = (EditText)v.findViewById(R.id.autofill_profile_editor_phone_number_edit);
+
Button saveButton = (Button)v.findViewById(R.id.autofill_profile_editor_save_button);
saveButton.setOnClickListener(new OnClickListener() {
public void onClick(View button) {
- View v = getView();
- EditText fullName = (EditText)v.findViewById(
- R.id.autofill_profile_editor_name_edit);
- EditText email = (EditText)v.findViewById(
- R.id.autofill_profile_editor_email_address_edit);
BrowserSettings.getInstance().setAutoFillProfile(getActivity(),
new AutoFillProfile(
- fullName.getText().toString(),
- email.getText().toString()));
+ mFullNameEdit.getText().toString(),
+ mEmailEdit.getText().toString(),
+ mCompanyEdit.getText().toString(),
+ mAddressLine1Edit.getText().toString(),
+ mAddressLine2Edit.getText().toString(),
+ mCityEdit.getText().toString(),
+ mStateEdit.getText().toString(),
+ mZipEdit.getText().toString(),
+ mCountryEdit.getText().toString(),
+ mPhoneEdit.getText().toString()));
+ }
+ });
+
+ Button deleteButton = (Button)v.findViewById(R.id.autofill_profile_editor_delete_button);
+ deleteButton.setOnClickListener(new OnClickListener() {
+ public void onClick(View button) {
+ Toast.makeText(getActivity(), "TODO: Implement me", Toast.LENGTH_SHORT).show();
}
});
+ Button cancelButton = (Button)v.findViewById(R.id.autofill_profile_editor_cancel_button);
+ cancelButton.setOnClickListener(new OnClickListener() {
+ public void onClick(View button) {
+ getFragmentManager().popBackStack();
+ }
+ });
+
// Populate the text boxes with any pre existing AutoFill data.
- EditText fullName = (EditText)v.findViewById(
- R.id.autofill_profile_editor_name_edit);
- EditText email = (EditText)v.findViewById(
- R.id.autofill_profile_editor_email_address_edit);
AutoFillProfile activeProfile = BrowserSettings.getInstance().getAutoFillProfile();
- fullName.setText(activeProfile.getFullName());
- email.setText(activeProfile.getEmailAddress());
+ if (activeProfile != null) {
+ mFullNameEdit.setText(activeProfile.getFullName());
+ mEmailEdit.setText(activeProfile.getEmailAddress());
+ mCompanyEdit.setText(activeProfile.getCompanyName());
+ mAddressLine1Edit.setText(activeProfile.getAddressLine1());
+ mAddressLine2Edit.setText(activeProfile.getAddressLine2());
+ mCityEdit.setText(activeProfile.getCity());
+ mStateEdit.setText(activeProfile.getState());
+ mZipEdit.setText(activeProfile.getZipCode());
+ mCountryEdit.setText(activeProfile.getCountry());
+ mPhoneEdit.setText(activeProfile.getPhoneNumber());
+ }
return v;
}
-
- @Override
- public void onPause() {
- AutoFillProfileDatabase db =
- AutoFillProfileDatabase.getInstance(getActivity());
- db.close();
- super.onPause();
- }
}