Added setting for roam-like-at-home

This commit is contained in:
M66B
2019-05-10 17:29:07 +02:00
parent 3568209a3b
commit 7533fc067c
4 changed files with 81 additions and 3 deletions

View File

@@ -48,11 +48,12 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
private SwitchCompat swMetered;
private Spinner spDownload;
private SwitchCompat swRoaming;
private SwitchCompat swRlah;
private TextView tvConnectionType;
private TextView tvConnectionRoaming;
private final static String[] RESET_OPTIONS = new String[]{
"metered", "download", "roaming"
"metered", "download", "roaming", "rlah"
};
@Override
@@ -68,6 +69,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
swMetered = view.findViewById(R.id.swMetered);
spDownload = view.findViewById(R.id.spDownload);
swRoaming = view.findViewById(R.id.swRoaming);
swRlah = view.findViewById(R.id.swRlah);
tvConnectionType = view.findViewById(R.id.tvConnectionType);
tvConnectionRoaming = view.findViewById(R.id.tvConnectionRoaming);
@@ -107,6 +109,14 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
});
swRlah.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("rlah", checked).apply();
ServiceSynchronize.reload(getContext(), "rlah=" + checked);
}
});
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
tvConnectionType.setVisibility(View.GONE);
@@ -183,6 +193,7 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
swRoaming.setChecked(prefs.getBoolean("roaming", true));
swRlah.setChecked(prefs.getBoolean("rlah", false));
}
private ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {