Fix spontaneous crashes in android station screen

This commit is contained in:
DBotThePony 2025-01-07 16:22:31 +07:00
parent ffa0e3d6d5
commit 6f67912041
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -450,7 +450,11 @@ private enum class PreviewScrollers(
LEFT_TO_RIGHT(
init = { it, random ->
it.xOffset = it.width
it.yOffset = random.nextFloat(-it.childrenRectHeight + 18f, 0f)
if (it.childrenRectHeight == 0f)
it.yOffset = 0f
else
it.yOffset = random.nextFloat(-it.childrenRectHeight + 18f, 0f)
},
scroll = { it, _ ->
@ -462,7 +466,11 @@ private enum class PreviewScrollers(
RIGHT_TO_LEFT(
init = { it, random ->
it.xOffset = -it.childrenRectWidth
it.yOffset = random.nextFloat(-it.childrenRectHeight + 18f, 0f)
if (it.childrenRectHeight == 0f)
it.yOffset = 0f
else
it.yOffset = random.nextFloat(-it.childrenRectHeight + 18f, 0f)
},
scroll = { it, _ ->
@ -474,7 +482,11 @@ private enum class PreviewScrollers(
BOTTOM_TO_TOP(
init = { it, random ->
it.yOffset = -it.childrenRectHeight
it.xOffset = random.nextFloat(-it.childrenRectWidth + 18f, 0f)
if (it.childrenRectWidth == 0f)
it.xOffset = 0f
else
it.xOffset = random.nextFloat(-it.childrenRectWidth + 18f, 0f)
},
scroll = { it, _ ->
@ -486,7 +498,11 @@ private enum class PreviewScrollers(
TOP_TO_BOTTOM(
init = { it, random ->
it.yOffset = it.height
it.xOffset = random.nextFloat(-it.childrenRectWidth + 18f, 0f)
if (it.childrenRectWidth == 0f)
it.xOffset = 0f
else
it.xOffset = random.nextFloat(-it.childrenRectWidth + 18f, 0f)
},
scroll = { it, _ ->