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

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

Issue 837613003: Added code to disable save button if no text is present in name or number field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 11 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 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);
}
/**
« 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