android.support.v17.leanback.widget.Action Java Examples
The following examples show how to use
android.support.v17.leanback.widget.Action.
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: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Video... videos) { DetailsOverviewRow row = new DetailsOverviewRow(videos[0]); try { Bitmap poster = Picasso.with(getActivity()) .load(videos[0].getThumbUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e); } SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter(); adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString( R.string.action_play))); adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later))); row.setActionsAdapter(adapter); return row; }
Example #2
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 #3
Source File: TVVideoDetailsFragment.java From BuildingForAndroidTV with MIT License | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Movie... movies) { selectedMovie = movies[0]; DetailsOverviewRow row = new DetailsOverviewRow(selectedMovie); try { Bitmap poster = Picasso.with(getActivity()) .load(selectedMovie.getCardImageUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { } row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString( R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2))); row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1), getResources().getString(R.string.rent_2))); row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1), getResources().getString(R.string.buy_2))); return row; }
Example #4
Source File: TVVideoDetailsFragment.java From BuildingForAndroidTV with MIT License | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Movie... movies) { selectedMovie = movies[0]; DetailsOverviewRow row = new DetailsOverviewRow(selectedMovie); try { Bitmap poster = Picasso.with(getActivity()) .load(selectedMovie.getCardImageUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { } row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString( R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2))); row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1), getResources().getString(R.string.rent_2))); row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1), getResources().getString(R.string.buy_2))); return row; }
Example #5
Source File: TVVideoDetailsFragment.java From BuildingForAndroidTV with MIT License | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Movie... movies) { selectedMovie = movies[0]; DetailsOverviewRow row = new DetailsOverviewRow(selectedMovie); try { Bitmap poster = Picasso.with(getActivity()) .load(selectedMovie.getCardImageUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { } row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString( R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2))); row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1), getResources().getString(R.string.rent_2))); row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1), getResources().getString(R.string.buy_2))); return row; }
Example #6
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Video... videos) { DetailsOverviewRow row = new DetailsOverviewRow(videos[0]); try { Bitmap poster = Picasso.with(getActivity()) .load(videos[0].getThumbUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e); } SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter(); adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString( R.string.action_play))); adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later))); row.setActionsAdapter(adapter); return row; }
Example #7
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Video... videos) { DetailsOverviewRow row = new DetailsOverviewRow(videos[0]); try { Bitmap poster = Picasso.with(getActivity()) .load(videos[0].getThumbUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e); } SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter(); adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString( R.string.action_play))); adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later))); row.setActionsAdapter(adapter); return row; }
Example #8
Source File: VideoDetailsFragment.java From android-tv-leanback with Apache License 2.0 | 6 votes |
@Override protected DetailsOverviewRow doInBackground(Video... videos) { DetailsOverviewRow row = new DetailsOverviewRow(videos[0]); try { Bitmap poster = Picasso.with(getActivity()) .load(videos[0].getThumbUrl()) .resize(dpToPx(DETAIL_THUMB_WIDTH, getActivity().getApplicationContext()), dpToPx(DETAIL_THUMB_HEIGHT, getActivity().getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(getActivity(), poster); } catch (IOException e) { Log.e("VideoDetailsFragment", "Cannot load thumbnail for " + videos[0].getId(), e); } SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter(); adapter.set(ACTION_PLAY, new Action(ACTION_PLAY, getResources().getString( R.string.action_play))); adapter.set(ACTION_WATCH_LATER, new Action(ACTION_WATCH_LATER, getResources().getString(R.string.action_watch_later))); row.setActionsAdapter(adapter); return row; }
Example #9
Source File: DetailViewExampleWithVideoBackgroundFragment.java From leanback-showcase with Apache License 2.0 | 6 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof Action)) return; Action action = (Action) item; long id = action.getId(); if (id == ACTION_RENT) { startWizardActivityForPayment(); } else if (action.getId() == ACTION_PLAY) { playMainVideoOnBackground(); } else if (action.getId() == ACTION_RELATED) { setSelectedPosition(1); } else { Toast.makeText(getActivity(), getString(R.string.action_cicked), Toast.LENGTH_LONG) .show(); } }
Example #10
Source File: ActionsModule.java From leanback-showcase with Apache License 2.0 | 5 votes |
@PerFragment @PlayActionQualifier @Provides Action providePlayAction() { return new Action(ACTION_PLAY, SampleApplication.getInstance().getString(R.string.livedata_action_play)); }
Example #11
Source File: VideoDetailsFragment.java From leanback-assistant with Apache License 2.0 | 5 votes |
private void setupDetailsOverviewRow() { final DetailsOverviewRow row = new DetailsOverviewRow(mMovie); Glide.with(this) .load(mMovie.getCardImage()) .asBitmap() .dontAnimate() .error(R.drawable.assistant_tv_banner) .into( new SimpleTarget<Bitmap>() { @Override public void onResourceReady( final Bitmap resource, GlideAnimation glideAnimation) { row.setImageBitmap(getActivity(), resource); } }); SparseArrayObjectAdapter adapter = new SparseArrayObjectAdapter(); adapter.set( ACTION_WATCH, new Action(ACTION_WATCH, getResources().getString(R.string.watch))); adapter.set( ACTION_RENT, new Action( ACTION_RENT, getResources().getString(R.string.rent), mMovie.getRentalPrice())); adapter.set( ACTION_BUY, new Action( ACTION_BUY, getResources().getString(R.string.buy), mMovie.getPurchasePrice())); row.setActionsAdapter(adapter); mAdapter.add(row); }
Example #12
Source File: MovieDetailsFragment.java From BuildingForAndroidTV with MIT License | 5 votes |
private void setupDetailsOverviewRow() { Log.d(TAG, "doInBackground: " + mSelectedMovie.toString()); final DetailsOverviewRow row = new DetailsOverviewRow(mSelectedMovie); row.setImageDrawable(getResources().getDrawable(R.drawable.default_background)); int width = Utils.convertDpToPixel(getActivity() .getApplicationContext(), DETAIL_THUMB_WIDTH); int height = Utils.convertDpToPixel(getActivity() .getApplicationContext(), DETAIL_THUMB_HEIGHT); Glide.with(getActivity()) .load(mSelectedMovie.getCardImageUrl()) .centerCrop() .error(R.drawable.default_background) .into(new SimpleTarget<GlideDrawable>(width, height) { @Override public void onResourceReady(GlideDrawable resource, GlideAnimation<? super GlideDrawable> glideAnimation) { Log.d(TAG, "details overview card image url ready: " + resource); row.setImageDrawable(resource); mAdapter.notifyArrayItemRangeChanged(0, mAdapter.size()); } }); row.addAction(new Action(ACTION_WATCH_TRAILER, getResources().getString( R.string.watch_trailer_1), getResources().getString(R.string.watch_trailer_2))); row.addAction(new Action(ACTION_RENT, getResources().getString(R.string.rent_1), getResources().getString(R.string.rent_2))); row.addAction(new Action(ACTION_BUY, getResources().getString(R.string.buy_1), getResources().getString(R.string.buy_2))); mAdapter.add(row); }
Example #13
Source File: PlaybackOverlayFragment.java From BuildingForAndroidTV with MIT License | 5 votes |
private void notifyChanged(Action action) { ArrayObjectAdapter adapter = mPrimaryActionsAdapter; if (adapter.indexOf(action) >= 0) { adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1); return; } adapter = mSecondaryActionsAdapter; if (adapter.indexOf(action) >= 0) { adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1); return; } }
Example #14
Source File: PrimaryPlaybackControlsGlue.java From leanback-assistant with Apache License 2.0 | 5 votes |
@Override public void onActionClicked(Action action) { if (action == mRewindAction) { rewind(); } else if (action == mFastForwardAction) { fastForward(); } else { // Super class handles play/pause and delegates to abstract methods next()/previous(). super.onActionClicked(action); } }
Example #15
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 #16
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 #17
Source File: DetailRowBuilderTask.java From Amphitheatre with Apache License 2.0 | 5 votes |
@Override protected DetailsOverviewRow doInBackground(Video... videos) { mVideo = videos[0]; DetailsOverviewRow row = new DetailsOverviewRow(mVideo); try { Bitmap poster = Picasso.with(mActivity) .load(mVideo.getCardImageUrl()) .resize(Utils.dpToPx(DETAIL_THUMB_WIDTH, mActivity.getApplicationContext()), Utils.dpToPx(DETAIL_THUMB_HEIGHT, mActivity.getApplicationContext())) .centerCrop() .get(); row.setImageBitmap(mActivity, poster); } catch (IOException e) { e.printStackTrace(); } if (mShowPlayButton) { row.addAction(new Action(ACTION_PLAY, mActivity.getString(R.string.play))); } if (mVideo.getMovie() != null && !TextUtils.isEmpty(mVideo.getMovie().getTrailer())) { row.addAction( new Action(ACTION_VIEW_TRAILER, mActivity.getString(R.string.watch_trailer))); } return row; }
Example #18
Source File: DetailFragment.java From TuentiTV with Apache License 2.0 | 5 votes |
private DetailsOverviewRow configureDetailsOverviewRow(CardInfo cardInfo, Bitmap bitmap) { final DetailsOverviewRow row = new DetailsOverviewRow(cardInfo); row.setImageBitmap(getActivity(), bitmap); row.addAction(new Action(VD_CALL_ACTION_ID, getString(R.string.vd_call_action_title))); row.addAction(new Action(CALL_ACTION_ID, getString(R.string.call_action_title))); row.addAction(new Action(CHAT_ACTION_ID, getString(R.string.chat_action_title))); row.addAction(new Action(EDIT_ACTION_ID, getString(R.string.edit_action_title))); return row; }
Example #19
Source File: LiveDataDetailViewWithVideoBackgroundFragment.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onActionClicked(Action action) { if (action == mActionRent) { new AsyncTask<Void, Void, Void>() { @Override protected Void doInBackground(Void... voids) { if (AppConfiguration.IS_RENTING_OPERATION_DELAY_ENABLED) { addDelay(2000L); } // update the database with rented field mViewModel.updateDatabase(mObservedVideo, RENTED, ""); return null; } }.execute(); getActivity().findViewById(R.id.renting_progressbar).setVisibility(View.VISIBLE); getActivity().findViewById(R.id.loading_renting).setVisibility(View.VISIBLE); } else if (action == mActionPlay) { mDetailsBgController.switchToVideo(); } else if (action == mActionPreview) { mDetailsBgController.switchToVideo(); } else if (action == mActionLoading) { Toast.makeText(getActivity(), "Loading...", Toast.LENGTH_SHORT).show(); } }
Example #20
Source File: ActionsModule.java From leanback-showcase with Apache License 2.0 | 5 votes |
@PerFragment @RentActionQualifier @Provides Action provideRentAction() { return new Action(ACTION_RENT, SampleApplication.getInstance().getString(R.string.livedata_actoin_rent), SampleApplication.getInstance().getString(R.string.livedata_rent_price), ResourcesCompat .getDrawable( SampleApplication.getInstance().getResources(), R.drawable.ic_favorite_border_white_24dp, SampleApplication.getInstance().getTheme())); }
Example #21
Source File: VideoDetailsFragment.java From leanback-assistant with Apache License 2.0 | 5 votes |
private void setupAdapter() { FullWidthDetailsOverviewRowPresenter detailsPresenter = new FullWidthDetailsOverviewRowPresenter( new DetailsDescriptionPresenter(), new MovieDetailsOverviewLogoPresenter()); detailsPresenter.setBackgroundColor( ContextCompat.getColor(getContext(), R.color.background_dark)); detailsPresenter.setInitialState(FullWidthDetailsOverviewRowPresenter.STATE_HALF); detailsPresenter.setOnActionClickedListener( new OnActionClickedListener() { @Override public void onActionClicked(Action action) { if (action.getId() == ACTION_WATCH) { Intent intent = PlaybackActivity.createIntent(getContext(), mMovie.getId()); startActivity(intent); } else { Toast.makeText(getActivity(), action.toString(), Toast.LENGTH_SHORT) .show(); } } }); ClassPresenterSelector mPresenterSelector = new ClassPresenterSelector(); mPresenterSelector.addClassPresenter(DetailsOverviewRow.class, detailsPresenter); mAdapter = new ArrayObjectAdapter(mPresenterSelector); setAdapter(mAdapter); }
Example #22
Source File: DetailViewExampleFragment.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onItemClicked(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) { if (!(item instanceof Action)) return; Action action = (Action) item; if (action.getId() == ACTION_RELATED) { setSelectedPosition(1); } else { Toast.makeText(getActivity(), getString(R.string.action_cicked), Toast.LENGTH_LONG) .show(); } }
Example #23
Source File: VideoMediaPlayerGlue.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onActionClicked(Action action) { if (shouldDispatchAction(action)) { dispatchAction(action); return; } super.onActionClicked(action); }
Example #24
Source File: VideoMediaPlayerGlue.java From leanback-showcase with Apache License 2.0 | 5 votes |
private void dispatchAction(Action action) { if (action == mPipAction) { ((Activity) getContext()).enterPictureInPictureMode(); } else { Toast.makeText(getContext(), action.toString(), Toast.LENGTH_SHORT).show(); PlaybackControlsRow.MultiAction multiAction = (PlaybackControlsRow.MultiAction) action; multiAction.nextIndex(); notifyActionChanged(multiAction); } }
Example #25
Source File: MusicMediaPlayerGlue.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onActionClicked(Action action) { // If either 'Shuffle' or 'Repeat' has been clicked we need to make sure the acitons index // is incremented and the UI updated such that we can display the new state. super.onActionClicked(action); if (action instanceof PlaybackControlsRow.RepeatAction) { int index = ((PlaybackControlsRow.RepeatAction) action).getIndex(); if (mPlaybackService != null) { mPlaybackService.setRepeatState(mapActionIndexToServiceRepeatState(index)); } } }
Example #26
Source File: MediaPlayerGlue.java From leanback-showcase with Apache License 2.0 | 5 votes |
@Override public void onActionClicked(Action action) { if (action instanceof PlaybackControlsRow.ShuffleAction || action instanceof PlaybackControlsRow.RepeatAction) { ((PlaybackControlsRow.MultiAction) action).nextIndex(); notifySecondaryActionChanged(action); } else if (action == mThumbsUpAction) { if (mThumbsUpAction.getIndex() == PlaybackControlsRow.ThumbsAction.SOLID) { mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE); notifySecondaryActionChanged(mThumbsUpAction); } else { mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.SOLID); mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE); notifySecondaryActionChanged(mThumbsUpAction); notifySecondaryActionChanged(mThumbsDownAction); } } else if (action == mThumbsDownAction) { if (mThumbsDownAction.getIndex() == PlaybackControlsRow.ThumbsAction.SOLID) { mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE); notifySecondaryActionChanged(mThumbsDownAction); } else { mThumbsDownAction.setIndex(PlaybackControlsRow.ThumbsAction.SOLID); mThumbsUpAction.setIndex(PlaybackControlsRow.ThumbsAction.OUTLINE); notifySecondaryActionChanged(mThumbsUpAction); notifySecondaryActionChanged(mThumbsDownAction); } } else { super.onActionClicked(action); } }
Example #27
Source File: ActionsModule.java From leanback-showcase with Apache License 2.0 | 5 votes |
@PerFragment @LoadingActionQualifier @Provides Action provideLoadingAction() { return new Action(ACTION_LOADING, SampleApplication.getInstance().getString(R.string.livedata_action_loading)); }
Example #28
Source File: ActionsModule.java From leanback-showcase with Apache License 2.0 | 5 votes |
@PerFragment @PreviewActionQualifier @Provides Action providePreviewAction() { return new Action(ACTION_PREVIEW, SampleApplication.getInstance().getString(R.string.livedata_action_preview)); }
Example #29
Source File: PlaybackOverlayFragment.java From android-tv-leanback with Apache License 2.0 | 5 votes |
private void notifyChanged(Action action) { ArrayObjectAdapter adapter = mPrimaryActionsAdapter; if (adapter.indexOf(action) >= 0) { adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1); return; } adapter = mSecondaryActionsAdapter; if (adapter.indexOf(action) >= 0) { adapter.notifyArrayItemRangeChanged(adapter.indexOf(action), 1); return; } }
Example #30
Source File: PlaybackOverlayFragment.java From android-tv-leanback with Apache License 2.0 | 5 votes |
public void onActionClicked(Action action) { if (action.getId() == mPlayPauseAction.getId()) { if (mPlayPauseAction.getIndex() == PlayPauseAction.PLAY) { startProgressAutomation(); setFadingEnabled(true); mCallback.onFragmentPlayPause(mVideo, mPlaybackControlsRow.getCurrentTime(), true); } else { stopProgressAutomation(); setFadingEnabled(false); mCallback.onFragmentPlayPause(mVideo, mPlaybackControlsRow.getCurrentTime(), false); } } else if (action.getId() == mSkipNextAction.getId()) { next(); } else if (action.getId() == mSkipPreviousAction.getId()) { prev(); } else if (action.getId() == mFastForwardAction.getId()) { fastForward(); } else if (action.getId() == mRewindAction.getId()) { fastRewind(); } if (action instanceof PlaybackControlsRow.MultiAction) { ((PlaybackControlsRow.MultiAction) action).nextIndex(); notifyChanged(action); } }