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

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

Issue 800903004: Resolve lint warnings related to DefaultLocale and SimpleDateFormat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments incorporated 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 unified diff | Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.preferences.autofill; 5 package org.chromium.chrome.browser.preferences.autofill;
6 6
7 import android.app.Fragment; 7 import android.app.Fragment;
8 import android.os.Bundle; 8 import android.os.Bundle;
9 import android.text.Editable; 9 import android.text.Editable;
10 import android.text.TextUtils; 10 import android.text.TextUtils;
11 import android.text.TextWatcher; 11 import android.text.TextWatcher;
12 import android.view.LayoutInflater; 12 import android.view.LayoutInflater;
13 import android.view.View; 13 import android.view.View;
14 import android.view.ViewGroup; 14 import android.view.ViewGroup;
15 import android.widget.AdapterView; 15 import android.widget.AdapterView;
16 import android.widget.AdapterView.OnItemSelectedListener; 16 import android.widget.AdapterView.OnItemSelectedListener;
17 import android.widget.ArrayAdapter; 17 import android.widget.ArrayAdapter;
18 import android.widget.Button; 18 import android.widget.Button;
19 import android.widget.EditText; 19 import android.widget.EditText;
20 import android.widget.Spinner; 20 import android.widget.Spinner;
21 21
22 import org.chromium.chrome.R; 22 import org.chromium.chrome.R;
23 import org.chromium.chrome.browser.autofill.PersonalDataManager; 23 import org.chromium.chrome.browser.autofill.PersonalDataManager;
24 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; 24 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard;
25 25
26 import java.text.SimpleDateFormat; 26 import java.text.SimpleDateFormat;
27 import java.util.Calendar; 27 import java.util.Calendar;
28 import java.util.Locale;
28 29
29 /** 30 /**
30 * Provides the Java-ui for editing a Credit Card autofill entry. 31 * Provides the Java-ui for editing a Credit Card autofill entry.
31 */ 32 */
32 public class AutofillCreditCardEditor extends Fragment implements OnItemSelected Listener, 33 public class AutofillCreditCardEditor extends Fragment implements OnItemSelected Listener,
33 TextWatcher { 34 TextWatcher {
34 // GUID of the profile we are editing. 35 // GUID of the profile we are editing.
35 // May be the empty string if creating a new profile. 36 // May be the empty string if creating a new profile.
36 private String mGUID; 37 private String mGUID;
37 38
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 @Override 107 @Override
107 public void onTextChanged(CharSequence s, int start, int before, int count) { 108 public void onTextChanged(CharSequence s, int start, int before, int count) {
108 enableSaveButton(); 109 enableSaveButton();
109 } 110 }
110 111
111 void addSpinnerAdapters() { 112 void addSpinnerAdapters() {
112 ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getA ctivity(), 113 ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getA ctivity(),
113 android.R.layout.simple_spinner_item); 114 android.R.layout.simple_spinner_item);
114 115
115 Calendar calendar = Calendar.getInstance(); 116 Calendar calendar = Calendar.getInstance();
116 SimpleDateFormat formatter = new SimpleDateFormat("MMMM (MM)"); 117 SimpleDateFormat formatter = new SimpleDateFormat("MMMM (MM)", Locale.ge tDefault());
117 118
118 for (int month = 0; month < 12; month++) { 119 for (int month = 0; month < 12; month++) {
119 calendar.set(Calendar.MONTH, month); 120 calendar.set(Calendar.MONTH, month);
120 adapter.add(formatter.format(calendar.getTime())); 121 adapter.add(formatter.format(calendar.getTime()));
121 } 122 }
122 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown _item); 123 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown _item);
123 mExpirationMonth.setAdapter(adapter); 124 mExpirationMonth.setAdapter(adapter);
124 125
125 adapter = new ArrayAdapter<CharSequence>(getActivity(), 126 adapter = new ArrayAdapter<CharSequence>(getActivity(),
126 android.R.layout.simple_spinner_item); 127 android.R.layout.simple_spinner_item);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 } 320 }
320 } 321 }
321 322
322 public static boolean hasDashOrSpace(final CharSequence s, final int sta rt, 323 public static boolean hasDashOrSpace(final CharSequence s, final int sta rt,
323 final int count) { 324 final int count) {
324 return TextUtils.indexOf(s, " ", start, start + count) != -1 325 return TextUtils.indexOf(s, " ", start, start + count) != -1
325 || TextUtils.indexOf(s, "-", start, start + count) != -1; 326 || TextUtils.indexOf(s, "-", start, start + count) != -1;
326 } 327 }
327 } 328 }
328 } 329 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/omnibox/OmniboxUrlEmphasizer.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698