From 6982b635aed064783a4e6b96d5ce0bc7a91c1625 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 6 Nov 2022 10:02:21 +0100 Subject: [PATCH] VirusTotal: use text input layout for API key --- .../faircode/email/FragmentOptionsMisc.java | 8 +++---- .../main/res/layout/fragment_options_misc.xml | 24 ++++++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java index d69656d28b..4ad3eb3729 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsMisc.java @@ -135,7 +135,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc private ImageButton ibDeepL; private SwitchCompat swVirusTotal; private TextView tvVirusTotalPrivacy; - private EditText etVirusTotal; + private TextInputLayout tilVirusTotal; private ImageButton ibVirusTotal; private SwitchCompat swSend; private EditText etSend; @@ -352,7 +352,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc ibDeepL = view.findViewById(R.id.ibDeepL); swVirusTotal = view.findViewById(R.id.swVirusTotal); tvVirusTotalPrivacy = view.findViewById(R.id.tvVirusTotalPrivacy); - etVirusTotal = view.findViewById(R.id.etVirusTotal); + tilVirusTotal = view.findViewById(R.id.tilVirusTotal); ibVirusTotal = view.findViewById(R.id.ibVirusTotal); swSend = view.findViewById(R.id.swSend); etSend = view.findViewById(R.id.etSend); @@ -791,7 +791,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc } }); - etVirusTotal.addTextChangedListener(new TextWatcher() { + tilVirusTotal.getEditText().addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { // Do nothing @@ -2140,7 +2140,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc tilLanguageToolKey.getEditText().setText(prefs.getString("lt_key", null)); swDeepL.setChecked(prefs.getBoolean("deepl_enabled", false)); swVirusTotal.setChecked(prefs.getBoolean("vt_enabled", false)); - etVirusTotal.setText(prefs.getString("vt_apikey", null)); + tilVirusTotal.getEditText().setText(prefs.getString("vt_apikey", null)); swSend.setChecked(prefs.getBoolean("send_enabled", false)); etSend.setText(prefs.getString("send_host", null)); swUpdates.setChecked(prefs.getBoolean("updates", true)); diff --git a/app/src/main/res/layout/fragment_options_misc.xml b/app/src/main/res/layout/fragment_options_misc.xml index 5d031e614a..8b61f6b391 100644 --- a/app/src/main/res/layout/fragment_options_misc.xml +++ b/app/src/main/res/layout/fragment_options_misc.xml @@ -500,17 +500,25 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swVirusTotal" /> - + app:layout_constraintTop_toBottomOf="@+id/tvVirusTotalPrivacy"> + + + + app:constraint_referenced_ids="swVirusTotal,tvVirusTotalPrivacy,ibVirusTotal,tilVirusTotal" />