From 3e5e6af5fbdd5d60999158e919ac3e6c15d324c3 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 4 Sep 2022 11:00:19 +0200 Subject: [PATCH] Whois behavior improvements --- .../eu/faircode/email/FragmentDialogOpenLink.java | 15 +++++++++++++++ app/src/main/res/layout/dialog_open_link.xml | 11 +++++++++++ app/src/main/res/layout/dialog_whois.xml | 4 +--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java index 9cc66b0dd2..e46596f003 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java @@ -95,6 +95,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { private TextView tvHost; private TextView tvOwner; private Button btnWhois; + private ContentLoadingProgressBar pbWhois; private Group grpOwner; private Button btnSettings; private Button btnDefault; @@ -188,6 +189,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { tvOwner = dview.findViewById(R.id.tvOwner); grpOwner = dview.findViewById(R.id.grpOwner); btnWhois = dview.findViewById(R.id.btnWhois); + pbWhois = dview.findViewById(R.id.pbWhois); btnSettings = dview.findViewById(R.id.btnSettings); btnDefault = dview.findViewById(R.id.btnDefault); tvReset = dview.findViewById(R.id.tvReset); @@ -425,6 +427,18 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { args.putParcelable("uri", Uri.parse(etLink.getText().toString())); new SimpleTask() { + @Override + protected void onPreExecute(Bundle args) { + btnWhois.setEnabled(false); + pbWhois.setVisibility(View.VISIBLE); + } + + @Override + protected void onPostExecute(Bundle args) { + btnWhois.setEnabled(true); + pbWhois.setVisibility(View.GONE); + } + @Override protected String onExecute(Context context, Bundle args) throws Throwable { Uri uri = args.getParcelable("uri"); @@ -724,6 +738,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { tvOwnerRemark.setVisibility(show ? View.VISIBLE : View.GONE); grpOwner.setVisibility(View.GONE); btnWhois.setVisibility(show && !BuildConfig.PLAY_STORE_RELEASE ? View.VISIBLE : View.GONE); + pbWhois.setVisibility(View.GONE); btnSettings.setVisibility(show ? View.VISIBLE : View.GONE); btnDefault.setVisibility(show && n ? View.VISIBLE : View.GONE); tvReset.setVisibility(show ? View.VISIBLE : View.GONE); diff --git a/app/src/main/res/layout/dialog_open_link.xml b/app/src/main/res/layout/dialog_open_link.xml index 0d93ed7140..cfe568dc0a 100644 --- a/app/src/main/res/layout/dialog_open_link.xml +++ b/app/src/main/res/layout/dialog_open_link.xml @@ -321,6 +321,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/tvOwner" /> + +