From 23c353275c16ff1d92723343c6e0197f204c7349 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Sun, 15 Oct 2023 11:14:09 -0400 Subject: Continue implementing showing post filter usages in PostFilterPreferenceActivity. --- ...PostFilterUsageEmbeddedRecyclerViewAdapter.java | 9 +++- .../InterceptTouchEventLinearLayout.java | 31 ++++++++++++++ .../res/layout/item_post_filter_usage_embedded.xml | 3 +- .../res/layout/item_post_filter_with_usage.xml | 50 +++++++++------------- 4 files changed, 61 insertions(+), 32 deletions(-) create mode 100644 app/src/main/java/ml/docilealligator/infinityforreddit/customviews/InterceptTouchEventLinearLayout.java (limited to 'app') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java index 050afbd2..c13e548a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/navigationdrawer/PostFilterUsageEmbeddedRecyclerViewAdapter.java @@ -85,7 +85,14 @@ public class PostFilterUsageEmbeddedRecyclerViewAdapter extends RecyclerView.Ada public EntryViewHolder(@NonNull ItemPostFilterUsageEmbeddedBinding binding) { super(binding.getRoot()); - this.textView = binding.getRoot(); + textView = binding.getRoot(); + + textView.setTextColor(baseActivity.customThemeWrapper.getSecondaryTextColor()); + + if (baseActivity.typeface != null) { + textView.setTypeface(baseActivity.typeface); + } + textView.setOnClickListener(view -> { Toast.makeText(baseActivity, textView.getText(), Toast.LENGTH_SHORT).show(); }); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/InterceptTouchEventLinearLayout.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/InterceptTouchEventLinearLayout.java new file mode 100644 index 00000000..ebc7ce5b --- /dev/null +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/InterceptTouchEventLinearLayout.java @@ -0,0 +1,31 @@ +package ml.docilealligator.infinityforreddit.customviews; + +import android.content.Context; +import android.util.AttributeSet; +import android.view.MotionEvent; +import android.widget.LinearLayout; + +import androidx.annotation.Nullable; + +public class InterceptTouchEventLinearLayout extends LinearLayout { + public InterceptTouchEventLinearLayout(Context context) { + super(context); + } + + public InterceptTouchEventLinearLayout(Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + } + + public InterceptTouchEventLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + @Override + public boolean onInterceptTouchEvent(MotionEvent ev) { + return true; + } + + public InterceptTouchEventLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } +} diff --git a/app/src/main/res/layout/item_post_filter_usage_embedded.xml b/app/src/main/res/layout/item_post_filter_usage_embedded.xml index bfec3dbb..e156e968 100644 --- a/app/src/main/res/layout/item_post_filter_usage_embedded.xml +++ b/app/src/main/res/layout/item_post_filter_usage_embedded.xml @@ -2,7 +2,8 @@ \ No newline at end of file diff --git a/app/src/main/res/layout/item_post_filter_with_usage.xml b/app/src/main/res/layout/item_post_filter_with_usage.xml index 8a083caa..74699ed4 100644 --- a/app/src/main/res/layout/item_post_filter_with_usage.xml +++ b/app/src/main/res/layout/item_post_filter_with_usage.xml @@ -1,38 +1,28 @@ - + android:orientation="vertical" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground"> - + android:fontFamily="?attr/font_family" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" /> - - - - - + - \ No newline at end of file + \ No newline at end of file -- cgit v1.2.3