Whois behavior improvements

This commit is contained in:
M66B 2022-09-04 11:00:19 +02:00
parent 041d27a061
commit 3e5e6af5fb
3 changed files with 27 additions and 3 deletions

View File

@ -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<String>() {
@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);

View File

@ -321,6 +321,17 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOwner" />
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbWhois"
style="@style/Base.Widget.AppCompat.ProgressBar"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="12dp"
android:indeterminate="true"
app:layout_constraintBottom_toBottomOf="@id/btnWhois"
app:layout_constraintStart_toEndOf="@id/btnWhois"
app:layout_constraintTop_toTopOf="@id/btnWhois" />
<Button
android:id="@+id/btnSettings"
style="?android:attr/buttonStyleSmall"

View File

@ -28,10 +28,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:fontFamily="monospace"
android:text="Whois"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" />