Search in sources :

Example 1 with SimpleCelebrity

use of me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity 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);
    }
}
Also used : SimpleReview(me.zhanghai.android.douya.network.api.info.frodo.SimpleReview) Context(android.content.Context) UncollectItemManager(me.zhanghai.android.douya.item.content.UncollectItemManager) UriHandler(me.zhanghai.android.douya.link.UriHandler) GalleryActivity(me.zhanghai.android.douya.gallery.ui.GalleryActivity) BaseItemFragmentResource(me.zhanghai.android.douya.item.content.BaseItemFragmentResource) CollectableItem(me.zhanghai.android.douya.network.api.info.frodo.CollectableItem) CopyTextDialogFragment(me.zhanghai.android.douya.ui.CopyTextDialogFragment) BindDimen(butterknife.BindDimen) Doulist(me.zhanghai.android.douya.network.api.info.frodo.Doulist) Rating(me.zhanghai.android.douya.network.api.info.frodo.Rating) ImageUtils(me.zhanghai.android.douya.util.ImageUtils) SimpleMovie(me.zhanghai.android.douya.network.api.info.frodo.SimpleMovie) ViewUtils(me.zhanghai.android.douya.util.ViewUtils) ConfirmUncollectItemDialogFragment(me.zhanghai.android.douya.item.content.ConfirmUncollectItemDialogFragment) MovieFragmentResource(me.zhanghai.android.douya.item.content.MovieFragmentResource) ItemAwardItem(me.zhanghai.android.douya.network.api.info.frodo.ItemAwardItem) Movie(me.zhanghai.android.douya.network.api.info.frodo.Movie) SimpleCelebrity(me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity) BarrierAdapter(me.zhanghai.android.douya.ui.BarrierAdapter) R(me.zhanghai.android.douya.R) DoubanUtils(me.zhanghai.android.douya.util.DoubanUtils) List(java.util.List) SimpleItemForumTopic(me.zhanghai.android.douya.network.api.info.frodo.SimpleItemForumTopic) SimpleItemCollection(me.zhanghai.android.douya.network.api.info.frodo.SimpleItemCollection) Photo(me.zhanghai.android.douya.network.api.info.frodo.Photo) Context(android.content.Context)

Example 2 with SimpleCelebrity

use of me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity in project Douya by DreaminginCodeZH.

the class CelebrityListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    SimpleCelebrity celebrity = getItem(position);
    ImageUtils.loadImage(holder.avatarImage, celebrity.avatar);
    holder.nameText.setText(celebrity.name);
    if (celebrity.isDirector) {
        holder.descriptionText.setText(R.string.item_celebrity_director);
    } else {
        holder.descriptionText.setText(celebrity.character);
    }
    holder.itemView.setOnClickListener(view -> {
        // TODO
        UriHandler.open(celebrity.url, view.getContext());
    });
}
Also used : SimpleCelebrity(me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity)

Example 3 with SimpleCelebrity

use of me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity in project Douya by DreaminginCodeZH.

the class BaseItemIntroductionFragment method addCelebrityListToData.

protected void addCelebrityListToData(int titleRes, List<SimpleCelebrity> celebrityList, List<Pair<String, String>> data) {
    if (!CollectionUtils.isEmpty(celebrityList)) {
        List<String> celebrityNameList = new ArrayList<>();
        for (SimpleCelebrity director : celebrityList) {
            celebrityNameList.add(director.name);
        }
        addTextListToData(titleRes, celebrityNameList, getString(R.string.item_introduction_celebrity_delimiter), data);
    }
}
Also used : SimpleCelebrity(me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity) ArrayList(java.util.ArrayList)

Example 4 with SimpleCelebrity

use of me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity in project Douya by DreaminginCodeZH.

the class CelebrityListResource method transformResponse.

private List<SimpleCelebrity> transformResponse(CelebrityList response) {
    List<SimpleCelebrity> celebrityList = new ArrayList<>();
    celebrityList.addAll(response.directors);
    for (SimpleCelebrity celebrity : celebrityList) {
        celebrity.isDirector = true;
    }
    celebrityList.addAll(response.actors);
    return celebrityList;
}
Also used : SimpleCelebrity(me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity) ArrayList(java.util.ArrayList)

Aggregations

SimpleCelebrity (me.zhanghai.android.douya.network.api.info.frodo.SimpleCelebrity)4 ArrayList (java.util.ArrayList)2 Context (android.content.Context)1 BindDimen (butterknife.BindDimen)1 List (java.util.List)1 R (me.zhanghai.android.douya.R)1 GalleryActivity (me.zhanghai.android.douya.gallery.ui.GalleryActivity)1 BaseItemFragmentResource (me.zhanghai.android.douya.item.content.BaseItemFragmentResource)1 ConfirmUncollectItemDialogFragment (me.zhanghai.android.douya.item.content.ConfirmUncollectItemDialogFragment)1 MovieFragmentResource (me.zhanghai.android.douya.item.content.MovieFragmentResource)1 UncollectItemManager (me.zhanghai.android.douya.item.content.UncollectItemManager)1 UriHandler (me.zhanghai.android.douya.link.UriHandler)1 CollectableItem (me.zhanghai.android.douya.network.api.info.frodo.CollectableItem)1 Doulist (me.zhanghai.android.douya.network.api.info.frodo.Doulist)1 ItemAwardItem (me.zhanghai.android.douya.network.api.info.frodo.ItemAwardItem)1 Movie (me.zhanghai.android.douya.network.api.info.frodo.Movie)1 Photo (me.zhanghai.android.douya.network.api.info.frodo.Photo)1 Rating (me.zhanghai.android.douya.network.api.info.frodo.Rating)1 SimpleItemCollection (me.zhanghai.android.douya.network.api.info.frodo.SimpleItemCollection)1 SimpleItemForumTopic (me.zhanghai.android.douya.network.api.info.frodo.SimpleItemForumTopic)1