Java Code Examples for android.support.v17.leanback.widget.DetailsOverviewRowPresenter#setBackgroundColor()
The following examples show how to use
android.support.v17.leanback.widget.DetailsOverviewRowPresenter#setBackgroundColor() .
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: MovieDetailsFragment.java From BuildingForAndroidTV with MIT License | 6 votes |
private void setupDetailsOverviewRowPresenter() { // Set detail background and style. DetailsOverviewRowPresenter detailsPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter()); detailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background)); detailsPresenter.setStyleLarge(true); // Hook up transition element. detailsPresenter.setSharedElementEnterTransition(getActivity(), MovieDetailsActivity.SHARED_ELEMENT_NAME); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_WATCH_TRAILER) { Intent intent = new Intent(getActivity(), PlaybackActivity.class); intent.putExtra(MovieDetailsActivity.MOVIE, mSelectedMovie); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); }
Example 2
Source File: AppDetailsFragment.java From TvAppRepo with Apache License 2.0 | 5 votes |
private void setupDetailsOverviewRowPresenter() { // Set detail background and style. DetailsOverviewRowPresenter detailsPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter(getActivity())); detailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background)); detailsPresenter.setStyleLarge(true); // Hook up transition element. detailsPresenter.setSharedElementEnterTransition(getActivity(), DetailsActivity.SHARED_ELEMENT_NAME); mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); }
Example 3
Source File: DetailRowBuilderTask.java From Amphitheatre with Apache License 2.0 | 5 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter(mActivity)); dorPresenter.setBackgroundColor(mActivity.getResources().getColor(R.color.fastlane_background)); dorPresenter.setStyleLarge(true); dorPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_PLAY) { VideoUtils.playVideo(new WeakReference<Activity>(mActivity), mVideo); } else if (action.getId() == ACTION_VIEW_TRAILER) { Uri trailerUri = Uri.parse(mVideo.getMovie().getTrailer()); mActivity.startActivity(new Intent(Intent.ACTION_VIEW, trailerUri)); } else { Toast.makeText(mActivity, action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); addGroups(adapter); if (mRowBuilderTaskListener != null) { mRowBuilderTaskListener.taskCompleted(adapter); } }
Example 4
Source File: VideoDetailsFragment.java From AndroidDemoProjects with Apache License 2.0 | 5 votes |
@Override protected void onPostExecute( DetailsOverviewRow detailRow ) { if( detailRow == null ) return; ClassPresenterSelector ps = new ClassPresenterSelector(); DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter( new DetailsDescriptionPresenter() ); // set detail background and style dorPresenter.setBackgroundColor( getResources().getColor( R.color.detail_background ) ); dorPresenter.setStyleLarge( true ); dorPresenter.setOnActionClickedListener( new OnActionClickedListener() { @Override public void onActionClicked( Action action ) { if (action.getId() == ACTION_WATCH ) { Intent intent = new Intent( getActivity(), PlayerActivity.class ); intent.putExtra( EXTRA_MOVIE, mSelectedMovie ); intent.putExtra( EXTRA_SHOULD_AUTO_START, true ); startActivity( intent ); } } }); ps.addClassPresenter( DetailsOverviewRow.class, dorPresenter ); ps.addClassPresenter( ListRow.class, new ListRowPresenter() ); ArrayObjectAdapter adapter = new ArrayObjectAdapter( ps ); adapter.add( detailRow ); loadRelatedMedia( adapter ); setAdapter( adapter ); }
Example 5
Source File: VideoDetailsFragment.java From CumulusTV with MIT License | 4 votes |
private void setupDetailsOverviewRowPresenter() { // Set detail background and style. DetailsOverviewRowPresenter detailsPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter()); detailsPresenter.setBackgroundColor(getResources().getColor(R.color.selected_background)); detailsPresenter.setStyleLarge(true); // Hook up transition element. detailsPresenter.setSharedElementEnterTransition(getActivity(), DetailsActivity.SHARED_ELEMENT_NAME); detailsPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if(action.getId() == ACTION_EDIT) { ActivityUtils.editChannel(getActivity(), jsonChannel.getMediaUrl()); } else if(action.getId() == ACTION_WATCH) { Log.d(TAG, ChannelDatabase.getInstance(getActivity()).getHashMap().toString()); if (ChannelDatabase.getInstance(getActivity()).getHashMap() .containsKey(jsonChannel.getMediaUrl())) { // Open in Live Channels Uri liveChannelsUri = TvContract.buildChannelUri( ChannelDatabase.getInstance( getActivity()).getHashMap() .get(jsonChannel.getMediaUrl())); getActivity().startActivity( new Intent(Intent.ACTION_VIEW, liveChannelsUri)); } else { ActivityUtils.openStream(getActivity(), jsonChannel.getMediaUrl()); } } else if(action.getId() == ACTION_ADD) { Log.d(TAG, "Adding " + jsonChannel.toString()); ActivityUtils .addChannel(getActivity(), gapi, jsonChannel); getActivity().setResult(LeanbackActivity.RESULT_CODE_REFRESH_UI); getActivity().finish(); } } }); mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); }
Example 6
Source File: RichAppLinkDetailsFragment.java From androidtv-sample-inputs with Apache License 2.0 | 4 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final String displayNumber = getActivity().getIntent().getStringExtra( RichFeedUtil.EXTRA_DISPLAY_NUMBER); DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter( new DetailsDescriptionPresenter()); dorPresenter.setSharedElementEnterTransition(getActivity(), "RichAppLinkDetailsFragment"); DetailsOverviewRow row = new DetailsOverviewRow(displayNumber); Resources res = getResources(); Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.your_company); int length = Math.min(bitmap.getWidth(), bitmap.getHeight()); Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, (bitmap.getWidth() - length) / 2, (bitmap.getHeight() - length) / 2, length, length); row.setImageBitmap(getActivity(), croppedBitmap); Action action1 = new Action(0, res.getString(R.string.details_fragment_action_1)); Action action2 = new Action(1, res.getString(R.string.details_fragment_action_2)); row.addAction(action1); row.addAction(action2); ClassPresenterSelector presenterSelector = new ClassPresenterSelector(); dorPresenter.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.detail_background)); dorPresenter.setStyleLarge(true); dorPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { getActivity().finish(); } }); presenterSelector.addClassPresenter(DetailsOverviewRow.class, dorPresenter); presenterSelector.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter adapter = new ArrayObjectAdapter(presenterSelector); adapter.add(row); setAdapter(adapter); }
Example 7
Source File: TVVideoDetailsFragment.java From BuildingForAndroidTV with MIT License | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter()); // set detail background and style dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background)); dorPresenter.setStyleLarge(true); dorPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_WATCH_TRAILER) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(getResources().getString(R.string.movie), selectedMovie); intent.putExtra(getResources().getString(R.string.should_start), true); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { getString(R.string.related_movies) }; List<Movie> list = MovieList.list; Collections.shuffle(list); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); for (int j = 0; j < NUM_COLS; j++) { listRowAdapter.add(list.get(j % 5)); } HeaderItem header = new HeaderItem(0, subcategories[0], null); adapter.add(new ListRow(header, listRowAdapter)); setAdapter(adapter); }
Example 8
Source File: TVVideoDetailsFragment.java From BuildingForAndroidTV with MIT License | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter()); // set detail background and style dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background)); dorPresenter.setStyleLarge(true); dorPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_WATCH_TRAILER) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(getResources().getString(R.string.movie), selectedMovie); intent.putExtra(getResources().getString(R.string.should_start), true); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { getString(R.string.related_movies) }; List<Movie> list = MovieList.list; Collections.shuffle(list); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); for (int j = 0; j < NUM_COLS; j++) { listRowAdapter.add(list.get(j % 5)); } HeaderItem header = new HeaderItem(0, subcategories[0], null); adapter.add(new ListRow(header, listRowAdapter)); setAdapter(adapter); }
Example 9
Source File: TVVideoDetailsFragment.java From BuildingForAndroidTV with MIT License | 4 votes |
@Override protected void onPostExecute(DetailsOverviewRow detailRow) { ClassPresenterSelector ps = new ClassPresenterSelector(); DetailsOverviewRowPresenter dorPresenter = new DetailsOverviewRowPresenter(new DetailsDescriptionPresenter()); // set detail background and style dorPresenter.setBackgroundColor(getResources().getColor(R.color.detail_background)); dorPresenter.setStyleLarge(true); dorPresenter.setOnActionClickedListener(new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_WATCH_TRAILER) { Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra(getResources().getString(R.string.movie), selectedMovie); intent.putExtra(getResources().getString(R.string.should_start), true); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT).show(); } } }); ps.addClassPresenter(DetailsOverviewRow.class, dorPresenter); ps.addClassPresenter(ListRow.class, new ListRowPresenter()); ArrayObjectAdapter adapter = new ArrayObjectAdapter(ps); adapter.add(detailRow); String subcategories[] = { getString(R.string.related_movies) }; List<Movie> list = MovieList.list; Collections.shuffle(list); ArrayObjectAdapter listRowAdapter = new ArrayObjectAdapter(new CardPresenter()); for (int j = 0; j < NUM_COLS; j++) { listRowAdapter.add(list.get(j % 5)); } HeaderItem header = new HeaderItem(0, subcategories[0], null); adapter.add(new ListRow(header, listRowAdapter)); setAdapter(adapter); }