From 1b8711c04886f2e67e2b1cfc626b49c25d59333b Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 9 Sep 2019 16:44:06 +0200 Subject: [PATCH] Added account/identity support button --- FAQ.md | 2 ++ .../eu/faircode/email/FragmentAccount.java | 18 +++++++++++++++--- .../eu/faircode/email/FragmentIdentity.java | 18 +++++++++++++++--- .../eu/faircode/email/FragmentQuickSetup.java | 19 +++++++++++++++---- app/src/main/res/layout/fragment_account.xml | 12 ++++++++++++ app/src/main/res/layout/fragment_identity.xml | 12 ++++++++++++ .../main/res/layout/fragment_quick_setup.xml | 12 ++++++++++++ 7 files changed, 83 insertions(+), 10 deletions(-) diff --git a/FAQ.md b/FAQ.md index ea7fb11429..d920e757f5 100644 --- a/FAQ.md +++ b/FAQ.md @@ -21,6 +21,8 @@ For authorizing: * Microsoft Exchange: see [question 8](#user-content-faq8) * Yahoo!: see [question 88](#user-content-faq88) +Please see [here](#user-content-faq22) for common error messages. + ## Known problems * ~~A [bug in Android 5.1 and 6](https://issuetracker.google.com/issues/37054851) causes apps to sometimes show a wrong time format. Toggling the Android setting *Use 24-hour format* might temporarily solve the issue. A workaround was added.~~ diff --git a/app/src/main/java/eu/faircode/email/FragmentAccount.java b/app/src/main/java/eu/faircode/email/FragmentAccount.java index a3a948235d..dc83662715 100644 --- a/app/src/main/java/eu/faircode/email/FragmentAccount.java +++ b/app/src/main/java/eu/faircode/email/FragmentAccount.java @@ -129,6 +129,7 @@ public class FragmentAccount extends FragmentBase { private ContentLoadingProgressBar pbSave; private TextView tvError; private Button btnHelp; + private Button btnSupport; private TextView tvInstructions; private ContentLoadingProgressBar pbWait; @@ -222,6 +223,7 @@ public class FragmentAccount extends FragmentBase { tvError = view.findViewById(R.id.tvError); btnHelp = view.findViewById(R.id.btnHelp); + btnSupport = view.findViewById(R.id.btnSupport); tvInstructions = view.findViewById(R.id.tvInstructions); pbWait = view.findViewById(R.id.pbWait); @@ -398,6 +400,13 @@ public class FragmentAccount extends FragmentBase { } }); + btnSupport.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Helper.view(getContext(), Uri.parse(Helper.FAQ_URI + "#user-content-authorizing-accounts"), false); + } + }); + adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_item1, android.R.id.text1, new ArrayList()); adapter.setDropDownViewResource(R.layout.spinner_item1_dropdown); @@ -436,6 +445,7 @@ public class FragmentAccount extends FragmentBase { tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); tvInstructions.setMovementMethod(LinkMovementMethod.getInstance()); @@ -512,6 +522,7 @@ public class FragmentAccount extends FragmentBase { grpFolders.setVisibility(View.GONE); tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); } @@ -750,6 +761,7 @@ public class FragmentAccount extends FragmentBase { pbSave.setVisibility(View.VISIBLE); tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); } @@ -1123,6 +1135,8 @@ public class FragmentAccount extends FragmentBase { btnHelp.setVisibility(View.VISIBLE); } + btnSupport.setVisibility(View.VISIBLE); + if (provider != null && provider.documentation != null) { tvInstructions.setText(HtmlHelper.fromHtml(provider.documentation.toString())); tvInstructions.setVisibility(View.VISIBLE); @@ -1133,10 +1147,8 @@ public class FragmentAccount extends FragmentBase { public void run() { if (provider != null && provider.documentation != null) scroll.smoothScrollTo(0, tvInstructions.getBottom()); - else if (provider != null && provider.link != null) - scroll.smoothScrollTo(0, btnHelp.getBottom()); else - scroll.smoothScrollTo(0, tvError.getBottom()); + scroll.smoothScrollTo(0, btnSupport.getBottom()); } }); } diff --git a/app/src/main/java/eu/faircode/email/FragmentIdentity.java b/app/src/main/java/eu/faircode/email/FragmentIdentity.java index 8b13fbf369..133806c888 100644 --- a/app/src/main/java/eu/faircode/email/FragmentIdentity.java +++ b/app/src/main/java/eu/faircode/email/FragmentIdentity.java @@ -120,6 +120,7 @@ public class FragmentIdentity extends FragmentBase { private ContentLoadingProgressBar pbSave; private TextView tvError; private Button btnHelp; + private Button btnSupport; private TextView tvInstructions; private ContentLoadingProgressBar pbWait; @@ -201,6 +202,7 @@ public class FragmentIdentity extends FragmentBase { pbSave = view.findViewById(R.id.pbSave); tvError = view.findViewById(R.id.tvError); btnHelp = view.findViewById(R.id.btnHelp); + btnSupport = view.findViewById(R.id.btnSupport); tvInstructions = view.findViewById(R.id.tvInstructions); tvInstructions.setMovementMethod(LinkMovementMethod.getInstance()); @@ -218,6 +220,7 @@ public class FragmentIdentity extends FragmentBase { if (position == 0) { tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); grpAdvanced.setVisibility(View.GONE); } @@ -432,6 +435,13 @@ public class FragmentIdentity extends FragmentBase { } }); + btnSupport.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Helper.view(getContext(), Uri.parse(Helper.FAQ_URI + "#user-content-authorizing-accounts"), false); + } + }); + // Initialize Helper.setViewsEnabled(view, false); btnAutoConfig.setEnabled(false); @@ -447,6 +457,7 @@ public class FragmentIdentity extends FragmentBase { pbSave.setVisibility(View.GONE); tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); grpAuthorize.setVisibility(View.GONE); @@ -546,6 +557,7 @@ public class FragmentIdentity extends FragmentBase { pbSave.setVisibility(View.VISIBLE); tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); } @@ -817,6 +829,8 @@ public class FragmentIdentity extends FragmentBase { btnHelp.setVisibility(View.VISIBLE); } + btnSupport.setVisibility(View.VISIBLE); + if (provider != null && provider.documentation != null) { tvInstructions.setText(HtmlHelper.fromHtml(provider.documentation.toString())); tvInstructions.setVisibility(View.VISIBLE); @@ -827,10 +841,8 @@ public class FragmentIdentity extends FragmentBase { public void run() { if (provider != null && provider.documentation != null) scroll.smoothScrollTo(0, tvInstructions.getBottom()); - else if (provider != null && provider.link != null) - scroll.smoothScrollTo(0, btnHelp.getBottom()); else - scroll.smoothScrollTo(0, tvError.getBottom()); + scroll.smoothScrollTo(0, btnSupport.getBottom()); } }); } diff --git a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java index 6a212408ce..476bfb782c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java +++ b/app/src/main/java/eu/faircode/email/FragmentQuickSetup.java @@ -73,6 +73,7 @@ public class FragmentQuickSetup extends FragmentBase { private TextView tvError; private Button btnHelp; + private Button btnSupport; private TextView tvInstructions; private TextView tvImap; @@ -102,6 +103,7 @@ public class FragmentQuickSetup extends FragmentBase { tvError = view.findViewById(R.id.tvError); btnHelp = view.findViewById(R.id.btnHelp); + btnSupport = view.findViewById(R.id.btnSupport); tvInstructions = view.findViewById(R.id.tvInstructions); tvImap = view.findViewById(R.id.tvImap); @@ -147,11 +149,19 @@ public class FragmentQuickSetup extends FragmentBase { } }); + btnSupport.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Helper.view(getContext(), Uri.parse(Helper.FAQ_URI + "#user-content-authorizing-accounts"), false); + } + }); + // Initialize pbCheck.setVisibility(View.GONE); pbSave.setVisibility(View.GONE); tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); tvInstructions.setMovementMethod(LinkMovementMethod.getInstance()); grpSetup.setVisibility(View.GONE); @@ -207,6 +217,7 @@ public class FragmentQuickSetup extends FragmentBase { pbSave.setVisibility(check ? View.GONE : View.VISIBLE); tvError.setVisibility(View.GONE); btnHelp.setVisibility(View.GONE); + btnSupport.setVisibility(View.GONE); tvInstructions.setVisibility(View.GONE); grpSetup.setVisibility(check ? View.GONE : View.VISIBLE); } @@ -440,6 +451,8 @@ public class FragmentQuickSetup extends FragmentBase { btnHelp.setVisibility(View.VISIBLE); } + btnSupport.setVisibility(View.VISIBLE); + if (args.containsKey("documentation")) { tvInstructions.setText(HtmlHelper.fromHtml(args.getString("documentation"))); tvInstructions.setVisibility(View.VISIBLE); @@ -450,10 +463,8 @@ public class FragmentQuickSetup extends FragmentBase { public void run() { if (args.containsKey("documentation")) scroll.smoothScrollTo(0, tvInstructions.getBottom()); - else if (args.containsKey("link")) - scroll.smoothScrollTo(0, btnHelp.getBottom()); - else if (tvError.getVisibility() == View.VISIBLE) - scroll.smoothScrollTo(0, tvError.getBottom()); + else + scroll.smoothScrollTo(0, btnSupport.getBottom()); } }); diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml index ae1c7eb84f..44f0f4ee1c 100644 --- a/app/src/main/res/layout/fragment_account.xml +++ b/app/src/main/res/layout/fragment_account.xml @@ -758,6 +758,18 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvError" /> +