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 3b441fc8c9416c79abf1b720657c2c72e51d3599..a015cfd3e322573dbb6ecf7fa0458294d9879f36 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,8 +12,6 @@ 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; |
@@ -30,8 +28,7 @@ import java.util.Locale; |
/** |
* Provides the Java-ui for editing a Credit Card autofill entry. |
*/ |
-public class AutofillCreditCardEditor extends Fragment implements OnItemSelectedListener, |
- TextWatcher { |
+public class AutofillCreditCardEditor extends Fragment implements TextWatcher { |
// GUID of the profile we are editing. |
// May be the empty string if creating a new profile. |
private String mGUID; |
@@ -88,17 +85,6 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected |
} |
@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 |
@@ -106,7 +92,7 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected |
@Override |
public void onTextChanged(CharSequence s, int start, int before, int count) { |
- enableSaveButton(); |
+ updateSaveButtonState(); |
} |
void addSpinnerAdapters() { |
@@ -228,13 +214,13 @@ public class AutofillCreditCardEditor extends Fragment implements OnItemSelected |
// 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 enableSaveButton() { |
+ private void updateSaveButtonState() { |
Button button = (Button) getView().findViewById(R.id.autofill_credit_card_save); |
- button.setEnabled(true); |
+ boolean enabled = mNameText.getEditableText().toString().trim().length() > 0 |
+ || mNumberText.getEditableText().toString().trim().length() > 0; |
+ button.setEnabled(enabled); |
} |
/** |