FileDocCategorySizeDatePackage
AccountItemView.javaAPI DocAndroid 5.1 API3054Thu Mar 12 22:22:10 GMT 2015com.android.internal.widget

AccountItemView

public class AccountItemView extends android.widget.LinearLayout
An LinearLayout view, to show Accounts elements.

Fields Summary
private android.widget.ImageView
mAccountIcon
private android.widget.TextView
mAccountName
private android.widget.TextView
mAccountNumber
Constructors Summary
public AccountItemView(android.content.Context context)
Constructor.

        this(context, null);
    
public AccountItemView(android.content.Context context, android.util.AttributeSet attrs)
Constructor.

        super(context, attrs);
        LayoutInflater inflator = (LayoutInflater)
                context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflator.inflate(R.layout.simple_account_item, null);
        addView(view);
        initViewItem(view);
    
Methods Summary
private voidinitViewItem(android.view.View view)

        mAccountIcon = (ImageView)view.findViewById(android.R.id.icon);
        mAccountName = (TextView)view.findViewById(android.R.id.title);
        mAccountNumber = (TextView)view.findViewById(android.R.id.summary);
    
public voidsetAccountIcon(int resId)

        mAccountIcon.setImageResource(resId);
    
public voidsetAccountIcon(android.graphics.drawable.Drawable drawable)

        mAccountIcon.setBackgroundDrawable(drawable);
    
public voidsetAccountName(java.lang.String name)

        setText(mAccountName, name);
    
public voidsetAccountNumber(java.lang.String number)

        setText(mAccountNumber, number);
    
private voidsetText(android.widget.TextView view, java.lang.String text)

        if (TextUtils.isEmpty(text)) {
            view.setVisibility(View.GONE);
        } else {
            view.setText(text);
            view.setVisibility(View.VISIBLE);
        }
    
public voidsetViewItem(com.android.internal.widget.AccountViewAdapter.AccountElements element)

        Drawable drawable = element.getDrawable();
        if (drawable != null) {
            setAccountIcon(drawable);
        } else {
            setAccountIcon(element.getIcon());
        }
        setAccountName(element.getName());
        setAccountNumber(element.getNumber());