From 957afb1709c8f098e84fa41c4fd5d60dfdbafb8d Mon Sep 17 00:00:00 2001 From: Mihail Mitrofanov Date: Tue, 17 Jun 2025 11:50:34 +0200 Subject: [PATCH] [android]: Fixed the appearance of an extra margin in the dialog when there is no title. Also, add a tools:text attribute to the dialog_missed_maps.xml layout for better preview in Android Studio. --- .../routing/RoutingErrorDialogFragment.java | 20 ++++++++++--------- .../main/res/layout/dialog_missed_maps.xml | 1 + 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/android/app/src/main/java/app/organicmaps/routing/RoutingErrorDialogFragment.java b/android/app/src/main/java/app/organicmaps/routing/RoutingErrorDialogFragment.java index 9feac460a..bb5370cbe 100644 --- a/android/app/src/main/java/app/organicmaps/routing/RoutingErrorDialogFragment.java +++ b/android/app/src/main/java/app/organicmaps/routing/RoutingErrorDialogFragment.java @@ -38,15 +38,17 @@ public class RoutingErrorDialogFragment extends BaseRoutingErrorDialogFragment ResultCodesHelper.getDialogTitleSubtitle(requireContext(), mResultCode, mMissingMaps.size()); Pair titleMessage = resHolder.getTitleMessage(); - TextView titleView = new TextView(requireContext()); - titleView.setText(titleMessage.first); - titleView.setPadding(65, 32, 32, 16); - titleView.setTextSize(18); - titleView.setMaxLines(4); - titleView.setEllipsize(TextUtils.TruncateAt.END); - titleView.setTypeface(null, Typeface.BOLD); - builder.setCustomTitle(titleView); - + if (!TextUtils.isEmpty(titleMessage.first)) + { + TextView titleView = new TextView(requireContext()); + titleView.setText(titleMessage.first); + titleView.setPadding(65, 32, 32, 16); + titleView.setTextSize(18); + titleView.setMaxLines(4); + titleView.setEllipsize(TextUtils.TruncateAt.END); + titleView.setTypeface(null, Typeface.BOLD); + builder.setCustomTitle(titleView); + } mMessage = titleMessage.second; builder.setNegativeButton(resHolder.getCancelBtnResId(), null); if (ResultCodesHelper.isDownloadable(mResultCode, mMissingMaps.size())) diff --git a/android/app/src/main/res/layout/dialog_missed_maps.xml b/android/app/src/main/res/layout/dialog_missed_maps.xml index af64dcf56..701fd4884 100644 --- a/android/app/src/main/res/layout/dialog_missed_maps.xml +++ b/android/app/src/main/res/layout/dialog_missed_maps.xml @@ -15,6 +15,7 @@ android:paddingEnd="@dimen/margin_base_plus" android:textAppearance="@style/MwmTextAppearance.Body2" android:visibility="gone" + tools:text="Select maps to download" tools:visibility="visible"/>