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;
}
}
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);
}
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;
}
}
});
}
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);
}
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);
}
Aggregations