UserDetailItemViewpublic class UserDetailItemView extends android.widget.LinearLayout Displays one user in the {@link UserDetailView} view. |
Fields Summary |
---|
private com.android.systemui.statusbar.phone.UserAvatarView | mAvatar | private android.widget.TextView | mName | private android.graphics.Typeface | mRegularTypeface | private android.graphics.Typeface | mActivatedTypeface |
Constructors Summary |
---|
public UserDetailItemView(android.content.Context context)
this(context, null);
| public UserDetailItemView(android.content.Context context, android.util.AttributeSet attrs)
this(context, attrs, 0);
| public UserDetailItemView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr)
this(context, attrs, defStyleAttr, 0);
| public UserDetailItemView(android.content.Context context, android.util.AttributeSet attrs, int defStyleAttr, int defStyleRes)
super(context, attrs, defStyleAttr, defStyleRes);
final TypedArray a = context.obtainStyledAttributes(
attrs, R.styleable.UserDetailItemView, defStyleAttr, defStyleRes);
final int N = a.getIndexCount();
for (int i = 0; i < N; i++) {
int attr = a.getIndex(i);
switch (attr) {
case R.styleable.UserDetailItemView_regularFontFamily:
mRegularTypeface = Typeface.create(a.getString(attr), 0 /* style */);
break;
case R.styleable.UserDetailItemView_activatedFontFamily:
mActivatedTypeface = Typeface.create(a.getString(attr), 0 /* style */);
break;
}
}
a.recycle();
|
Methods Summary |
---|
public void | bind(java.lang.String name, android.graphics.Bitmap picture)
mName.setText(name);
mAvatar.setBitmap(picture);
| public void | bind(java.lang.String name, android.graphics.drawable.Drawable picture)
mName.setText(name);
mAvatar.setDrawable(picture);
| public static com.android.systemui.qs.tiles.UserDetailItemView | convertOrInflate(android.content.Context context, android.view.View convertView, android.view.ViewGroup root)
if (!(convertView instanceof UserDetailItemView)) {
convertView = LayoutInflater.from(context).inflate(
R.layout.qs_user_detail_item, root, false);
}
return (UserDetailItemView) convertView;
| protected void | drawableStateChanged()
super.drawableStateChanged();
updateTypeface();
| public boolean | hasOverlappingRendering()
return false;
| protected void | onConfigurationChanged(android.content.res.Configuration newConfig)
super.onConfigurationChanged(newConfig);
FontSizeUtils.updateFontSize(mName, R.dimen.qs_detail_item_secondary_text_size);
| protected void | onFinishInflate()
mAvatar = (UserAvatarView) findViewById(R.id.user_picture);
mName = (TextView) findViewById(R.id.user_name);
if (mRegularTypeface == null) {
mRegularTypeface = mName.getTypeface();
}
if (mActivatedTypeface == null) {
mActivatedTypeface = mName.getTypeface();
}
updateTypeface();
| private void | updateTypeface()
boolean activated = ArrayUtils.contains(getDrawableState(), android.R.attr.state_activated);
mName.setTypeface(activated ? mActivatedTypeface : mRegularTypeface);
|
|