1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-11-05 01:26:23 +00:00

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,
context.getString(R.string.error_report_channel_id) context.getString(R.string.error_report_channel_id)
) )
.setSmallIcon( .setSmallIcon(R.drawable.ic_bug_report)
// 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
)
.setContentTitle(context.getString(R.string.error_report_notification_title)) .setContentTitle(context.getString(R.string.error_report_notification_title))
.setContentText(context.getString(errorInfo.messageStringId)) .setContentText(context.getString(errorInfo.messageStringId))
.setAutoCancel(true) .setAutoCancel(true)

View File

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

View File

@ -1,19 +1,9 @@
package org.schabi.newpipe.settings package org.schabi.newpipe.settings
import android.os.Build
import android.os.Bundle import android.os.Bundle
import androidx.preference.Preference
import org.schabi.newpipe.R
class PlayerNotificationSettingsFragment : BasePreferenceFragment() { class PlayerNotificationSettingsFragment : BasePreferenceFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResourceRegistry() 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(), final int color = ThemeHelper.resolveColorFromAttr(getContext(),
android.R.attr.textColorPrimary); android.R.attr.textColorPrimary);
drawable = DrawableCompat.wrap(drawable).mutate(); drawable = DrawableCompat.wrap(drawable).mutate();
DrawableCompat.setTint(drawable, color); drawable.setTint(color);
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null, radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null,
null, drawable, null); null, drawable, null);
} }