Initialize delayed visibility

This commit is contained in:
M66B
2021-03-22 09:03:26 +01:00
parent 2d5e45a7a1
commit b247df8feb
2 changed files with 6 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import androidx.annotation.Nullable;
public class ContentLoadingProgressBar extends ProgressBar {
private int visibility = VISIBLE;
private boolean init = false;
private boolean delaying = false;
private static final int VISIBILITY_DELAY = 1500; // milliseconds
@@ -53,8 +54,9 @@ public class ContentLoadingProgressBar extends ProgressBar {
this.visibility = visibility;
if (visibility == VISIBLE) {
if (delaying || super.getVisibility() == VISIBLE)
if (delaying || (init && super.getVisibility() == VISIBLE))
return;
init = true;
delaying = true;
super.setVisibility(INVISIBLE);
ApplicationEx.getMainHandler().postDelayed(delayedShow, VISIBILITY_DELAY);