Skip to content

Commit fc28e96

Browse files
committed
More minSdk 21 cleanup
1 parent 722db75 commit fc28e96

File tree

4 files changed

+5
-26
lines changed

4 files changed

+5
-26
lines changed

app/src/main/java/org/schabi/newpipe/error/ErrorUtil.kt

+1-7
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,7 @@ class ErrorUtil {
114114
context,
115115
context.getString(R.string.error_report_channel_id)
116116
)
117-
.setSmallIcon(
118-
// the vector drawable icon causes crashes on KitKat devices
119-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
120-
R.drawable.ic_bug_report
121-
else
122-
android.R.drawable.stat_notify_error
123-
)
117+
.setSmallIcon(R.drawable.ic_bug_report)
124118
.setContentTitle(context.getString(R.string.error_report_notification_title))
125119
.setContentText(context.getString(errorInfo.messageStringId))
126120
.setAutoCancel(true)

app/src/main/java/org/schabi/newpipe/ktx/View.kt

+3-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import android.view.View
1212
import androidx.annotation.ColorInt
1313
import androidx.annotation.FloatRange
1414
import androidx.core.animation.addListener
15-
import androidx.core.view.ViewCompat
1615
import androidx.core.view.isGone
1716
import androidx.core.view.isInvisible
1817
import androidx.core.view.isVisible
@@ -21,10 +20,6 @@ import org.schabi.newpipe.MainActivity
2120

2221
private const val TAG = "ViewUtils"
2322

24-
inline var View.backgroundTintListCompat: ColorStateList?
25-
get() = ViewCompat.getBackgroundTintList(this)
26-
set(value) = ViewCompat.setBackgroundTintList(this, value)
27-
2823
/**
2924
* Animate the view.
3025
*
@@ -106,11 +101,11 @@ fun View.animateBackgroundColor(duration: Long, @ColorInt colorStart: Int, @Colo
106101
viewPropertyAnimator.interpolator = FastOutSlowInInterpolator()
107102
viewPropertyAnimator.duration = duration
108103
viewPropertyAnimator.addUpdateListener { animation: ValueAnimator ->
109-
backgroundTintListCompat = ColorStateList(empty, intArrayOf(animation.animatedValue as Int))
104+
backgroundTintList = ColorStateList(empty, intArrayOf(animation.animatedValue as Int))
110105
}
111106
viewPropertyAnimator.addListener(
112-
onCancel = { backgroundTintListCompat = ColorStateList(empty, intArrayOf(colorEnd)) },
113-
onEnd = { backgroundTintListCompat = ColorStateList(empty, intArrayOf(colorEnd)) }
107+
onCancel = { backgroundTintList = ColorStateList(empty, intArrayOf(colorEnd)) },
108+
onEnd = { backgroundTintList = ColorStateList(empty, intArrayOf(colorEnd)) }
114109
)
115110
viewPropertyAnimator.start()
116111
}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
package org.schabi.newpipe.settings
22

3-
import android.os.Build
43
import android.os.Bundle
5-
import androidx.preference.Preference
6-
import org.schabi.newpipe.R
74

85
class PlayerNotificationSettingsFragment : BasePreferenceFragment() {
96
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
107
addPreferencesFromResourceRegistry()
11-
12-
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
13-
val colorizePref: Preference? = findPreference(getString(R.string.notification_colorize_key))
14-
colorizePref?.let {
15-
preferenceScreen.removePreference(it)
16-
}
17-
}
188
}
199
}

app/src/main/java/org/schabi/newpipe/settings/custom/NotificationActionsPreference.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ void openActionChooserDialog() {
218218
final int color = ThemeHelper.resolveColorFromAttr(getContext(),
219219
android.R.attr.textColorPrimary);
220220
drawable = DrawableCompat.wrap(drawable).mutate();
221-
DrawableCompat.setTint(drawable, color);
221+
drawable.setTint(color);
222222
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(null,
223223
null, drawable, null);
224224
}

0 commit comments

Comments
 (0)