Search in sources :

Example 1 with MediaWrapper

use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.

the class StreamPlayerPresenterImpl method loadSubtitle.

private void loadSubtitle() {
    SubtitleWrapper subtitle = streamInfo.getSubtitle();
    MediaWrapper media = streamInfo.getMedia();
    SubsProvider provider = providerManager.getSubsProvider(media.getProviderId());
    subtitleManager.downloadSubtitle(provider, media.getMedia(), subtitle).observeOn(AndroidSchedulers.mainThread()).subscribe(new MaybeObserver<SubtitleWrapper>() {

        @Override
        public void onSubscribe(final Disposable d) {
            disposeSubs();
            subsDisposable = d;
        }

        @Override
        public void onSuccess(final SubtitleWrapper subs) {
            loadSubs(subs.getFileUri());
        }

        @Override
        public void onError(final Throwable e) {
            // TODO show error loading subs
            Timber.d("Error loading subs");
        }

        @Override
        public void onComplete() {
            Timber.d("Maybe empty");
        }
    });
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Disposable(io.reactivex.disposables.Disposable) SubsProvider(butter.droid.provider.subs.SubsProvider) SubtitleWrapper(butter.droid.base.providers.subs.model.SubtitleWrapper)

Example 2 with MediaWrapper

use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.

the class TVMediaGridFragment method onMediaItemClicked.

private void onMediaItemClicked(ImageCardView view, MediaCardPresenter.MediaCardItem item) {
    Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), view.getMainImageView(), TVMediaDetailActivity.SHARED_ELEMENT_NAME).toBundle();
    MediaWrapper media = item.getMediaWrapper();
    startActivity(TVMediaDetailActivity.getIntent(getActivity(), media), options);
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Bundle(android.os.Bundle)

Example 3 with MediaWrapper

use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.

the class TVOverviewFragment method onItemSelected.

@Override
public void onItemSelected(Presenter.ViewHolder itemViewHolder, Object item, RowPresenter.ViewHolder rowViewHolder, Row row) {
    int index = rowsAdapter.indexOf(row);
    MediaWrapper mediaItem = null;
    if (item instanceof MediaCardPresenter.MediaCardItem) {
        mediaItem = ((MediaCardItem) item).getMediaWrapper();
    }
    presenter.rowSelected(index, mediaItem);
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) MediaCardItem(butter.droid.tv.presenters.MediaCardPresenter.MediaCardItem)

Example 4 with MediaWrapper

use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.

the class TVOverviewFragment method onMediaItemClicked.

private void onMediaItemClicked(MediaCardPresenter.CustomImageCardView view, MediaCardPresenter.MediaCardItem media) {
    Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(requireActivity(), view.getMainImageView(), TVMediaDetailActivity.SHARED_ELEMENT_NAME).toBundle();
    MediaWrapper mediaItem = media.getMediaWrapper();
    if (view.getCustomSelectedSwatch() != null) {
        mediaItem.setColor(view.getCustomSelectedSwatch().getRgb());
    }
    startActivity(TVMediaDetailActivity.getIntent(getActivity(), mediaItem), options);
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Bundle(android.os.Bundle)

Example 5 with MediaWrapper

use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.

the class TVMediaDetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.activity_media_details);
    backgroundUpdater.initialise(this, R.color.black);
    Bundle extras = getIntent().getExtras();
    final MediaWrapper media = extras.getParcelable(EXTRA_ITEM);
    if (VersionUtils.isLollipop()) {
        postponeEnterTransition();
    }
    presenter.onCreate(media);
}
Also used : MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Bundle(android.os.Bundle)

Aggregations

MediaWrapper (butter.droid.base.providers.media.model.MediaWrapper)26 Bundle (android.os.Bundle)7 Disposable (io.reactivex.disposables.Disposable)6 ProviderManager (butter.droid.base.manager.internal.provider.ProviderManager)4 StreamInfo (butter.droid.base.providers.media.model.StreamInfo)4 Filter (butter.droid.provider.base.filter.Filter)4 Media (butter.droid.provider.base.model.Media)4 Pager (butter.droid.provider.filter.Pager)4 MediaCardItem (butter.droid.tv.presenters.MediaCardPresenter.MediaCardItem)4 Observable (io.reactivex.Observable)4 Single (io.reactivex.Single)4 AndroidSchedulers (io.reactivex.android.schedulers.AndroidSchedulers)4 Schedulers (io.reactivex.schedulers.Schedulers)4 List (java.util.List)4 Nullable (android.support.annotation.Nullable)3 Pair (android.util.Pair)3 SubtitleWrapper (butter.droid.base.providers.subs.model.SubtitleWrapper)3 Clip (butter.droid.provider.base.model.Clip)3 Paging (butter.droid.provider.base.paging.Paging)3 SingleObserver (io.reactivex.SingleObserver)3