mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-01 22:56:33 +02:00
Added option to set auto download size
This commit is contained in:
@@ -25,7 +25,9 @@ import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -42,6 +44,7 @@ public class FragmentOptions extends FragmentEx {
|
||||
private SwitchCompat swSwipe;
|
||||
private SwitchCompat swNav;
|
||||
private SwitchCompat swInsecure;
|
||||
private Spinner spDownload;
|
||||
private SwitchCompat swDebug;
|
||||
|
||||
@Override
|
||||
@@ -62,6 +65,7 @@ public class FragmentOptions extends FragmentEx {
|
||||
swSwipe = view.findViewById(R.id.swSwipe);
|
||||
swNav = view.findViewById(R.id.swNav);
|
||||
swInsecure = view.findViewById(R.id.swInsecure);
|
||||
spDownload = view.findViewById(R.id.spDownload);
|
||||
swDebug = view.findViewById(R.id.swDebug);
|
||||
|
||||
// Wire controls
|
||||
@@ -152,6 +156,25 @@ public class FragmentOptions extends FragmentEx {
|
||||
}
|
||||
});
|
||||
|
||||
int download = prefs.getInt("download", 32768);
|
||||
final int[] values = getResources().getIntArray(R.array.downloadValues);
|
||||
for (int i = 0; i < values.length; i++)
|
||||
if (values[i] == download) {
|
||||
spDownload.setSelection(i);
|
||||
break;
|
||||
}
|
||||
spDownload.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
prefs.edit().putInt("download", values[position]).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
prefs.edit().remove("download").apply();
|
||||
}
|
||||
});
|
||||
|
||||
swDebug.setChecked(prefs.getBoolean("debug", false));
|
||||
swDebug.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user