mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 12:49:19 +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,7 +65,16 @@ 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) {
|
||||||
appBarLayout?.isLifted = (dyConsumed != 0 || dyUnconsumed >= 0) && tabLayout?.isVisible == false
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user