mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-17 15:33:30 +01:00
Fix unread filter deactivating when scrolling through the conversation list.
This commit is contained in:
committed by
Cody Henthorne
parent
a0c0acb8fc
commit
9594599d60
@@ -22,14 +22,14 @@ class ConversationFilterBehavior(context: Context, attributeSet: AttributeSet) :
|
||||
|
||||
override fun onStopNestedScroll(coordinatorLayout: CoordinatorLayout, child: AppBarLayout, target: View, type: Int) {
|
||||
super.onStopNestedScroll(coordinatorLayout, child, target, type)
|
||||
child.setExpanded(false, true)
|
||||
callback?.onStopNestedScroll()
|
||||
child.setExpanded(false, true)
|
||||
}
|
||||
|
||||
override fun onTouchEvent(parent: CoordinatorLayout, child: AppBarLayout, ev: MotionEvent): Boolean {
|
||||
if (ev.action == MotionEvent.ACTION_UP) {
|
||||
child.setExpanded(false, true)
|
||||
callback?.onStopNestedScroll()
|
||||
child.setExpanded(false, true)
|
||||
}
|
||||
return super.onTouchEvent(parent, child, ev)
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ class ConversationListFilterPullView @JvmOverloads constructor(
|
||||
private val velocityTracker = ProgressVelocityTracker(5)
|
||||
private var animateHelpText = 0
|
||||
private var helpTextStartFraction = 0.35f
|
||||
private var previousDragProgress: Float? = null
|
||||
|
||||
private val pillDefaultBackgroundTint = ContextCompat.getColor(context, CoreUiR.color.signal_colorSecondaryContainer)
|
||||
private val pillWillCloseBackgroundTint = ContextCompat.getColor(context, CoreUiR.color.signal_colorSurface1)
|
||||
@@ -114,6 +115,9 @@ class ConversationListFilterPullView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun onUserDrag(progress: Float) {
|
||||
val previousProgress = previousDragProgress ?: progress
|
||||
val enteredApexFromBelow = previousProgress < 1f && progress >= 1f
|
||||
|
||||
binding.filterCircle.progress = progress
|
||||
|
||||
if (state == FilterPullState.CLOSED && progress <= 0) {
|
||||
@@ -123,7 +127,7 @@ class ConversationListFilterPullView @JvmOverloads constructor(
|
||||
vibrate()
|
||||
resetHelpText()
|
||||
resetPillColor()
|
||||
} else if (state == FilterPullState.OPEN && progress >= 1f) {
|
||||
} else if (state == FilterPullState.OPEN && enteredApexFromBelow) {
|
||||
setState(FilterPullState.CLOSE_APEX, ConversationFilterSource.DRAG)
|
||||
vibrate()
|
||||
animatePillColor()
|
||||
@@ -167,6 +171,8 @@ class ConversationListFilterPullView @JvmOverloads constructor(
|
||||
if (state == FilterPullState.CLOSE_APEX) {
|
||||
binding.filterText.alpha = FilterLerp.getPillCloseApexAlphaLerp(progress)
|
||||
}
|
||||
|
||||
previousDragProgress = progress
|
||||
}
|
||||
|
||||
fun onUserDragFinished() {
|
||||
|
||||
Reference in New Issue
Block a user