use of me.zhanghai.android.douya.network.api.info.frodo.Movie in project Douya by DreaminginCodeZH.
the class ItemIntroductionActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Calls ensureSubDecor().
findViewById(android.R.id.content);
if (savedInstanceState == null) {
Intent intent = getIntent();
CollectableItem item = intent.getParcelableExtra(EXTRA_ITEM);
Fragment fragment;
switch(item.getType()) {
case APP:
// TODO
throw new UnsupportedOperationException();
case BOOK:
fragment = BookIntroductionFragment.newInstance((Book) item);
break;
case EVENT:
// TODO
throw new UnsupportedOperationException();
case GAME:
fragment = GameIntroductionFragment.newInstance((Game) item);
break;
case MOVIE:
case TV:
fragment = MovieIntroductionFragment.newInstance((Movie) item);
break;
case MUSIC:
fragment = MusicIntroductionFragment.newInstance((Music) item);
break;
default:
throw new IllegalArgumentException();
}
FragmentUtils.add(fragment, this, android.R.id.content);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Movie in project Douya by DreaminginCodeZH.
the class MovieFragment method uncollect.
@Override
public void uncollect() {
if (!mResource.hasItem()) {
return;
}
Movie movie = mResource.getItem();
UncollectItemManager.getInstance().write(movie.getType(), movie.id, getActivity());
}
use of me.zhanghai.android.douya.network.api.info.frodo.Movie in project Douya by DreaminginCodeZH.
the class MovieFragment method update.
private void update(Movie movie, Rating rating, List<Photo> photoList, List<SimpleCelebrity> celebrityList, List<ItemAwardItem> awardList, List<SimpleItemCollection> itemCollectionList, List<SimpleReview> reviewList, List<SimpleItemForumTopic> forumTopicList, List<CollectableItem> recommendationList, List<Doulist> relatedDoulistList) {
if (movie != null) {
super.updateWithSimpleItem(movie);
}
if (movie == null || photoList == null) {
return;
}
if (!mBackdropBound) {
boolean hasTrailer = movie.trailer != null;
mExcludeFirstPhoto = false;
String backdropUrl = null;
if (hasTrailer) {
backdropUrl = movie.trailer.coverUrl;
mBackdropLayout.setOnClickListener(view -> {
// TODO
UriHandler.open(movie.trailer.videoUrl, view.getContext());
});
} else if (!photoList.isEmpty()) {
backdropUrl = photoList.get(0).getLargeUrl();
mExcludeFirstPhoto = true;
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeImageListIntent(photoList, 0, context));
});
} else if (movie.poster != null) {
backdropUrl = movie.poster.getLargeUrl();
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeIntent(movie.poster, context));
});
} else if (movie.cover != null) {
backdropUrl = movie.cover.getLargeUrl();
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeIntent(movie.cover, context));
});
}
if (backdropUrl != null) {
ImageUtils.loadItemBackdropAndFadeIn(mBackdropImage, backdropUrl, hasTrailer ? mBackdropPlayImage : null);
} else {
mBackdropImage.setBackgroundColor(movie.getThemeColor());
ViewUtils.fadeIn(mBackdropImage);
}
mBackdropBound = true;
}
mAdapter.setData(new MovieDataAdapter.Data(movie, rating, photoList, mExcludeFirstPhoto, celebrityList, awardList, itemCollectionList, reviewList, forumTopicList, recommendationList, relatedDoulistList));
if (mAdapter.getItemCount() > 0) {
mContentStateLayout.setLoaded(true);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Movie in project Douya by DreaminginCodeZH.
the class MovieActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Calls ensureSubDecor().
findViewById(android.R.id.content);
if (savedInstanceState == null) {
Intent intent = getIntent();
long movieId = intent.getLongExtra(EXTRA_MOVIE_ID, -1);
SimpleMovie simpleMovie = intent.getParcelableExtra(EXTRA_SIMPLE_MOVIE);
Movie movie = intent.getParcelableExtra(EXTRA_MOVIE);
FragmentUtils.add(MovieFragment.newInstance(movieId, simpleMovie, movie), this, android.R.id.content);
}
}
Aggregations