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

Unified Diff: ui/android/java/src/org/chromium/ui/DropdownAdapter.java

Issue 2510283002: Http Bad: Put icon on the left of warning message and make value and label in one line on Android (Closed)
Patch Set: format Created 4 years, 1 month 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
Index: ui/android/java/src/org/chromium/ui/DropdownAdapter.java
diff --git a/ui/android/java/src/org/chromium/ui/DropdownAdapter.java b/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
index ec3505f48c6cf73cc9930993184030fe16dc0f4d..3bd92b25ab168cbc63d5c36c27ce8e8d95979206 100644
--- a/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
@@ -52,11 +52,17 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
+ DropdownItem item = getItem(position);
+
View layout = convertView;
if (convertView == null) {
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- layout = inflater.inflate(R.layout.dropdown_item, null);
+ if (item.isIconOnLeft()) {
+ layout = inflater.inflate(R.layout.dropdown_item_left_icon, null);
Ted C 2016/11/28 18:29:11 You can't actually use different layouts. getView
lshang 2016/11/30 10:35:43 Done.
+ } else {
+ layout = inflater.inflate(R.layout.dropdown_item, null);
+ }
layout.setBackground(new DropdownDividerDrawable());
}
@@ -78,15 +84,14 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
}
}
- DropdownItem item = getItem(position);
-
// Note: trying to set the height of the root LinearLayout breaks accessibility,
// so we have to adjust the height of this LinearLayout that wraps the TextViews instead.
// If you need to modify this layout, don't forget to test it with TalkBack and make sure
// it doesn't regress.
// http://crbug.com/429364
- View wrapper = layout.findViewById(R.id.dropdown_label_wrapper);
+ LinearLayout wrapper = (LinearLayout) layout.findViewById(R.id.dropdown_label_wrapper);
if (item.isMultilineLabel()) height = LayoutParams.WRAP_CONTENT;
+ wrapper.setOrientation(item.getLabelSublabelOrientation());
wrapper.setLayoutParams(new LinearLayout.LayoutParams(0, height, 1));
TextView labelView = (TextView) layout.findViewById(R.id.dropdown_label);

Powered by Google App Engine
This is Rietveld 408576698