ProgressDialog that waits a minimum time to be dismissed before showing. Once visible, the ProgressDialog will be visible for a minimum amount of time to avoid "flashes" in the UI.
I found a race timing dependent issue where the dialog is not dismissed in some cases, when the dialog it dismissed shortly after it has been shown.
ContentLoadingProgressDialog.dismiss() is called
it fires mDelayedHide
onAttachedToWindow() is called before mDelayedHide executes, and remove the callback
as a consequence, the callback is not called and the dialog not dismissed
Although I could reprod it easily, it might be difficult to reproduce on a particular phone / Android version as it is really timing dependent.
Raising minShowTime to 1000 or higher seems to fix it.
It can also possibly fixed by modifying onAttachedToWindow() to not remove the callback if the dislog is in the process of being dismissed (not sure this is the correct fix though)