Java 类android.support.v17.leanback.widget.OnItemViewSelectedListener 实例源码

项目:leanback-showcase    文件:ListenerModule.java   
@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;
        }
    };
}
项目:leanback-showcase    文件:ListenerFactory.java   
@Inject
public ListenerFactory(Map<Class, OnItemViewClickedListener> onItemViewClickedListenerMap,
        Map<Class, OnItemViewSelectedListener> onItemViewSelectedListenerMap,
        Map<Class, View.OnClickListener> viewOnClickListenerMap) {
    mOnItemViewClickedListenerMap = onItemViewClickedListenerMap;
    mOnItemViewSelectedListenerMap = onItemViewSelectedListenerMap;
    mViewOnClickListenerMap = viewOnClickListenerMap;

}
项目:sbs-android-tv    文件:DetailsFragment.java   
private OnItemViewSelectedListener getItemSelectedListener() {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            Log.d(TAG, "Selected item:" + item);
            if (item instanceof EpisodeBaseModel) {
                selectCurrentEpisode((EpisodeBaseModel) item, false);
            }
        }
    };
}
项目:danish-media-license    文件:OnDemandListeners.java   
static OnItemViewSelectedListener createOnItemViewSelectedListener(final Activity activity) {
  notNull(activity);
  return new OnItemViewSelectedListener() {
    @Override
    public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                               RowPresenter.ViewHolder rowViewHolder, Row row) {
      if (item instanceof Video) {
        Video video = (Video) item;
        BackgroundHelper.setBackgroundDelayed(activity, video.getImageUrl());
      }
    }
  };
}
项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
protected OnItemViewSelectedListener getDefaultItemSelectedListener() {

        return new OnItemViewSelectedListener() {
            public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                                       RowPresenter.ViewHolder rowViewHolder, Row row) {
                if (item instanceof Video) {
                    bgHelper.setBackgroundUrl(((Video) item).getThumbUrl());
                    bgHelper.startBackgroundTimer();
                }

            }
        };
    }
项目:android-tv-leanback    文件:LeanbackBrowseFragment.java   
protected OnItemViewSelectedListener getDefaultItemSelectedListener() {

        return new OnItemViewSelectedListener() {
            public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                                       RowPresenter.ViewHolder rowViewHolder, Row row) {
                if (item instanceof Video) {
                    bgHelper.setBackgroundUrl(((Video) item).getThumbUrl());
                    bgHelper.startBackgroundTimer();
                }

            }
        };
    }
项目:iview-android-tv    文件:DetailsFragment.java   
private OnItemViewSelectedListener getItemSelectedListener() {
    return new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
            Log.d(TAG, "Selected item:" + item);
            if (item instanceof EpisodeBaseModel) {
                selectCurrentEpisode((EpisodeBaseModel) item, false);
            }
        }
    };
}
项目:adt-leanback-support    文件:RowsSupportFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        final int count = listView.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder)
                    listView.getChildViewHolder(view);
            setOnItemViewSelectedListener(vh, mOnItemViewSelectedListener);
        }
    }
}
项目:adt-leanback-support    文件:RowsFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
    VerticalGridView listView = getVerticalGridView();
    if (listView != null) {
        final int count = listView.getChildCount();
        for (int i = 0; i < count; i++) {
            View view = listView.getChildAt(i);
            ItemBridgeAdapter.ViewHolder vh = (ItemBridgeAdapter.ViewHolder)
                    listView.getChildViewHolder(view);
            setOnItemViewSelectedListener(vh, mOnItemViewSelectedListener);
        }
    }
}
项目:aos-Video    文件:MyVerticalGridFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
项目:leanback-showcase    文件:ListenerFactory.java   
public OnItemViewSelectedListener getOnItemViewSelectedListener(Class key) {
    return mOnItemViewSelectedListenerMap.get(key);
}
项目:leanback-showcase    文件:GridFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
项目:MediaBrowser.AndroidTv    文件:StdBrowseFragment.java   
public void registerListener (OnItemViewSelectedListener listener) {
    registeredListeners.add(listener);
}
项目:MediaBrowser.AndroidTv    文件:StdBrowseFragment.java   
public void unRegisterListener (OnItemViewSelectedListener listener) {
    registeredListeners.remove(listener);
}
项目:MediaBrowser.AndroidTv    文件:StdBrowseFragment.java   
@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    for (OnItemViewSelectedListener listener : registeredListeners) {
        listener.onItemSelected(itemViewHolder, item, rowViewHolder, row);
    }
}
项目:adt-leanback-support    文件:VerticalGridSupportFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
项目:adt-leanback-support    文件:RowsSupportFragment.java   
/**
 * Returns an item selection listener.
 */
public OnItemViewSelectedListener getOnItemViewSelectedListener() {
    return mOnItemViewSelectedListener;
}
项目:adt-leanback-support    文件:RowsSupportFragment.java   
private static void setOnItemViewSelectedListener(ItemBridgeAdapter.ViewHolder vh,
        OnItemViewSelectedListener listener) {
    ((RowPresenter) vh.getPresenter()).setOnItemViewSelectedListener(listener);
}
项目:adt-leanback-support    文件:DetailsSupportFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mExternalOnItemViewSelectedListener = listener;
}
项目:adt-leanback-support    文件:DetailsFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mExternalOnItemViewSelectedListener = listener;
}
项目:adt-leanback-support    文件:RowsFragment.java   
/**
 * Returns an item selection listener.
 */
public OnItemViewSelectedListener getOnItemViewSelectedListener() {
    return mOnItemViewSelectedListener;
}
项目:adt-leanback-support    文件:RowsFragment.java   
private static void setOnItemViewSelectedListener(ItemBridgeAdapter.ViewHolder vh,
        OnItemViewSelectedListener listener) {
    ((RowPresenter) vh.getPresenter()).setOnItemViewSelectedListener(listener);
}
项目:adt-leanback-support    文件:BrowseFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mExternalOnItemViewSelectedListener = listener;
}
项目:adt-leanback-support    文件:BrowseFragment.java   
/**
 * Returns an item selection listener.
 */
public OnItemViewSelectedListener getOnItemViewSelectedListener() {
    return mExternalOnItemViewSelectedListener;
}
项目:adt-leanback-support    文件:BrowseSupportFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mExternalOnItemViewSelectedListener = listener;
}
项目:adt-leanback-support    文件:BrowseSupportFragment.java   
/**
 * Returns an item selection listener.
 */
public OnItemViewSelectedListener getOnItemViewSelectedListener() {
    return mExternalOnItemViewSelectedListener;
}
项目:adt-leanback-support    文件:VerticalGridFragment.java   
/**
 * Sets an item selection listener.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
项目:BuildingForAndroidTV    文件:PlaybackOverlayFragment.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate");
    super.onCreate(savedInstanceState);

    mItems = new ArrayList<Movie>();
    mSelectedMovie = (Movie) getActivity()
            .getIntent().getParcelableExtra(MovieDetailsActivity.MOVIE);

    HashMap<String, List<Movie>> movies = VideoProvider.getMovieList();

    if (movies != null) {
        for (Map.Entry<String, List<Movie>> entry : movies.entrySet()) {
            if (mSelectedMovie.getCategory().contains(entry.getKey())) {
                List<Movie> list = entry.getValue();
                if (list != null && !list.isEmpty()) {
                    for (int j = 0; j < list.size(); j++) {
                        mItems.add(list.get(j));
                        if (mSelectedMovie.getTitle().contentEquals(list.get(j).getTitle())) {
                            mCurrentItem = j;
                        }
                    }
                }
            }
        }
    }

    mHandler = new Handler();

    setBackgroundType(BACKGROUND_TYPE);
    setFadingEnabled(false);

    setupRows();

    setOnItemViewSelectedListener(new OnItemViewSelectedListener() {
        @Override
        public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item,
                                   RowPresenter.ViewHolder rowViewHolder, Row row) {
            Log.i(TAG, "onItemSelected: " + item + " row " + row);
        }
    });
    setOnItemViewClickedListener(new ItemViewClickedListener());
}
项目:adt-leanback-support    文件:SearchSupportFragment.java   
/**
 * Sets an item selection listener for the results.
 *
 * @param listener The item selection listener to be invoked when an item in
 *        the search results is selected.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}
项目:adt-leanback-support    文件:SearchFragment.java   
/**
 * Sets an item selection listener for the results.
 *
 * @param listener The item selection listener to be invoked when an item in
 *        the search results is selected.
 */
public void setOnItemViewSelectedListener(OnItemViewSelectedListener listener) {
    mOnItemViewSelectedListener = listener;
}