Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Background Complications #25

Closed
Irriius opened this issue Nov 22, 2021 · 1 comment · Fixed by #26
Closed

Update Background Complications #25

Irriius opened this issue Nov 22, 2021 · 1 comment · Fixed by #26
Assignees
Labels
bug Something isn't working

Comments

@Irriius
Copy link

Irriius commented Nov 22, 2021

Hi Vladimir, I discovered the following problem with the complication of the background of the dial.

After choosing the complication of the background of the watch face, the background image replaces the main color (gradient), this works well, BUT if you turn off the complications of the background image, then there is no automatic change to the usual gradient. This will happen only after switching the dial to another and returning back, that is, reinitializing the settings.

I see the reason that the data storage is not updating

Maybe a problem in the following piece of code in WatchFace.kt

override fun onComplicationDataUpdate(watchFaceComplicationId: Int, complicationData: ComplicationData) {
    super.onComplicationDataUpdate(watchFaceComplicationId, complicationData)
    val data = complicationData.sanitize(this@WatchFace, dataStorage.getComplicationProviderName(watchFaceComplicationId))

    if(watchFaceComplicationId == BACKGROUND_COMPLICATION_ID) {
        if(data.largeImage != null) {
            layouts.backgroundComplication.isVisible = true
            layouts.backgroundComplication.setComplicationData(data)
        } else {
            layouts.backgroundComplication.isVisible = false
        }
    } else {
        layouts.complications.setComplicationData(watchFaceComplicationId, data)
    }

    invalidate()
}

if before
layouts.backgroundComplication.isVisible = false

add code
layouts.backgroundComplication.setComplicationData (null)

Then the background change will occur correctly

@VladimirWrites
Copy link
Owner

Thank you for creating the issue and also investing your time and finding the solution! :)
It will be released in the next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants