https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
glance
  • j

    John Turkson

    02/15/2022, 9:44 PM
    Are there any plans to implement
    textOverflow
    (as well as the remaining parameters) from
    androidx.compose.material.Text
    to Glance
    Text
    fields?
    m
    • 2
    • 2
  • m

    Mehmet Peker

    03/06/2022, 2:20 AM
    Hello everyone,can we access local data using room library? If we can how can i do?What is the correct way creating database instance and using this instance?If we can't what do you recommend me for accessing local data?
    ➕ 1
    p
    • 2
    • 5
  • p

    Piotr Prus

    03/08/2022, 1:13 PM
    Hello, anyone here know if there is possibility to update the widget from
    Worker
    using
    updateAppWidgetState
    ? I have tried to use it in Worker, but the update function need to be used from GlanceWidget class or I have to pass the
    GlanceStateDefinition
    . So the question is, can I create the State Definition inside my worker? If not, what is the way to update the widget from
    Worker
    ? I found that passing my state in constructor of MyGlanceWidget works, but then I am not using widgetState at all.
    ➕ 1
    • 1
    • 1
  • m

    Mehmet Peker

    03/09/2022, 1:48 PM
    I make a call http request and update widget but i get error after i did update widget .UI updated but then give an error.I share to my error for your better understanding.
    untitled1.webm
    p
    y
    m
    • 4
    • 26
  • d

    daivid

    03/10/2022, 3:53 AM
    Hey 🤔 Do y'all know if it's possible to have a single
    GlanceStateDefinition
    shared across multiple instances of the same widget?
    p
    p
    m
    • 4
    • 19
  • p

    Piotr Prus

    03/10/2022, 10:25 AM
    I have a problem with passing parameters in action
    actionStartActivity
    . The click parameter is assign during composition and I cannot use hte dynamic state as I can for ActionCallback. Rephrasing: Is there a way to start activity but using class
    ActionCallback
    ? This class is called on click, not during composition, so i can get my parameters base on glanceID. @Marcel Pinto?
    d
    m
    • 3
    • 10
  • o

    Odin

    03/23/2022, 9:49 AM
    Hi, we have implemented a widget with Glance that uses
    actionRunCalback
    with an action that uses a deeplink to open the app. We're doing this because our Glance widget is in a different module than our
    MainActivity
    and then to avoid
    CircularDependencyException
    . However, we're seeing a rather strange error from Crashlytics saying
    java.lang.IllegalArgumentException: List adapter activity trampoline invoked without specifying target intent.
    . I saw that there was a check in
    ActionTrampoline.kt
    that could throw this. Has anyone else seen this before? 😄 Stacktrace in thread 🧵
    p
    • 2
    • 5
  • p

    Piotr Prus

    04/22/2022, 1:49 PM
    I had a talk about Glance Widget today at droidcon Lisbon. Here is the demo application: https://github.com/PiotrPrus/WeatherGlanceWidget The widget present temperature and wind from choosen location, updating manually or every 15 minues using WorkManager.
    👍 4
    y
    m
    • 3
    • 5
  • k

    Kimon

    05/06/2022, 10:28 AM
    Hi! Is it possible to do the following in Glance composables? • add elevation (e.g. in a Row)? Like you can in a LinearLayout? • tint a drawable
    p
    p
    • 3
    • 7
  • a

    andrew

    05/27/2022, 4:26 PM
    Is there anyway to use
    ViewFlipper
    in glance?
    m
    • 2
    • 1
  • a

    andrew

    05/27/2022, 6:05 PM
    Also, is there a recommended way to load a bunch of images remotely in a lazy column?
    m
    • 2
    • 10
  • n

    Nicholas Doglio

    06/04/2022, 4:56 PM
    Can I call a Glance Composable within a regular Composable? I want to have a live preview of my widget within the configuration screen so a user could see what it will look like based on settings they change (like the attached screenshot from Weather Timeline)
    m
    • 2
    • 2
  • m

    Marcel Pinto

    06/17/2022, 9:55 AM
    Override the sizeMode variable inside GlanceAppWidget and use the sizeMode Exact. Every time the available size changes the Content fun will be called and the available size will be provided via LocalSize
    🙌 1
    k
    • 2
    • 1
  • q

    Qusai Zakir

    06/26/2022, 9:34 AM
    How would I go about getting ripple effects for icons that implement the clickable modifier? Or even some kind of response to a button/icon being clicked?
    c
    m
    • 3
    • 5
  • m

    Marcel Pinto

    07/01/2022, 3:14 PM
    FYI new samples for Glance are available now in GitHub 🙂 https://github.com/android/user-interface-samples/tree/main/AppWidget https://twitter.com/marxallski/status/1542878189998944256
    :blob-sunglasses: 7
  • r

    Racka N

    07/11/2022, 8:29 PM
    Hello everyone. Anyone here got an idea why I can't launch this PendingIntent for Compose Navigation deeplinking from my Glance widget. I get
    android.app.PendingIntent$CanceledException
    when I execute the action. PendingIntent code
    internal fun openDeepLinkPendingIntent(context: Context, uriString: String): PendingIntent? {
        val intent = Intent(
            Intent.ACTION_VIEW,
            uriString.toUri()
        )
        return TaskStackBuilder.create(context).run {
            addNextIntentWithParentStack(intent)
            getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
        }
    }
    My ActionCallback:
    class OpenTaskDetailsAction : ActionCallback {
        override suspend fun onRun(context: Context, glanceId: GlanceId, parameters: ActionParameters) {
            val taskId = parameters[PendingTasksWidgetParamKeys.TASK_ID_KEY]
            taskId?.let {
                val pendingIntent = openDeepLinkPendingIntent(context, it)
                println("Pending Intent is present: $pendingIntent")
                pendingIntent?.send()
            }
        }
    }
    m
    • 2
    • 9
  • t

    Tolriq

    08/11/2022, 3:16 PM
    For the record https://issuetracker.google.com/issues/239549285
    m
    • 2
    • 30
  • k

    Kimon

    08/15/2022, 9:38 AM
    java.lang.IllegalStateException: No child for position 5 and size Wrap x Expand
    Is there an easy way to figure out what is wrong with my composables when I get this error? What does the position stand for? It happens when I use
    defaultWeight
    GlanceModifier.
    • 1
    • 1
  • m

    Marcel Pinto

    08/22/2022, 9:15 AM
    Could you paste the full stacktrace?
  • r

    rsktash

    08/22/2022, 2:10 PM
    Hi. There is an issue with the latest version alpha 04 While compiling the app for release it throws an error saying
    Task android:minifyReleaseWithR8 FAILED
    Execution failed for task ‘android:minifyReleaseWithR8’.
    com.android.tools.r8.CompilationFailedException: Compilation failed to complete, position: offset: 932, line: 22, column: 7, origin: /Users/rustam/.gradle/caches/transforms-3/5bd4f57de5d0b1b3ad27e41d1f34fee0/transformed/glance-appwidget-1.0.0-alpha04/proguard.txt
  • t

    Tolriq

    08/22/2022, 3:08 PM
    It's linked 2 lines above I give a workaround in the issue.
  • m

    Marcel Pinto

    09/02/2022, 8:24 AM
    📣 Yesterday we release a new open source library for Glance to experiment with some useful tools https://github.com/google/glance-experimental-tools In a nutshell it uses compose to host RemoteViews (generated from a Glance-appwidget) and enable Android Studio tools like Live Edit. Looking forward for your feedback! https://twitter.com/AndroidDev/status/1565418868344066058
  • a

    Allen Baker

    09/28/2022, 1:40 PM
    Morning. I've been reading the docs to no avail. Does anyone know if there's a callback or if it's possible to detect when a Column becomes visible within a LazyColumn? I'm hoping to detect when the list scrolls and an item appears on the screen.
    m
    a
    • 3
    • 4
  • d

    Davide Giuseppe Farella

    09/30/2022, 9:45 AM
    ’Morning, has something changed about
    actionStartActivity
    on alpha04? I had a simple
    val intent = packageManager.getLaunchIntentForPackage(package)!!
    GlanceModifier.clickable(actionStartActivity(intent))
    on alpha03, but after the update, clicking of the item has no effect
    m
    s
    • 3
    • 9
  • t

    Tolriq

    10/06/2022, 6:27 PM
    Starting again to play with Glance with alpha5 but I'm facing a strange issue and have no idea where to start looking. It seems there's a race internally And when calling
    AGlanceWidget().updateAll(it)
    BGlanceWidget().updateAll(it)
    Then something the wrong widget content is rendered (Like A is rendered in B widget)
    k
    m
    • 3
    • 8
  • a

    Allen Baker

    10/06/2022, 7:32 PM
    ^Speaking of alpha05, I haven't had a chance to try it out yet but I read the release notes. Does anyone happen to know if this fixed issue is included in alpha05?
    t
    • 2
    • 5
  • t

    Tolriq

    10/07/2022, 9:03 AM
    Seems there's still no way to tint images via ColorProviders to support day/night changes properly?
    b
    • 2
    • 3
  • t

    Tolriq

    10/07/2022, 6:54 PM
    Trying to backport image rounding in the widgets to all API versions, and while there's plenty of methods I can't find how to port a RoundedCorner of x dp to the equivalent in path or roundedrect in canvas. Is there something obvious I'm missing?
  • k

    Kimon

    10/13/2022, 2:37 PM
    Is there a limit of 10 children inside a
    Column
    or
    Row
    in Glance? I get a
    java.lang.IllegalArgumentException: Cannot find container Row with 11 children
    error once I try to add the 11th children.. 🤔
    b
    • 2
    • 2
  • r

    Rodri Represa

    10/14/2022, 7:15 AM
    What is the easiest way to render an image from a url on glance? retrieving the url from backend on the worker -> downloading it and storing in the device -> send the uri to the state and render it?
    k
    a
    b
    • 4
    • 4
Powered by Linen
Title
r

Rodri Represa

10/14/2022, 7:15 AM
What is the easiest way to render an image from a url on glance? retrieving the url from backend on the worker -> downloading it and storing in the device -> send the uri to the state and render it?
k

Kimon

10/14/2022, 7:24 AM
I believe this is what you are looking for: https://github.com/android/user-interface-samples/tree/main/AppWidget/app/src/main/java/com/example/android/appwidget/glance/image
r

Rodri Represa

10/14/2022, 9:19 AM
Thanks!! @Kimon
a

Allen Baker

10/14/2022, 2:37 PM
I'm using Glide (or structured concurrency with coroutines) and caching the image URI for each item when converting my API model to the widget model (storing the cached image URI in the widget model)
b

bbade_

10/14/2022, 8:43 PM
Also fwiw, we are considering more support around loading images from urls in the future.
View count: 5