Android sample app to learn about the Jetpack Glance library, a recently introduced addition to Jetpack, built on top of compose that makes building app widgets easier.
The app showcases:
- Building a basic app widget (HelloWorldWidget)
- Handling user interactions by firing a callback, or launching an Activity, Service or BroadcastReceiver (ActionWidget).
- Handling widget errors and providing a custom error UI (ErrorUIWidget).
- Composing the widget's UI using the UI components Glance offers, and using GlanceModifier to decorate them and define their behavior (ListWidget).
- Building stateful app widgets, i.e storing the state of the widget's UI using a data store (e.g Preferences) and saving to it, as well as updating both the widget's state and refreshing its UI when the state changes (StatefulWidget).
- Choosing the right size mode to define how the widget's UI reacts to the user resizing it. Glance provides 3 options to choose from: Single, Exact and Responsive (SizeSingleWidget, SizeExactWidget, SizeResponsiveWidget).
- Using Glance in interoperability with RemoteViews, the traditional way of building app widgets (RemoteViewInteropWidget).