Revert "Drop support for Android 5.x"

This reverts commit 443024cebb. Guess I'll do this a bit later so scb can get another major update first.

April Fools or whatever.
This commit is contained in:
arkon
2021-03-31 22:20:24 -04:00
parent 7aa379a857
commit f7a6cbe5e2
15 changed files with 91 additions and 37 deletions

View File

@@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.widget
import android.animation.ObjectAnimator
import android.animation.StateListAnimator
import android.content.Context
import android.os.Build
import android.util.AttributeSet
import com.google.android.material.R
import com.google.android.material.appbar.AppBarLayout
@@ -19,7 +20,12 @@ class ElevationAppBarLayout @JvmOverloads constructor(
}
fun enableElevation(liftOnScroll: Boolean) {
setElevation(liftOnScroll)
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
// Delay to avoid crash
post { setElevation(liftOnScroll) }
} else {
setElevation(liftOnScroll)
}
}
private fun setElevation(liftOnScroll: Boolean) {

View File

@@ -49,8 +49,10 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
* @param centerX x starting point
* @param centerY y starting point
* @param listener animation listener
*
* @return sdk version lower then 21
*/
fun showRevealEffect(centerX: Int, centerY: Int, listener: Animator.AnimatorListener) {
fun showRevealEffect(centerX: Int, centerY: Int, listener: Animator.AnimatorListener): Boolean {
this.isVisible = true
val height = this.height
@@ -69,5 +71,6 @@ class RevealAnimationView @JvmOverloads constructor(context: Context, attrs: Att
anim.addListener(listener)
anim.start()
return true
}
}