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

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

Issue 2664083007: Always adds margin at the end of the label to handle case where label (Closed)
Patch Set: Creates new layout params for sublabel to handle view reuse. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | 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 28483d08125239592a9e418a43fd8b6b7b9728cc..b227427072db2948bf4fa4bdceb6b20d9bcd3d5d 100644
--- a/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
+++ b/ui/android/java/src/org/chromium/ui/DropdownAdapter.java
@@ -190,7 +190,18 @@ public class DropdownAdapter extends ArrayAdapter<DropdownItem> {
if (TextUtils.isEmpty(sublabel)) {
sublabelView.setVisibility(View.GONE);
} else {
- sublabelView.setLayoutParams(layoutParams);
+ if (item.isLabelAndSublabelOnSameLine()) {
+ // Use the layout params in |dropdown_item.xml| for the sublabel if it is on the
+ // same line as the label. We regenerate the layout params in case the view is
+ // reused and the label and sublabel are on the same line when the view is reused.
+ LinearLayout.LayoutParams subLabelLayoutParams = new LinearLayout.LayoutParams(
+ LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+ ApiCompatibilityUtils.setMarginStart(subLabelLayoutParams, mLabelHorizontalMargin);
+ ApiCompatibilityUtils.setMarginEnd(subLabelLayoutParams, mLabelHorizontalMargin);
+ sublabelView.setLayoutParams(subLabelLayoutParams);
+ } else {
+ sublabelView.setLayoutParams(layoutParams);
+ }
sublabelView.setText(sublabel);
sublabelView.setTextSize(TypedValue.COMPLEX_UNIT_PX,
mContext.getResources().getDimension(item.getSublabelFontSizeResId()));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698