Search in sources :

Example 1 with GroupActorAdapter

use of com.mxt.anitrend.adapter.recycler.group.GroupActorAdapter in project anitrend-app by AniTrend.

the class CharacterActorsFragment method updateUI.

@Override
protected void updateUI() {
    if (mAdapter == null) {
        mAdapter = new GroupActorAdapter(model, getContext());
        ((GroupActorAdapter) mAdapter).setMediaClickListener(new ItemClickListener<EntityGroup>() {

            /**
             * When the target view from {@link View.OnClickListener}
             * is clicked from a view holder this method will be called
             *
             * @param target view that has been clicked
             * @param data   the model that at the click index
             */
            @Override
            public void onItemClick(View target, EntityGroup data) {
                switch(target.getId()) {
                    case R.id.container:
                        Intent intent = new Intent(getActivity(), MediaActivity.class);
                        intent.putExtra(KeyUtil.arg_id, ((MediaBase) data).getId());
                        intent.putExtra(KeyUtil.arg_mediaType, ((MediaBase) data).getType());
                        CompatUtil.startRevealAnim(getActivity(), target, intent);
                        break;
                }
            }

            /**
             * When the target view from {@link View.OnLongClickListener}
             * is clicked from a view holder this method will be called
             *
             * @param target view that has been long clicked
             * @param data   the model that at the long click index
             */
            @Override
            public void onItemLongClick(View target, EntityGroup data) {
                switch(target.getId()) {
                    case R.id.container:
                        if (getPresenter().getApplicationPref().isAuthenticated()) {
                            mediaActionUtil = new MediaActionUtil.Builder().setModel((MediaBase) data).build(getActivity());
                            mediaActionUtil.startSeriesAction();
                        } else
                            NotifyUtil.makeText(getContext(), R.string.info_login_req, R.drawable.ic_group_add_grey_600_18dp, Toast.LENGTH_SHORT).show();
                        break;
                }
            }
        });
    }
    setSwipeRefreshLayoutEnabled(false);
    injectAdapter();
}
Also used : GroupActorAdapter(com.mxt.anitrend.adapter.recycler.group.GroupActorAdapter) EntityGroup(com.mxt.anitrend.model.entity.group.EntityGroup) QueryContainerBuilder(com.mxt.anitrend.model.entity.container.request.QueryContainerBuilder) Intent(android.content.Intent) MediaActivity(com.mxt.anitrend.view.activity.detail.MediaActivity) MediaBase(com.mxt.anitrend.model.entity.base.MediaBase) View(android.view.View)

Aggregations

Intent (android.content.Intent)1 View (android.view.View)1 GroupActorAdapter (com.mxt.anitrend.adapter.recycler.group.GroupActorAdapter)1 MediaBase (com.mxt.anitrend.model.entity.base.MediaBase)1 QueryContainerBuilder (com.mxt.anitrend.model.entity.container.request.QueryContainerBuilder)1 EntityGroup (com.mxt.anitrend.model.entity.group.EntityGroup)1 MediaActivity (com.mxt.anitrend.view.activity.detail.MediaActivity)1