Added setting to disable downloading while roaming

This commit is contained in:
M66B
2019-04-19 20:13:27 +02:00
parent a095d645fb
commit bc9259d042
4 changed files with 25 additions and 14 deletions

View File

@@ -71,6 +71,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
private TextView tvConnectionRoaming;
private SwitchCompat swMetered;
private Spinner spDownload;
private SwitchCompat swRoaming;
private Spinner spStartup;
private SwitchCompat swDate;
@@ -126,7 +127,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
private final static String[] ADVANCED_OPTIONS = new String[]{
"enabled", "schedule_start", "schedule_end",
"metered", "download",
"metered", "download", "roaming",
"startup", "date", "threading", "avatars", "identicons", "name_email", "subject_italic", "flags", "preview",
"addresses", "monospaced", "autohtml", "autoimages", "actionbar",
"pull", "swipenav", "autoexpand", "autoclose", "autonext", "collapse", "autoread", "automove",
@@ -155,6 +156,7 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
tvConnectionRoaming = view.findViewById(R.id.tvConnectionRoaming);
swMetered = view.findViewById(R.id.swMetered);
spDownload = view.findViewById(R.id.spDownload);
swRoaming = view.findViewById(R.id.swRoaming);
spStartup = view.findViewById(R.id.spStartup);
swDate = view.findViewById(R.id.swDate);
@@ -281,6 +283,14 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
}
});
swRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("roaming", checked).apply();
ServiceSynchronize.reload(getContext(), "roaming=" + checked);
}
});
spStartup.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
@@ -652,6 +662,8 @@ public class FragmentOptions extends FragmentBase implements SharedPreferences.O
break;
}
swRoaming.setChecked(prefs.getBoolean("roaming", true));
boolean compact = prefs.getBoolean("compact", false);
String startup = prefs.getString("startup", "unified");