mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-03 10:16:45 +00:00
Increased visibility delay
This commit is contained in:
parent
f4b6b337be
commit
8afe5503a6
2 changed files with 13 additions and 17 deletions
|
@ -30,7 +30,7 @@ public class ContentLoadingProgressBar extends ProgressBar {
|
||||||
private int visibility = VISIBLE;
|
private int visibility = VISIBLE;
|
||||||
private boolean delaying = false;
|
private boolean delaying = false;
|
||||||
|
|
||||||
private static final int VISIBILITY_DELAY = 500; // milliseconds
|
private static final int VISIBILITY_DELAY = 1500; // milliseconds
|
||||||
|
|
||||||
public ContentLoadingProgressBar(@NonNull Context context) {
|
public ContentLoadingProgressBar(@NonNull Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
|
|
|
@ -28,8 +28,9 @@ import androidx.appcompat.widget.AppCompatTextView;
|
||||||
|
|
||||||
public class ViewTextDelayed extends AppCompatTextView {
|
public class ViewTextDelayed extends AppCompatTextView {
|
||||||
private int visibility = VISIBLE;
|
private int visibility = VISIBLE;
|
||||||
|
private boolean delaying = false;
|
||||||
|
|
||||||
private static final int VISIBILITY_DELAY = 500; // milliseconds
|
private static final int VISIBILITY_DELAY = 1500; // milliseconds
|
||||||
|
|
||||||
public ViewTextDelayed(@NonNull Context context) {
|
public ViewTextDelayed(@NonNull Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -47,15 +48,17 @@ public class ViewTextDelayed extends AppCompatTextView {
|
||||||
public void setVisibility(int visibility) {
|
public void setVisibility(int visibility) {
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
|
|
||||||
ApplicationEx.getMainHandler().removeCallbacks(delayedShow);
|
if (visibility == VISIBLE) {
|
||||||
ApplicationEx.getMainHandler().removeCallbacks(delayedHide);
|
if (delaying)
|
||||||
|
return;
|
||||||
if (visibility == VISIBLE)
|
delaying = true;
|
||||||
|
super.setVisibility(INVISIBLE);
|
||||||
ApplicationEx.getMainHandler().postDelayed(delayedShow, VISIBILITY_DELAY);
|
ApplicationEx.getMainHandler().postDelayed(delayedShow, VISIBILITY_DELAY);
|
||||||
else if (visibility == GONE)
|
} else {
|
||||||
ApplicationEx.getMainHandler().postDelayed(delayedHide, VISIBILITY_DELAY);
|
ApplicationEx.getMainHandler().removeCallbacks(delayedShow);
|
||||||
else
|
delaying = false;
|
||||||
super.setVisibility(visibility);
|
super.setVisibility(visibility);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,16 +69,9 @@ public class ViewTextDelayed extends AppCompatTextView {
|
||||||
private final Runnable delayedShow = new Runnable() {
|
private final Runnable delayedShow = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
delaying = false;
|
||||||
if (visibility == VISIBLE)
|
if (visibility == VISIBLE)
|
||||||
ViewTextDelayed.super.setVisibility(VISIBLE);
|
ViewTextDelayed.super.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final Runnable delayedHide = new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (visibility == GONE)
|
|
||||||
ViewTextDelayed.super.setVisibility(GONE);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue