diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java index 8e16174055d..ed63c6fd7b5 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/playlist/PlaylistFragment.java @@ -4,7 +4,6 @@ import static org.schabi.newpipe.ktx.ViewUtils.animateHideRecyclerViewAllowingScrolling; import android.content.Context; -import android.content.res.ColorStateList; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; @@ -18,7 +17,6 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.content.res.AppCompatResources; -import androidx.core.content.ContextCompat; import com.google.android.material.shape.CornerFamily; import com.google.android.material.shape.ShapeAppearanceModel; @@ -42,6 +40,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem; import org.schabi.newpipe.fragments.list.BaseListInfoFragment; import org.schabi.newpipe.info_list.dialog.InfoItemDialog; +import org.schabi.newpipe.info_list.dialog.StreamDialogDefaultEntry; import org.schabi.newpipe.local.dialog.PlaylistDialog; import org.schabi.newpipe.local.playlist.RemotePlaylistManager; import org.schabi.newpipe.player.MainPlayer.PlayerType; @@ -51,7 +50,6 @@ import org.schabi.newpipe.util.Localization; import org.schabi.newpipe.util.NavigationHelper; import org.schabi.newpipe.util.PicassoHelper; -import org.schabi.newpipe.info_list.dialog.StreamDialogDefaultEntry; import org.schabi.newpipe.util.external_communication.ShareUtils; import java.util.ArrayList; @@ -307,10 +305,8 @@ public void handleResult(@NonNull final PlaylistInfo result) { .setAllCorners(CornerFamily.ROUNDED, 0f) .build(); // this turns the image back into a square headerBinding.uploaderAvatarView.setShapeAppearanceModel(model); - headerBinding.uploaderAvatarView.setStrokeColor( - ColorStateList.valueOf(ContextCompat.getColor( - requireContext(), R.color.transparent_background_color)) - ); + headerBinding.uploaderAvatarView.setStrokeColor(AppCompatResources + .getColorStateList(requireContext(), R.color.transparent_background_color)); headerBinding.uploaderAvatarView.setImageDrawable( AppCompatResources.getDrawable(requireContext(), R.drawable.ic_radio) diff --git a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt index 851e84f9f52..e9632896195 100644 --- a/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt +++ b/app/src/main/java/org/schabi/newpipe/local/subscription/dialog/FeedGroupDialog.kt @@ -1,7 +1,6 @@ package org.schabi.newpipe.local.subscription.dialog import android.app.Dialog -import android.content.res.ColorStateList import android.os.Bundle import android.os.Parcelable import android.view.LayoutInflater @@ -9,7 +8,7 @@ import android.view.View import android.view.ViewGroup import android.view.inputmethod.InputMethodManager import android.widget.Toast -import androidx.core.content.ContextCompat +import androidx.appcompat.content.res.AppCompatResources import androidx.core.content.getSystemService import androidx.core.os.bundleOf import androidx.core.view.isGone @@ -127,7 +126,7 @@ class FeedGroupDialog : DialogFragment(), BackPressable { if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) { // KitKat doesn't apply container's theme to content - val contrastColor = ColorStateList.valueOf(ContextCompat.getColor(requireContext(), R.color.contrastColor)) + val contrastColor = AppCompatResources.getColorStateList(requireContext(), R.color.contrastColor) searchLayoutBinding.toolbarSearchEditText.setTextColor(contrastColor) searchLayoutBinding.toolbarSearchEditText.setHintTextColor(contrastColor.withAlpha(128)) ImageViewCompat.setImageTintList(searchLayoutBinding.toolbarSearchClearIcon, contrastColor) diff --git a/app/src/main/java/org/schabi/newpipe/util/ThemeHelper.java b/app/src/main/java/org/schabi/newpipe/util/ThemeHelper.java index 7d06e57b699..b8e3a86ed38 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ThemeHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ThemeHelper.java @@ -33,6 +33,7 @@ import androidx.appcompat.app.ActionBar; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatDelegate; +import androidx.appcompat.content.res.AppCompatResources; import androidx.core.content.ContextCompat; import androidx.preference.PreferenceManager; @@ -236,13 +237,11 @@ public static int resolveColorFromAttr(final Context context, @AttrRes final int * @param attrResId Resource id * @return the {@link Drawable} */ - public static Drawable resolveDrawable( - @NonNull final Context context, - @AttrRes final int attrResId - ) { + public static Drawable resolveDrawable(@NonNull final Context context, + @AttrRes final int attrResId) { final TypedValue typedValue = new TypedValue(); context.getTheme().resolveAttribute(attrResId, typedValue, true); - return ContextCompat.getDrawable(context, typedValue.resourceId); + return AppCompatResources.getDrawable(context, typedValue.resourceId); } private static String getSelectedThemeKey(final Context context) {