| 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.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 labelView.setText(item.getLabel()); | 92 labelView.setText(item.getLabel()); |
| 93 labelView.setSingleLine(!item.isMultilineLabel()); | 93 labelView.setSingleLine(!item.isMultilineLabel()); |
| 94 | 94 |
| 95 labelView.setEnabled(item.isEnabled()); | 95 labelView.setEnabled(item.isEnabled()); |
| 96 if (item.isGroupHeader()) { | 96 if (item.isGroupHeader()) { |
| 97 labelView.setTypeface(null, Typeface.BOLD); | 97 labelView.setTypeface(null, Typeface.BOLD); |
| 98 } else { | 98 } else { |
| 99 labelView.setTypeface(null, Typeface.NORMAL); | 99 labelView.setTypeface(null, Typeface.NORMAL); |
| 100 } | 100 } |
| 101 | 101 |
| 102 labelView.setTextColor( |
| 103 ApiCompatibilityUtils.getColor(mContext.getResources(), item.get
LabelFontColor())); |
| 104 labelView.setTextSize( |
| 105 mContext.getResources().getDimensionPixelSize(item.getLabelFontS
ize())); |
| 106 |
| 102 TextView sublabelView = (TextView) layout.findViewById(R.id.dropdown_sub
label); | 107 TextView sublabelView = (TextView) layout.findViewById(R.id.dropdown_sub
label); |
| 103 CharSequence sublabel = item.getSublabel(); | 108 CharSequence sublabel = item.getSublabel(); |
| 104 if (TextUtils.isEmpty(sublabel)) { | 109 if (TextUtils.isEmpty(sublabel)) { |
| 105 sublabelView.setVisibility(View.GONE); | 110 sublabelView.setVisibility(View.GONE); |
| 106 } else { | 111 } else { |
| 107 sublabelView.setText(sublabel); | 112 sublabelView.setText(sublabel); |
| 108 sublabelView.setVisibility(View.VISIBLE); | 113 sublabelView.setVisibility(View.VISIBLE); |
| 109 } | 114 } |
| 110 | 115 |
| 111 ImageView iconView = (ImageView) layout.findViewById(R.id.dropdown_icon)
; | 116 ImageView iconView = (ImageView) layout.findViewById(R.id.dropdown_icon)
; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 124 return mAreAllItemsEnabled; | 129 return mAreAllItemsEnabled; |
| 125 } | 130 } |
| 126 | 131 |
| 127 @Override | 132 @Override |
| 128 public boolean isEnabled(int position) { | 133 public boolean isEnabled(int position) { |
| 129 if (position < 0 || position >= getCount()) return false; | 134 if (position < 0 || position >= getCount()) return false; |
| 130 DropdownItem item = getItem(position); | 135 DropdownItem item = getItem(position); |
| 131 return item.isEnabled() && !item.isGroupHeader(); | 136 return item.isEnabled() && !item.isGroupHeader(); |
| 132 } | 137 } |
| 133 } | 138 } |
| OLD | NEW |