Glance

Build layouts for remote surfaces using a Jetpack Compose-style API.
Latest Update Stable Release Release Candidate Beta Release Alpha Release
August 10, 2022 - - - 1.0.0-alpha04

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 AppWidgets support
    implementation "androidx.glance:glance-appwidget:1.0.0-alpha04"

    // For Wear-Tiles support
    implementation "androidx.glance:glance-wear-tiles:1.0.0-alpha04"
}

android {
    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = "1.1.0-beta03"
    }

    kotlinOptions {
        jvmTarget = "1.8"
    }
}

Kotlin

dependencies {
    // For AppWidgets support
    implementation("androidx.glance:glance-appwidget:1.0.0-alpha04")

    // For Wear-Tiles support
    implementation("androidx.glance:glance-wear-tiles:1.0.0-alpha04")
}

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.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.0.0

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 to ColorProvider.getColor (Ic9dfe)
  • Adds copy() method to TextStyle. (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 and GlanceCurvedModifier. (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 existing appWidgetId or an intent from a configuration activity (Icb70c, b/230391946)
  • Add GlanceComposable annotation. (I2c21f)
  • Added GlanceRemoteViews for running composition outside of GlanceAppWidget. (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 added curvedLine and curvedSpacer which are translated to ArcLine and ArcSpacer in proto tiles (Ib955b)
  • Updated nullability in core and appcompat to match Tiramisu DP2 (I0cbb7)
  • Add support for RuncallbackAction in glance-wear-tiles, only RunCallbackAction 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. Removed GlanceAppWidget.updateAppWidgetState and introduced updateAppWidgetState that uses Preferences 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 on SingleEntityTemplate (I01ee0)
  • Update template class name (I3720e)
  • Added LinearProgressIndicator and CircularProgressIndicator 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 and TimelineMode.TimeBoundEntries.
  • LocalTimeInterval, the Local composition refer to a specific time interval.
  • BorderModifer is a GlanceModifier applying a border around an element.

This release also adds Progress Indicators to AppWidget Glance.

API Changes

  • Added LinearProgressIndicator and CircularProgressIndicator composable. (Ie116b)
  • Change actionStartBroadcastReceiver to actionSendBroadcast (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