[Cleanup] Removed redundant API 21(Lollipop) or lower version checks as the minimum SDK version is 21

This commit is contained in:
Prathamesh More 2021-11-28 12:17:20 +05:30
parent aefd52c12e
commit de14e72689
11 changed files with 36 additions and 68 deletions

View file

@ -91,21 +91,19 @@ object ATH {
fun setTaskDescriptionColor(activity: Activity, @ColorInt color: Int) {
var colorFinal = color
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// Task description requires fully opaque color
colorFinal = ColorUtil.stripAlpha(colorFinal)
// Sets color of entry in the system recents page
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activity.setTaskDescription(
ActivityManager.TaskDescription(
activity.title as String?,
-1,
colorFinal
)
// Task description requires fully opaque color
colorFinal = ColorUtil.stripAlpha(colorFinal)
// Sets color of entry in the system recents page
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
activity.setTaskDescription(
ActivityManager.TaskDescription(
activity.title as String?,
-1,
colorFinal
)
} else {
activity.setTaskDescription(ActivityManager.TaskDescription(activity.title as String?))
}
)
} else {
activity.setTaskDescription(ActivityManager.TaskDescription(activity.title as String?))
}
}

View file

@ -7,14 +7,6 @@ import android.os.Build
*/
object VersionUtils {
/**
* @return true if device is running API >= 21
*/
fun hasLollipop(): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
}
/**
* @return true if device is running API >= 23
*/