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

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: minor change Created 4 years 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 | « ui/android/java/res/values/dimens.xml ('k') | ui/android/java/src/org/chromium/ui/DropdownItem.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d8ad3f3fdeed237e8c817613c839f37363e7c0c5 100644
--- a/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
@@ -85,14 +85,33 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
// 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;
+ if (item.isLabelAndSublabelOnSameLine()) {
+ wrapper.setOrientation(LinearLayout.HORIZONTAL);
+ } else {
+ wrapper.setOrientation(LinearLayout.VERTICAL);
+ }
+
wrapper.setLayoutParams(new LinearLayout.LayoutParams(0, height, 1));
TextView labelView = (TextView) layout.findViewById(R.id.dropdown_label);
labelView.setText(item.getLabel());
labelView.setSingleLine(!item.isMultilineLabel());
+ if (item.isLabelAndSublabelOnSameLine()) {
+ labelView.setLayoutParams(
+ new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1));
+ } else {
+ LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
+ LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ int labelMargin = mContext.getResources().getDimensionPixelSize(
+ R.dimen.dropdown_item_label_margin);
+ ApiCompatibilityUtils.setMarginStart(layoutParams, labelMargin);
+ ApiCompatibilityUtils.setMarginEnd(layoutParams, labelMargin);
+ labelView.setLayoutParams(layoutParams);
+ }
+
labelView.setEnabled(item.isEnabled());
if (item.isGroupHeader()) {
labelView.setTypeface(null, Typeface.BOLD);
@@ -114,7 +133,15 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
sublabelView.setVisibility(View.VISIBLE);
}
- ImageView iconView = (ImageView) layout.findViewById(R.id.dropdown_icon);
+ ImageView iconViewStart = (ImageView) layout.findViewById(R.id.start_dropdown_icon);
+ ImageView iconViewEnd = (ImageView) layout.findViewById(R.id.end_dropdown_icon);
+ if (item.isIconAtStart()) {
+ iconViewEnd.setVisibility(View.GONE);
+ } else {
+ iconViewStart.setVisibility(View.GONE);
+ }
+
+ ImageView iconView = item.isIconAtStart() ? iconViewStart : iconViewEnd;
if (item.getIconId() == DropdownItem.NO_ICON) {
iconView.setVisibility(View.GONE);
} else {
« no previous file with comments | « ui/android/java/res/values/dimens.xml ('k') | ui/android/java/src/org/chromium/ui/DropdownItem.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698