OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.app.Fragment; | 8 import android.app.Fragment; |
9 import android.content.Context; | 9 import android.content.Context; |
10 import android.os.Bundle; | 10 import android.os.Bundle; |
11 import android.text.Editable; | 11 import android.text.Editable; |
12 import android.text.TextWatcher; | 12 import android.text.TextWatcher; |
13 import android.view.LayoutInflater; | 13 import android.view.LayoutInflater; |
14 import android.view.Menu; | 14 import android.view.Menu; |
15 import android.view.MenuInflater; | 15 import android.view.MenuInflater; |
16 import android.view.MenuItem; | 16 import android.view.MenuItem; |
17 import android.view.MotionEvent; | 17 import android.view.MotionEvent; |
18 import android.view.View; | 18 import android.view.View; |
19 import android.view.View.OnTouchListener; | 19 import android.view.View.OnTouchListener; |
20 import android.view.ViewGroup; | 20 import android.view.ViewGroup; |
21 import android.view.inputmethod.InputMethodManager; | 21 import android.view.inputmethod.InputMethodManager; |
22 import android.widget.AdapterView; | 22 import android.widget.AdapterView; |
23 import android.widget.AdapterView.OnItemSelectedListener; | 23 import android.widget.AdapterView.OnItemSelectedListener; |
24 import android.widget.Button; | 24 import android.widget.Button; |
25 import android.widget.LinearLayout; | 25 import android.widget.LinearLayout; |
26 import android.widget.Spinner; | 26 import android.widget.Spinner; |
27 | 27 |
28 import org.chromium.chrome.R; | 28 import org.chromium.chrome.R; |
29 import org.chromium.chrome.browser.payments.ui.EditorView; | 29 import org.chromium.chrome.browser.payments.ui.EditorView; |
30 import org.chromium.chrome.browser.payments.ui.FadingEdgeScrollView; | |
31 import org.chromium.chrome.browser.widget.DualControlLayout; | 30 import org.chromium.chrome.browser.widget.DualControlLayout; |
| 31 import org.chromium.chrome.browser.widget.FadingEdgeScrollView; |
32 | 32 |
33 /** Base class for Autofill editors (e.g. credit cards and profiles). */ | 33 /** Base class for Autofill editors (e.g. credit cards and profiles). */ |
34 public abstract class AutofillEditorBase | 34 public abstract class AutofillEditorBase |
35 extends Fragment implements OnItemSelectedListener, OnTouchListener, Tex
tWatcher { | 35 extends Fragment implements OnItemSelectedListener, OnTouchListener, Tex
tWatcher { |
36 | 36 |
37 /** GUID of the profile we are editing. Empty if creating a new profile. */ | 37 /** GUID of the profile we are editing. Empty if creating a new profile. */ |
38 protected String mGUID; | 38 protected String mGUID; |
39 | 39 |
40 /** Whether or not the editor is creating a new entry. */ | 40 /** Whether or not the editor is creating a new entry. */ |
41 protected boolean mIsNewEntry; | 41 protected boolean mIsNewEntry; |
(...skipping 18 matching lines...) Expand all Loading... |
60 mGUID = ""; | 60 mGUID = ""; |
61 mIsNewEntry = true; | 61 mIsNewEntry = true; |
62 } else { | 62 } else { |
63 mIsNewEntry = false; | 63 mIsNewEntry = false; |
64 } | 64 } |
65 getActivity().setTitle(getTitleResourceId(mIsNewEntry)); | 65 getActivity().setTitle(getTitleResourceId(mIsNewEntry)); |
66 | 66 |
67 // Hide the top shadow on the ScrollView because the toolbar draws one. | 67 // Hide the top shadow on the ScrollView because the toolbar draws one. |
68 FadingEdgeScrollView scrollView = (FadingEdgeScrollView) inflater.inflat
e( | 68 FadingEdgeScrollView scrollView = (FadingEdgeScrollView) inflater.inflat
e( |
69 R.layout.autofill_editor_base, container, false); | 69 R.layout.autofill_editor_base, container, false); |
70 scrollView.setShadowVisibility(false, true); | 70 scrollView.setEdgeVisibility( |
| 71 FadingEdgeScrollView.DRAW_NO_EDGE, FadingEdgeScrollView.DRAW_FAD
ING_EDGE); |
71 | 72 |
72 // Inflate the editor and buttons into the "content" LinearLayout. | 73 // Inflate the editor and buttons into the "content" LinearLayout. |
73 LinearLayout contentLayout = (LinearLayout) scrollView.findViewById(R.id
.content); | 74 LinearLayout contentLayout = (LinearLayout) scrollView.findViewById(R.id
.content); |
74 inflater.inflate(getLayoutId(), contentLayout, true); | 75 inflater.inflate(getLayoutId(), contentLayout, true); |
75 inflater.inflate(R.layout.autofill_editor_base_buttons, contentLayout, t
rue); | 76 inflater.inflate(R.layout.autofill_editor_base_buttons, contentLayout, t
rue); |
76 | 77 |
77 return scrollView; | 78 return scrollView; |
78 } | 79 } |
79 | 80 |
80 @Override | 81 @Override |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 162 |
162 @Override | 163 @Override |
163 public void onTextChanged(CharSequence s, int start, int before, int count)
{} | 164 public void onTextChanged(CharSequence s, int start, int before, int count)
{} |
164 | 165 |
165 @Override | 166 @Override |
166 public void afterTextChanged(Editable s) {} | 167 public void afterTextChanged(Editable s) {} |
167 | 168 |
168 @Override | 169 @Override |
169 public void beforeTextChanged(CharSequence s, int start, int count, int afte
r) {} | 170 public void beforeTextChanged(CharSequence s, int start, int count, int afte
r) {} |
170 } | 171 } |
OLD | NEW |