mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-10 12:47:48 +01:00
Delay restoring AppBar elevation on Android 5.0 (fixes #4311)
This commit is contained in:
parent
1a5858e99b
commit
837d8f5f30
1 changed files with 10 additions and 0 deletions
|
@ -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,6 +20,15 @@ class ElevationAppBarLayout @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
fun enableElevation(liftOnScroll: Boolean) {
|
||||
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) {
|
||||
// Delay to avoid crash
|
||||
post { setElevation(liftOnScroll) }
|
||||
} else {
|
||||
setElevation(liftOnScroll)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setElevation(liftOnScroll: Boolean) {
|
||||
stateListAnimator = origStateAnimator
|
||||
isLiftOnScroll = liftOnScroll
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue