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

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

Issue 895433005: revert a057427e02b14f2f7851 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 a015cfd3e322573dbb6ecf7fa0458294d9879f36..3b441fc8c9416c79abf1b720657c2c72e51d3599 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
@@ -12,6 +12,8 @@ import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
@@ -28,7 +30,8 @@ import java.util.Locale;
/**
* Provides the Java-ui for editing a Credit Card autofill entry.
*/
-public class AutofillCreditCardEditor extends Fragment implements TextWatcher {
+public class AutofillCreditCardEditor extends Fragment implements OnItemSelectedListener,
+ TextWatcher {
// GUID of the profile we are editing.
// May be the empty string if creating a new profile.
private String mGUID;
@@ -85,6 +88,17 @@ public class AutofillCreditCardEditor extends Fragment implements TextWatcher {
}
@Override
+ public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+ if ((parent == mExpirationYear && position != mInitialExpirationYearPos)
+ || (parent == mExpirationMonth && position != mInitialExpirationMonthPos)) {
+ enableSaveButton();
+ }
+ }
+
+ @Override
+ public void onNothingSelected(AdapterView<?> parent) {}
+
+ @Override
public void afterTextChanged(Editable s) {}
@Override
@@ -92,7 +106,7 @@ public class AutofillCreditCardEditor extends Fragment implements TextWatcher {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
- updateSaveButtonState();
+ enableSaveButton();
}
void addSpinnerAdapters() {
@@ -214,13 +228,13 @@ public class AutofillCreditCardEditor extends Fragment implements TextWatcher {
// Listen for changes to inputs. Enable the save button after something has changed.
mNameText.addTextChangedListener(this);
mNumberText.addTextChangedListener(this);
+ mExpirationMonth.setOnItemSelectedListener(this);
+ mExpirationYear.setOnItemSelectedListener(this);
}
- private void updateSaveButtonState() {
+ private void enableSaveButton() {
Button button = (Button) getView().findViewById(R.id.autofill_credit_card_save);
- boolean enabled = mNameText.getEditableText().toString().trim().length() > 0
- || mNumberText.getEditableText().toString().trim().length() > 0;
- button.setEnabled(enabled);
+ button.setEnabled(true);
}
/**
« 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