The presented project is an attempt to implement a widget for visualization of ECG using the Jetpack Compose extension for Android. The new project is a logical continuation of the previously created application in Kotlin: https://github.com/mk590901/Kotlin-ECG-Widget-Viewer. As a matter of fact, that project was created with the goal of developing a certain core: an independent set of classes for use with various graphics libraries. And this idea paid off: the same classes as before are used, in the case of Compose graphics and JetPack coroutines instead of handlers. This once again confirms the idea that the main thing is the business logic of the application. Everything else: graphics, timers, coroutines and threads, comes and goes.
- The CircularBuffer, GraphMode and Utils classes (and files) remained unchanged.
- Changes in the StoreWrapper class are due to the fact that Compose uses its own specific classes to represent graphic elements such as Path and Point (Offset). Therefore, the prepare... procedures have been changed, and variables of the specified types now refer not to android.graphics.Path and android.graphics.Point, but to androidx.compose.ui.graphics.Path and androidx.compose.ui.geometry.Offset. Pay attention on import directives on start of the file.
- The widget itself is implemented as the @Composable GraphEcgWidget function in the GraphicEchWidget.kt file.
compose_ecg.mp4
NB! As before, clicking (touching) on the rendering area causes ECG drawing to stop; clicking again will resume drawing.