Merge pull request #5802 from TacoTheDank/deprecations

Fix some deprecations
This commit is contained in:
ByteHamster 2022-05-15 18:09:07 +02:00 committed by GitHub
commit 993998c1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 6 deletions

View File

@ -2,6 +2,7 @@ package de.danoeh.antennapod.activity;
import android.content.Intent; import android.content.Intent;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -33,7 +34,8 @@ public class SplashActivity extends AppCompatActivity {
DrawableCompat.setTint(wrapDrawable, 0xffffffff); DrawableCompat.setTint(wrapDrawable, 0xffffffff);
progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable)); progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable));
} else { } else {
progressBar.getIndeterminateDrawable().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN); progressBar.getIndeterminateDrawable().setColorFilter(
new PorterDuffColorFilter(0xffffffff, PorterDuff.Mode.SRC_IN));
} }
Completable.create(subscriber -> { Completable.create(subscriber -> {

View File

@ -1,8 +1,10 @@
package de.danoeh.antennapod.adapter; package de.danoeh.antennapod.adapter;
import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.ColorUtils; import androidx.core.graphics.ColorUtils;
import androidx.palette.graphics.Palette; import androidx.palette.graphics.Palette;
@ -146,7 +148,8 @@ public class CoverLoader {
boolean showTitle = UserPreferences.shouldShowSubscriptionTitle(); boolean showTitle = UserPreferences.shouldShowSubscriptionTitle();
if (placeholder != null) { if (placeholder != null) {
if (textAndImageCombined || showTitle) { 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) { if (palette == null || !showTitle) {
placeholder.setBackgroundColor(bgColor); placeholder.setBackgroundColor(bgColor);
placeholder.setTextColor(ThemeUtils.getColorFromAttr(placeholder.getContext(), placeholder.setTextColor(ThemeUtils.getColorFromAttr(placeholder.getContext(),
@ -154,9 +157,9 @@ public class CoverLoader {
return; return;
} }
int dominantColor = palette.getDominantColor(bgColor); 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) { 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.setTextColor(textColor);
placeholder.setBackgroundColor(dominantColor); placeholder.setBackgroundColor(dominantColor);

View File

@ -22,6 +22,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -79,7 +80,8 @@ public class SubscriptionsRecyclerAdapter extends SelectableAdapter<Subscription
if (viewType == COVER_WITH_TITLE) { if (viewType == COVER_WITH_TITLE) {
topAndBottomItemId = 0; topAndBottomItemId = 0;
belowItemId = R.id.imgvCover; 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); int padding = (int) convertDpToPixel(feedTitle.getContext(), 6);
feedTitle.setPadding(padding, padding, padding, padding); feedTitle.setPadding(padding, padding, padding, padding);
} }

View File

@ -67,7 +67,6 @@ public class ShownotesWebView extends WebView implements View.OnLongClickListene
getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
} }
getSettings().setUseWideViewPort(false); getSettings().setUseWideViewPort(false);
getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
getSettings().setLoadWithOverviewMode(true); getSettings().setLoadWithOverviewMode(true);
setOnLongClickListener(this); setOnLongClickListener(this);