From 1110eb117a8476db5063f1610fd41b02e7e93241 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 6 Jan 2024 10:03:38 +0100 Subject: [PATCH] Added cards for server data --- .../eu/faircode/email/FragmentAccount.java | 12 +- .../eu/faircode/email/FragmentIdentity.java | 9 +- .../java/eu/faircode/email/FragmentPop.java | 9 +- app/src/main/res/layout/fragment_account.xml | 461 +++++++++-------- app/src/main/res/layout/fragment_identity.xml | 487 +++++++++--------- app/src/main/res/layout/fragment_pop.xml | 408 ++++++++------- 6 files changed, 728 insertions(+), 658 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index 3d1c8a65ed..ddd6cb669b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -101,7 +101,6 @@ public class FragmentAccount extends FragmentBase { private RadioGroup rgEncryption; private CheckBox cbInsecure; private TextView tvInsecureRemark; - private CheckBox cbDane; private EditText etPort; private EditText etUser; private TextInputLayout tilPassword; @@ -141,6 +140,7 @@ public class FragmentAccount extends FragmentBase { private CheckBox cbUnicode; private CheckBox cbUnmetered; private CheckBox cbVpnOnly; + private CheckBox cbDane; private Button btnCheck; private ContentLoadingProgressBar pbCheck; @@ -172,7 +172,6 @@ public class FragmentAccount extends FragmentBase { private ContentLoadingProgressBar pbWait; private Group grpServer; - private Group grpAuthorize; private Group grpCalendar; private Group grpAdvanced; private Group grpFolders; @@ -225,7 +224,6 @@ public class FragmentAccount extends FragmentBase { rgEncryption = view.findViewById(R.id.rgEncryption); cbInsecure = view.findViewById(R.id.cbInsecure); tvInsecureRemark = view.findViewById(R.id.tvInsecureRemark); - cbDane = view.findViewById(R.id.cbDane); etUser = view.findViewById(R.id.etUser); tilPassword = view.findViewById(R.id.tilPassword); tvAppPassword = view.findViewById(R.id.tvAppPassword); @@ -263,6 +261,7 @@ public class FragmentAccount extends FragmentBase { cbUnicode = view.findViewById(R.id.cbUnicode); cbUnmetered = view.findViewById(R.id.cbUnmeteredOnly); cbVpnOnly = view.findViewById(R.id.cbVpnOnly); + cbDane = view.findViewById(R.id.cbDane); btnCheck = view.findViewById(R.id.btnCheck); pbCheck = view.findViewById(R.id.pbCheck); @@ -292,7 +291,6 @@ public class FragmentAccount extends FragmentBase { pbWait = view.findViewById(R.id.pbWait); grpServer = view.findViewById(R.id.grpServer); - grpAuthorize = view.findViewById(R.id.grpAuthorize); grpCalendar = view.findViewById(R.id.grpCalendar); grpAdvanced = view.findViewById(R.id.grpAdvanced); grpFolders = view.findViewById(R.id.grpFolders); @@ -308,7 +306,6 @@ public class FragmentAccount extends FragmentBase { auth == AUTH_TYPE_PASSWORD && "gmail".equals(provider.id) ? View.VISIBLE : View.GONE); grpServer.setVisibility(position > 0 ? View.VISIBLE : View.GONE); - grpAuthorize.setVisibility(position > 0 ? View.VISIBLE : View.GONE); grpCalendar.setVisibility(position > 0 && !BuildConfig.PLAY_STORE_RELEASE ? View.VISIBLE : View.GONE); btnAdvanced.setVisibility(position > 0 ? View.VISIBLE : View.GONE); @@ -666,7 +663,6 @@ public class FragmentAccount extends FragmentBase { tvInstructions.setMovementMethod(LinkMovementMethodCompat.getInstance()); grpServer.setVisibility(View.GONE); - grpAuthorize.setVisibility(View.GONE); grpCalendar.setVisibility(View.GONE); grpAdvanced.setVisibility(View.GONE); grpFolders.setVisibility(View.GONE); @@ -1691,8 +1687,6 @@ public class FragmentAccount extends FragmentBase { rgEncryption.check(R.id.radio_ssl); cbInsecure.setChecked(account == null ? false : account.insecure); - cbDane.setChecked(account == null ? false : account.dane); - cbDane.setEnabled(!cbInsecure.isChecked()); etUser.setText(account == null ? null : account.user); tilPassword.getEditText().setText(account == null ? null : account.password); @@ -1732,6 +1726,8 @@ public class FragmentAccount extends FragmentBase { cbUnicode.setChecked(account == null ? false : account.unicode); cbUnmetered.setChecked(jcondition.optBoolean("unmetered")); cbVpnOnly.setChecked(jcondition.optBoolean("vpn_only")); + cbDane.setChecked(account == null ? false : account.dane); + cbDane.setEnabled(!cbInsecure.isChecked()); if (account != null && account.use_date) rgDate.check(R.id.radio_date_header); diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 5c97b4d344..00ceeddacf 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -102,7 +102,6 @@ public class FragmentIdentity extends FragmentBase { private RadioGroup rgEncryption; private CheckBox cbInsecure; private TextView tvInsecureRemark; - private CheckBox cbDane; private EditText etPort; private EditText etUser; private TextInputLayout tilPassword; @@ -137,6 +136,7 @@ public class FragmentIdentity extends FragmentBase { private CheckBox cbUnicode; private CheckBox cbOctetMime; private EditText etMaxSize; + private CheckBox cbDane; private Button btnSave; private ContentLoadingProgressBar pbSave; @@ -210,7 +210,6 @@ public class FragmentIdentity extends FragmentBase { rgEncryption = view.findViewById(R.id.rgEncryption); cbInsecure = view.findViewById(R.id.cbInsecure); tvInsecureRemark = view.findViewById(R.id.tvInsecureRemark); - cbDane = view.findViewById(R.id.cbDane); etPort = view.findViewById(R.id.etPort); etUser = view.findViewById(R.id.etUser); tilPassword = view.findViewById(R.id.tilPassword); @@ -245,6 +244,7 @@ public class FragmentIdentity extends FragmentBase { cbUnicode = view.findViewById(R.id.cbUnicode); cbOctetMime = view.findViewById(R.id.cbOctetMime); etMaxSize = view.findViewById(R.id.etMaxSize); + cbDane = view.findViewById(R.id.cbDane); btnSave = view.findViewById(R.id.btnSave); pbSave = view.findViewById(R.id.pbSave); @@ -573,6 +573,7 @@ public class FragmentIdentity extends FragmentBase { // Initialize Helper.setViewsEnabled(view, false); + btnAutoConfig.setEnabled(false); pbAutoConfig.setVisibility(View.GONE); @@ -1290,8 +1291,6 @@ public class FragmentIdentity extends FragmentBase { rgEncryption.check(R.id.radio_ssl); cbInsecure.setChecked(identity == null ? false : identity.insecure); - cbDane.setChecked(identity == null ? false : identity.dane); - cbDane.setEnabled(!cbInsecure.isChecked()); etPort.setText(identity == null ? null : Long.toString(identity.port)); etUser.setText(identity == null ? null : identity.user); tilPassword.getEditText().setText(identity == null ? null : identity.password); @@ -1332,6 +1331,8 @@ public class FragmentIdentity extends FragmentBase { cbEncryptDefault.setChecked(identity != null && identity.encrypt_default); cbUnicode.setChecked(identity != null && identity.unicode); cbOctetMime.setChecked(identity != null && identity.octetmime); + cbDane.setChecked(identity == null ? false : identity.dane); + cbDane.setEnabled(!cbInsecure.isChecked()); auth = (identity == null ? AUTH_TYPE_PASSWORD : identity.auth_type); provider = (identity == null ? null : identity.provider); diff --git a/app/src/main/java/eu/faircode/email/FragmentPop.java b/app/src/main/java/eu/faircode/email/FragmentPop.java index 373fe53b05..779b2b5782 100644 --- a/app/src/main/java/eu/faircode/email/FragmentPop.java +++ b/app/src/main/java/eu/faircode/email/FragmentPop.java @@ -76,7 +76,6 @@ public class FragmentPop extends FragmentBase { private RadioGroup rgEncryption; private CheckBox cbInsecure; private TextView tvInsecureRemark; - private CheckBox cbDane; private EditText etPort; private EditText etUser; private TextInputLayout tilPassword; @@ -108,6 +107,7 @@ public class FragmentPop extends FragmentBase { private EditText etInterval; private CheckBox cbUnmetered; private CheckBox cbVpnOnly; + private CheckBox cbDane; private ArrayAdapter adapterSwipe; private Spinner spLeft; @@ -157,7 +157,6 @@ public class FragmentPop extends FragmentBase { rgEncryption = view.findViewById(R.id.rgEncryption); cbInsecure = view.findViewById(R.id.cbInsecure); tvInsecureRemark = view.findViewById(R.id.tvInsecureRemark); - cbDane = view.findViewById(R.id.cbDane); etUser = view.findViewById(R.id.etUser); tilPassword = view.findViewById(R.id.tilPassword); tvPasswordStorage = view.findViewById(R.id.tvPasswordStorage); @@ -187,6 +186,7 @@ public class FragmentPop extends FragmentBase { etInterval = view.findViewById(R.id.etInterval); cbUnmetered = view.findViewById(R.id.cbUnmeteredOnly); cbVpnOnly = view.findViewById(R.id.cbVpnOnly); + cbDane = view.findViewById(R.id.cbDane); spLeft = view.findViewById(R.id.spLeft); spRight = view.findViewById(R.id.spRight); @@ -848,8 +848,6 @@ public class FragmentPop extends FragmentBase { rgEncryption.check(R.id.radio_ssl); cbInsecure.setChecked(account == null ? false : account.insecure); - cbDane.setChecked(account == null ? false : account.dane); - cbDane.setEnabled(!cbInsecure.isChecked()); etUser.setText(account == null ? null : account.user); tilPassword.getEditText().setText(account == null ? null : account.password); @@ -882,6 +880,9 @@ public class FragmentPop extends FragmentBase { etInterval.setText(account == null ? "" : Long.toString(account.poll_interval)); cbUnmetered.setChecked(jcondition.optBoolean("unmetered")); cbVpnOnly.setChecked(jcondition.optBoolean("vpn_only")); + cbDane.setChecked(account == null ? false : account.dane); + cbDane.setEnabled(!cbInsecure.isChecked()); + cbIdentity.setChecked(account == null); List folders = getSwipeActions(); diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index 71546da86b..0c79e90c2c 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -105,236 +105,260 @@ - - - - - - - - - - - - - + app:layout_constraintTop_toBottomOf="@id/btnAutoConfig"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:paddingHorizontal="6dp" + android:paddingVertical="12dp"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +