diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java
index 13a095a1b6..039464a608 100644
--- a/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java
+++ b/app/src/main/java/eu/faircode/email/FragmentOptionsBehavior.java
@@ -48,6 +48,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swDoubleBack;
private SwitchCompat swConversationActions;
private SwitchCompat swConversationActionsReplies;
+ private SwitchCompat swLanguageDetection;
private EditText etDefaultSnooze;
private SwitchCompat swPull;
private SwitchCompat swAutoScroll;
@@ -72,7 +73,8 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private Group grpConversationActions;
private final static String[] RESET_OPTIONS = new String[]{
- "double_back", "conversation_actions", "conversation_actions_replies", "default_snooze",
+ "double_back", "conversation_actions", "conversation_actions_replies", "language_detection",
+ "default_snooze",
"pull", "autoscroll", "quick_filter", "quick_scroll",
"doubletap", "swipenav", "volumenav", "reversed",
"autoexpand", "expand_all", "expand_one", "collapse_multiple",
@@ -93,6 +95,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swDoubleBack = view.findViewById(R.id.swDoubleBack);
swConversationActions = view.findViewById(R.id.swConversationActions);
swConversationActionsReplies = view.findViewById(R.id.swConversationActionsReplies);
+ swLanguageDetection = view.findViewById(R.id.swLanguageDetection);
etDefaultSnooze = view.findViewById(R.id.etDefaultSnooze);
swPull = view.findViewById(R.id.swPull);
swAutoScroll = view.findViewById(R.id.swAutoScroll);
@@ -144,6 +147,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
+ swLanguageDetection.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
+ prefs.edit().putBoolean("language_detection", checked).apply();
+ }
+ });
+
etDefaultSnooze.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
@@ -376,6 +386,9 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swConversationActions.setChecked(prefs.getBoolean("conversation_actions", true));
swConversationActionsReplies.setChecked(prefs.getBoolean("conversation_actions_replies", true));
swConversationActionsReplies.setEnabled(swConversationActions.isChecked());
+ swLanguageDetection.setChecked(prefs.getBoolean("language_detection", true));
+ swLanguageDetection.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.Q ? View.GONE : View.VISIBLE);
+
int default_snooze = prefs.getInt("default_snooze", 1);
etDefaultSnooze.setText(default_snooze == 1 ? null : Integer.toString(default_snooze));
etDefaultSnooze.setHint("1");
diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java
index 125b2aeb91..e8c22e26d4 100644
--- a/app/src/main/java/eu/faircode/email/HtmlHelper.java
+++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java
@@ -1108,8 +1108,8 @@ public class HtmlHelper {
static String getLanguage(Context context, String body) {
try {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
- boolean conversation_actions = prefs.getBoolean("conversation_actions", true);
- if (!conversation_actions)
+ boolean language_detection = prefs.getBoolean("language_detection", true);
+ if (!language_detection)
return null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
diff --git a/app/src/main/res/layout/fragment_options_behavior.xml b/app/src/main/res/layout/fragment_options_behavior.xml
index a9792aa383..2aa072a773 100644
--- a/app/src/main/res/layout/fragment_options_behavior.xml
+++ b/app/src/main/res/layout/fragment_options_behavior.xml
@@ -64,6 +64,17 @@
app:layout_constraintTop_toBottomOf="@id/swConversationActions"
app:switchPadding="12dp" />
+
+
+ app:layout_constraintTop_toBottomOf="@id/swLanguageDetection" />
Show frequently used contacts in Android share menu
Suggest actions
Suggest reply texts
+ Detect message text language
Build search index
%1$d / %2$d messages indexed (%3$s)
Force English language