Added option to show local contacts in addition to Android contacts

This commit is contained in:
M66B
2019-08-23 15:06:59 +02:00
parent 6d68db87ec
commit 84d80ce1b8
4 changed files with 78 additions and 66 deletions

View File

@@ -40,6 +40,7 @@ import androidx.preference.PreferenceManager;
public class FragmentOptionsSend extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swKeyboard;
private SwitchCompat swSuggestLocal;
private SwitchCompat swPrefixOnce;
private SwitchCompat swPlainOnly;
private SwitchCompat swUsenetSignature;
@@ -51,7 +52,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private Spinner spSendDelayed;
private final static String[] RESET_OPTIONS = new String[]{
"keyboard", "prefix_once", "plain_only", "usenet_signature", "autoresize", "resize", "lookup_mx", "autosend", "send_delayed"
"keyboard", "suggest_local", "prefix_once", "plain_only", "usenet_signature", "autoresize", "resize", "lookup_mx", "autosend", "send_delayed"
};
@Override
@@ -65,6 +66,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
// Get controls
swKeyboard = view.findViewById(R.id.swKeyboard);
swSuggestLocal = view.findViewById(R.id.swSuggestLocal);
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
swPlainOnly = view.findViewById(R.id.swPlainOnly);
swUsenetSignature = view.findViewById(R.id.swUsenetSignature);
@@ -88,6 +90,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
swSuggestLocal.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("suggest_local", checked).apply();
}
});
swPrefixOnce.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@@ -204,6 +213,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
swKeyboard.setChecked(prefs.getBoolean("keyboard", true));
swSuggestLocal.setChecked(prefs.getBoolean("suggest_local", false));
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
swUsenetSignature.setChecked(prefs.getBoolean("usenet_signature", false));