mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 11:17:25 +01:00
Delay restoring AppBar elevation on Android 5.0 (fixes #4311)
This commit is contained in:
parent
1a5858e99b
commit
837d8f5f30
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.widget
|
|||||||
import android.animation.ObjectAnimator
|
import android.animation.ObjectAnimator
|
||||||
import android.animation.StateListAnimator
|
import android.animation.StateListAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import com.google.android.material.R
|
import com.google.android.material.R
|
||||||
import com.google.android.material.appbar.AppBarLayout
|
import com.google.android.material.appbar.AppBarLayout
|
||||||
@ -19,6 +20,15 @@ class ElevationAppBarLayout @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun enableElevation(liftOnScroll: Boolean) {
|
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
|
stateListAnimator = origStateAnimator
|
||||||
isLiftOnScroll = liftOnScroll
|
isLiftOnScroll = liftOnScroll
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user