Search in sources :

Example 6 with MediaPresenter

use of com.mxt.anitrend.presenter.fragment.MediaPresenter in project anitrend-app by AniTrend.

the class MediaListFragment method onCreate.

/**
 * Override and set presenter, mColumnSize, and fetch argument/s
 *
 * @param savedInstanceState
 */
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        userId = getArguments().getLong(KeyUtil.arg_id);
        userName = getArguments().getString(KeyUtil.arg_userName);
        queryContainer = getArguments().getParcelable(KeyUtil.arg_graph_params);
        mediaType = getArguments().getString(KeyUtil.arg_mediaType);
    }
    isFilterable = true;
    isPager = false;
    hasSubscriber = true;
    mAdapter = new MediaListAdapter(getContext());
    ((MediaListAdapter) mAdapter).setCurrentUser(userName);
    setPresenter(new MediaPresenter(getContext()));
    setViewModel(true);
    if (getPresenter().getSettings().getMediaListStyle() == KeyUtil.LIST_VIEW_STYLE_COMPACT_X1) {
        mColumnSize = R.integer.single_list_x1;
    } else {
        mColumnSize = R.integer.grid_list_x2;
    }
}
Also used : MediaListAdapter(com.mxt.anitrend.adapter.recycler.index.MediaListAdapter) MediaPresenter(com.mxt.anitrend.presenter.fragment.MediaPresenter)

Example 7 with MediaPresenter

use of com.mxt.anitrend.presenter.fragment.MediaPresenter in project anitrend-app by AniTrend.

the class MediaActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    binding = DataBindingUtil.setContentView(this, R.layout.activity_series);
    setPresenter(new MediaPresenter(getApplicationContext()));
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    disableToolbarTitle();
    setViewModel(true);
    if (getIntent().hasExtra(KeyUtil.arg_id))
        id = getIntent().getLongExtra(KeyUtil.arg_id, -1);
    if (getIntent().hasExtra(KeyUtil.arg_mediaType))
        mediaType = getIntent().getStringExtra(KeyUtil.arg_mediaType);
}
Also used : MediaPresenter(com.mxt.anitrend.presenter.fragment.MediaPresenter)

Example 8 with MediaPresenter

use of com.mxt.anitrend.presenter.fragment.MediaPresenter in project anitrend-app by AniTrend.

the class CharacterActorsFragment method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        queryContainer = GraphUtil.INSTANCE.getDefaultQuery(true).putVariable(KeyUtil.arg_id, getArguments().getLong(KeyUtil.arg_id));
    }
    mColumnSize = R.integer.grid_giphy_x3;
    isPager = true;
    mAdapter = new GroupActorAdapter(getContext());
    setPresenter(new MediaPresenter(getContext()));
    setViewModel(true);
    ((GroupActorAdapter) mAdapter).setMediaClickListener(new ItemClickListener<RecyclerItem>() {

        /**
         * 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 clicked index
         */
        @Override
        public void onItemClick(View target, IntPair<RecyclerItem> data) {
            switch(target.getId()) {
                case R.id.container:
                    Intent intent = new Intent(getActivity(), MediaActivity.class);
                    intent.putExtra(KeyUtil.arg_id, ((MediaBase) data.getSecond()).getId());
                    intent.putExtra(KeyUtil.arg_mediaType, ((MediaBase) data.getSecond()).getType());
                    CompatUtil.INSTANCE.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 clicked index
         */
        @Override
        public void onItemLongClick(View target, IntPair<RecyclerItem> data) {
            switch(target.getId()) {
                case R.id.container:
                    if (getPresenter().getSettings().isAuthenticated()) {
                        mediaActionUtil = new MediaActionUtil.Builder().setId(((MediaBase) data.getSecond()).getId()).build(getActivity());
                        mediaActionUtil.startSeriesAction();
                    } else
                        NotifyUtil.INSTANCE.makeText(getContext(), R.string.info_login_req, R.drawable.ic_group_add_grey_600_18dp, Toast.LENGTH_SHORT).show();
                    break;
            }
        }
    });
}
Also used : GroupActorAdapter(com.mxt.anitrend.adapter.recycler.group.GroupActorAdapter) QueryContainerBuilder(io.github.wax911.library.model.request.QueryContainerBuilder) RecyclerItem(com.mxt.anitrend.model.entity.group.RecyclerItem) Intent(android.content.Intent) MediaActivity(com.mxt.anitrend.view.activity.detail.MediaActivity) MediaBase(com.mxt.anitrend.model.entity.base.MediaBase) View(android.view.View) MediaPresenter(com.mxt.anitrend.presenter.fragment.MediaPresenter)

Example 9 with MediaPresenter

use of com.mxt.anitrend.presenter.fragment.MediaPresenter in project anitrend-app by AniTrend.

the class MediaAnimeRoleFragment method onCreate.

/**
 * Override and set presenter, mColumnSize, and fetch argument/s
 *
 * @param savedInstanceState
 */
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        requestType = getArguments().getInt(KeyUtil.arg_request_type);
        id = getArguments().getLong(KeyUtil.arg_id);
        onList = (Boolean) getArguments().getSerializable(KeyUtil.arg_onList);
        mediaType = getArguments().getString(KeyUtil.arg_mediaType);
    }
    mColumnSize = R.integer.grid_giphy_x3;
    isPager = true;
    mAdapter = new GroupCharacterStaffAdapter(getContext());
    setPresenter(new MediaPresenter(getContext()));
    setViewModel(true);
}
Also used : GroupCharacterStaffAdapter(com.mxt.anitrend.adapter.recycler.group.GroupCharacterStaffAdapter) MediaPresenter(com.mxt.anitrend.presenter.fragment.MediaPresenter)

Example 10 with MediaPresenter

use of com.mxt.anitrend.presenter.fragment.MediaPresenter in project anitrend-app by AniTrend.

the class MediaCharacterFragment method onCreate.

/**
 * Override and set presenter, mColumnSize, and fetch argument/s
 *
 * @param savedInstanceState
 */
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (getArguments() != null) {
        mediaId = getArguments().getLong(KeyUtil.arg_id);
        mediaType = getArguments().getString(KeyUtil.arg_mediaType);
    }
    mColumnSize = R.integer.grid_giphy_x3;
    isPager = true;
    mAdapter = new GroupCharacterAdapter(getContext());
    setPresenter(new MediaPresenter(getContext()));
    setViewModel(true);
}
Also used : GroupCharacterAdapter(com.mxt.anitrend.adapter.recycler.group.GroupCharacterAdapter) MediaPresenter(com.mxt.anitrend.presenter.fragment.MediaPresenter)

Aggregations

MediaPresenter (com.mxt.anitrend.presenter.fragment.MediaPresenter)15 GroupSeriesAdapter (com.mxt.anitrend.adapter.recycler.group.GroupSeriesAdapter)4 MediaAdapter (com.mxt.anitrend.adapter.recycler.index.MediaAdapter)2 Intent (android.content.Intent)1 View (android.view.View)1 GroupActorAdapter (com.mxt.anitrend.adapter.recycler.group.GroupActorAdapter)1 GroupCharacterAdapter (com.mxt.anitrend.adapter.recycler.group.GroupCharacterAdapter)1 GroupCharacterStaffAdapter (com.mxt.anitrend.adapter.recycler.group.GroupCharacterStaffAdapter)1 GroupStaffRoleAdapter (com.mxt.anitrend.adapter.recycler.group.GroupStaffRoleAdapter)1 MediaListAdapter (com.mxt.anitrend.adapter.recycler.index.MediaListAdapter)1 MediaBase (com.mxt.anitrend.model.entity.base.MediaBase)1 RecyclerItem (com.mxt.anitrend.model.entity.group.RecyclerItem)1 MediaBrowseUtil (com.mxt.anitrend.util.media.MediaBrowseUtil)1 MediaActivity (com.mxt.anitrend.view.activity.detail.MediaActivity)1 QueryContainerBuilder (io.github.wax911.library.model.request.QueryContainerBuilder)1