Сделал мгновенное раскрытие реквестов при pull вниз
This commit is contained in:
@@ -1799,7 +1799,9 @@ fun ChatsListScreen(
|
||||
}
|
||||
val localDensity = LocalDensity.current
|
||||
val requestsRevealThresholdPx =
|
||||
remember(localDensity) { with(localDensity) { 56.dp.toPx() } }
|
||||
remember(localDensity) { with(localDensity) { 24.dp.toPx() } }
|
||||
val requestsRevealInstantPx =
|
||||
remember(localDensity) { with(localDensity) { 8.dp.toPx() } }
|
||||
val requestsHideThresholdPx =
|
||||
remember(localDensity) { with(localDensity) { 16.dp.toPx() } }
|
||||
|
||||
@@ -2096,6 +2098,7 @@ fun ChatsListScreen(
|
||||
chatListState,
|
||||
requestsCount,
|
||||
requestsRevealThresholdPx,
|
||||
requestsRevealInstantPx,
|
||||
requestsHideThresholdPx,
|
||||
hapticFeedback
|
||||
) {
|
||||
@@ -2127,12 +2130,15 @@ fun ChatsListScreen(
|
||||
}
|
||||
} else if (available.y > 0f && !isRequestsVisible && isAtTop()) {
|
||||
// Pull down from top should always reopen requests.
|
||||
val shouldRevealInstantly =
|
||||
available.y >= requestsRevealInstantPx
|
||||
accumulatedPullDown =
|
||||
(accumulatedPullDown + available.y)
|
||||
.coerceAtMost(
|
||||
requestsRevealThresholdPx * 2f
|
||||
)
|
||||
if (accumulatedPullDown >= requestsRevealThresholdPx) {
|
||||
(accumulatedPullDown + available.y).coerceAtMost(
|
||||
requestsRevealThresholdPx
|
||||
)
|
||||
if (shouldRevealInstantly ||
|
||||
accumulatedPullDown >= requestsRevealThresholdPx
|
||||
) {
|
||||
isRequestsVisible = true
|
||||
accumulatedPullDown = 0f
|
||||
if (!hapticSent) {
|
||||
|
||||
Reference in New Issue
Block a user