Glance
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
October 16, 2024 | 1.1.1 | - | - | - |
Declaring dependencies
To add a dependency on Glance, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.
Add the dependencies for the artifacts you need in the build.gradle
file for
your app or module:
Groovy
dependencies { // For Glance support implementation "androidx.glance:glance:1.1.1" // For AppWidgets support implementation "androidx.glance:glance-appwidget:1.1.1" // For Wear-Tiles support implementation "androidx.glance:glance-wear-tiles:1.0.0-alpha05" } android { buildFeatures { compose true } composeOptions { kotlinCompilerExtensionVersion = "1.1.0-beta03" } kotlinOptions { jvmTarget = "1.8" } }
Kotlin
dependencies { // For Glance support implementation("androidx.glance:glance:1.1.1") // For AppWidgets support implementation("androidx.glance:glance-appwidget:1.1.1") // For Wear-Tiles support implementation("androidx.glance:glance-wear-tiles:1.0.0-alpha05") } android { buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.1.0-beta03" } kotlinOptions { jvmTarget = "1.8" } }
For more information about dependencies, see Add build dependencies.
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
Version 1.1
Version 1.1.1
October 16, 2024
androidx.glance:glance-*:1.1.1
is released. Version 1.1.1 contains these commits.
Security Fixes
- As of this change, androidx compiles against protobuf 4.28.2 in order to address CVE-2024-7254. Upgrade your dependency on version 1.1.0 of
androidx.glance:glance-appwidget-proto
andandroidx.glance:glance-appwidget-external-protobuf
to 1.1.1 to address the vulnerability risk.
Version 1.1.0
June 12, 2024
androidx.glance:glance-*:1.1.0
is released. Version 1.1.0 contains these commits.
Important changes since 1.0.0
- Moves Glance to 1.1.0 stable.
Version 1.1.0-rc01
May 14, 2024
androidx.glance:glance-*:1.1.0-rc01
is released. Version 1.1.0-rc01 contains these commits.
New Features
- Added width and height parameters to Preview annotations for Glance. Moves 1.1.0 to Release Candidate.
API Changes
- Adds optional parameter to Scaffold. (If753f)
- Add width and height parameters to Glance
@Preview
. (Ibabe8) - Remove support for glance wear tile previews. (I3850a)
- Added API for setting custom weight values for
FontStyle
. (I7390a) - Rename
Viewfinder
'sImplementationMode
Enums to better reflect underlying implementations, and add fixed constants forTransformationInfo.sourceRotation
(Ic6149)
Bug Fixes
- Fixed a bug that caused rendering issues for
ViewGroups
in backwards compatibility mode (I8de92)
External Contribution
- Experimental
SharedTransitionScope
is now an interface rather than a class. (Iaf856, b/338415048, b/338414702)
Version 1.1.0-beta02
April 17, 2024
androidx.glance:glance-*:1.1.0-beta02
is released. This version contains source jars that were missing from the previous release.
Version 1.1.0-beta01
April 3, 2024
androidx.glance:glance-*:1.1.0-beta01
is released. Version 1.1.0-beta01 contains these commits.
Version 1.1.0-alpha01
February 7, 2024
androidx.glance:glance-*:1.1.0-alpha01
is released. Version 1.1.0-alpha01 contains these commits.
New Features
- Unit test library for Glance that doesn’t require UI Automator. Glance code can be tested directly without having to inflate the view.
- Higher level components for simpler layouts.
- New Modifiers and theme options.
- New API for getting a flow of RemoteViews from a composition,
runComposition
API Changes
- Adds a new
widgetBackground
color role to Glance themes. (Ia2ab8) - Add
GlanceAppWidget.runComposition
(I6344c, b/298066147) - Adds new
TopBar
component (Ibd361) - Adds overrides to the
clickable
modifier. (Iacecf) - Adds a new api for tinting buttons. This should be experimental until 1.0 ships. (I92523)
- Adds
runGlanceAppWidgetUnitTest
that provides scope to call methods onGlanceAppWidgetUnitTest
such asprovideComposable
to provide a small isolated composable for test,onNode
to find a Glance composable element in the provided content. This enables you to write unit tests for individual composable functions in your appWidget to verify that given certain inputs the function outputs the intended set of glance composable elements. (I2f682) - Adds a
testTag
modifier in semantics for use in unit tests. (I8f62f) - update
TitleBar
- text and icon individually tintable. (Ia0a60) - Adds scaffold component (I8a736)
- Adds
hasActionRunCallbackClickAction
filter andassertHasActionRunCallbackClickAction
assertion to testactionRunCallack
. Also, adds additional shorthand variant functions for action related test filters -hasStartActivityClickAction<activityClass>(..)
,hasStartServiceAction<receiverClass>(..)
,hasSendBroadcastAction<receiverClass>(..)
. Adds similar variants for theirassertHasXXX
counterparts. (Ieca63) - Moves unreleased api around. Changes a modifier from internal to public but library restricted (If2a08)
- Adds
onCompositionError
method where developers can run code when an error occurs (I9b56f) - Adds button and iconbutton apis to glance (I0fd6f)
- Adds
isLinearProgressIndicator
,isIndeterminateLinearProgressIndicator
,isIndeterminateCircularProgressIndicator
filters to match progress indicators. Additional includeshasAnyDescendants
filter to test if a node has a descendant in its sub-hierarchy that matches a specific matcher (Ifd426) - Adds assertions and filters to enable testing of click actions that start service / activity or broadcasts. Also includes testing if input elements are checked. (I3041c)
Version 1.0.0
Version 1.0.0-alpha06
February 7, 2024
androidx.glance:glance-appwidget-preview:1.0.0-alpha06
and androidx.glance:glance-preview:1.0.0-alpha06
are released. Version 1.0.0-alpha06 contains these commits.
New Features
- Version updated to follow the main Glance module.
Version 1.0.0
September 6, 2023
androidx.glance:glance-*:1.0.0
is released. Version 1.0.0 contains these commits.
Major features of 1.0.0
- Move Glance to stable version 1.0.0
Version 1.0.0-rc01
July 26, 2023
androidx.glance:glance-*:1.0.0-rc01
is released. Version 1.0.0-rc01 contains these commits.
Moves Glance to rc01 on the way to stable release for 1.0.0.
New Features
- Adds key parameters to action lambdas for more stable action invocation.
- Adds the ability to provide to
ActvityOptions
tostartActivity
actions. - Adds support for Android 14
API Changes
- Added an optional key parameter for all elements that accept lambdas. (Id96c1, b/282445798)
- Add support for setting
ActivityOptions
bundle foractionStartActivity
(I6a08d) - Merged public and experimental API files for d,e,f,g-paths (I03646, b/278769092)
- N/A, API file changes are just reordering methods (I5fa95)
- Add API for setting
CoroutineContext
forGlanceAppWidgetReceiver
requests (I0a100) - Added a new API to provide
ActivityOptions
forLazyColumn
andLazyVerticalGrid
that will be used for all actions in the list.(Id8d71)
Bug Fixes
- N/A, API file changes are just reordering methods (I5fa95)
- Glance text component style demo (Ie78a4)
Version 1.0.0-beta01
May 10, 2023
androidx.glance:glance-*:1.0.0-beta01
is released. Version 1.0.0-beta01 contains these commits.
New Features
- Moves the library into beta.
- Support for themeing using
GlanceTheme
, adds glance-material and glance-material3 modules to support material 2 and material 3 style themes in Glance. - Support for
FontFamily
added to text apis. - Moved
GlanceAppWidget
to aWorkManager
session based update mechanism. Users of Glance forAppWidgets
should now overrideGlanceAppWidget.provideGlance
instead of the oldContent
method. As this now happens in a worker, this is now a good place to load resources, database or network items without having to have a separate worker.
API Changes
- Added
*Defaults
API forButton
,Checkbox
,RadioButton
andSwitch
. It brings glance closer in line with the patterns of Jetpack Compose. (I94828) - New Glance templates module (I94459)
- Making
ResourceColorProvider
internal to module. Breaking change. Needed becauseResourceColorProvider
should only be used for dynamic theming to avoid situations where some colors are dynamic resources and some are fully resolved. (Ib0db7) - Adds
FontFamily
as an option forTextStyle
. (Ic19ba, b/274179837) - Value parameter name for
Enum.valueOf
changed (Ia9b89) - More thrown exceptions from enum
valueOf
(I818fe) - Updated
GlanceAppWidget
to useprovideGlance
as the main entrypoint.GlanceAppWidget.Content
is now deprecated. (I202b5) - Adds an option to supply tint color for images (I26192, b/212418562)
- More return type nullability of deprecated-hidden functions. (Ibf7b0)
- Adding
@JvmDefaultWithCompatibility
annotation (I8f206) - Removed the unused
SingleEntityTemplateData.displayHeader
. (I7f094) - Added support for using lambdas as callbacks (Ia0bbd)
- Moved
DayNightColorProvider
to glance module (I1842c, b/256934779) - Removes
LocalColorProvider
from Templates. Templates will now useGlanceTheme.colors
(Ic15e2) - Removed nullability from
Text(style: TextStyle)
(I7123b, b/237012816) - Default text color to black. remove nullability (I3072c, b/237012816)
- Making dynamic theme
ColorProviders
its own object. MakingResourceColorProvider
internal to the module. (Id0e2d, b/237012816) - Add the Undefined category to
ImageSize
. (I2fa39) - Remove deprecated
GlanceAppWidget.Content
function (Ib05f6) - Adds modifier as a parameter to
AndroidRemoteViews
. (I515d4) - Add
GlanceAppWidget.compose
to make unit testing easier (Ie9b28)
Bug Fixes
- Added a demo widget for Glance text fonts (I5c3d7)
- Makes
AndroidRemoteViews
sizable with Modifier. - Issues with inconsistent theme colors resolved
- All resources now prefixed to avoid collisions
Version 1.0.0-alpha05
October 5, 2022
androidx.glance:glance:1.0.0-alpha05
, androidx.glance:glance-appwidget:1.0.0-alpha05
, and androidx.glance:glance-wear-tiles:1.0.0-alpha05
are released. Version 1.0.0-alpha05 contains these commits.
New Features
- Adds
requestPinGlanceAppWidget
toGlanceAppWidgetManager
, allowing apps to prompt a user to add their Glance based widget to their home screen. (Ic6e47) - Adds
ACTION_DEBUG_UPDATE
toGlanceAppWidgetReceiver
to allow developers to force their widget to update from adb on rooted devices and emulators. (I94ae1)
API Changes
- Remove header action buttons in Glance templates to simplify use case. (Ie4387)
- Refactored Single Entity Template to reuse the Block subsystem design. (Iecd2c)
- Refactored Glance List Template to use
Text/Image/Action
Block design. (If0cc1) - Add priority number range for
TextBlock
andImageBlock
. (I73100)
Bug Fixes
- Removed Material3 dependency. (I28d1c)
- Moves toward a more consistent system for adding margins and spacing in glance template layouts. (I29773)
- Fixes malformed Proguard rule that was blocking minified releases from building.
Version 1.0.0-alpha04
August 10, 2022
androidx.glance:glance:1.0.0-alpha04
, androidx.glance:glance-appwidget:1.0.0-alpha04
, and androidx.glance:glance-wear-tiles:1.0.0-alpha04
are released. Version 1.0.0-alpha04 contains these commits.
New Features
- Adds Button coloring features.
- Adds
GlanceComposable
annotation for better compile time checking. - Adds Wear specific Glance features.
API Changes
- Update Glance Gallery Data API and Condensed View. (Ibc7a8)
- Adds
ButtonColors
for configuring buttons. (Iea88d, b/236305351) - Rename
ColorProvider.resolve
toColorProvider.getColor
(Ic9dfe) - Adds
copy()
method toTextStyle
. (I9aef6) - Adds a
ColorProviders
class that can be used as part of themes for Glance. (I848b9, b/237012816) - Add List Template support to list styles and collapsed view. (I50cdc)
- Add semantics to
GlanceModiier
andGlanceCurvedModifier
. (Ifda7e) - Add
GlanceComposable
annotation. (I5dbf0) - Moves Glance Templates into the main Glance project. (I9db94)
- Add
ColorProvider.resolve()
(Ife532, b/214733442) - New method to get
GlanceId
from an existingappWidgetId
or an intent from a configuration activity (Icb70c, b/230391946) - Add
GlanceComposable
annotation. (I2c21f) - Added
GlanceRemoteViews
for running composition outside ofGlanceAppWidget
. (I18f92) - Remove Color in
ProgressIndicatorDefaults
. (I40299) - Rename
ActionCallback
's onRun method to onAction, for consistency with the public APIs, as required by the API review feedback. (Icfa57) - Convert glance template layouts to use a map (I46bfd)
- Add
RadioButton
composable (I4ecce) - Added
GlanceWearTiles
for composing wear tiles (Ia9f65) - Added clickable to
GlanceCurvedModifier
(Iec2a0) - Implement
CurvedRow
as a scope and create a DSL to add normal composable and/or curved elements. Also addedcurvedLine
andcurvedSpacer
which are translated toArcLine
andArcSpacer
in proto tiles (Ib955b) - Updated nullability in core and appcompat to match Tiramisu DP2 (I0cbb7)
- Add support for
RuncallbackAction
in glance-wear-tiles, onlyRunCallbackAction
with NO parameter is supported for now (Ide64a)
External Contribution
- Updated :compose:ui:ui-test api (updateApi) due to test-coroutines-lib migration (I3366d)
Version 1.0.0-alpha03
February 23, 2022
androidx.glance:glance-*:1.0.0-alpha03
is released. Version 1.0.0-alpha03 contains these commits.
New Features
- Simplified state definition to default to Preferences.
API Changes
- Simplify state handling by make
PreferencesGlanceStateDefinition
the default state handling. RemovedGlanceAppWidget.updateAppWidgetState
and introducedupdateAppWidgetState
that usesPreferences
by default. (I58963) - Add Glance TemplateText class and update Template design (I4e146)
- Adds outline infrastructure for the Freeform template (If03d6)
- Updates to
SingleEntityTemplate
layouts (If925d) - Added
LazyVerticalGrid
(I5f442) - Use
ColorProvider
onSingleEntityTemplate
(I01ee0) - Update template class name (I3720e)
- Added
LinearProgressIndicator
andCircularProgressIndicator
composable. (Ie116b)
Bug Fixes
- Initial glance templates implementation, defines "single item template" data and example template layout (I35837)
- Align the tile cotent to center by default (I264be)
- Bug fix with fillMaxSize/Width/Height in glance-wear-tiles (I0a39f)
Version 1.0.0-alpha02
January 26, 2022
androidx.glance:glance-*:1.0.0-alpha02
is released. Version 1.0.0-alpha02 contains these commits.
New Features
This release contains the set of APIs to build Wear Tiles using Compose runtime with composables optimized for "Glanceable"
- Declare your wear tile service by extending
GlanceTileService
, a service to create your tile in the composable Content() function. - Wear tiles specific glance composables:
CurvedRow
,CurvedText
. - Handle different timeline modes for tile by defining
TimelineMode.SingleEntry
andTimelineMode.TimeBoundEntries
. LocalTimeInterval
, the Local composition refer to a specific time interval.BorderModifer
is aGlanceModifier
applying a border around an element.
This release also adds Progress Indicators to AppWidget Glance.
API Changes
- Added
LinearProgressIndicator
andCircularProgressIndicator
composable. (Ie116b) - Change
actionStartBroadcastReceiver
toactionSendBroadcast
(I7d555) - Pass Context to
GlanceAppWidget
onDelete callback (I4c795)
Bug Fixes
- Correct handling of OPTIONS_APPWIDGET_SIZES if present but empty. (I01f82)
Version 1.0.0-alpha01
December 15, 2021
androidx.glance:glance:1.0.0-alpha01
, androidx.glance:glance-appwidget:1.0.0-alpha01
, and androidx.glance:glance-appwidget-proto:1.0.0-alpha01
are released. Version 1.0.0-alpha01 contains these commits.
Features in initial release
- The first release of Glance includes the first set of APIs to build AppWidget using Compose Runtime with a set of new Composables optimized for “Glanceables”.
Features
- Declare your app widgets with GlanceAppWidget and GlanceAppWidgetReceiver.
- Compose your UI with the initial set of Glance Composables: Box, Row, Column, Text, Button, LazyColumn, Image, Spacer.
- Apply modifiers to the composables using GlanceModifier methods.
- Handle user interaction with predefined Actions.
- Provide parameters to Action with ActionParameters.
- Handle different size modes by defining SizeMode.Single, SizeMode.Exact or SizeMode.Responsive.
- Persist GlanceAppWidget state by providing a GlanceStateDefinition.
- Local compositions like LocalContext, LocalState, LocalGlanceId, LocalSize.
- Interop with your existing RemoteViews with the AndroidRemoteViews Composable.