FileDocCategorySizeDatePackage
Action.javaAPI DocAndroid 5.1 API3903Thu Mar 12 22:22:56 GMT 2015android.support.v17.leanback.widget

Action

public class Action extends Object
An action that can be shown on a details page. It contains one or two lines of text and an optional image.

Fields Summary
private long
mId
private android.graphics.drawable.Drawable
mIcon
private CharSequence
mLabel1
private CharSequence
mLabel2
Constructors Summary
public Action(long id)
Constructor for an Action.

param
id The id of the Action.


                    
       
        this(id, "");
    
public Action(long id, CharSequence label)
Constructor for an Action.

param
id The id of the Action.
param
label The label to display for the Action.

        this(id, label, null);
    
public Action(long id, CharSequence label1, CharSequence label2)
Constructor for an Action.

param
id The id of the Action.
param
label1 The label to display on the first line of the Action.
param
label2 The label to display on the second line of the Action.

        this(id, label1, label2, null);
    
public Action(long id, CharSequence label1, CharSequence label2, android.graphics.drawable.Drawable icon)
Constructor for an Action.

param
id The id of the Action.
param
label1 The label to display on the first line of the Action.
param
label2 The label to display on the second line of the Action.
param
icon The icon to display for the Action.

        setId(id);
        setLabel1(label1);
        setLabel2(label2);
        setIcon(icon);
    
Methods Summary
public final android.graphics.drawable.DrawablegetIcon()
Returns the icon drawable for this Action.

        return mIcon;
    
public final longgetId()
Returns the id for this Action.

        return mId;
    
public final java.lang.CharSequencegetLabel1()
Returns the first line label for this Action.

        return mLabel1;
    
public final java.lang.CharSequencegetLabel2()
Returns the second line label for this Action.

        return mLabel2;
    
public final voidsetIcon(android.graphics.drawable.Drawable icon)
Set the icon drawable for this Action.

        mIcon = icon;
    
public final voidsetId(long id)
Set id for this Action.

        mId = id;
    
public final voidsetLabel1(java.lang.CharSequence label)
Set the first line label for this Action.

        mLabel1 = label;
    
public final voidsetLabel2(java.lang.CharSequence label)
Set the second line label for this Action.

        mLabel2 = label;
    
public java.lang.StringtoString()

        StringBuilder sb = new StringBuilder();
        if (!TextUtils.isEmpty(mLabel1)) {
            sb.append(mLabel1);
        }
        if (!TextUtils.isEmpty(mLabel2)) {
            if (!TextUtils.isEmpty(mLabel1)) {
                sb.append(" ");
            }
            sb.append(mLabel2);
        }
        if (mIcon != null && sb.length() == 0) {
            sb.append("(action icon)");
        }
        return sb.toString();