use of com.mxt.anitrend.model.entity.base.MediaBase in project anitrend-app by AniTrend.
the class CommentFragment method onItemClick.
/**
* 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, FeedReply data) {
Intent intent;
switch(target.getId()) {
case R.id.series_image:
MediaBase mediaBase = feedList.getMedia();
intent = new Intent(getActivity(), MediaActivity.class);
intent.putExtra(KeyUtil.arg_id, mediaBase.getId());
intent.putExtra(KeyUtil.arg_mediaType, mediaBase.getType());
CompatUtil.startRevealAnim(getActivity(), target, intent);
break;
case R.id.widget_mention:
composerWidget.mentionUserFrom(data);
break;
case R.id.widget_edit:
composerWidget.setModel(data, KeyUtil.MUT_SAVE_FEED_REPLY);
composerWidget.setText(data.getReply());
break;
case R.id.widget_users:
List<UserBase> likes = data.getLikes();
if (likes.size() > 0) {
mBottomSheet = new BottomSheetUsers.Builder().setModel(likes).setTitle(R.string.title_bottom_sheet_likes).build();
showBottomSheet();
} else
NotifyUtil.makeText(getActivity(), R.string.text_no_likes, Toast.LENGTH_SHORT).show();
break;
case R.id.user_avatar:
intent = new Intent(getActivity(), ProfileActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(KeyUtil.arg_id, data.getUser().getId());
CompatUtil.startRevealAnim(getActivity(), target, intent);
break;
}
}
use of com.mxt.anitrend.model.entity.base.MediaBase 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();
}
use of com.mxt.anitrend.model.entity.base.MediaBase in project anitrend-app by AniTrend.
the class FeedListFragment method onItemClick.
/**
* 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, FeedList data) {
Intent intent;
switch(target.getId()) {
case R.id.series_image:
MediaBase series = data.getMedia();
intent = new Intent(getActivity(), MediaActivity.class);
intent.putExtra(KeyUtil.arg_id, series.getId());
intent.putExtra(KeyUtil.arg_mediaType, series.getType());
CompatUtil.startRevealAnim(getActivity(), target, intent);
break;
case R.id.widget_comment:
intent = new Intent(getActivity(), CommentActivity.class);
intent.putExtra(KeyUtil.arg_model, data);
CompatUtil.startRevealAnim(getActivity(), target, intent);
break;
case R.id.widget_edit:
mBottomSheet = new BottomSheetComposer.Builder().setUserActivity(data).setRequestMode(KeyUtil.MUT_SAVE_TEXT_FEED).setTitle(R.string.edit_status_title).build();
showBottomSheet();
break;
case R.id.widget_users:
List<UserBase> likes = data.getLikes();
if (likes.size() > 0) {
mBottomSheet = new BottomSheetUsers.Builder().setModel(likes).setTitle(R.string.title_bottom_sheet_likes).build();
showBottomSheet();
} else
NotifyUtil.makeText(getActivity(), R.string.text_no_likes, Toast.LENGTH_SHORT).show();
break;
case R.id.user_avatar:
if (data.getUser() != null) {
intent = new Intent(getActivity(), ProfileActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(KeyUtil.arg_id, data.getUser().getId());
CompatUtil.startRevealAnim(getActivity(), target, intent);
}
break;
}
}
use of com.mxt.anitrend.model.entity.base.MediaBase in project anitrend-app by AniTrend.
the class GroupSeriesListAdapter method getFilter.
@Override
public Filter getFilter() {
return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
String filter = constraint.toString();
if (filter.isEmpty()) {
data = clone;
} else {
data = new ArrayList<>();
for (EntityGroup model : clone) {
if (model instanceof MediaList) {
MediaBase mediaBase = ((MediaList) model).getMedia();
if (mediaBase.getTitle().getEnglish().toLowerCase(Locale.getDefault()).contains(filter) || mediaBase.getTitle().getRomaji().toLowerCase(Locale.getDefault()).contains(filter) || mediaBase.getTitle().getOriginal().toLowerCase(Locale.getDefault()).contains(filter))
data.add(model);
}
}
}
FilterResults results = new FilterResults();
results.values = data;
return results;
}
@Override
@SuppressWarnings("unchecked")
protected void publishResults(CharSequence constraint, FilterResults results) {
data = new ArrayList<>((List<EntityGroup>) results.values);
notifyDataSetChanged();
}
};
}
use of com.mxt.anitrend.model.entity.base.MediaBase in project anitrend-app by AniTrend.
the class ReviewFragment method onItemClick.
/**
* 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, Review data) {
Intent intent;
switch(target.getId()) {
case R.id.series_image:
MediaBase mediaBase = data.getMedia();
intent = new Intent(getActivity(), MediaActivity.class);
intent.putExtra(KeyUtil.arg_id, mediaBase.getId());
intent.putExtra(KeyUtil.arg_mediaType, mediaBase.getType());
CompatUtil.startRevealAnim(getActivity(), target, intent);
break;
case R.id.user_avatar:
if (getPresenter().getApplicationPref().isAuthenticated()) {
intent = new Intent(getActivity(), ProfileActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(KeyUtil.arg_id, data.getUser().getId());
CompatUtil.startRevealAnim(getActivity(), target, intent);
} else
NotifyUtil.makeText(getActivity(), R.string.info_login_req, R.drawable.ic_warning_white_18dp, Toast.LENGTH_SHORT).show();
break;
case R.id.review_read_more:
mBottomSheet = new BottomReviewReader.Builder().setReview(data).setTitle(R.string.drawer_title_reviews).build();
showBottomSheet();
break;
}
}
Aggregations