From 32da4f8e09292575ad3e7839119f39ad7a1cc838 Mon Sep 17 00:00:00 2001 From: LucasGGamerM Date: Sun, 16 Apr 2023 18:27:29 -0300 Subject: [PATCH] feat: use targetAccount domain name in lookup dialog --- .../org/joinmastodon/android/ui/utils/UiUtils.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index 33a0a3184..e7e367379 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -1139,6 +1139,7 @@ public class UiUtils { return; } + String finalDomain = domain; new GetSearchResults(trimmedQuery, type, false).setCallback(new Callback<>() { @Override public void onSuccess(SearchResults results) { @@ -1156,7 +1157,7 @@ public class UiUtils { } }) .wrapProgress((Activity)context, R.string.loading, true, - d -> transformDialogForLookup(context, targetAccountID, null, d)) + d -> transformDialogForLookup(context, targetAccountID, null, d, finalDomain)) .execNoAuth(domain); } @@ -1164,9 +1165,13 @@ public class UiUtils { openURL(context, accountID, url, true); } - private static void transformDialogForLookup(Context context, String accountID, @Nullable String url, ProgressDialog dialog) { + private static void transformDialogForLookup(Context context, String accountID, @Nullable String url, ProgressDialog dialog){ + transformDialogForLookup(context, accountID, url, dialog, null); + } + + private static void transformDialogForLookup(Context context, String accountID, @Nullable String url, ProgressDialog dialog, @Nullable String instanceName) { if (accountID != null) { - dialog.setTitle(context.getString(R.string.sk_loading_resource_on_instance_title, getInstanceName(accountID))); + dialog.setTitle(context.getString(R.string.sk_loading_resource_on_instance_title, instanceName != null ? instanceName : getInstanceName(accountID))); } else { dialog.setTitle(R.string.sk_loading_fediverse_resource_title); }