HabitRPG / habitica-android

Native Android app for Habitica
GNU General Public License v3.0
1.46k stars 520 forks source link

Fix IndeterminateProgressView not removing (WearOS) #1957

Closed shane-tang closed 1 year ago

shane-tang commented 1 year ago

There was a bug where wrapperBinding.root.removeView(progressView) was always evaluating progressView as null, so the IndeterminateProgressView was never actually being removed from the ViewGroup.

Even though the progressView = null assignment happens on line 84 and ...removeView(progressView) gets invoked on line 82, ...removeView(progressView) is invoked inside progressView?.post { ... }, meaning it gets scheduled on the UI thread and doesn't actually evaluate progressView until after the progressView = null reassignment. This PR moves the progressView = null assignment inside the UI runnable after the ...removeView(progressView) invocation.

image

This PR also mimics the smooth ease-in animation when the progress bar completes. If this was not added, the progress bar would smoothly reveal itself then abruptly disappear (see second video). Now, the progress bar smoothly reveals itself then smoothly disappears (see third video).


Current Behavior Without Ease-Out With Ease-Out

My Habitica User-ID: 99f20106-7060-4398-b565-26e56c4de2ad

Hafizzle commented 1 year ago

@shane-tang TY for submitting this! I've reviewed and tested the changes, it works well. I'll go ahead and merge the PR. Thank you again!