use of me.zhanghai.android.douya.network.api.info.frodo.Game 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.Game in project Douya by DreaminginCodeZH.
the class GameActivity 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 gameId = intent.getLongExtra(EXTRA_GAME_ID, -1);
SimpleGame simpleGame = intent.getParcelableExtra(EXTRA_SIMPLE_GAME);
Game game = intent.getParcelableExtra(EXTRA_GAME);
FragmentUtils.add(GameFragment.newInstance(gameId, simpleGame, game), this, android.R.id.content);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Game in project Douya by DreaminginCodeZH.
the class GameFragment method update.
private void update(Game game, Rating rating, List<Photo> photoList, List<SimpleItemCollection> itemCollectionList, List<SimpleReview> gameGuideList, List<SimpleReview> reviewList, List<SimpleItemForumTopic> forumTopicList, List<CollectableItem> recommendationList, List<Doulist> relatedDoulistList) {
if (game != null) {
super.updateWithSimpleItem(game);
}
if (game == null || photoList == null) {
return;
}
if (!mBackdropBound) {
// TODO: Add game videos like movie trailer.
mExcludeFirstPhoto = false;
String backdropUrl = null;
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 (game.cover != null) {
backdropUrl = game.cover.getLargeUrl();
mBackdropLayout.setOnClickListener(view -> {
// TODO
Context context = view.getContext();
context.startActivity(GalleryActivity.makeIntent(game.cover, context));
});
}
if (backdropUrl != null) {
ImageUtils.loadItemBackdropAndFadeIn(mBackdropImage, backdropUrl, null);
} else {
mBackdropImage.setBackgroundColor(game.getThemeColor());
ViewUtils.fadeIn(mBackdropImage);
}
mBackdropBound = true;
}
mAdapter.setData(new GameDataAdapter.Data(game, rating, photoList, mExcludeFirstPhoto, itemCollectionList, gameGuideList, reviewList, forumTopicList, recommendationList, relatedDoulistList));
if (mAdapter.getItemCount() > 0) {
mContentStateLayout.setLoaded(true);
}
}
use of me.zhanghai.android.douya.network.api.info.frodo.Game in project Douya by DreaminginCodeZH.
the class GameFragment method uncollect.
@Override
public void uncollect() {
if (!mResource.hasItem()) {
return;
}
Game game = mResource.getItem();
UncollectItemManager.getInstance().write(game.getType(), game.id, getActivity());
}
Aggregations