Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.ui; | 5 package org.chromium.ui; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Color; | 8 import android.graphics.Color; |
| 9 import android.graphics.Typeface; | 9 import android.graphics.Typeface; |
| 10 import android.support.annotation.Nullable; | 10 import android.support.annotation.Nullable; |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 labelView.setTextColor(ApiCompatibilityUtils.getColor( | 183 labelView.setTextColor(ApiCompatibilityUtils.getColor( |
| 184 mContext.getResources(), item.getLabelFontColorResId())); | 184 mContext.getResources(), item.getLabelFontColorResId())); |
| 185 labelView.setTextSize(TypedValue.COMPLEX_UNIT_PX, | 185 labelView.setTextSize(TypedValue.COMPLEX_UNIT_PX, |
| 186 mContext.getResources().getDimension(item.getLabelFontSizeResId( ))); | 186 mContext.getResources().getDimension(item.getLabelFontSizeResId( ))); |
| 187 | 187 |
| 188 TextView sublabelView = (TextView) layout.findViewById(R.id.dropdown_sub label); | 188 TextView sublabelView = (TextView) layout.findViewById(R.id.dropdown_sub label); |
| 189 CharSequence sublabel = item.getSublabel(); | 189 CharSequence sublabel = item.getSublabel(); |
| 190 if (TextUtils.isEmpty(sublabel)) { | 190 if (TextUtils.isEmpty(sublabel)) { |
| 191 sublabelView.setVisibility(View.GONE); | 191 sublabelView.setVisibility(View.GONE); |
| 192 } else { | 192 } else { |
| 193 sublabelView.setLayoutParams(layoutParams); | 193 // Use the layout params in |dropdown_item.xml| for the sublabel if it is on the same |
| 194 // line as the label. | |
| 195 if (!item.isLabelAndSublabelOnSameLine()) { | |
| 196 sublabelView.setLayoutParams(layoutParams); | |
|
Ted C
2017/02/02 23:19:22
by conditionally overwriting the layout params, if
csashi
2017/02/03 00:03:37
Done.
| |
| 197 } | |
| 194 sublabelView.setText(sublabel); | 198 sublabelView.setText(sublabel); |
| 195 sublabelView.setTextSize(TypedValue.COMPLEX_UNIT_PX, | 199 sublabelView.setTextSize(TypedValue.COMPLEX_UNIT_PX, |
| 196 mContext.getResources().getDimension(item.getSublabelFontSiz eResId())); | 200 mContext.getResources().getDimension(item.getSublabelFontSiz eResId())); |
| 197 sublabelView.setVisibility(View.VISIBLE); | 201 sublabelView.setVisibility(View.VISIBLE); |
| 198 } | 202 } |
| 199 | 203 |
| 200 ImageView iconViewStart = (ImageView) layout.findViewById(R.id.start_dro pdown_icon); | 204 ImageView iconViewStart = (ImageView) layout.findViewById(R.id.start_dro pdown_icon); |
| 201 ImageView iconViewEnd = (ImageView) layout.findViewById(R.id.end_dropdow n_icon); | 205 ImageView iconViewEnd = (ImageView) layout.findViewById(R.id.end_dropdow n_icon); |
| 202 if (item.isIconAtStart()) { | 206 if (item.isIconAtStart()) { |
| 203 iconViewEnd.setVisibility(View.GONE); | 207 iconViewEnd.setVisibility(View.GONE); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 234 return mAreAllItemsEnabled; | 238 return mAreAllItemsEnabled; |
| 235 } | 239 } |
| 236 | 240 |
| 237 @Override | 241 @Override |
| 238 public boolean isEnabled(int position) { | 242 public boolean isEnabled(int position) { |
| 239 if (position < 0 || position >= getCount()) return false; | 243 if (position < 0 || position >= getCount()) return false; |
| 240 DropdownItem item = getItem(position); | 244 DropdownItem item = getItem(position); |
| 241 return item.isEnabled() && !item.isGroupHeader(); | 245 return item.isEnabled() && !item.isGroupHeader(); |
| 242 } | 246 } |
| 243 } | 247 } |
| OLD | NEW |