mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-03 18:26:20 +00:00
Added LT picky option
This commit is contained in:
parent
a38e39c2f4
commit
2f2a255cda
3 changed files with 32 additions and 2 deletions
|
@ -122,6 +122,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private TextView tvFtsPro;
|
||||
private Spinner spLanguage;
|
||||
private SwitchCompat swLanguageTool;
|
||||
private SwitchCompat swLanguageToolPicky;
|
||||
private TextView tvLanguageToolPrivacy;
|
||||
private ImageButton ibLanguageTool;
|
||||
private SwitchCompat swDeepL;
|
||||
|
@ -241,7 +242,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"sort_answers", "shortcuts", "fts",
|
||||
"classification", "class_min_probability", "class_min_difference",
|
||||
"language", "lt_enabled", "deepl_enabled", "vt_enabled", "vt_apikey", "send_enabled", "send_host",
|
||||
"language", "lt_enabled", "lt_picky", "deepl_enabled", "vt_enabled", "vt_apikey", "send_enabled", "send_host",
|
||||
"updates", "weekly", "show_changelog",
|
||||
"crash_reports", "cleanup_attachments",
|
||||
"watchdog", "experiments", "main_log", "main_log_memory", "protocol", "log_level", "debug", "leak_canary",
|
||||
|
@ -326,6 +327,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
tvFtsPro = view.findViewById(R.id.tvFtsPro);
|
||||
spLanguage = view.findViewById(R.id.spLanguage);
|
||||
swLanguageTool = view.findViewById(R.id.swLanguageTool);
|
||||
swLanguageToolPicky = view.findViewById(R.id.swLanguageToolPicky);
|
||||
tvLanguageToolPrivacy = view.findViewById(R.id.tvLanguageToolPrivacy);
|
||||
ibLanguageTool = view.findViewById(R.id.ibLanguageTool);
|
||||
swDeepL = view.findViewById(R.id.swDeepL);
|
||||
|
@ -633,6 +635,14 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("lt_enabled", checked).apply();
|
||||
swLanguageToolPicky.setEnabled(checked);
|
||||
}
|
||||
});
|
||||
|
||||
swLanguageToolPicky.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("lt_picky", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1996,6 +2006,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
spLanguage.setSelection(selected);
|
||||
|
||||
swLanguageTool.setChecked(prefs.getBoolean("lt_enabled", false));
|
||||
swLanguageToolPicky.setChecked(prefs.getBoolean("lt_picky", false));
|
||||
swLanguageToolPicky.setEnabled(swLanguageTool.isChecked());
|
||||
swDeepL.setChecked(prefs.getBoolean("deepl_enabled", false));
|
||||
swVirusTotal.setChecked(prefs.getBoolean("vt_enabled", false));
|
||||
etVirusTotal.setText(prefs.getString("vt_apikey", null));
|
||||
|
|
|
@ -76,6 +76,12 @@ public class LanguageTool {
|
|||
if (code != null)
|
||||
request += "&preferredVariants=" + code;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean lt_picky = prefs.getBoolean("lt_picky", false);
|
||||
|
||||
if (lt_picky)
|
||||
request += "&level=picky";
|
||||
|
||||
Log.i("LT locale=" + locale + " request=" + request);
|
||||
|
||||
URL url = new URL(LT_URI + "check");
|
||||
|
|
|
@ -343,6 +343,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLanguageToolHint" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swLanguageToolPicky"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_translate_formal"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvLanguageToolPrivacy"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/ibLanguageTool"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -351,7 +363,7 @@
|
|||
android:contentDescription="@string/title_info"
|
||||
android:tooltipText="@string/title_info"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvLanguageToolPrivacy"
|
||||
app:layout_constraintTop_toBottomOf="@id/swLanguageToolPicky"
|
||||
app:srcCompat="@drawable/twotone_info_24" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
|
|
Loading…
Reference in a new issue