diff options
3 files changed, 42 insertions, 22 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java index d2c3eabf..56559ed1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostFilterRecyclerViewAdapter.java @@ -13,6 +13,7 @@ import java.util.List; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; +import ml.docilealligator.infinityforreddit.databinding.ItemPostFilterBinding; import ml.docilealligator.infinityforreddit.postfilter.PostFilter; import ml.docilealligator.infinityforreddit.utils.Utils; @@ -51,14 +52,14 @@ public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<Recycler if (viewType == VIEW_TYPE_HEADER) { return new HeaderViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_filter_fragment_header, parent, false)); } else { - return new PostFilterViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_post_filter, parent, false)); + return new PostFilterViewHolder(ItemPostFilterBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false)); } } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) { if (holder instanceof PostFilterViewHolder) { - ((PostFilterViewHolder) holder).textView.setText(postFilterList.get(position - 1).name); + ((PostFilterViewHolder) holder).binding.postFilterNameTextViewItemPostFilter.setText(postFilterList.get(position - 1).name); } } @@ -73,16 +74,15 @@ public class PostFilterRecyclerViewAdapter extends RecyclerView.Adapter<Recycler } private class PostFilterViewHolder extends RecyclerView.ViewHolder { - TextView textView; + ItemPostFilterBinding binding; - public PostFilterViewHolder(@NonNull View itemView) { - super(itemView); - textView = (TextView) itemView; - - textView.setTextColor(customThemeWrapper.getPrimaryTextColor()); + public PostFilterViewHolder(@NonNull ItemPostFilterBinding binding) { + super(binding.getRoot()); + this.binding = binding; + binding.postFilterNameTextViewItemPostFilter.setTextColor(customThemeWrapper.getPrimaryTextColor()); if (activity.typeface != null) { - textView.setTypeface(activity.typeface); + binding.postFilterNameTextViewItemPostFilter.setTypeface(activity.typeface); } itemView.setOnClickListener(view -> { diff --git a/app/src/main/res/layout/item_post_card_3_text.xml b/app/src/main/res/layout/item_post_card_3_text.xml index 1145188d..dbf9ac7e 100644 --- a/app/src/main/res/layout/item_post_card_3_text.xml +++ b/app/src/main/res/layout/item_post_card_3_text.xml @@ -9,7 +9,6 @@ android:layout_marginStart="16dp" android:layout_marginEnd="16dp" app:cardCornerRadius="12dp" - app:cardBackgroundColor="#FBEEFC" style="?attr/materialCardViewFilledStyle"> <LinearLayout diff --git a/app/src/main/res/layout/item_post_filter.xml b/app/src/main/res/layout/item_post_filter.xml index 62a5e886..8487e105 100644 --- a/app/src/main/res/layout/item_post_filter.xml +++ b/app/src/main/res/layout/item_post_filter.xml @@ -1,14 +1,35 @@ <?xml version="1.0" encoding="utf-8"?> -<TextView - xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" +<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" - android:paddingTop="16dp" - android:paddingBottom="16dp" - android:paddingStart="72dp" - android:paddingEnd="16dp" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_16" - android:fontFamily="?attr/font_family" - android:clickable="true" - android:focusable="true" - android:background="?attr/selectableItemBackground" />
\ No newline at end of file + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:layout_marginStart="16dp" + android:layout_marginEnd="16dp" + app:cardBackgroundColor="#FBEEFC" + style="?attr/materialCardViewFilledStyle"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical"> + + <TextView + android:id="@+id/post_filter_name_text_view_item_post_filter" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingTop="16dp" + android:paddingBottom="16dp" + android:paddingStart="72dp" + android:paddingEnd="16dp" + android:textColor="?attr/primaryTextColor" + android:textSize="?attr/font_16" + android:fontFamily="?attr/font_family" + android:clickable="true" + android:focusable="true" + android:background="?attr/selectableItemBackground" /> + + </LinearLayout> + +</com.google.android.material.card.MaterialCardView>
\ No newline at end of file |