diff options
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java | 18 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java | 4 |
2 files changed, 20 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index ca3ebb2b..47db2b6d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -3424,11 +3424,29 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView super(itemView); ButterKnife.bind(this, itemView); + itemView.setBackgroundTintList(ColorStateList.valueOf(mCardViewBackgroundColor)); titleTextView.setTextColor(mPostTitleColor); progressBar.setIndeterminateTintList(ColorStateList.valueOf(mColorAccent)); noPreviewImageView.setBackgroundColor(mNoPreviewPostTypeBackgroundColor); noPreviewImageView.setColorFilter(mNoPreviewPostTypeIconTint, android.graphics.PorterDuff.Mode.SRC_IN); errorTextView.setTextColor(mPrimaryTextColor); + + itemView.setOnClickListener(view -> { + int position = getBindingAdapterPosition(); + if (position >= 0 && canStartActivity) { + Post post = getItem(position); + if (post != null) { + //markPostRead(post, true); + canStartActivity = false; + + Intent intent = new Intent(mActivity, ViewPostDetailActivity.class); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_DATA, post); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_LIST_POSITION, getBindingAdapterPosition()); + intent.putExtra(ViewPostDetailActivity.EXTRA_POST_FRAGMENT_ID, mFragment.getPostFragmentId()); + mActivity.startActivity(intent); + } + } + }); } } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java index 140a36a8..c2be273a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java @@ -1711,9 +1711,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator { int halfOffset = mItemOffset / 2; if (spanIndex == 0) { - outRect.set(0, 0, halfOffset, 0); + outRect.set(halfOffset, 0, halfOffset, 0); } else { - outRect.set(halfOffset, 0, 0, 0); + outRect.set(halfOffset, 0, halfOffset, 0); } } } |