Search in sources :

Example 1 with UserBase

use of com.mxt.anitrend.model.entity.base.UserBase 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;
    }
}
Also used : UserBase(com.mxt.anitrend.model.entity.base.UserBase) ProfileActivity(com.mxt.anitrend.view.activity.detail.ProfileActivity) QueryContainerBuilder(com.mxt.anitrend.model.entity.container.request.QueryContainerBuilder) Intent(android.content.Intent) MediaBase(com.mxt.anitrend.model.entity.base.MediaBase) MediaActivity(com.mxt.anitrend.view.activity.detail.MediaActivity)

Example 2 with UserBase

use of com.mxt.anitrend.model.entity.base.UserBase 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;
    }
}
Also used : UserBase(com.mxt.anitrend.model.entity.base.UserBase) ProfileActivity(com.mxt.anitrend.view.activity.detail.ProfileActivity) QueryContainerBuilder(com.mxt.anitrend.model.entity.container.request.QueryContainerBuilder) CommentActivity(com.mxt.anitrend.view.activity.detail.CommentActivity) Intent(android.content.Intent) MediaBase(com.mxt.anitrend.model.entity.base.MediaBase) MediaActivity(com.mxt.anitrend.view.activity.detail.MediaActivity) BottomSheetComposer(com.mxt.anitrend.view.sheet.BottomSheetComposer)

Aggregations

Intent (android.content.Intent)2 MediaBase (com.mxt.anitrend.model.entity.base.MediaBase)2 UserBase (com.mxt.anitrend.model.entity.base.UserBase)2 QueryContainerBuilder (com.mxt.anitrend.model.entity.container.request.QueryContainerBuilder)2 MediaActivity (com.mxt.anitrend.view.activity.detail.MediaActivity)2 ProfileActivity (com.mxt.anitrend.view.activity.detail.ProfileActivity)2 CommentActivity (com.mxt.anitrend.view.activity.detail.CommentActivity)1 BottomSheetComposer (com.mxt.anitrend.view.sheet.BottomSheetComposer)1