1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-31 20:25:38 +00:00

Prevent crash

This commit is contained in:
M66B 2021-10-17 07:02:00 +02:00
parent f00427136b
commit fba29ddbdd

View file

@ -55,6 +55,7 @@ import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.Group;
import androidx.core.view.MenuCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.Observer;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.preference.PreferenceManager;
@ -748,7 +749,7 @@ public class FragmentSetup extends FragmentBase {
view.post(new Runnable() {
@Override
public void run() {
tvNoInternet.setVisibility(View.GONE);
updateInternet(true);
}
});
}
@ -758,10 +759,16 @@ public class FragmentSetup extends FragmentBase {
view.post(new Runnable() {
@Override
public void run() {
tvNoInternet.setVisibility(View.VISIBLE);
updateInternet(false);
}
});
}
private void updateInternet(boolean available) {
if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
return;
tvNoInternet.setVisibility(available ? View.GONE : View.VISIBLE);
}
};
public static class FragmentDialogDoze extends FragmentDialogBase {