Refactoring

This commit is contained in:
M66B 2022-07-11 11:35:53 +02:00
parent f4a294bbe8
commit f38e54b7db
5 changed files with 20 additions and 14 deletions

View File

@ -636,8 +636,13 @@ public class ApplicationEx extends Application
editor.putBoolean("auto_identity", true);
} else if (version < 1931)
editor.remove("button_force_light").remove("fake_dark");
else if (version < 1933)
else if (version < 1933) {
editor.putBoolean("lt_enabled", true);
if (prefs.contains("disable_top")) {
editor.putBoolean("use_top", !prefs.getBoolean("disable_top", false));
editor.remove("disable_top");
}
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && !BuildConfig.DEBUG)
editor.remove("background_service");

View File

@ -190,14 +190,14 @@ public class EmailService implements AutoCloseable {
boolean auth_ntlm = prefs.getBoolean("auth_ntlm", true);
boolean auth_sasl = prefs.getBoolean("auth_sasl", true);
boolean auth_apop = prefs.getBoolean("auth_apop", false);
boolean disable_top = prefs.getBoolean("disable_top", false);
boolean use_top = prefs.getBoolean("use_top", true);
Log.i("Authenticate" +
" plain=" + auth_plain +
" login=" + auth_login +
" ntlm=" + auth_ntlm +
" sasl=" + auth_sasl +
" apop=" + auth_apop +
" disable_top=" + disable_top);
" use_top=" + use_top);
properties.put("mail.event.scope", "folder");
properties.put("mail.event.executor", executor);
@ -210,7 +210,7 @@ public class EmailService implements AutoCloseable {
properties.put("mail." + protocol + ".auth.ntlm.disable", "true");
if (auth_apop)
properties.put("mail." + protocol + ".apop.enable", "true");
if (disable_top)
if (!use_top)
properties.put("mail." + protocol + ".disabletop", "true");
// SASL is attempted before other authentication methods

View File

@ -177,7 +177,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swAuthNtlm;
private SwitchCompat swAuthSasl;
private SwitchCompat swAuthApop;
private SwitchCompat swDisableTop;
private SwitchCompat swUseTop;
private SwitchCompat swKeepAlivePoll;
private SwitchCompat swEmptyPool;
private SwitchCompat swIdleDone;
@ -227,7 +227,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
"webview_legacy", "browser_zoom", "fake_dark",
"show_recent",
"use_modseq", "uid_command", "perform_expunge", "uid_expunge",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "disable_top",
"auth_plain", "auth_login", "auth_ntlm", "auth_sasl", "auth_apop", "use_top",
"keep_alive_poll", "empty_pool", "idle_done", "logarithmic_backoff",
"exact_alarms", "infra", "dkim_verify", "dup_msgids", "test_iab"
};
@ -362,7 +362,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swAuthNtlm = view.findViewById(R.id.swAuthNtlm);
swAuthSasl = view.findViewById(R.id.swAuthSasl);
swAuthApop = view.findViewById(R.id.swAuthApop);
swDisableTop = view.findViewById(R.id.swDisableTop);
swUseTop = view.findViewById(R.id.swUseTop);
swKeepAlivePoll = view.findViewById(R.id.swKeepAlivePoll);
swEmptyPool = view.findViewById(R.id.swEmptyPool);
swIdleDone = view.findViewById(R.id.swIdleDone);
@ -1180,10 +1180,10 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
swDisableTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
swUseTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("disable_top", checked).apply();
prefs.edit().putBoolean("use_top", checked).apply();
}
});
@ -1847,7 +1847,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swAuthNtlm.setChecked(prefs.getBoolean("auth_ntlm", true));
swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true));
swAuthApop.setChecked(prefs.getBoolean("auth_apop", false));
swDisableTop.setChecked(prefs.getBoolean("disable_top", false));
swUseTop.setChecked(prefs.getBoolean("use_top", true));
swKeepAlivePoll.setChecked(prefs.getBoolean("keep_alive_poll", false));
swEmptyPool.setChecked(prefs.getBoolean("empty_pool", true));
swIdleDone.setChecked(prefs.getBoolean("idle_done", true));

View File

@ -1232,11 +1232,12 @@
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swDisableTop"
android:id="@+id/swUseTop"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_disable_top"
android:checked="true"
android:text="@string/title_advanced_use_top"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthApop"
@ -1250,7 +1251,7 @@
android:text="@string/title_advanced_keep_alive_poll"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDisableTop"
app:layout_constraintTop_toBottomOf="@id/swUseTop"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat

View File

@ -778,7 +778,7 @@
<string name="title_advanced_auth_ntlm" translatable="false">NTLM</string>
<string name="title_advanced_auth_sasl" translatable="false">SASL</string>
<string name="title_advanced_auth_apop" translatable="false">APOP</string>
<string name="title_advanced_disable_top" translatable="false">Disable TOP</string>
<string name="title_advanced_use_top" translatable="false">Use TOP</string>
<string name="title_advanced_idle_done" translatable="false">IDLE/DONE</string>
<string name="title_advanced_logarithmic_backoff" translatable="false">Logarithmic back-off</string>
<string name="title_advanced_logarithmic_backoff_hint" translatable="false">Turning this off can result in a significant increase in battery usage!</string>