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

Row

public class Row extends Object
A row in a RowsFragment. This is the base class for all rows. You will typically use a {@link ListRow}, but you may override this class for non-list Rows.

Fields Summary
private static final int
FLAG_ID_USE_MASK
private static final int
FLAG_ID_USE_HEADER
private static final int
FLAG_ID_USE_ID
private int
mFlags
private HeaderItem
mHeaderItem
private long
mId
Constructors Summary
public Row(long id, HeaderItem headerItem)
Constructor for a Row.

param
id The id of the row.
param
headerItem The {@link HeaderItem} for this Row, or null if there is no header.


                                          
         
        setId(id);
        setHeaderItem(headerItem);
    
public Row(HeaderItem headerItem)
Constructor for a Row.

param
headerItem The {@link HeaderItem} for this Row, or null if there is no header.

        setHeaderItem(headerItem);
    
public Row()
Constructor for a Row.

    
Methods Summary
final intgetFlags()

        return mFlags;
    
public final HeaderItemgetHeaderItem()
Get the {@link HeaderItem} that represents metadata for the row.

return
The HeaderItem for this row, or null if unset.

        return mHeaderItem;
    
public final longgetId()
Returns a unique identifier for this row. This id can come from one of three places:
  • If {@link #setId(long)} is ever called on this row, it will return this id.
  • If {@link #setId(long)} has not been called but the header item is not null, the result of {@link HeaderItem#getId()} is returned.
  • Otherwise {@link ObjectAdapter#NO_ID NO_ID} is returned.

        if ( (mFlags & FLAG_ID_USE_MASK) == FLAG_ID_USE_HEADER) {
            HeaderItem header = getHeaderItem();
            if (header != null) {
                return header.getId();
            }
            return NO_ID;
        } else {
            return mId;
        }
    
final voidsetFlags(int flags, int mask)

        mFlags = (mFlags & ~mask) | (flags & mask);
    
public final voidsetHeaderItem(HeaderItem headerItem)
Set the {@link HeaderItem} that represents metadata for the row.

param
headerItem The HeaderItem for this Row, or null if there is no header.

        mHeaderItem = headerItem;
    
public final voidsetId(long id)
Set the id for this row.

param
id The id of the row.

        mId = id;
        setFlags(FLAG_ID_USE_ID, FLAG_ID_USE_MASK);