diff options
author | TacoTheDank <SkytkRSfan3895@gmail.com> | 2022-05-14 16:51:47 -0400 |
---|---|---|
committer | TacoTheDank <SkytkRSfan3895@gmail.com> | 2022-05-14 16:51:47 -0400 |
commit | 31ed16cd9c9dc86b78d903771ca4a6e4aa94f81d (patch) | |
tree | 5acc17b450bf80ec3d04092d6f8b15025a889d96 /app/src/main/java/de/danoeh/antennapod/adapter | |
parent | 6e5004be22f20e3a51697909bf4d1e423252b83c (diff) | |
download | AntennaPod-31ed16cd9c9dc86b78d903771ca4a6e4aa94f81d.zip |
Fix some deprecations
Diffstat (limited to 'app/src/main/java/de/danoeh/antennapod/adapter')
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java | 9 | ||||
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java b/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java index 34726e248..d30141b7a 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/CoverLoader.java @@ -1,8 +1,10 @@ package de.danoeh.antennapod.adapter; +import android.content.Context; import android.graphics.drawable.Drawable; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; import androidx.core.graphics.ColorUtils; import androidx.palette.graphics.Palette; @@ -146,7 +148,8 @@ public class CoverLoader { boolean showTitle = UserPreferences.shouldShowSubscriptionTitle(); if (placeholder != null) { if (textAndImageCombined || showTitle) { - int bgColor = placeholder.getContext().getResources().getColor(R.color.feed_text_bg); + final Context context = placeholder.getContext(); + int bgColor = ContextCompat.getColor(context, R.color.feed_text_bg); if (palette == null || !showTitle) { placeholder.setBackgroundColor(bgColor); placeholder.setTextColor(ThemeUtils.getColorFromAttr(placeholder.getContext(), @@ -154,9 +157,9 @@ public class CoverLoader { return; } int dominantColor = palette.getDominantColor(bgColor); - int textColor = placeholder.getContext().getResources().getColor(R.color.white); + int textColor = ContextCompat.getColor(context, R.color.white); if (ColorUtils.calculateLuminance(dominantColor) > 0.5) { - textColor = placeholder.getContext().getResources().getColor(R.color.black); + textColor = ContextCompat.getColor(context, R.color.black); } placeholder.setTextColor(textColor); placeholder.setBackgroundColor(dominantColor); diff --git a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java index 7c3166043..a7986e144 100644 --- a/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java +++ b/app/src/main/java/de/danoeh/antennapod/adapter/SubscriptionsRecyclerAdapter.java @@ -22,6 +22,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.appcompat.content.res.AppCompatResources; +import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.RecyclerView; @@ -79,7 +80,8 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription if (viewType == COVER_WITH_TITLE) { topAndBottomItemId = 0; belowItemId = R.id.imgvCover; - feedTitle.setBackgroundColor(feedTitle.getContext().getResources().getColor(R.color.feed_text_bg)); + feedTitle.setBackgroundColor( + ContextCompat.getColor(feedTitle.getContext(), R.color.feed_text_bg)); int padding = (int) convertDpToPixel(feedTitle.getContext(), 6); feedTitle.setPadding(padding, padding, padding, padding); } |