Fields Summary |
---|
private int | mBackgroundColor |
private boolean | mBackgroundColorSet |
private int | mProgressColor |
private boolean | mProgressColorSet |
private boolean | mSecondaryActionsHidden |
private Presenter | mDescriptionPresenter |
private PlaybackControlsPresenter | mPlaybackControlsPresenter |
private ControlBarPresenter | mSecondaryControlsPresenter |
private OnActionClickedListener | mOnActionClickedListener |
private static float | sShadowZ |
private final android.support.v17.leanback.widget.ControlBarPresenter.OnControlSelectedListener | mOnControlSelectedListener |
private final android.support.v17.leanback.widget.ControlBarPresenter.OnControlClickedListener | mOnControlClickedListener |
Methods Summary |
---|
public boolean | areSecondaryActionsHidden()Returns true if secondary actions are hidden.
return mSecondaryActionsHidden;
|
protected RowPresenter.ViewHolder | createRowViewHolder(android.view.ViewGroup parent)
View v = LayoutInflater.from(parent.getContext())
.inflate(R.layout.lb_playback_controls_row, parent, false);
ViewHolder vh = new ViewHolder(v, mDescriptionPresenter);
initRow(vh);
return vh;
|
public int | getBackgroundColor()Returns the background color. If no background color was set, transparent
is returned.
return mBackgroundColor;
|
private int | getDefaultBackgroundColor(android.content.Context context)
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.defaultBrandColor, outValue, true);
return context.getResources().getColor(outValue.resourceId);
|
private int | getDefaultProgressColor(android.content.Context context)
TypedValue outValue = new TypedValue();
context.getTheme().resolveAttribute(R.attr.playbackProgressPrimaryColor, outValue, true);
return context.getResources().getColor(outValue.resourceId);
|
public OnActionClickedListener | getOnActionClickedListener()Gets the listener for {@link Action} click events.
return mOnActionClickedListener;
|
public int | getProgressColor()Returns the primary color for the progress bar. If no color was set, transparent
is returned.
return mProgressColor;
|
private void | initRow(android.support.v17.leanback.widget.PlaybackControlsRowPresenter$ViewHolder vh)
vh.mCardHeight = vh.mCard.getLayoutParams().height;
MarginLayoutParams lp = (MarginLayoutParams) vh.mControlsDock.getLayoutParams();
vh.mControlsDockMarginStart = lp.getMarginStart();
vh.mControlsDockMarginEnd = lp.getMarginEnd();
vh.mControlsVh = (PlaybackControlsPresenter.ViewHolder)
mPlaybackControlsPresenter.onCreateViewHolder(vh.mControlsDock);
mPlaybackControlsPresenter.setProgressColor(vh.mControlsVh,
mProgressColorSet ? mProgressColor :
getDefaultProgressColor(vh.mControlsDock.getContext()));
vh.mControlsDock.addView(vh.mControlsVh.view);
vh.mSecondaryControlsVh =
mSecondaryControlsPresenter.onCreateViewHolder(vh.mSecondaryControlsDock);
if (!mSecondaryActionsHidden) {
vh.mSecondaryControlsDock.addView(vh.mSecondaryControlsVh.view);
}
|
protected void | onBindRowViewHolder(RowPresenter.ViewHolder holder, java.lang.Object item)
super.onBindRowViewHolder(holder, item);
ViewHolder vh = (ViewHolder) holder;
PlaybackControlsRow row = (PlaybackControlsRow) vh.getRow();
mPlaybackControlsPresenter.enableSecondaryActions(mSecondaryActionsHidden);
if (row.getItem() == null) {
LayoutParams lp = vh.mCard.getLayoutParams();
lp.height = LayoutParams.WRAP_CONTENT;
vh.mCard.setLayoutParams(lp);
vh.mDescriptionDock.setVisibility(View.GONE);
vh.mSpacer.setVisibility(View.GONE);
} else {
LayoutParams lp = vh.mCard.getLayoutParams();
lp.height = vh.mCardHeight;
vh.mCard.setLayoutParams(lp);
vh.mDescriptionDock.setVisibility(View.VISIBLE);
if (vh.mDescriptionViewHolder != null) {
mDescriptionPresenter.onBindViewHolder(vh.mDescriptionViewHolder, row.getItem());
}
vh.mSpacer.setVisibility(View.VISIBLE);
}
MarginLayoutParams lp = (MarginLayoutParams) vh.mControlsDock.getLayoutParams();
if (row.getImageDrawable() == null || row.getItem() == null) {
vh.mImageView.setImageDrawable(null);
vh.setBackground(vh.mControlsDock);
lp.setMarginStart(0);
lp.setMarginEnd(0);
mPlaybackControlsPresenter.enableTimeMargins(vh.mControlsVh, true);
} else {
vh.mImageView.setImageDrawable(row.getImageDrawable());
vh.setBackground(vh.mCard);
lp.setMarginStart(vh.mControlsDockMarginStart);
lp.setMarginEnd(vh.mControlsDockMarginEnd);
mPlaybackControlsPresenter.enableTimeMargins(vh.mControlsVh, false);
}
vh.mControlsDock.setLayoutParams(lp);
vh.mControlsBoundData.adapter = row.getPrimaryActionsAdapter();
vh.mControlsBoundData.secondaryActionsAdapter = row.getSecondaryActionsAdapter();
vh.mControlsBoundData.presenter = vh.getPresenter(true);
vh.mControlsBoundData.mRowViewHolder = vh;
mPlaybackControlsPresenter.onBindViewHolder(vh.mControlsVh, vh.mControlsBoundData);
vh.mSecondaryBoundData.adapter = row.getSecondaryActionsAdapter();
vh.mSecondaryBoundData.presenter = vh.getPresenter(false);
vh.mSecondaryBoundData.mRowViewHolder = vh;
mSecondaryControlsPresenter.onBindViewHolder(vh.mSecondaryControlsVh,
vh.mSecondaryBoundData);
mPlaybackControlsPresenter.setTotalTime(vh.mControlsVh, row.getTotalTime());
mPlaybackControlsPresenter.setCurrentTime(vh.mControlsVh, row.getCurrentTime());
mPlaybackControlsPresenter.setSecondaryProgress(vh.mControlsVh, row.getBufferedProgress());
row.setOnPlaybackStateChangedListener(vh.mListener);
|
protected void | onRowViewAttachedToWindow(RowPresenter.ViewHolder vh)
super.onRowViewAttachedToWindow(vh);
if (mDescriptionPresenter != null) {
mDescriptionPresenter.onViewAttachedToWindow(
((ViewHolder) vh).mDescriptionViewHolder);
}
|
protected void | onRowViewDetachedFromWindow(RowPresenter.ViewHolder vh)
super.onRowViewDetachedFromWindow(vh);
if (mDescriptionPresenter != null) {
mDescriptionPresenter.onViewDetachedFromWindow(
((ViewHolder) vh).mDescriptionViewHolder);
}
|
protected void | onRowViewSelected(RowPresenter.ViewHolder vh, boolean selected)
super.onRowViewSelected(vh, selected);
if (selected) {
((ViewHolder) vh).dispatchItemSelection();
}
|
protected void | onUnbindRowViewHolder(RowPresenter.ViewHolder holder)
ViewHolder vh = (ViewHolder) holder;
PlaybackControlsRow row = (PlaybackControlsRow) vh.getRow();
if (vh.mDescriptionViewHolder != null) {
mDescriptionPresenter.onUnbindViewHolder(vh.mDescriptionViewHolder);
}
mPlaybackControlsPresenter.onUnbindViewHolder(vh.mControlsVh);
mSecondaryControlsPresenter.onUnbindViewHolder(vh.mSecondaryControlsVh);
row.setOnPlaybackStateChangedListener(null);
super.onUnbindRowViewHolder(holder);
|
public void | setBackgroundColor(int color)Sets the background color. If not set, a default from the theme will be used.
mBackgroundColor = color;
mBackgroundColorSet = true;
|
public void | setOnActionClickedListener(OnActionClickedListener listener)Sets the listener for {@link Action} click events.
mOnActionClickedListener = listener;
|
public void | setProgressColor(int color)Sets the primary color for the progress bar. If not set, a default from
the theme will be used.
mProgressColor = color;
mProgressColorSet = true;
|
public void | setSecondaryActionsHidden(boolean hidden)Sets the secondary actions to be hidden behind a "more actions" button.
When "more actions" is selected, the primary actions are replaced with
the secondary actions.
mSecondaryActionsHidden = hidden;
|
public void | showBottomSpace(android.support.v17.leanback.widget.PlaybackControlsRowPresenter$ViewHolder vh, boolean show)Shows or hides space at the bottom of the playback controls row.
This allows the row to hug the bottom of the display when no
other rows are present.
vh.mBottomSpacer.setVisibility(show ? View.VISIBLE : View.GONE);
|
public void | showPrimaryActions(android.support.v17.leanback.widget.PlaybackControlsRowPresenter$ViewHolder vh)Display the primary actions.
mPlaybackControlsPresenter.showPrimaryActions(vh.mControlsVh);
|