Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1702)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java

Issue 1019523002: Disable autofill credit card save button if all fields are empty (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move logic into updateSaveButtonEnabled() Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java
index 15ea95848872429559aa2a487e0b960792eba2ce..1cd8dc0d2b9ff0c819c3644d4906049846dbc85e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillCreditCardEditor.java
@@ -46,6 +46,7 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected
private int mInitialExpirationMonthPos;
private int mInitialExpirationYearPos;
+ private boolean mYearOrMonthSelected;
@Override
public void onCreate(Bundle savedState) {
@@ -94,7 +95,8 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if ((parent == mExpirationYear && position != mInitialExpirationYearPos)
|| (parent == mExpirationMonth && position != mInitialExpirationMonthPos)) {
- enableSaveButton();
+ mYearOrMonthSelected = true;
+ updateSaveButtonEnabled();
}
}
@@ -109,7 +111,7 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
- enableSaveButton();
+ updateSaveButtonEnabled();
}
void addSpinnerAdapters() {
@@ -247,9 +249,11 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected
mExpirationYear.setOnItemSelectedListener(this);
}
- private void enableSaveButton() {
+ private void updateSaveButtonEnabled() {
+ boolean enabled = mYearOrMonthSelected || !TextUtils.isEmpty(mNameText.getText())
+ || !TextUtils.isEmpty(mNumberText.getText());
Button button = (Button) getView().findViewById(R.id.autofill_credit_card_save);
- button.setEnabled(true);
+ button.setEnabled(enabled);
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698