Updated on 2026-08-14

This commit is contained in:
Tangem 2022-03-02 19:42:49 +03:00
parent 531affeb7c
commit 542c1d341f
2 changed files with 40 additions and 21 deletions

View file

@ -54,28 +54,46 @@ fun StoriesScreen(
Modifier
.fillMaxSize()
.background(Color(0xFF090E13))
.pointerInput(Unit) {
val maxWidth = this.size.width
detectTapGestures(
onPress = {
val pressStartTime = System.currentTimeMillis()
isPressed.value = true
this.tryAwaitRelease()
val pressEndTime = System.currentTimeMillis()
val totalPressTime = pressEndTime - pressStartTime
if (totalPressTime < 200) {
val isTapOnRightTwoTiers = (it.x > (maxWidth / 2))
if (isTapOnRightTwoTiers) {
goToNextScreen()
} else {
goToPreviousScreen()
}
}
isPressed.value = false
},
)
}
) {
Row(
Modifier.fillMaxSize()
) {
Box(
Modifier
.weight(1f)
.fillMaxHeight()
.pointerInput(isPressed) {
detectTapGestures(
onPress = {
val pressStartTime = System.currentTimeMillis()
isPressed.value = true
this.tryAwaitRelease()
val pressEndTime = System.currentTimeMillis()
val totalPressTime = pressEndTime - pressStartTime
if (totalPressTime < 200) goToPreviousScreen()
isPressed.value = false
},
)
}
)
Box(
Modifier.weight(1f)
.fillMaxHeight()
.pointerInput(isPressed) {
detectTapGestures(
onPress = {
val pressStartTime = System.currentTimeMillis()
isPressed.value = true
this.tryAwaitRelease()
val pressEndTime = System.currentTimeMillis()
val totalPressTime = pressEndTime - pressStartTime
if (totalPressTime < 200) goToNextScreen()
isPressed.value = false
},
)
}
)
}
if (!isDarkBackground) {
Image(
painter = painterResource(id = R.drawable.ic_overlay),

View file

@ -6,6 +6,7 @@ import android.view.View
import android.view.animation.OvershootInterpolator
import androidx.annotation.LayoutRes
import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isVisible
import androidx.transition.TransitionInflater
import androidx.transition.TransitionManager
import com.squareup.picasso.Picasso