2018-12-27 12:31:02 +00:00
|
|
|
package eu.faircode.email;
|
|
|
|
|
2018-12-31 08:04:33 +00:00
|
|
|
/*
|
|
|
|
This file is part of FairEmail.
|
|
|
|
|
|
|
|
FairEmail is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
FairEmail is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
Copyright 2018-2019 by Marcel Bokhorst (M66B)
|
|
|
|
*/
|
|
|
|
|
2018-12-27 12:31:02 +00:00
|
|
|
import android.content.Context;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.widget.ProgressBar;
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
|
|
public class ContentLoadingProgressBar extends ProgressBar {
|
|
|
|
public ContentLoadingProgressBar(@NonNull Context context) {
|
|
|
|
this(context, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public ContentLoadingProgressBar(@NonNull Context context, @Nullable AttributeSet attrs) {
|
|
|
|
super(context, attrs, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void setVisibility(int visibility) {
|
2019-01-29 08:35:42 +00:00
|
|
|
if (false && BuildConfig.DEBUG) {
|
|
|
|
super.setVisibility(visibility);
|
|
|
|
return;
|
|
|
|
}
|
2018-12-27 12:31:02 +00:00
|
|
|
removeCallbacks(delayedShow);
|
|
|
|
if (visibility == VISIBLE) {
|
|
|
|
super.setVisibility(INVISIBLE);
|
|
|
|
postDelayed(delayedShow, 500);
|
|
|
|
} else
|
|
|
|
super.setVisibility(visibility);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final Runnable delayedShow = new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
ContentLoadingProgressBar.super.setVisibility(VISIBLE);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|