-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Animate images with image overlay #293
base: v.next
Are you sure you want to change the base?
Conversation
...y/src/main/java/com/esri/arcgismaps/sample/animateimageswithimageoverlay/DownloadActivity.kt
Outdated
Show resolved
Hide resolved
samples-lib/src/main/java/com/esri/arcgismaps/sample/sampleslib/DownloaderActivity.kt
Show resolved
Hide resolved
...ps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt
Outdated
Show resolved
Hide resolved
...ps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt
Outdated
Show resolved
Hide resolved
...cgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt
Outdated
Show resolved
Hide resolved
...cgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt
Outdated
Show resolved
Hide resolved
...cgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt
Outdated
Show resolved
Hide resolved
...cgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt
Outdated
Show resolved
Hide resolved
...cgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt
Outdated
Show resolved
Hide resolved
Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/DownloadActivity.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/screens/AnimateImagesWithImageOverlayScreen.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
…ri/arcgismaps/sample/animateimageswithimageoverlay/components/AnimateImagesWithImageOverlayViewModel.kt Co-authored-by: Shubham Sharma <[email protected]>
Thanks for all the detailed suggestions @shubham7109 -- changes made! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TADraeseke The sample looks great. Thanks for making the changes, just a few minor enhancement suggestions.
val period = when (fps) { | ||
60 -> 17 // 1000ms/17 = 60 fps | ||
30 -> 33 // 1000ms/33 = 30 fps | ||
15 -> 67 // 1000ms/67 = 15 fps | ||
else -> 0 | ||
} | ||
timer?.cancel() | ||
timer = fixedRateTimer("Image overlay timer", period = period.toLong()) { | ||
addNextImageFrameToImageOverlay() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fps
could be part of an internal flow that creates a new fixedRateTimer
on each update. This would allow us to change the fps of the animation in real-time.
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use a @Preview
function here:
} | |
} | |
@Preview(showBackground = true) | |
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES, showBackground = true) | |
@Composable | |
fun ClusterInfoContentPreview() { | |
SampleAppTheme { | |
Surface { | |
ImageOverlayMenu( | |
isStarted = true, | |
fps = 60, | |
opacity = 1F, | |
fpsOptions = listOf(60, 30, 15), | |
onFpsOptionSelected = { }, | |
onOpacityChanged = { }, | |
onIsStartedChanged = {} | |
) | |
} | |
} | |
} | |
updateFpsOption: KFunction1<Int, Unit>, | ||
updateOpacity: KFunction1<Float, Unit>, | ||
updateIsStarted: KFunction1<Boolean, Unit> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name change:
updateFpsOption: KFunction1<Int, Unit>, | |
updateOpacity: KFunction1<Float, Unit>, | |
updateIsStarted: KFunction1<Boolean, Unit> | |
onFpsOptionSelected: (Int) -> Unit, | |
onOpacityChanged: (Float) -> Unit, | |
onIsStartedChanged: (Boolean) -> Unit |
updateIsStarted: KFunction1<Boolean, Unit> | ||
) { | ||
|
||
var selectedFps by remember { mutableIntStateOf(60) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be removed in favor of the fps
provided by the view model.
var selectedFps by remember { mutableIntStateOf(60) } |
Description
PR to add a new Kotlin sample "Animate images with image overlay" in
Visualization
category.Links and Data
Sample issue: https://devtopia.esri.com/runtime/kotlin/issues/1138
What To Review