Use theme color for subscription card background (#7423)

This commit is contained in:
ByteHamster 2024-09-23 23:20:43 +02:00 committed by GitHub
parent 0398912801
commit a4bc5a6442
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 19 additions and 20 deletions

View File

@ -119,14 +119,14 @@ public class AllEpisodesFragment extends EpisodesListFragment {
private void updateFilterUi() { private void updateFilterUi() {
swipeActions.setFilter(getFilter()); swipeActions.setFilter(getFilter());
if (listAdapter.inActionMode()) { if (getFilter().getValues().length == 0) {
txtvInformation.setVisibility(View.INVISIBLE);
} else if (getFilter().getValues().length > 0) {
txtvInformation.setVisibility(View.VISIBLE);
emptyView.setMessage(R.string.no_all_episodes_filtered_label);
} else {
txtvInformation.setVisibility(View.GONE); txtvInformation.setVisibility(View.GONE);
emptyView.setMessage(R.string.no_all_episodes_label); emptyView.setMessage(R.string.no_all_episodes_label);
} else if (listAdapter.inActionMode()) {
txtvInformation.setVisibility(View.INVISIBLE);
} else {
txtvInformation.setVisibility(View.VISIBLE);
emptyView.setMessage(R.string.no_all_episodes_filtered_label);
} }
toolbar.getMenu().findItem(R.id.action_favorites).setIcon( toolbar.getMenu().findItem(R.id.action_favorites).setIcon(
getFilter().showIsFavorite ? R.drawable.ic_star : R.drawable.ic_star_border); getFilter().showIsFavorite ? R.drawable.ic_star : R.drawable.ic_star_border);

View File

@ -325,12 +325,12 @@ public class SubscriptionFragment extends Fragment
} }
private void updateFilterVisibility() { private void updateFilterVisibility() {
if (subscriptionAdapter.inActionMode()) { if (!UserPreferences.getSubscriptionsFilter().isEnabled()) {
feedsFilteredMsg.setVisibility(View.INVISIBLE);
} else if (UserPreferences.getSubscriptionsFilter().isEnabled()) {
feedsFilteredMsg.setVisibility(View.VISIBLE);
} else {
feedsFilteredMsg.setVisibility(View.GONE); feedsFilteredMsg.setVisibility(View.GONE);
} else if (subscriptionAdapter.inActionMode()) {
feedsFilteredMsg.setVisibility(View.INVISIBLE);
} else {
feedsFilteredMsg.setVisibility(View.VISIBLE);
} }
} }

View File

@ -10,13 +10,13 @@ import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.cardview.widget.CardView; import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.elevation.SurfaceColors;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.storage.database.NavDrawerData; import de.danoeh.antennapod.storage.database.NavDrawerData;
import de.danoeh.antennapod.storage.preferences.UserPreferences; import de.danoeh.antennapod.storage.preferences.UserPreferences;
import de.danoeh.antennapod.ui.CoverLoader; import de.danoeh.antennapod.ui.CoverLoader;
import de.danoeh.antennapod.ui.common.ThemeUtils;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.text.NumberFormat; import java.text.NumberFormat;
@ -84,8 +84,8 @@ public class SubscriptionViewHolder extends RecyclerView.ViewHolder {
coverLoader.load(); coverLoader.load();
if (card != null) { if (card != null) {
float density = mainActivityRef.get().getResources().getDisplayMetrics().density; card.setCardBackgroundColor(ThemeUtils.getColorFromAttr(
card.setCardBackgroundColor(SurfaceColors.getColorForElevation(mainActivityRef.get(), 1 * density)); mainActivityRef.get(), R.attr.colorSurfaceContainer));
} }
int textPadding = columnCount <= 3 ? 16 : 8; int textPadding = columnCount <= 3 ? 16 : 8;

View File

@ -85,7 +85,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
holder.selectCheckbox.setVisibility(View.VISIBLE); holder.selectCheckbox.setVisibility(View.VISIBLE);
} }
holder.selectView.setVisibility(isFeed ? View.VISIBLE : View.GONE); holder.selectView.setVisibility(isFeed ? View.VISIBLE : View.GONE);
holder.coverImage.setAlpha(0.6f);
holder.selectCheckbox.setChecked((isSelected(position))); holder.selectCheckbox.setChecked((isSelected(position)));
holder.selectCheckbox.setOnCheckedChangeListener((buttonView, isChecked) holder.selectCheckbox.setOnCheckedChangeListener((buttonView, isChecked)
-> setSelected(holder.getBindingAdapterPosition(), isChecked)); -> setSelected(holder.getBindingAdapterPosition(), isChecked));
@ -102,7 +101,6 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
if (holder.selectView != null) { if (holder.selectView != null) {
holder.selectCheckbox.setVisibility(View.GONE); holder.selectCheckbox.setVisibility(View.GONE);
holder.selectView.setVisibility(View.GONE); holder.selectView.setVisibility(View.GONE);
holder.coverImage.setAlpha(1.0f);
} }
} }

View File

@ -7,6 +7,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp" android:padding="4dp"
android:clipToPadding="false"
tools:layout_width="150dp"> tools:layout_width="150dp">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
@ -16,7 +17,7 @@
android:clickable="false" android:clickable="false"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground"
app:cardCornerRadius="12dp" app:cardCornerRadius="12dp"
app:cardElevation="0dp"> app:cardElevation="1dp">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -112,7 +113,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minWidth="0dp" android:minWidth="0dp"
android:minHeight="0dp" android:minHeight="0dp"
android:layout_margin="8dp" /> android:layout_margin="4dp" />
</FrameLayout> </FrameLayout>

View File

@ -1,6 +1,6 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="56dp" android:width="48dp"
android:height="56dp" android:height="48dp"
android:viewportWidth="15.1" android:viewportWidth="15.1"
android:viewportHeight="15.1"> android:viewportHeight="15.1">
<path <path