1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-01-01 04:35:57 +00:00

Revert "Simplification"

This reverts commit a22fcc9064.
This commit is contained in:
M66B 2020-01-02 20:07:53 +01:00
parent c45757c73b
commit e9c8f0c1b4
3 changed files with 33 additions and 10 deletions

View file

@ -917,8 +917,15 @@ public class FragmentCompose extends FragmentBase {
} }
private void check() { private void check() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) Activity activity = getActivity();
checkInternet(); if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
checkInternet();
}
});
} }
}; };

View file

@ -2734,8 +2734,15 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
} }
private void check() { private void check() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) Activity activity = getActivity();
adapter.checkInternet(); if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
adapter.checkInternet();
}
});
} }
}; };

View file

@ -277,12 +277,21 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}; };
private void showConnectionType() { private void showConnectionType() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) { FragmentActivity activity = getActivity();
ConnectionHelper.NetworkState networkState = ConnectionHelper.getNetworkState(getContext()); if (activity == null)
return;
tvConnectionType.setText(networkState.isUnmetered() ? R.string.title_legend_unmetered : R.string.title_legend_metered); activity.runOnUiThread(new Runnable() {
tvConnectionType.setVisibility(networkState.isConnected() ? View.VISIBLE : View.GONE); @Override
tvConnectionRoaming.setVisibility(networkState.isRoaming() ? View.VISIBLE : View.GONE); public void run() {
} if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED)) {
ConnectionHelper.NetworkState networkState = ConnectionHelper.getNetworkState(getContext());
tvConnectionType.setText(networkState.isUnmetered() ? R.string.title_legend_unmetered : R.string.title_legend_metered);
tvConnectionType.setVisibility(networkState.isConnected() ? View.VISIBLE : View.GONE);
tvConnectionRoaming.setVisibility(networkState.isRoaming() ? View.VISIBLE : View.GONE);
}
}
});
} }
} }