Index: content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java b/content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
similarity index 54% |
copy from ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java |
copy to content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
index 62203dc70a802f4c7268cb3cbbd920f77e4f1956..64276fc2307e994c2eeb9ce161d27c2233f17bfe 100644 |
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/input/DateTimeSuggestionListAdapter.java |
@@ -3,7 +3,7 @@ |
// found in the LICENSE file. |
newt (away)
2013/10/09 07:20:52
remove blank line
|
-package org.chromium.ui.autofill; |
+package org.chromium.content.browser.input; |
import android.content.Context; |
import android.text.TextUtils; |
@@ -14,18 +14,18 @@ import android.view.ViewGroup; |
import android.widget.ArrayAdapter; |
import android.widget.TextView; |
-import org.chromium.ui.R; |
+import org.chromium.content.R; |
import java.util.ArrayList; |
/** |
* Autofill suggestion adapter for AutofillWindow. |
Miguel Garcia
2013/10/08 17:44:40
please fix doc
|
*/ |
-public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> { |
+public class DateTimeSuggestionListAdapter extends ArrayAdapter<DateTimeSuggestion> { |
private Context mContext; |
- AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects) { |
- super(context, R.layout.autofill_text, objects); |
+ DateTimeSuggestionListAdapter(Context context, ArrayList<DateTimeSuggestion> objects) { |
+ super(context, R.layout.date_time_suggestion_item, objects); |
mContext = context; |
} |
@@ -35,20 +35,24 @@ public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> { |
if (convertView == null) { |
LayoutInflater inflater = |
newt (away)
2013/10/09 07:20:52
LayoutInflater inflater = LayoutInflater.from(mCon
keishi
2013/10/21 17:00:58
Done.
|
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); |
- layout = inflater.inflate(R.layout.autofill_text, null); |
+ layout = inflater.inflate(R.layout.date_time_suggestion_item, null); |
newt (away)
2013/10/09 07:20:52
do this:
layout = inflater.inflate(R.layout.d
|
} |
- TextView labelView = (TextView) layout.findViewById(R.id.autofill_label); |
- labelView.setText(getItem(position).mLabel); |
+ TextView labelView = (TextView) layout.findViewById(R.id.date_time_suggestion_value); |
+ TextView sublabelView = (TextView) layout.findViewById(R.id.date_time_suggestion_label); |
- TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel); |
- CharSequence sublabel = getItem(position).mSublabel; |
- if (TextUtils.isEmpty(sublabel)) { |
- sublabelView.setVisibility(View.GONE); |
+ if (position == getCount() - 1) { |
+ labelView.setText(mContext.getText(R.string.date_picker_dialog_other_item_label)); |
+ sublabelView.setText(""); |
} else { |
- sublabelView.setText(sublabel); |
- sublabelView.setVisibility(View.VISIBLE); |
+ labelView.setText(getItem(position).mLocalizedValue); |
+ sublabelView.setText(getItem(position).mLabel); |
} |
return layout; |
} |
+ |
+ @Override |
+ public int getCount() { |
+ return super.getCount() + 1; |
Miguel Garcia
2013/10/08 17:44:40
why +1? getCount should give you the actual size r
|
+ } |
} |