androidx.leanback.widget.OnItemViewSelectedListener Java Examples

The following examples show how to use androidx.leanback.widget.OnItemViewSelectedListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ListenerModule.java    From tv-samples with Apache License 2.0 6 votes vote down vote up
@PerFragment
@Provides
@IntoMap
@ListenerModuleKey(LiveDataFragment.class)
public OnItemViewSelectedListener provideOnItemViewSelectedListener(final Activity activity,
        final DisplayMetrics metrics, final BackgroundManager backgroundManager,
        final RequestOptions defaultPlaceHolder, final Drawable finalDrawable, final Handler mainHandler) {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                RowPresenter.ViewHolder rowViewHolder, Row row) {
            VideoEntity selectedVideo = (VideoEntity) item;
            RunnableClass backgroundRunnable = new RunnableClass(selectedVideo, activity,
                    metrics, backgroundManager, defaultPlaceHolder, finalDrawable);

            if (lastTime != null) {
                mainHandler.removeCallbacks(lastTime);
            }
            mainHandler.postDelayed(backgroundRunnable, BACKGROUND_UPDATE_DELAY);
            lastTime = backgroundRunnable;
        }
    };
}
 
Example #2
Source File: ListenerFactory.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
@Inject
public ListenerFactory(Map<Class, OnItemViewClickedListener> onItemViewClickedListenerMap,
        Map<Class, OnItemViewSelectedListener> onItemViewSelectedListenerMap,
        Map<Class, View.OnClickListener> viewOnClickListenerMap) {
    mOnItemViewClickedListenerMap = onItemViewClickedListenerMap;
    mOnItemViewSelectedListenerMap = onItemViewSelectedListenerMap;
    mViewOnClickListenerMap = viewOnClickListenerMap;

}
 
Example #3
Source File: ListenerFactory.java    From tv-samples with Apache License 2.0 4 votes vote down vote up
public OnItemViewSelectedListener getOnItemViewSelectedListener(Class key) {
    return mOnItemViewSelectedListenerMap.get(key);
}
 
Example #4
Source File: GridFragment.java    From tv-samples with Apache License 2.0 4 votes vote down vote up
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
 
Example #5
Source File: HorizontalGridPresenter.java    From jellyfin-androidtv with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Returns the item selected listener.
 */
public final OnItemViewSelectedListener getOnItemViewSelectedListener() {
    return mOnItemViewSelectedListener;
}
 
Example #6
Source File: GridFragment.java    From jellyfin-androidtv with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
 
Example #7
Source File: CompositeSelectedListener.java    From jellyfin-androidtv with GNU General Public License v2.0 4 votes vote down vote up
public void registerListener (OnItemViewSelectedListener listener) {
    registeredListeners.add(listener);
}
 
Example #8
Source File: CompositeSelectedListener.java    From jellyfin-androidtv with GNU General Public License v2.0 4 votes vote down vote up
public void unRegisterListener (OnItemViewSelectedListener listener) {
    registeredListeners.remove(listener);
}
 
Example #9
Source File: CompositeSelectedListener.java    From jellyfin-androidtv with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    for (OnItemViewSelectedListener listener : registeredListeners) {
        listener.onItemSelected(itemViewHolder, item, rowViewHolder, row);
    }
}
 
Example #10
Source File: HorizontalGridPresenter.java    From jellyfin-androidtv with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets the item selected listener.
 * Since this is a grid the row parameter is always null.
 */
public final void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}