mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 14:09:17 +01:00
Fix AppBar not unlifting when scrolling using ComposeView (#6952)
This commit is contained in:
parent
189f92d7e8
commit
b20ca36db9
@ -5,8 +5,10 @@ import android.os.Parcel
|
|||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.compose.ui.platform.ComposeView
|
||||||
import androidx.coordinatorlayout.R
|
import androidx.coordinatorlayout.R
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
import androidx.core.view.doOnLayout
|
import androidx.core.view.doOnLayout
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.customview.view.AbsSavedState
|
import androidx.customview.view.AbsSavedState
|
||||||
@ -63,9 +65,18 @@ class TachiyomiCoordinatorLayout @JvmOverloads constructor(
|
|||||||
super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type, consumed)
|
super.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed, type, consumed)
|
||||||
// Disable elevation overlay when tabs are visible
|
// Disable elevation overlay when tabs are visible
|
||||||
if (canLiftAppBarOnScroll) {
|
if (canLiftAppBarOnScroll) {
|
||||||
|
if (target is ComposeView) {
|
||||||
|
val scrollCondition = if (type == ViewCompat.TYPE_NON_TOUCH) {
|
||||||
|
dyUnconsumed >= 0
|
||||||
|
} else {
|
||||||
|
dyConsumed != 0 || dyUnconsumed >= 0
|
||||||
|
}
|
||||||
|
appBarLayout?.isLifted = scrollCondition && tabLayout?.isVisible == false
|
||||||
|
} else {
|
||||||
appBarLayout?.isLifted = (dyConsumed != 0 || dyUnconsumed >= 0) && tabLayout?.isVisible == false
|
appBarLayout?.isLifted = (dyConsumed != 0 || dyUnconsumed >= 0) && tabLayout?.isVisible == false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onAttachedToWindow() {
|
override fun onAttachedToWindow() {
|
||||||
super.onAttachedToWindow()
|
super.onAttachedToWindow()
|
||||||
|
Loading…
Reference in New Issue
Block a user