Vaibhav Jaiswal
01/16/2024, 5:18 AMVaibhav Jaiswal
01/16/2024, 5:23 AMVaibhav Jaiswal
01/16/2024, 5:25 AMVaibhav Jaiswal
01/16/2024, 5:30 AMArkadii Ivanov
01/16/2024, 8:41 AMArkadii Ivanov
01/16/2024, 8:51 AMinternal fun CountersContent(component: CountersComponent, modifier: Modifier = Modifier) {
Children(
stack = component.childStack,
modifier = modifier,
animation = predictiveBackAnimation(
backHandler = component.backHandler,
fallbackAnimation = stackAnimation(fade() + scale()),
selector = { initialBackEvent, _, _ ->
predictiveBackAnimatable(
initialBackEvent = initialBackEvent,
exitModifier = { progress, edge -> Modifier.exitModifier(progress = progress, edge = edge) },
enterModifier = { progress, _ -> Modifier.enterModifier(progress = progress) },
)
},
onBack = component::onBackClicked,
),
) {
...
}
}
private fun Modifier.exitModifier(progress: Float, edge: BackEvent.SwipeEdge): Modifier =
scale(1F - progress * 0.25F)
.absoluteOffset(
x = when (edge) {
BackEvent.SwipeEdge.LEFT -> 32.dp * progress
BackEvent.SwipeEdge.RIGHT -> (-32).dp * progress
BackEvent.SwipeEdge.UNKNOWN -> 0.dp
},
)
.alpha(((1F - progress) * 2F).coerceAtMost(1F))
.clip(RoundedCornerShape(size = 64.dp * progress))
private fun Modifier.enterModifier(progress: Float): Modifier =
drawWithContent {
drawContent()
drawRect(color = Color(red = 0F, green = 0F, blue = 0F, alpha = (1F - progress) / 4F))
}
Vaibhav Jaiswal
01/16/2024, 8:52 AMArkadii Ivanov
01/16/2024, 9:03 AMPersistentBackAnimatable
interface and returning it from the selector
lambda. You can refer to the default animatable implementation for reference.Vaibhav Jaiswal
01/16/2024, 9:09 AMArkadii Ivanov
01/16/2024, 9:14 AMलातों वाला भूत
01/16/2024, 12:38 PMArkadii Ivanov
01/16/2024, 12:44 PMलातों वाला भूत
01/16/2024, 12:45 PMArkadii Ivanov
01/16/2024, 12:56 PMलातों वाला भूत
01/16/2024, 1:02 PMलातों वाला भूत
01/17/2024, 3:30 PMPointerEventPass.Initial
seems to be correct precedence.
Another aspect is first back swipe, right after coming to a new screen is sometimes dropped.
Perhaps because of
If requireUnconsumed is true and the first down is consumed in the PointerEventPass.Main pass, that gesture is ignored
How can I customise this to give scroll events the precedence and not drop gesture event.Arkadii Ivanov
01/17/2024, 3:48 PMI thought Initial means that the overlay will have (and use) the opportunity to intercept touch events before they reach scrollable widgets. I would try using anotherseems to be correct precedencePointerEventPass.Initial
PointerEventPass
.
Also maybe try placing the overlay under the content, not above.लातों वाला भूत
01/17/2024, 3:49 PMMain
and Final
. Do not seem to have an effectArkadii Ivanov
01/17/2024, 4:00 PMलातों वाला भूत
01/17/2024, 4:59 PMrequireUnconsumed
produce the desired effect.
What if even strange is at times the first attempt to back swipe is completely ignoredलातों वाला भूत
01/17/2024, 5:17 PMArkadii Ivanov
01/17/2024, 5:19 PMलातों वाला भूत
01/17/2024, 5:20 PMMain
should allow descendants to handle the touch before ancestors.Arkadii Ivanov
01/17/2024, 5:28 PMलातों वाला भूत
01/17/2024, 5:33 PMArkadii Ivanov
01/17/2024, 6:03 PMArkadii Ivanov
01/17/2024, 6:05 PMpointerInput
messes with the screen content that also handles touch events.Arkadii Ivanov
01/17/2024, 6:06 PMलातों वाला भूत
01/17/2024, 6:11 PMArkadii Ivanov
01/17/2024, 6:15 PMलातों वाला भूत
01/17/2024, 6:16 PMArkadii Ivanov
01/17/2024, 6:28 PMलातों वाला भूत
01/17/2024, 6:30 PMलातों वाला भूत
01/17/2024, 6:32 PMArkadii Ivanov
01/17/2024, 6:51 PMArkadii Ivanov
01/17/2024, 6:52 PM