Keep network state

This commit is contained in:
M66B
2019-03-16 13:12:31 +00:00
parent fa579d3c10
commit 4ca5cd0540
11 changed files with 94 additions and 53 deletions

View File

@@ -687,11 +687,10 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
@Override
public void run() {
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED)) {
Boolean metered = Helper.isMetered(getContext(), false);
Helper.NetworkState networkState = Helper.getNetworkState(getContext());
tvConnectionType.setVisibility(metered == null ? View.GONE : View.VISIBLE);
if (metered != null)
tvConnectionType.setText(metered ? R.string.title_legend_metered : R.string.title_legend_unmetered);
tvConnectionType.setText(networkState.isUnmetered() ? R.string.title_legend_unmetered : R.string.title_legend_metered);
tvConnectionType.setVisibility(networkState.isConnected() ? View.VISIBLE : View.GONE);
}
}
});