use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class MediaDetailsDescriptionPresenter method onBindDescription.
@Override
protected void onBindDescription(ViewHolder viewHolder, Object item) {
MediaWrapper itemWrapper = (MediaWrapper) item;
if (itemWrapper != null) {
Media media = itemWrapper.getMedia();
viewHolder.getTitle().setText(media.getTitle());
viewHolder.getBody().setText(media.getSynopsis());
}
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class TrailerPlayerFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
String uri = args.getString(ARG_URI);
MediaWrapper media = args.getParcelable(ARG_MEDIA);
presenter.onCreate(media, uri, getResumePosition(savedInstanceState));
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class BaseMediaListFragment method onItemClick.
@Override
public void onItemClick(View view, final int position) {
final MediaWrapper media = adapter.getItem(position);
presenter.onMediaItemClicked(media);
// TODO: 6/25/17 Colors
// RecyclerView.ViewHolder holder = recyclerView.getChildViewHolder(view);
// ImageView coverImage = ((MediaGridAdapter.ViewHolder) holder).getCoverImage();
//
// if (coverImage.getDrawable() == null) {
// showLoadingDialog(position);
// return;
// }
// //
// Bitmap cover = ((BitmapDrawable) coverImage.getDrawable()).getBitmap();
// Palette.from(cover)
// .maximumColorCount(5)
// .generate(palette -> {
// int vibrantColor = palette.getVibrantColor(Color.TRANSPARENT);
// int paletteColor;
// if (vibrantColor == Color.TRANSPARENT) {
// paletteColor = palette.getMutedColor(ContextCompat.getColor(getContext(), R.color.primary));
// } else {
// paletteColor = vibrantColor;
// }
// media.setColor(paletteColor);
// showLoadingDialog(position);
// });
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class BaseMediaListPresenterImpl method loadNextPage.
@Override
public void loadNextPage(@Nullable String endCursor) {
cancelListCall();
if (items.isEmpty()) {
updateLoadingMessage(getLoadingMessage());
showLoading();
}
providerManager.getMediaProvider(providerId).items(filter, new Pager(endCursor)).flatMap(w -> Single.zip(Single.just(w.getPaging()), Observable.fromIterable(w.getMedia()).map(i -> new MediaWrapper(i, providerId)).toList(), Pair::create)).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SingleObserver<Pair<Paging, List<MediaWrapper>>>() {
@Override
public void onSubscribe(final Disposable d) {
listCall = d;
}
@Override
public void onSuccess(final Pair<Paging, List<MediaWrapper>> value) {
Paging paging = value.first;
view.addItems(value.second, !paging.hasNextPage(), paging.getEndCursor());
items.addAll(value.second);
showLoaded();
}
@Override
public void onError(final Throwable e) {
// TODO: 6/24/17 Most of this is not relevant any more
if (e.getMessage().equals("Canceled")) {
showLoaded();
} else if (e.getMessage() != null && e.getMessage().equals(ButterApplication.getAppContext().getString(R.string.movies_error))) {
view.addItems(null, false, null);
showLoaded();
} else {
Timber.e(e.getMessage());
view.showErrorMessage(R.string.unknown_error);
showLoaded();
}
}
});
}
use of butter.droid.base.providers.media.model.MediaWrapper in project butter-android by butterproject.
the class MainActivity method checkActions.
private void checkActions() {
String action = getIntent().getAction();
Uri data = getIntent().getData();
if (action != null && action.equals(Intent.ACTION_VIEW) && data != null) {
String streamUrl = data.toString();
try {
streamUrl = URLDecoder.decode(streamUrl, "UTF-8");
// TODO: 7/29/17 Check if actual torrent
final Media clip = new Clip("0", streamUrl, 0, new Genre[0], -1, "", "", "", streamUrl);
StreamLoadingActivity.startActivity(this, new StreamInfo(streamUrl, new MediaWrapper(clip, -1), null));
finish();
} catch (UnsupportedEncodingException e) {
// this should never happen
Timber.d("Unknown encoding");
}
}
}
Aggregations