diff options
Diffstat (limited to 'app/src/main')
6 files changed, 86 insertions, 58 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); } } } diff --git a/app/src/main/res/layout/item_post_gallery.xml b/app/src/main/res/layout/item_post_gallery.xml index 82e4ec60..dd1c7c1d 100644 --- a/app/src/main/res/layout/item_post_gallery.xml +++ b/app/src/main/res/layout/item_post_gallery.xml @@ -1,67 +1,80 @@ <?xml version="1.0" encoding="utf-8"?> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" +<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - xmlns:app="http://schemas.android.com/apk/res-auto"> + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + app:cardElevation="2dp" + app:cardCornerRadius="8dp"> - <ProgressBar - android:id="@+id/progress_bar_item_post_gallery" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:visibility="gone" /> + <FrameLayout + android:layout_width="match_parent" + android:layout_height="wrap_content"> - <ImageView - android:id="@+id/video_or_gif_indicator_image_view_item_post_gallery" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_margin="16dp" - android:layout_gravity="start" - android:background="@drawable/play_button_round_background" - android:src="@drawable/ic_play_circle_36dp" - android:visibility="gone" /> + <ProgressBar + android:id="@+id/progress_bar_item_post_gallery" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="center" + android:visibility="gone" /> - <RelativeLayout - android:id="@+id/load_image_error_relative_layout_item_post_gallery" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_gravity="center" - android:visibility="gone"> + <ImageView + android:id="@+id/video_or_gif_indicator_image_view_item_post_gallery" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="16dp" + android:layout_gravity="start" + android:background="@drawable/play_button_round_background" + android:src="@drawable/ic_play_circle_36dp" + android:visibility="gone" /> - <TextView - android:id="@+id/load_image_error_text_view_item_gallery" + <RelativeLayout + android:id="@+id/load_image_error_relative_layout_item_post_gallery" android:layout_width="match_parent" - android:layout_height="wrap_content" - app:drawableTopCompat="@drawable/ic_error_outline_black_24dp" + android:layout_height="match_parent" android:layout_gravity="center" - android:gravity="center" - android:text="@string/error_loading_image_tap_to_retry" - android:textSize="?attr/font_default" - android:fontFamily="?attr/font_family" /> + android:visibility="gone"> - </RelativeLayout> + <TextView + android:id="@+id/load_image_error_text_view_item_gallery" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:drawableTopCompat="@drawable/ic_error_outline_black_24dp" + android:layout_gravity="center" + android:gravity="center" + android:text="@string/error_loading_image_tap_to_retry" + android:textSize="?attr/font_default" + android:fontFamily="?attr/font_family" /> - <ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView - android:id="@+id/image_view_item_post_gallery" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:visibility="gone" /> + </RelativeLayout> - <ImageView - android:id="@+id/image_view_no_preview_item_post_gallery" - android:layout_width="match_parent" - android:layout_height="150dp" - android:scaleType="center" - android:visibility="gone" /> + <ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView + android:id="@+id/image_view_item_post_gallery" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" /> - <TextView - android:id="@+id/title_text_view_item_post_gallery" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingEnd="16dp" - android:textSize="?attr/title_font_18" - android:fontFamily="?attr/title_font_family" - android:visibility="gone" /> + <ImageView + android:id="@+id/image_view_no_preview_item_post_gallery" + android:layout_width="match_parent" + android:layout_height="150dp" + android:scaleType="center" + android:background="@drawable/thumbnail_compact_layout_rounded_edge" + android:visibility="gone" /> + + <TextView + android:id="@+id/title_text_view_item_post_gallery" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="16dp" + android:paddingEnd="16dp" + android:textSize="?attr/title_font_18" + android:fontFamily="?attr/title_font_family" + android:visibility="gone" /> + + </FrameLayout> -</FrameLayout>
\ No newline at end of file +</com.google.android.material.card.MaterialCardView>
\ No newline at end of file diff --git a/app/src/main/res/layout/item_post_text.xml b/app/src/main/res/layout/item_post_text.xml index 1d1dbce0..9bffa573 100644 --- a/app/src/main/res/layout/item_post_text.xml +++ b/app/src/main/res/layout/item_post_text.xml @@ -7,7 +7,6 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:id="@+id/card_view_item_post_text_type" - app:cardBackgroundColor="?attr/cardViewBackgroundColor" app:cardElevation="2dp" app:cardCornerRadius="16dp"> diff --git a/app/src/main/res/layout/item_post_video_type_autoplay.xml b/app/src/main/res/layout/item_post_video_type_autoplay.xml index b4fcb314..9573d808 100644 --- a/app/src/main/res/layout/item_post_video_type_autoplay.xml +++ b/app/src/main/res/layout/item_post_video_type_autoplay.xml @@ -7,7 +7,6 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:id="@+id/card_view_item_post_video_type_autoplay" - app:cardBackgroundColor="?attr/cardViewBackgroundColor" app:cardElevation="2dp" app:cardCornerRadius="16dp"> diff --git a/app/src/main/res/layout/item_post_with_preview.xml b/app/src/main/res/layout/item_post_with_preview.xml index 0e7b65b3..5cec4cfa 100644 --- a/app/src/main/res/layout/item_post_with_preview.xml +++ b/app/src/main/res/layout/item_post_with_preview.xml @@ -7,7 +7,6 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp" android:id="@+id/card_view_item_post_with_preview" - app:cardBackgroundColor="?attr/cardViewBackgroundColor" app:cardElevation="2dp" app:cardCornerRadius="16dp"> |