aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-02-16 03:41:38 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-02-16 03:41:38 +0000
commit538827f11e2dd20dd8076544f8fbb3b85eb83df8 (patch)
treecd4ffb501c16ddbb6dc34d91c16d32aa06d8a885 /app/src/main/java
parent83ffdb5511a30a3fb4ce0e8467b889187819f24b (diff)
downloadinfinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.tar
infinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.tar.gz
infinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.tar.bz2
infinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.tar.lz
infinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.tar.xz
infinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.tar.zst
infinity-for-reddit-538827f11e2dd20dd8076544f8fbb3b85eb83df8.zip
Continue adding Gallery Layout.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java18
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java4
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);
}
}
}