aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java15
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java4
2 files changed, 16 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index a815302f..d9b3da20 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -1306,6 +1306,15 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
((PostBaseViewHolder) viewHolder).downvoteButton.performClick();
}
}
+ } else if (viewHolder instanceof PostCompactBaseViewHolder) {
+ Post post = getItem(viewHolder.getAdapterPosition());
+ if (post != null) {
+ if (direction == ItemTouchHelper.LEFT || direction == ItemTouchHelper.START) {
+ ((PostCompactBaseViewHolder) viewHolder).upvoteButton.performClick();
+ } else {
+ ((PostCompactBaseViewHolder) viewHolder).downvoteButton.performClick();
+ }
+ }
}
}
@@ -1317,7 +1326,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
void currentlyBindItem(int position);
}
- class PostBaseViewHolder extends RecyclerView.ViewHolder {
+ public class PostBaseViewHolder extends RecyclerView.ViewHolder {
MaterialCardView cardView;
AspectRatioGifImageView iconGifImageView;
TextView subredditTextView;
@@ -2658,7 +2667,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
}
}
- class PostCompactBaseViewHolder extends RecyclerView.ViewHolder {
+ public class PostCompactBaseViewHolder extends RecyclerView.ViewHolder {
AspectRatioGifImageView iconGifImageView;
TextView nameTextView;
ImageView stickiedPostImageView;
@@ -2760,7 +2769,7 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
constraintSet.applyTo(bottomConstraintLayout);
}
- itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor));
+ itemView.setBackgroundColor(mCardViewBackgroundColor);
postTimeTextView.setTextColor(mSecondaryTextColor);
titleTextView.setTextColor(mPostTitleColor);
stickiedPostImageView.setColorFilter(mStickiedPostIconTint, PorterDuff.Mode.SRC_IN);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
index e04e1dde..37264783 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java
@@ -645,6 +645,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
@Override
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
+ if (!(viewHolder instanceof PostRecyclerViewAdapter.PostBaseViewHolder) &&
+ !(viewHolder instanceof PostRecyclerViewAdapter.PostCompactBaseViewHolder)) {
+ return makeMovementFlags(0, 0);
+ }
int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
return makeMovementFlags(0, swipeFlags);
}