From 8f8d4366d48fa1e544b56573744e0f367d802d9a Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Wed, 31 Mar 2021 13:01:16 +0300 Subject: [PATCH] Please re-check the "Terrain" menu empty state, it looks strange, why URL is on the first line? Other rtl languages work fine: Persian, Hebrew. Arabic may have its own characteristics , so its hardcoded in commit. --- .../plus/srtmplugin/TerrainFragment.java | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java index 1475a0a7fd..6583dea040 100644 --- a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java +++ b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java @@ -21,7 +21,6 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.SwitchCompat; -import androidx.core.content.ContextCompat; import com.github.ksoichiro.android.observablescrollview.ObservableListView; import com.google.android.material.slider.RangeSlider; @@ -50,14 +49,16 @@ import org.apache.commons.logging.Log; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.List; +import java.util.Locale; -import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*; +import static net.osmand.plus.UiUtilities.CustomRadioButtonType.END; +import static net.osmand.plus.UiUtilities.CustomRadioButtonType.START; import static net.osmand.plus.download.DownloadActivityType.HILLSHADE_FILE; import static net.osmand.plus.download.DownloadActivityType.SLOPE_FILE; -import static net.osmand.plus.srtmplugin.TerrainMode.HILLSHADE; -import static net.osmand.plus.srtmplugin.TerrainMode.SLOPE; import static net.osmand.plus.srtmplugin.SRTMPlugin.TERRAIN_MAX_ZOOM; import static net.osmand.plus.srtmplugin.SRTMPlugin.TERRAIN_MIN_ZOOM; +import static net.osmand.plus.srtmplugin.TerrainMode.HILLSHADE; +import static net.osmand.plus.srtmplugin.TerrainMode.SLOPE; public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickListener, @@ -102,7 +103,7 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL private ArrayAdapter listAdapter; - private Slider.OnChangeListener transparencySliderChangeListener = new Slider.OnChangeListener() { + private final Slider.OnChangeListener transparencySliderChangeListener = new Slider.OnChangeListener() { @Override public void onValueChange(@NonNull Slider slider, float value, boolean fromUser) { if (fromUser) { @@ -114,7 +115,7 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL } }; - private RangeSlider.OnChangeListener zoomSliderChangeListener = new RangeSlider.OnChangeListener() { + private final RangeSlider.OnChangeListener zoomSliderChangeListener = new RangeSlider.OnChangeListener() { @Override public void onValueChange(@NonNull RangeSlider slider, float value, boolean fromUser) { List values = slider.getValues(); @@ -186,11 +187,13 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL getString(R.string.slope_read_more), wikiString ); - String emptyStateText = String.format( - getString(R.string.ltr_or_rtl_combine_via_space), - getString(R.string.terrain_empty_state_text), - PLUGIN_URL - ); + boolean isArabicLocale = Locale.getDefault().getLanguage().equals("ar"); + String emptyStateText; + if (isArabicLocale) { + emptyStateText = getString(R.string.terrain_empty_state_text) + "\n" + PLUGIN_URL; + } else { + emptyStateText = String.format(getString(R.string.ltr_or_rtl_combine_via_space), getString(R.string.terrain_empty_state_text), PLUGIN_URL); + } setupClickableText(slopeReadMoreTv, readMoreText, wikiString, SLOPES_WIKI_URL, false); setupClickableText(emptyStateDescriptionTv, emptyStateText, PLUGIN_URL, PLUGIN_URL, true); @@ -269,7 +272,7 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL } private void adjustGlobalVisibility() { - emptyState.setVisibility(terrainEnabled ? View.GONE : View.VISIBLE); + emptyState.setVisibility(View.VISIBLE); titleBottomDivider.setVisibility(terrainEnabled ? View.GONE : View.VISIBLE); contentContainer.setVisibility(terrainEnabled ? View.VISIBLE : View.GONE); } @@ -290,10 +293,10 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL } private void setupClickableText(TextView textView, - String text, - String clickableText, - final String url, - final boolean medium) { + String text, + String clickableText, + final String url, + final boolean medium) { SpannableString spannableString = new SpannableString(text); ClickableSpan clickableSpan = new ClickableSpan() { @Override