From a4bc5a64423730088e23f870b76a47e79a2c047a Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Mon, 23 Sep 2024 23:20:43 +0200 Subject: Use theme color for subscription card background (#7423) --- .../de/danoeh/antennapod/ui/screen/AllEpisodesFragment.java | 10 +++++----- .../ui/screen/subscriptions/SubscriptionFragment.java | 8 ++++---- .../ui/screen/subscriptions/SubscriptionViewHolder.java | 6 +++--- .../ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java | 2 -- app/src/main/res/layout/subscription_grid_item.xml | 5 +++-- ui/common/src/main/res/drawable/ic_checkbox_background.xml | 4 ++-- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/AllEpisodesFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/AllEpisodesFragment.java index 6e48ade39..f555a9137 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/AllEpisodesFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/AllEpisodesFragment.java @@ -119,14 +119,14 @@ public class AllEpisodesFragment extends EpisodesListFragment { private void updateFilterUi() { swipeActions.setFilter(getFilter()); - if (listAdapter.inActionMode()) { + if (getFilter().getValues().length == 0) { + txtvInformation.setVisibility(View.GONE); + emptyView.setMessage(R.string.no_all_episodes_label); + } else if (listAdapter.inActionMode()) { txtvInformation.setVisibility(View.INVISIBLE); - } else if (getFilter().getValues().length > 0) { + } else { txtvInformation.setVisibility(View.VISIBLE); emptyView.setMessage(R.string.no_all_episodes_filtered_label); - } else { - txtvInformation.setVisibility(View.GONE); - emptyView.setMessage(R.string.no_all_episodes_label); } toolbar.getMenu().findItem(R.id.action_favorites).setIcon( getFilter().showIsFavorite ? R.drawable.ic_star : R.drawable.ic_star_border); diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java index c7bc579b1..31b1e7d26 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionFragment.java @@ -325,12 +325,12 @@ public class SubscriptionFragment extends Fragment } private void updateFilterVisibility() { - if (subscriptionAdapter.inActionMode()) { + if (!UserPreferences.getSubscriptionsFilter().isEnabled()) { + feedsFilteredMsg.setVisibility(View.GONE); + } else if (subscriptionAdapter.inActionMode()) { feedsFilteredMsg.setVisibility(View.INVISIBLE); - } else if (UserPreferences.getSubscriptionsFilter().isEnabled()) { - feedsFilteredMsg.setVisibility(View.VISIBLE); } else { - feedsFilteredMsg.setVisibility(View.GONE); + feedsFilteredMsg.setVisibility(View.VISIBLE); } } diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java index b28c50bd1..bf5239f8c 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionViewHolder.java @@ -10,13 +10,13 @@ import androidx.annotation.NonNull; import androidx.appcompat.content.res.AppCompatResources; import androidx.cardview.widget.CardView; import androidx.recyclerview.widget.RecyclerView; -import com.google.android.material.elevation.SurfaceColors; import de.danoeh.antennapod.R; import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.storage.database.NavDrawerData; import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.ui.CoverLoader; +import de.danoeh.antennapod.ui.common.ThemeUtils; import java.lang.ref.WeakReference; import java.text.NumberFormat; @@ -84,8 +84,8 @@ public class SubscriptionViewHolder extends RecyclerView.ViewHolder { coverLoader.load(); if (card != null) { - float density = mainActivityRef.get().getResources().getDisplayMetrics().density; - card.setCardBackgroundColor(SurfaceColors.getColorForElevation(mainActivityRef.get(), 1 * density)); + card.setCardBackgroundColor(ThemeUtils.getColorFromAttr( + mainActivityRef.get(), R.attr.colorSurfaceContainer)); } int textPadding = columnCount <= 3 ? 16 : 8; diff --git a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java index 2ca09ff4f..1a243a250 100644 --- a/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/ui/screen/subscriptions/SubscriptionsRecyclerAdapter.java @@ -85,7 +85,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter setSelected(holder.getBindingAdapterPosition(), isChecked)); @@ -102,7 +101,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter + app:cardElevation="1dp"> + android:layout_margin="4dp" /> diff --git a/ui/common/src/main/res/drawable/ic_checkbox_background.xml b/ui/common/src/main/res/drawable/ic_checkbox_background.xml index 470ac4a5c..9ec3a4239 100644 --- a/ui/common/src/main/res/drawable/ic_checkbox_background.xml +++ b/ui/common/src/main/res/drawable/ic_checkbox_background.xml @@ -1,6 +1,6 @@