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

PlaybackControlsRow

public class PlaybackControlsRow extends Row
A row of playback controls to be displayed by a {@link PlaybackControlsRowPresenter}. This row consists of some optional item detail, a series of primary actions, and an optional series of secondary actions. Controls are specified via an {@link ObjectAdapter} containing one or more {@link Action}s. Adapters should have their {@link PresenterSelector} set to an instance of {@link ControlButtonPresenterSelector}.

Fields Summary
private Object
mItem
private android.graphics.drawable.Drawable
mImageDrawable
private ObjectAdapter
mPrimaryActionsAdapter
private ObjectAdapter
mSecondaryActionsAdapter
private int
mTotalTimeMs
private int
mCurrentTimeMs
private int
mBufferedProgressMs
private OnPlaybackStateChangedListener
mListener
Constructors Summary
public PlaybackControlsRow(Object item)
Constructor for a PlaybackControlsRow that displays some details from the given item.

param
item The main item for the row.

        mItem = item;
    
public PlaybackControlsRow()
Constructor for a PlaybackControlsRow that has no item details.

    
Methods Summary
private voidbufferedProgressChanged()

        if (mListener != null) {
            mListener.onBufferedProgressChanged(mBufferedProgressMs);
        }
    
private static android.graphics.BitmapcreateBitmap(android.graphics.Bitmap bitmap, int color)

        Bitmap dst = bitmap.copy(bitmap.getConfig(), true);
        Canvas canvas = new Canvas(dst);
        Paint paint = new Paint();
        paint.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_ATOP));
        canvas.drawBitmap(bitmap, 0, 0, paint);
        return dst;
    
private voidcurrentTimeChanged()

        if (mListener != null) {
            mListener.onCurrentTimeChanged(mCurrentTimeMs);
        }
    
public intgetBufferedProgress()
Returns the buffered progress for the playback controls row.

        return mBufferedProgressMs;
    
private static intgetColorFromTheme(android.content.Context context, int attributeResId)

        TypedValue outValue = new TypedValue();
        context.getTheme().resolveAttribute(attributeResId, outValue, true);
        return outValue.data;
    
public intgetCurrentTime()
Returns the current time in milliseconds for the playback controls row.

        return mCurrentTimeMs;
    
public final android.graphics.drawable.DrawablegetImageDrawable()
Gets the image {@link Drawable} of this row.

return
The overview's image drawable, or null if no drawable has been assigned.

        return mImageDrawable;
    
public final java.lang.ObjectgetItem()
Gets the main item for the details page.

        return mItem;
    
public android.support.v17.leanback.widget.PlaybackControlsRow$OnPlaybackStateChangedListenergetOnPlaybackStateChangedListener()
Returns the playback state listener.

        return mListener;
    
public final ObjectAdaptergetPrimaryActionsAdapter()
Returns the primary actions {@link ObjectAdapter}.

        return mPrimaryActionsAdapter;
    
public final ObjectAdaptergetSecondaryActionsAdapter()
Returns the secondary actions {@link ObjectAdapter}.

        return mSecondaryActionsAdapter;
    
private static android.graphics.drawable.DrawablegetStyledDrawable(android.content.Context context, int index)

        TypedValue outValue = new TypedValue();
        context.getTheme().resolveAttribute(
                R.attr.playbackControlsActionIcons, outValue, false);
        TypedArray array = context.getTheme().obtainStyledAttributes(outValue.data,
                R.styleable.lbPlaybackControlsActionIcons);
        Drawable drawable = array.getDrawable(index);
        array.recycle();
        return drawable;
    
public intgetTotalTime()
Returns the total time in milliseconds for the playback controls row.

        return mTotalTimeMs;
    
public voidsetBufferedProgress(int ms)
Sets the buffered progress for the playback controls row. If this row is bound to a view, the view will automatically be updated to reflect the new value.

        if (mBufferedProgressMs != ms) {
            mBufferedProgressMs = ms;
            bufferedProgressChanged();
        }
    
public voidsetCurrentTime(int ms)
Sets the current time in milliseconds for the playback controls row. If this row is bound to a view, the view will automatically be updated to reflect the new value.

        if (mCurrentTimeMs != ms) {
            mCurrentTimeMs = ms;
            currentTimeChanged();
        }
    
public final voidsetImageBitmap(android.content.Context context, android.graphics.Bitmap bm)
Sets a {@link Bitmap} for this row.

param
context The context to retrieve display metrics from.
param
bm The bitmap to set.

        mImageDrawable = new BitmapDrawable(context.getResources(), bm);
    
public final voidsetImageDrawable(android.graphics.drawable.Drawable drawable)
Sets a {link @Drawable} image for this row.

param
drawable The drawable to set.

        mImageDrawable = drawable;
    
public voidsetOnPlaybackStateChangedListener(android.support.v17.leanback.widget.PlaybackControlsRow$OnPlaybackStateChangedListener listener)
Sets a listener to be called when the playback state changes.

        mListener = listener;
    
public final voidsetPrimaryActionsAdapter(ObjectAdapter adapter)
Sets the primary actions {@link ObjectAdapter}.

        mPrimaryActionsAdapter = adapter;
    
public final voidsetSecondaryActionsAdapter(ObjectAdapter adapter)
Sets the secondary actions {@link ObjectAdapter}.

        mSecondaryActionsAdapter = adapter;
    
public voidsetTotalTime(int ms)
Sets the total time in milliseconds for the playback controls row.

        mTotalTimeMs = ms;