More minSdk 21 cleanup

This commit is contained in:
TacoTheDank 2022-07-06 17:48:38 -04:00 committed by Stypox
parent 4ec9cbe379
commit 189c92affa
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
4 changed files with 5 additions and 26 deletions

View File

@ -114,13 +114,7 @@ class ErrorUtil {
context,
context.getString(R.string.error_report_channel_id)
)
.setSmallIcon(
// the vector drawable icon causes crashes on KitKat devices
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
R.drawable.ic_bug_report
else
android.R.drawable.stat_notify_error
)
.setSmallIcon(R.drawable.ic_bug_report)
.setContentTitle(context.getString(R.string.error_report_notification_title))
.setContentText(context.getString(errorInfo.messageStringId))
.setAutoCancel(true)

View File

@ -12,7 +12,6 @@ import android.view.View
import androidx.annotation.ColorInt
import androidx.annotation.FloatRange
import androidx.core.animation.addListener
import androidx.core.view.ViewCompat
import androidx.core.view.isGone
import androidx.core.view.isInvisible
import androidx.core.view.isVisible
@ -21,10 +20,6 @@ import org.schabi.newpipe.MainActivity
private const val TAG = "ViewUtils"
inline var View.backgroundTintListCompat: ColorStateList?
get() = ViewCompat.getBackgroundTintList(this)
set(value) = ViewCompat.setBackgroundTintList(this, value)
/**
* Animate the view.
*
@ -106,11 +101,11 @@ fun View.animateBackgroundColor(duration: Long, @ColorInt colorStart: Int, @Colo
viewPropertyAnimator.interpolator = FastOutSlowInInterpolator()
viewPropertyAnimator.duration = duration
viewPropertyAnimator.addUpdateListener { animation: ValueAnimator ->
backgroundTintListCompat = ColorStateList(empty, intArrayOf(animation.animatedValue as Int))
backgroundTintList = ColorStateList(empty, intArrayOf(animation.animatedValue as Int))
}
viewPropertyAnimator.addListener(
onCancel = { backgroundTintListCompat = ColorStateList(empty, intArrayOf(colorEnd)) },
onEnd = { backgroundTintListCompat = ColorStateList(empty, intArrayOf(colorEnd)) }
onCancel = { backgroundTintList = ColorStateList(empty, intArrayOf(colorEnd)) },
onEnd = { backgroundTintList = ColorStateList(empty, intArrayOf(colorEnd)) }
)
viewPropertyAnimator.start()
}

View File

@ -1,19 +1,9 @@
package org.schabi.newpipe.settings
import android.os.Build
import android.os.Bundle
import androidx.preference.Preference
import org.schabi.newpipe.R
class PlayerNotificationSettingsFragment : BasePreferenceFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResourceRegistry()
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
val colorizePref: Preference? = findPreference(getString(R.string.notification_colorize_key))
colorizePref?.let {
preferenceScreen.removePreference(it)
}
}
}
}

View File

@ -218,7 +218,7 @@ public class NotificationActionsPreference extends Preference {
final int color = ThemeHelper.resolveColorFromAttr(getContext(),
android.R.attr.textColorPrimary);
drawable = DrawableCompat.wrap(drawable).mutate();
DrawableCompat.setTint(drawable, color);
drawable.setTint(color);
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null,
null, drawable, null);
}