parent
a62fdf7535
commit
83cbadb4e1
|
@ -62,6 +62,10 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
private boolean useStarsForLikes;
|
||||
private boolean showAbsoluteTime;
|
||||
private int showingActionCardPosition = RecyclerView.NO_POSITION;
|
||||
private FollowClickListener followClickListener;
|
||||
private RequestClickListener requestClickListener;
|
||||
private IStatusViewHolder.StatusClickListener statusClickListener;
|
||||
private UserClickListener userClickListener;
|
||||
|
||||
public DummyItemAdapter(Context context) {
|
||||
this(context, new TwidereLinkify(null), null);
|
||||
|
@ -84,14 +88,14 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
|
||||
@NonNull
|
||||
@Override
|
||||
public MediaLoaderWrapper getMediaLoader() {
|
||||
return loader;
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NonNull
|
||||
@Override
|
||||
public UserListAdapterListener getUserListAdapterListener() {
|
||||
return null;
|
||||
public MediaLoaderWrapper getMediaLoader() {
|
||||
return loader;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
@ -100,35 +104,33 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
return formatter;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MediaLoadingHandler getMediaLoadingHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IStatusViewHolder.StatusClickListener getStatusClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StatusAdapterListener getStatusAdapterListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public UserColorNameManager getUserColorNameManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public UserListClickListener getUserListClickListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IStatusViewHolder.StatusClickListener getStatusClickListener() {
|
||||
return statusClickListener;
|
||||
}
|
||||
|
||||
public void setStatusClickListener(IStatusViewHolder.StatusClickListener statusClickListener) {
|
||||
this.statusClickListener = statusClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
|
@ -155,7 +157,17 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
return textSize;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public UserClickListener getUserClickListener() {
|
||||
return userClickListener;
|
||||
}
|
||||
|
||||
public void setUserClickListener(UserClickListener userClickListener) {
|
||||
this.userClickListener = userClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@IndicatorPosition
|
||||
public int getLoadMoreIndicatorPosition() {
|
||||
return IndicatorPosition.NONE;
|
||||
|
@ -179,6 +191,11 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
|
||||
@Override
|
||||
public ParcelableStatus getStatus(int position) {
|
||||
if (adapter instanceof ParcelableStatusesAdapter) {
|
||||
return ((ParcelableStatusesAdapter) adapter).getStatus(position);
|
||||
} else if (adapter instanceof VariousItemsAdapter) {
|
||||
return (ParcelableStatus) ((VariousItemsAdapter) adapter).getItem(position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -249,7 +266,6 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
return sensitiveContentEnabled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isCardActionsShown(int position) {
|
||||
if (position == RecyclerView.NO_POSITION) return showCardActions;
|
||||
|
@ -269,6 +285,11 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
|
||||
@Override
|
||||
public ParcelableUser getUser(int position) {
|
||||
if (adapter instanceof ParcelableUsersAdapter) {
|
||||
return ((ParcelableUsersAdapter) adapter).getUser(position);
|
||||
} else if (adapter instanceof VariousItemsAdapter) {
|
||||
return (ParcelableUser) ((VariousItemsAdapter) adapter).getItem(position);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -303,20 +324,23 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public UserAdapterListener getUserAdapterListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RequestClickListener getRequestClickListener() {
|
||||
return null;
|
||||
return requestClickListener;
|
||||
}
|
||||
|
||||
public void setRequestClickListener(RequestClickListener requestClickListener) {
|
||||
this.requestClickListener = requestClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FollowClickListener getFollowClickListener() {
|
||||
return null;
|
||||
return followClickListener;
|
||||
}
|
||||
|
||||
public void setFollowClickListener(FollowClickListener followClickListener) {
|
||||
this.followClickListener = followClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -363,11 +387,11 @@ public final class DummyItemAdapter implements IStatusesAdapter<Object>,
|
|||
textSize = preferences.getInt(KEY_TEXT_SIZE, context.getResources().getInteger(R.integer.default_text_size));
|
||||
nameFirst = preferences.getBoolean(KEY_NAME_FIRST, true);
|
||||
displayProfileImage = preferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||
displayMediaPreview = preferences.getBoolean(KEY_MEDIA_PREVIEW, false);
|
||||
setMediaPreviewEnabled(preferences.getBoolean(KEY_MEDIA_PREVIEW, false));
|
||||
sensitiveContentEnabled = preferences.getBoolean(KEY_DISPLAY_SENSITIVE_CONTENTS, false);
|
||||
showCardActions = !preferences.getBoolean(KEY_HIDE_CARD_ACTIONS, false);
|
||||
linkHighlightStyle = Utils.getLinkHighlightingStyleInt(preferences.getString(KEY_LINK_HIGHLIGHT_OPTION, null));
|
||||
useStarsForLikes = preferences.getBoolean(KEY_I_WANT_MY_STARS_BACK);
|
||||
showAbsoluteTime = preferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME);
|
||||
setUseStarsForLikes(preferences.getBoolean(KEY_I_WANT_MY_STARS_BACK));
|
||||
setShowAbsoluteTime(preferences.getBoolean(KEY_SHOW_ABSOLUTE_TIME));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import org.mariotaku.twidere.model.ParcelableActivity;
|
|||
import org.mariotaku.twidere.model.ParcelableActivityCursorIndices;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableStatusCursorIndices;
|
||||
import org.mariotaku.twidere.model.UserKey;
|
||||
import org.mariotaku.twidere.model.util.ParcelableActivityUtils;
|
||||
import org.mariotaku.twidere.util.IntentUtils;
|
||||
|
@ -220,10 +219,6 @@ public class ParcelableActivitiesAdapter extends LoadMoreSupportAdapter<Recycler
|
|||
return mStatusAdapterDelegate.getTextSize();
|
||||
}
|
||||
|
||||
public int getLinkHighlightingStyle() {
|
||||
return mStatusAdapterDelegate.getLinkHighlightingStyle();
|
||||
}
|
||||
|
||||
public boolean isNameFirst() {
|
||||
return mStatusAdapterDelegate.isNameFirst();
|
||||
}
|
||||
|
@ -469,11 +464,11 @@ public class ParcelableActivitiesAdapter extends LoadMoreSupportAdapter<Recycler
|
|||
}
|
||||
|
||||
@Override
|
||||
public final void onGapClick(RecyclerView.ViewHolder holder, int position) {
|
||||
public final void onGapClick(GapViewHolder holder, int position) {
|
||||
final ParcelableActivitiesAdapter adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
if (adapter.mActivityAdapterListener != null) {
|
||||
adapter.mActivityAdapterListener.onGapClick((GapViewHolder) holder, position);
|
||||
adapter.mActivityAdapterListener.onGapClick(holder, position);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.mariotaku.library.objectcursor.ObjectCursor;
|
|||
import org.mariotaku.twidere.Constants;
|
||||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableStatusCursorIndices;
|
||||
import org.mariotaku.twidere.model.UserKey;
|
||||
|
@ -49,7 +48,6 @@ import org.mariotaku.twidere.view.holder.GapViewHolder;
|
|||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -78,9 +76,8 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
private final boolean mShowCardActions;
|
||||
private final boolean mUseStarsForLikes;
|
||||
private final boolean mShowAbsoluteTime;
|
||||
private final EventListener mEventListener;
|
||||
@Nullable
|
||||
private StatusAdapterListener mStatusAdapterListener;
|
||||
private IStatusViewHolder.StatusClickListener mStatusClickListener;
|
||||
private boolean mShowInReplyTo;
|
||||
private boolean mShowAccountsColor;
|
||||
private List<ParcelableStatus> mData;
|
||||
|
@ -93,7 +90,6 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
ThemeUtils.getUserThemeBackgroundAlpha(context));
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mLoadingHandler = new MediaLoadingHandler(getProgressViewIds());
|
||||
mEventListener = new EventListener(this);
|
||||
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, context.getResources().getInteger(R.integer.default_text_size));
|
||||
mCompactCards = compact;
|
||||
mProfileImageStyle = Utils.getProfileImageStyle(mPreferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||
|
@ -243,7 +239,11 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
@Nullable
|
||||
@Override
|
||||
public IStatusViewHolder.StatusClickListener getStatusClickListener() {
|
||||
return mEventListener;
|
||||
return mStatusClickListener;
|
||||
}
|
||||
|
||||
public void setStatusClickListener(@Nullable IStatusViewHolder.StatusClickListener statusClickListener) {
|
||||
mStatusClickListener = statusClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -261,14 +261,7 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
return mTextSize;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StatusAdapterListener getStatusAdapterListener() {
|
||||
return mStatusAdapterListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public TwidereLinkify getTwidereLinkify() {
|
||||
return mLinkify;
|
||||
}
|
||||
|
@ -409,10 +402,6 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
return count;
|
||||
}
|
||||
|
||||
public void setListener(@Nullable StatusAdapterListener listener) {
|
||||
mStatusAdapterListener = listener;
|
||||
}
|
||||
|
||||
public void setShowAccountsColor(boolean showAccountsColor) {
|
||||
if (mShowAccountsColor == showAccountsColor) return;
|
||||
mShowAccountsColor = showAccountsColor;
|
||||
|
@ -423,7 +412,7 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
@Override
|
||||
public ParcelableStatus findStatusById(UserKey accountKey, String statusId) {
|
||||
for (int i = 0, j = getStatusCount(); i < j; i++) {
|
||||
if (accountKey.equals(getAccountKey(i)) && statusId == getStatusId(i)) {
|
||||
if (accountKey.equals(getAccountKey(i)) && statusId.equals(getStatusId(i))) {
|
||||
return getStatus(i);
|
||||
}
|
||||
}
|
||||
|
@ -437,7 +426,7 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
@Nullable
|
||||
@Override
|
||||
public GapClickListener getGapClickListener() {
|
||||
return mEventListener;
|
||||
return mStatusClickListener;
|
||||
}
|
||||
|
||||
public int getStatusStartIndex() {
|
||||
|
@ -454,77 +443,4 @@ public abstract class ParcelableStatusesAdapter extends LoadMoreSupportAdapter<R
|
|||
return getStatus(position).is_filtered;
|
||||
}
|
||||
|
||||
public static class EventListener implements GapClickListener, IStatusViewHolder.StatusClickListener {
|
||||
|
||||
private final WeakReference<IStatusesAdapter<?>> adapterRef;
|
||||
|
||||
public EventListener(IStatusesAdapter<?> adapter) {
|
||||
adapterRef = new WeakReference<IStatusesAdapter<?>>(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onStatusClick(IStatusViewHolder holder, int position) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
if (listener == null) return;
|
||||
listener.onStatusClick(holder, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMediaClick(IStatusViewHolder holder, View view, final ParcelableMedia media, int statusPosition) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
if (listener == null) return;
|
||||
listener.onMediaClick(holder, view, media, statusPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserProfileClick(final IStatusViewHolder holder, final int position) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
if (listener == null) return;
|
||||
final ParcelableStatus status = adapter.getStatus(position);
|
||||
if (status == null) return;
|
||||
listener.onUserProfileClick(holder, status, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStatusLongClick(IStatusViewHolder holder, int position) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return false;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
return listener != null && listener.onStatusLongClick(holder, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemActionClick(RecyclerView.ViewHolder holder, int id, int position) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
if (listener == null) return;
|
||||
listener.onStatusActionClick((IStatusViewHolder) holder, id, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemMenuClick(RecyclerView.ViewHolder holder, View menuView, int position) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
if (listener == null) return;
|
||||
listener.onStatusMenuClick((IStatusViewHolder) holder, menuView, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onGapClick(RecyclerView.ViewHolder holder, int position) {
|
||||
final IStatusesAdapter<?> adapter = adapterRef.get();
|
||||
if (adapter == null) return;
|
||||
final StatusAdapterListener listener = adapter.getStatusAdapterListener();
|
||||
if (listener == null) return;
|
||||
listener.onGapClick((GapViewHolder) holder, position);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,8 @@ public class ParcelableUserListsAdapter extends LoadMoreSupportAdapter<RecyclerV
|
|||
private final boolean mDisplayProfileImage;
|
||||
private final boolean mShowAbsoluteTime;
|
||||
private final boolean mNameFirst;
|
||||
private final EventListener mEventListener;
|
||||
private List<ParcelableUserList> mData;
|
||||
private UserListAdapterListener mUserListAdapterListener;
|
||||
private UserListClickListener mUserListClickListener;
|
||||
|
||||
|
||||
public ParcelableUserListsAdapter(Context context) {
|
||||
|
@ -58,7 +57,6 @@ public class ParcelableUserListsAdapter extends LoadMoreSupportAdapter<RecyclerV
|
|||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context,
|
||||
ThemeUtils.getThemeBackgroundOption(context),
|
||||
ThemeUtils.getUserThemeBackgroundAlpha(context));
|
||||
mEventListener = new EventListener(this);
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mTextSize = mPreferences.getInt(KEY_TEXT_SIZE, context.getResources().getInteger(R.integer.default_text_size));
|
||||
mProfileImageStyle = Utils.getProfileImageStyle(mPreferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||
|
@ -173,8 +171,8 @@ public class ParcelableUserListsAdapter extends LoadMoreSupportAdapter<RecyclerV
|
|||
return ITEM_VIEW_TYPE_USER_LIST;
|
||||
}
|
||||
|
||||
public void setListener(UserListAdapterListener userListAdapterListener) {
|
||||
mUserListAdapterListener = userListAdapterListener;
|
||||
public void setUserListClickListener(UserListClickListener userListClickListener) {
|
||||
mUserListClickListener = userListClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,8 +182,8 @@ public class ParcelableUserListsAdapter extends LoadMoreSupportAdapter<RecyclerV
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public IUserListsAdapter.UserListAdapterListener getUserListAdapterListener() {
|
||||
return mEventListener;
|
||||
public UserListClickListener getUserListClickListener() {
|
||||
return mUserListClickListener;
|
||||
}
|
||||
|
||||
public static UserListViewHolder createUserListViewHolder(IUserListsAdapter<?> adapter,
|
||||
|
@ -202,33 +200,5 @@ public class ParcelableUserListsAdapter extends LoadMoreSupportAdapter<RecyclerV
|
|||
return holder;
|
||||
}
|
||||
|
||||
public interface UserListAdapterListener {
|
||||
|
||||
void onUserListClick(UserListViewHolder holder, int position);
|
||||
|
||||
boolean onUserListLongClick(UserListViewHolder holder, int position);
|
||||
|
||||
}
|
||||
|
||||
static class EventListener implements IUserListsAdapter.UserListAdapterListener {
|
||||
|
||||
private final ParcelableUserListsAdapter mAdapter;
|
||||
|
||||
public EventListener(ParcelableUserListsAdapter adapter) {
|
||||
mAdapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserListClick(UserListViewHolder holder, int position) {
|
||||
final UserListAdapterListener listener = mAdapter.mUserListAdapterListener;
|
||||
if (listener == null) return;
|
||||
listener.onUserListClick(holder, position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUserListLongClick(UserListViewHolder holder, int position) {
|
||||
final UserListAdapterListener listener = mAdapter.mUserListAdapterListener;
|
||||
return listener != null && listener.onUserListLongClick(holder, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ParcelableUsersAdapter extends LoadMoreSupportAdapter<RecyclerView.
|
|||
private final boolean mDisplayProfileImage;
|
||||
private final boolean mShowAbsoluteTime;
|
||||
private List<ParcelableUser> mData;
|
||||
private UserAdapterListener mUserAdapterListener;
|
||||
private UserClickListener mUserClickListener;
|
||||
private RequestClickListener mRequestClickListener;
|
||||
private FollowClickListener mFollowClickListener;
|
||||
|
||||
|
@ -200,12 +200,12 @@ public class ParcelableUsersAdapter extends LoadMoreSupportAdapter<RecyclerView.
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public UserAdapterListener getUserAdapterListener() {
|
||||
return mUserAdapterListener;
|
||||
public UserClickListener getUserClickListener() {
|
||||
return mUserClickListener;
|
||||
}
|
||||
|
||||
public void setUserAdapterListener(UserAdapterListener userAdapterListener) {
|
||||
mUserAdapterListener = userAdapterListener;
|
||||
public void setUserClickListener(UserClickListener userClickListener) {
|
||||
mUserClickListener = userClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.mariotaku.twidere.model.ParcelableStatus;
|
|||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||
import org.mariotaku.twidere.util.ThemeUtils;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.UserListViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.UserViewHolder;
|
||||
|
@ -38,7 +39,8 @@ public class VariousItemsAdapter extends LoadMoreSupportAdapter<RecyclerView.Vie
|
|||
mCardBackgroundColor = ThemeUtils.getCardBackgroundColor(context,
|
||||
ThemeUtils.getThemeBackgroundOption(context),
|
||||
ThemeUtils.getUserThemeBackgroundAlpha(context));
|
||||
mDummyAdapter = new DummyItemAdapter(context);
|
||||
mDummyAdapter = new DummyItemAdapter(context, new TwidereLinkify(null), this);
|
||||
mDummyAdapter.updateOptions();
|
||||
setLoadMoreIndicatorPosition(IndicatorPosition.NONE);
|
||||
}
|
||||
|
||||
|
@ -107,4 +109,12 @@ public class VariousItemsAdapter extends LoadMoreSupportAdapter<RecyclerView.Vie
|
|||
if (mData == null) return 0;
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
return mData.get(position);
|
||||
}
|
||||
|
||||
public DummyItemAdapter getDummyAdapter() {
|
||||
return mDummyAdapter;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
package org.mariotaku.twidere.adapter.iface;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 14/12/3.
|
||||
|
@ -36,7 +37,7 @@ public interface IGapSupportedAdapter {
|
|||
|
||||
interface GapClickListener {
|
||||
|
||||
void onGapClick(ViewHolder holder, int position);
|
||||
void onGapClick(GapViewHolder holder, int position);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package org.mariotaku.twidere.adapter.iface;
|
||||
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.UserKey;
|
||||
import org.mariotaku.twidere.util.MediaLoadingHandler;
|
||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||
import org.mariotaku.twidere.view.CardMediaContainer.PreviewStyle;
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
|
||||
|
||||
/**
|
||||
|
@ -64,22 +61,4 @@ public interface IStatusesAdapter<Data> extends IContentCardAdapter, IGapSupport
|
|||
@Nullable
|
||||
IStatusViewHolder.StatusClickListener getStatusClickListener();
|
||||
|
||||
@Nullable
|
||||
StatusAdapterListener getStatusAdapterListener();
|
||||
|
||||
interface StatusAdapterListener {
|
||||
void onGapClick(GapViewHolder holder, int position);
|
||||
|
||||
void onMediaClick(IStatusViewHolder holder, View view, ParcelableMedia media, int statusPosition);
|
||||
|
||||
void onStatusActionClick(IStatusViewHolder holder, int id, int position);
|
||||
|
||||
void onStatusClick(IStatusViewHolder holder, int position);
|
||||
|
||||
boolean onStatusLongClick(IStatusViewHolder holder, int position);
|
||||
|
||||
void onStatusMenuClick(IStatusViewHolder holder, View menuView, int position);
|
||||
|
||||
void onUserProfileClick(IStatusViewHolder holder, ParcelableStatus status, int position);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ public interface IUserListsAdapter<Data> extends IContentCardAdapter {
|
|||
MediaLoaderWrapper getMediaLoader();
|
||||
|
||||
@Nullable
|
||||
UserListAdapterListener getUserListAdapterListener();
|
||||
UserListClickListener getUserListClickListener();
|
||||
|
||||
interface UserListAdapterListener {
|
||||
interface UserListClickListener {
|
||||
|
||||
void onUserListClick(UserListViewHolder holder, int position);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ public interface IUsersAdapter<Data> extends IContentCardAdapter {
|
|||
void setData(Data data);
|
||||
|
||||
@Nullable
|
||||
UserAdapterListener getUserAdapterListener();
|
||||
UserClickListener getUserClickListener();
|
||||
|
||||
RequestClickListener getRequestClickListener();
|
||||
|
||||
|
@ -53,7 +53,7 @@ public interface IUsersAdapter<Data> extends IContentCardAdapter {
|
|||
@Override
|
||||
MediaLoaderWrapper getMediaLoader();
|
||||
|
||||
interface UserAdapterListener {
|
||||
interface UserClickListener {
|
||||
|
||||
void onUserClick(UserViewHolder holder, int position);
|
||||
|
||||
|
@ -71,4 +71,32 @@ public interface IUsersAdapter<Data> extends IContentCardAdapter {
|
|||
interface FollowClickListener {
|
||||
void onFollowClicked(UserViewHolder holder, int position);
|
||||
}
|
||||
|
||||
abstract class SimpleUserClickListener implements UserClickListener, RequestClickListener, FollowClickListener {
|
||||
|
||||
@Override
|
||||
public void onFollowClicked(UserViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAcceptClicked(UserViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDenyClicked(UserViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserClick(UserViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUserLongClick(UserViewHolder holder, int position) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,6 @@ import com.squareup.otto.Subscribe;
|
|||
import org.mariotaku.twidere.R;
|
||||
import org.mariotaku.twidere.adapter.ParcelableStatusesAdapter;
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter.StatusAdapterListener;
|
||||
import org.mariotaku.twidere.annotation.ReadPositionTag;
|
||||
import org.mariotaku.twidere.graphic.like.LikeAnimationDrawable;
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader;
|
||||
|
@ -68,6 +67,7 @@ import org.mariotaku.twidere.util.Utils;
|
|||
import org.mariotaku.twidere.util.imageloader.PauseRecyclerViewOnScrollListener;
|
||||
import org.mariotaku.twidere.view.ExtendedRecyclerView;
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -84,7 +84,7 @@ import edu.tsinghua.hotmobi.model.TimelineType;
|
|||
* Created by mariotaku on 14/11/5.
|
||||
*/
|
||||
public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFragment<ParcelableStatusesAdapter>
|
||||
implements LoaderCallbacks<List<ParcelableStatus>>, StatusAdapterListener, KeyboardShortcutCallback {
|
||||
implements LoaderCallbacks<List<ParcelableStatus>>, IStatusViewHolder.StatusClickListener, KeyboardShortcutCallback {
|
||||
|
||||
private final Object mStatusesBusCallback;
|
||||
private final OnScrollListener mHotMobiScrollTracker = new OnScrollListener() {
|
||||
|
@ -364,7 +364,7 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
protected abstract String getTimelineType();
|
||||
|
||||
@Override
|
||||
public void onStatusActionClick(IStatusViewHolder holder, int id, int position) {
|
||||
public void onItemActionClick(RecyclerView.ViewHolder holder, int id, int position) {
|
||||
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||
final ParcelableStatus status = adapter.getStatus(position);
|
||||
if (status == null) return;
|
||||
|
@ -387,7 +387,8 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
if (status.is_favorite) {
|
||||
twitter.destroyFavoriteAsync(status.account_key, status.id);
|
||||
} else {
|
||||
holder.playLikeAnimation(new DefaultOnLikedListener(twitter, status));
|
||||
((StatusViewHolder) holder).playLikeAnimation(new DefaultOnLikedListener(twitter,
|
||||
status));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -407,7 +408,7 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStatusMenuClick(IStatusViewHolder holder, View menuView, int position) {
|
||||
public void onItemMenuClick(RecyclerView.ViewHolder holder, View menuView, int position) {
|
||||
if (getActivity() == null) return;
|
||||
final LinearLayoutManager lm = getLayoutManager();
|
||||
final View view = lm.findViewByPosition(position);
|
||||
|
@ -416,8 +417,9 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUserProfileClick(IStatusViewHolder holder, ParcelableStatus status, int position) {
|
||||
public void onUserProfileClick(IStatusViewHolder holder, int position) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
final ParcelableStatus status = getAdapter().getStatus(position);
|
||||
IntentUtils.openUserProfile(activity, status.account_key, status.user_key.getId(),
|
||||
status.user_screen_name, null, true, UserFragment.Referral.TIMELINE_STATUS);
|
||||
}
|
||||
|
@ -471,7 +473,7 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||
adapter.setListener(null);
|
||||
adapter.setStatusClickListener(null);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
|
@ -490,7 +492,7 @@ public abstract class AbsStatusesFragment extends AbsContentListRecyclerViewFrag
|
|||
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||
final RecyclerView recyclerView = getRecyclerView();
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
adapter.setListener(this);
|
||||
adapter.setStatusClickListener(this);
|
||||
registerForContextMenu(recyclerView);
|
||||
mNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager,
|
||||
adapter, this);
|
||||
|
|
|
@ -10,8 +10,15 @@ import android.support.v4.content.AsyncTaskLoader;
|
|||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
||||
import org.mariotaku.twidere.adapter.DummyItemAdapter;
|
||||
import org.mariotaku.twidere.adapter.VariousItemsAdapter;
|
||||
import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.util.IntentUtils;
|
||||
import org.mariotaku.twidere.view.holder.UserViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -31,7 +38,26 @@ public class ItemsListFragment extends AbsContentListRecyclerViewFragment<Variou
|
|||
@NonNull
|
||||
@Override
|
||||
protected VariousItemsAdapter onCreateAdapter(Context context, boolean compact) {
|
||||
return new VariousItemsAdapter(context, compact);
|
||||
final VariousItemsAdapter adapter = new VariousItemsAdapter(context, compact);
|
||||
final DummyItemAdapter dummyItemAdapter = adapter.getDummyAdapter();
|
||||
dummyItemAdapter.setStatusClickListener(new IStatusViewHolder.SimpleStatusClickListener() {
|
||||
@Override
|
||||
public void onStatusClick(IStatusViewHolder holder, int position) {
|
||||
final ParcelableStatus status = dummyItemAdapter.getStatus(position);
|
||||
if (status == null) return;
|
||||
IntentUtils.openStatus(getContext(), status, null);
|
||||
}
|
||||
});
|
||||
dummyItemAdapter.setUserClickListener(new IUsersAdapter.SimpleUserClickListener() {
|
||||
@Override
|
||||
public void onUserClick(UserViewHolder holder, int position) {
|
||||
final ParcelableUser user = dummyItemAdapter.getUser(position);
|
||||
if (user == null) return;
|
||||
IntentUtils.openUserProfile(getContext(), user, null, true,
|
||||
UserFragment.Referral.TIMELINE_STATUS);
|
||||
}
|
||||
});
|
||||
return adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,8 +31,8 @@ import android.support.v7.widget.RecyclerView;
|
|||
import android.view.KeyEvent;
|
||||
|
||||
import org.mariotaku.twidere.adapter.ParcelableUserListsAdapter;
|
||||
import org.mariotaku.twidere.adapter.ParcelableUserListsAdapter.UserListAdapterListener;
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||
import org.mariotaku.twidere.adapter.iface.IUserListsAdapter.UserListClickListener;
|
||||
import org.mariotaku.twidere.loader.iface.ICursorSupportLoader;
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader;
|
||||
import org.mariotaku.twidere.model.ParcelableUserList;
|
||||
|
@ -46,7 +46,7 @@ import org.mariotaku.twidere.view.holder.UserListViewHolder;
|
|||
import java.util.List;
|
||||
|
||||
public abstract class ParcelableUserListsFragment extends AbsContentListRecyclerViewFragment<ParcelableUserListsAdapter>
|
||||
implements LoaderCallbacks<List<ParcelableUserList>>, UserListAdapterListener, KeyboardShortcutCallback {
|
||||
implements LoaderCallbacks<List<ParcelableUserList>>, UserListClickListener, KeyboardShortcutCallback {
|
||||
|
||||
private RecyclerViewNavigationHelper mNavigationHelper;
|
||||
private long mNextCursor;
|
||||
|
@ -141,7 +141,7 @@ public abstract class ParcelableUserListsFragment extends AbsContentListRecycler
|
|||
final ParcelableUserListsAdapter adapter = getAdapter();
|
||||
final RecyclerView recyclerView = getRecyclerView();
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
adapter.setListener(this);
|
||||
adapter.setUserListClickListener(this);
|
||||
|
||||
mNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter,
|
||||
this);
|
||||
|
|
|
@ -38,7 +38,7 @@ import com.squareup.otto.Subscribe;
|
|||
import org.mariotaku.twidere.adapter.ParcelableUsersAdapter;
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.UserAdapterListener;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.UserClickListener;
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.UserKey;
|
||||
|
@ -56,7 +56,7 @@ import org.mariotaku.twidere.view.holder.UserViewHolder;
|
|||
import java.util.List;
|
||||
|
||||
public abstract class ParcelableUsersFragment extends AbsContentListRecyclerViewFragment<ParcelableUsersAdapter>
|
||||
implements LoaderCallbacks<List<ParcelableUser>>, UserAdapterListener, KeyboardShortcutCallback,
|
||||
implements LoaderCallbacks<List<ParcelableUser>>, UserClickListener, KeyboardShortcutCallback,
|
||||
IUsersAdapter.FollowClickListener {
|
||||
|
||||
@NonNull
|
||||
|
@ -74,7 +74,7 @@ public abstract class ParcelableUsersFragment extends AbsContentListRecyclerView
|
|||
final ParcelableUsersAdapter adapter = getAdapter();
|
||||
final RecyclerView recyclerView = getRecyclerView();
|
||||
final LinearLayoutManager layoutManager = getLayoutManager();
|
||||
adapter.setUserAdapterListener(this);
|
||||
adapter.setUserClickListener(this);
|
||||
|
||||
mNavigationHelper = new RecyclerViewNavigationHelper(recyclerView, layoutManager, adapter,
|
||||
this);
|
||||
|
|
|
@ -89,11 +89,9 @@ import org.mariotaku.twidere.R;
|
|||
import org.mariotaku.twidere.activity.ColorPickerDialogActivity;
|
||||
import org.mariotaku.twidere.adapter.BaseRecyclerViewAdapter;
|
||||
import org.mariotaku.twidere.adapter.LoadMoreSupportAdapter;
|
||||
import org.mariotaku.twidere.adapter.ParcelableStatusesAdapter;
|
||||
import org.mariotaku.twidere.adapter.decorator.DividerItemDecoration;
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter;
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter.StatusAdapterListener;
|
||||
import org.mariotaku.twidere.api.twitter.Twitter;
|
||||
import org.mariotaku.twidere.api.twitter.TwitterException;
|
||||
import org.mariotaku.twidere.api.twitter.model.Paging;
|
||||
|
@ -132,7 +130,7 @@ import org.mariotaku.twidere.util.AsyncTaskUtils;
|
|||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
import org.mariotaku.twidere.util.CheckUtils;
|
||||
import org.mariotaku.twidere.util.CompareUtils;
|
||||
import org.mariotaku.twidere.util.ContentScrollHandler;
|
||||
import org.mariotaku.twidere.util.ContentScrollHandler.ContentListSupport;
|
||||
import org.mariotaku.twidere.util.DataStoreUtils;
|
||||
import org.mariotaku.twidere.util.HtmlSpanBuilder;
|
||||
import org.mariotaku.twidere.util.IntentUtils;
|
||||
|
@ -169,6 +167,7 @@ import org.mariotaku.twidere.view.holder.GapViewHolder;
|
|||
import org.mariotaku.twidere.view.holder.LoadIndicatorViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder;
|
||||
import org.mariotaku.twidere.view.holder.iface.IStatusViewHolder.StatusClickListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -183,7 +182,7 @@ import edu.tsinghua.hotmobi.model.TweetEvent;
|
|||
* Created by mariotaku on 14/12/5.
|
||||
*/
|
||||
public class StatusFragment extends BaseSupportFragment implements LoaderCallbacks<SingleResponse<ParcelableStatus>>,
|
||||
OnMediaClickListener, StatusAdapterListener, KeyboardShortcutCallback, ContentScrollHandler.ContentListSupport {
|
||||
OnMediaClickListener, StatusClickListener, KeyboardShortcutCallback, ContentListSupport {
|
||||
|
||||
// Constants
|
||||
private static final int LOADER_ID_DETAIL_STATUS = 1;
|
||||
|
@ -376,7 +375,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
mLayoutManager.setRecycleChildrenOnDetach(true);
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mStatusAdapter.setEventListener(this);
|
||||
mStatusAdapter.setStatusClickListener(this);
|
||||
mRecyclerView.setAdapter(mStatusAdapter);
|
||||
registerForContextMenu(mRecyclerView);
|
||||
|
||||
|
@ -418,7 +417,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStatusActionClick(IStatusViewHolder holder, int id, int position) {
|
||||
public void onItemActionClick(ViewHolder holder, int id, int position) {
|
||||
final ParcelableStatus status = mStatusAdapter.getStatus(position);
|
||||
if (status == null) return;
|
||||
switch (id) {
|
||||
|
@ -440,7 +439,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
if (status.is_favorite) {
|
||||
twitter.destroyFavoriteAsync(status.account_key, status.id);
|
||||
} else {
|
||||
holder.playLikeAnimation(new DefaultOnLikedListener(twitter, status));
|
||||
((StatusViewHolder) holder).playLikeAnimation(new DefaultOnLikedListener(twitter,
|
||||
status));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStatusMenuClick(IStatusViewHolder holder, View menuView, int position) {
|
||||
public void onItemMenuClick(ViewHolder holder, View menuView, int position) {
|
||||
if (getActivity() == null) return;
|
||||
final View view = mLayoutManager.findViewByPosition(position);
|
||||
if (view == null) return;
|
||||
|
@ -466,8 +466,9 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onUserProfileClick(IStatusViewHolder holder, ParcelableStatus status, int position) {
|
||||
public void onUserProfileClick(IStatusViewHolder holder, int position) {
|
||||
final FragmentActivity activity = getActivity();
|
||||
final ParcelableStatus status = mStatusAdapter.getStatus(position);
|
||||
IntentUtils.openUserProfile(activity, status.account_key, status.user_key.getId(),
|
||||
status.user_screen_name, null, true, UserFragment.Referral.TIMELINE_STATUS);
|
||||
}
|
||||
|
@ -1681,7 +1682,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
private final MediaLoadingHandler mMediaLoadingHandler;
|
||||
private final TwidereLinkify mTwidereLinkify;
|
||||
|
||||
private StatusAdapterListener mStatusAdapterListener;
|
||||
private StatusClickListener mStatusClickListener;
|
||||
private RecyclerView mRecyclerView;
|
||||
private DetailStatusViewHolder mStatusViewHolder;
|
||||
|
||||
|
@ -1701,7 +1702,6 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
private final boolean mShowCardActions;
|
||||
private final boolean mUseStarsForLikes;
|
||||
private final boolean mShowAbsoluteTime;
|
||||
private final ParcelableStatusesAdapter.EventListener mEventListener;
|
||||
private boolean mDetailMediaExpanded;
|
||||
|
||||
private ParcelableStatus mStatus;
|
||||
|
@ -1749,7 +1749,6 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
mCardLayoutResource = R.layout.card_item_status;
|
||||
}
|
||||
mTwidereLinkify = new TwidereLinkify(new StatusAdapterLinkClickHandler<>(this));
|
||||
mEventListener = new ParcelableStatusesAdapter.EventListener(this);
|
||||
}
|
||||
|
||||
public int findPositionById(long itemId) {
|
||||
|
@ -1954,15 +1953,10 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public IStatusViewHolder.StatusClickListener getStatusClickListener() {
|
||||
return mEventListener;
|
||||
public StatusClickListener getStatusClickListener() {
|
||||
return mStatusClickListener;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public StatusAdapterListener getStatusAdapterListener() {
|
||||
return mStatusAdapterListener;
|
||||
}
|
||||
|
||||
public ParcelableStatus getStatus() {
|
||||
return mStatus;
|
||||
|
@ -1995,7 +1989,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
@Nullable
|
||||
@Override
|
||||
public GapClickListener getGapClickListener() {
|
||||
return mEventListener;
|
||||
return mStatusClickListener;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2205,8 +2199,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
return mItemCounts[idx];
|
||||
}
|
||||
|
||||
public void setEventListener(StatusAdapterListener listener) {
|
||||
mStatusAdapterListener = listener;
|
||||
public void setStatusClickListener(StatusClickListener listener) {
|
||||
mStatusClickListener = listener;
|
||||
}
|
||||
|
||||
public void setReplyError(CharSequence error) {
|
||||
|
@ -2264,7 +2258,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
public void setStatusActivity(StatusActivity activity) {
|
||||
final ParcelableStatus status = getStatus();
|
||||
if (status == null) return;
|
||||
if (activity != null && activity.statusId != (status.is_retweet ? status.retweet_id : status.id)) {
|
||||
if (activity != null && activity.isStatus(status)) {
|
||||
return;
|
||||
}
|
||||
mStatusActivity = activity;
|
||||
|
@ -2603,6 +2597,10 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
|
|||
", retweetCount=" + retweetCount +
|
||||
'}';
|
||||
}
|
||||
|
||||
public boolean isStatus(ParcelableStatus status) {
|
||||
return TextUtils.equals(statusId, status.is_retweet ? status.retweet_id : status.id);
|
||||
}
|
||||
}
|
||||
|
||||
static class ReadPosition {
|
||||
|
|
|
@ -919,9 +919,7 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
public void onPrepareOptionsMenu(final Menu menu) {
|
||||
final AsyncTwitterWrapper twitter = mTwitterWrapper;
|
||||
final ParcelableUser user = getUser();
|
||||
final UserRelationship userRelationship = mRelationship;
|
||||
if (twitter == null || user == null || userRelationship == null) return;
|
||||
final Relationship relationship = userRelationship.relationship;
|
||||
if (twitter == null || user == null) return;
|
||||
|
||||
final boolean isMyself = user.account_key.equals(user.key);
|
||||
final MenuItem mentionItem = menu.findItem(R.id.mention);
|
||||
|
@ -934,20 +932,10 @@ public class UserFragment extends BaseSupportFragment implements OnClickListener
|
|||
MenuUtils.setMenuItemAvailability(menu, R.id.saved_searches, isMyself);
|
||||
MenuUtils.setMenuItemAvailability(menu, R.id.scheduled_statuses, isMyself
|
||||
&& TwitterAPIFactory.getOfficialKeyType(getActivity(), user.account_key) == ConsumerKeyType.TWEETDECK);
|
||||
// final MenuItem followItem = menu.findItem(MENU_FOLLOW);
|
||||
// followItem.setVisible(!isMyself);
|
||||
// final boolean shouldShowFollowItem = !creatingFriendship && !destroyingFriendship && !isMyself
|
||||
// && relationship != null;
|
||||
// followItem.setEnabled(shouldShowFollowItem);
|
||||
// if (shouldShowFollowItem) {
|
||||
// followItem.setTitle(isFollowing ? R.string.unfollow : isProtected ? R.string.send_follow_request
|
||||
// : R.string.follow);
|
||||
// followItem.setIcon(isFollowing ? R.drawable.ic_action_cancel : R.drawable.ic_action_add);
|
||||
// } else {
|
||||
// followItem.setTitle(null);
|
||||
// followItem.setIcon(null);
|
||||
// }
|
||||
if (!isMyself) {
|
||||
|
||||
final UserRelationship userRelationship = mRelationship;
|
||||
if (!isMyself && userRelationship != null) {
|
||||
final Relationship relationship = userRelationship.relationship;
|
||||
MenuUtils.setMenuItemAvailability(menu, R.id.send_direct_message, relationship.canSourceDMTarget());
|
||||
MenuUtils.setMenuItemAvailability(menu, R.id.block, true);
|
||||
MenuUtils.setMenuItemAvailability(menu, R.id.mute_user, true);
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.support.annotation.NonNull;
|
|||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.StaggeredGridLayoutManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -17,7 +18,6 @@ import org.mariotaku.twidere.adapter.ParcelableStatusesAdapter;
|
|||
import org.mariotaku.twidere.adapter.StaggeredGridParcelableStatusesAdapter;
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter.IndicatorPosition;
|
||||
import org.mariotaku.twidere.adapter.iface.IStatusesAdapter;
|
||||
import org.mariotaku.twidere.fragment.AbsContentRecyclerViewFragment;
|
||||
import org.mariotaku.twidere.loader.MediaTimelineLoader;
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
* Created by mariotaku on 14/11/5.
|
||||
*/
|
||||
public class UserMediaTimelineFragment extends AbsContentRecyclerViewFragment<StaggeredGridParcelableStatusesAdapter, StaggeredGridLayoutManager>
|
||||
implements LoaderCallbacks<List<ParcelableStatus>>, DrawerCallback, ParcelableStatusesAdapter.StatusAdapterListener {
|
||||
implements LoaderCallbacks<List<ParcelableStatus>>, DrawerCallback, IStatusViewHolder.StatusClickListener {
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -54,7 +54,7 @@ public class UserMediaTimelineFragment extends AbsContentRecyclerViewFragment<St
|
|||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
final ParcelableStatusesAdapter adapter = getAdapter();
|
||||
adapter.setListener(this);
|
||||
adapter.setStatusClickListener(this);
|
||||
final Bundle loaderArgs = new Bundle(getArguments());
|
||||
loaderArgs.putBoolean(EXTRA_FROM_USER, true);
|
||||
getLoaderManager().initLoader(0, loaderArgs, this);
|
||||
|
@ -168,7 +168,7 @@ public class UserMediaTimelineFragment extends AbsContentRecyclerViewFragment<St
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStatusActionClick(IStatusViewHolder holder, int id, int position) {
|
||||
public void onItemActionClick(RecyclerView.ViewHolder holder, int id, int position) {
|
||||
|
||||
}
|
||||
|
||||
|
@ -183,12 +183,12 @@ public class UserMediaTimelineFragment extends AbsContentRecyclerViewFragment<St
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onStatusMenuClick(IStatusViewHolder holder, View menuView, int position) {
|
||||
public void onItemMenuClick(RecyclerView.ViewHolder holder, View menuView, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserProfileClick(IStatusViewHolder holder, ParcelableStatus status, int position) {
|
||||
public void onUserProfileClick(IStatusViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ public class CardPreviewPreference extends Preference implements Constants, OnSh
|
|||
mHolder.setStatusClickListener(new IStatusViewHolder.SimpleStatusClickListener() {
|
||||
@Override
|
||||
public void onItemActionClick(RecyclerView.ViewHolder holder, int id, int position) {
|
||||
if (id == R.id.favorite_count) {
|
||||
if (id == R.id.favorite) {
|
||||
((StatusViewHolder) holder).playLikeAnimation(new LikeAnimationDrawable.OnLikedListener() {
|
||||
@Override
|
||||
public boolean onLiked() {
|
||||
|
|
|
@ -57,7 +57,7 @@ public class TimelineContentTextView extends AppCompatTextView {
|
|||
public boolean dispatchTouchEvent(MotionEvent event) {
|
||||
// FIXME simple workaround to https://code.google.com/p/android/issues/detail?id=191430
|
||||
// Android clears TextView when setText(), so setText before touch
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isTextSelectable()) {
|
||||
if (getSelectionEnd() != getSelectionStart()) {
|
||||
final CharSequence text = getText();
|
||||
setText(null);
|
||||
|
@ -69,6 +69,9 @@ public class TimelineContentTextView extends AppCompatTextView {
|
|||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (isTextSelectable()) {
|
||||
return super.onTouchEvent(event);
|
||||
}
|
||||
switch (event.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: {
|
||||
Layout layout = getLayout();
|
||||
|
|
|
@ -51,7 +51,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
|
|||
private final TextView membersCountView;
|
||||
private final TextView subscribersCountView;
|
||||
|
||||
private IUserListsAdapter.UserListAdapterListener userListClickListener;
|
||||
private IUserListsAdapter.UserListClickListener userListClickListener;
|
||||
|
||||
public UserListViewHolder(IUserListsAdapter<?> adapter, View itemView) {
|
||||
super(itemView);
|
||||
|
@ -91,7 +91,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
|
|||
}
|
||||
|
||||
public void setOnClickListeners() {
|
||||
setUserListClickListener(adapter.getUserListAdapterListener());
|
||||
setUserListClickListener(adapter.getUserListClickListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
|
|||
return false;
|
||||
}
|
||||
|
||||
public void setUserListClickListener(IUserListsAdapter.UserListAdapterListener listener) {
|
||||
public void setUserListClickListener(IUserListsAdapter.UserListClickListener listener) {
|
||||
userListClickListener = listener;
|
||||
((View) itemContent).setOnClickListener(this);
|
||||
((View) itemContent).setOnLongClickListener(this);
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.mariotaku.twidere.R;
|
|||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.FollowClickListener;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.RequestClickListener;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.UserAdapterListener;
|
||||
import org.mariotaku.twidere.adapter.iface.IUsersAdapter.UserClickListener;
|
||||
import org.mariotaku.twidere.model.ParcelableUser;
|
||||
import org.mariotaku.twidere.model.util.UserKeyUtils;
|
||||
import org.mariotaku.twidere.util.AsyncTwitterWrapper;
|
||||
|
@ -63,7 +63,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
|
|||
private final View actionsContainer;
|
||||
private final View processingRequestProgress;
|
||||
|
||||
private UserAdapterListener userClickListener;
|
||||
private UserClickListener userClickListener;
|
||||
private RequestClickListener requestClickListener;
|
||||
private FollowClickListener followClickListener;
|
||||
|
||||
|
@ -205,7 +205,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
|
|||
}
|
||||
|
||||
public void setOnClickListeners() {
|
||||
setUserClickListener(adapter.getUserAdapterListener());
|
||||
setUserClickListener(adapter.getUserClickListener());
|
||||
setActionClickListeners(adapter.getRequestClickListener(), adapter.getFollowClickListener());
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
|
|||
friendsCountView.setTextSize(textSize);
|
||||
}
|
||||
|
||||
public void setUserClickListener(UserAdapterListener listener) {
|
||||
public void setUserClickListener(UserClickListener listener) {
|
||||
userClickListener = listener;
|
||||
((View) itemContent).setOnClickListener(this);
|
||||
((View) itemContent).setOnLongClickListener(this);
|
||||
|
|
|
@ -26,11 +26,13 @@ import android.view.View;
|
|||
import android.widget.ImageView;
|
||||
|
||||
import org.mariotaku.twidere.adapter.iface.ContentCardClickListener;
|
||||
import org.mariotaku.twidere.adapter.iface.IGapSupportedAdapter;
|
||||
import org.mariotaku.twidere.graphic.like.LikeAnimationDrawable;
|
||||
import org.mariotaku.twidere.model.ParcelableMedia;
|
||||
import org.mariotaku.twidere.model.ParcelableStatus;
|
||||
import org.mariotaku.twidere.model.UserKey;
|
||||
import org.mariotaku.twidere.view.CardMediaContainer;
|
||||
import org.mariotaku.twidere.view.holder.GapViewHolder;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 15/10/26.
|
||||
|
@ -56,7 +58,7 @@ public interface IStatusViewHolder extends CardMediaContainer.OnMediaClickListen
|
|||
|
||||
void playLikeAnimation(LikeAnimationDrawable.OnLikedListener listener);
|
||||
|
||||
interface StatusClickListener extends ContentCardClickListener {
|
||||
interface StatusClickListener extends ContentCardClickListener, IGapSupportedAdapter.GapClickListener {
|
||||
|
||||
void onMediaClick(IStatusViewHolder holder, View view, ParcelableMedia media, int statusPosition);
|
||||
|
||||
|
@ -68,19 +70,27 @@ public interface IStatusViewHolder extends CardMediaContainer.OnMediaClickListen
|
|||
}
|
||||
|
||||
abstract class SimpleStatusClickListener implements StatusClickListener {
|
||||
|
||||
@Override
|
||||
public void onMediaClick(IStatusViewHolder holder, View view, ParcelableMedia media, int statusPosition) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusClick(IStatusViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onStatusLongClick(IStatusViewHolder holder, int position) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGapClick(GapViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserProfileClick(IStatusViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue