Fix settings gear visibility

When the settings gear is first initialized the width can be reported as
0, which lead to NaN in the `map` function and throwing off the other
calculations. This adds a check to the width so it will simply be set
invisible in that case instead

Fixes: 185929062
Test: manual (repro steps in bug)

Change-Id: Id2a8582e8342d807825536bfcaac7d79a042c7cc
This commit is contained in:
Beth Thibodeau
2021-06-23 23:08:55 -04:00
parent f1c4d4e1a4
commit 85a7e84034

View File

@@ -236,7 +236,7 @@ class MediaCarouselScrollHandler(
}
private fun updateSettingsPresentation() {
if (showsSettingsButton) {
if (showsSettingsButton && settingsButton.width > 0) {
val settingsOffset = MathUtils.map(
0.0f,
getMaxTranslation().toFloat(),