From 1f1aad244633e9f168a4a5fc5d25509998c7a1db Mon Sep 17 00:00:00 2001 From: Nazar-Kutz Date: Thu, 11 Jun 2020 10:34:02 +0300 Subject: [PATCH] RTL - Step 3 (Share button) --- .../EditFavoriteGroupDialogFragment.java | 7 ++++- .../activities/FavoritesTreeFragment.java | 2 +- .../ItemMenuBottomSheetDialogFragment.java | 8 ++++- .../osmand/plus/audionotes/NotesFragment.java | 31 +++++++++++++------ .../base/OsmandExpandableListFragment.java | 15 +++++++-- .../plus/development/LogcatActivity.java | 6 +++- .../plus/myplaces/AvailableGPXFragment.java | 3 +- .../plus/myplaces/TrackPointFragment.java | 2 +- .../plus/myplaces/TrackSegmentFragment.java | 5 ++- .../osmand/plus/osmedit/OsmEditsFragment.java | 5 ++- .../ChooseRouteFragment.java | 11 +++++-- .../MapRouteInfoMenu.java | 5 ++- .../search/QuickSearchDialogFragment.java | 8 ++++- .../osmand/plus/views/MapControlsLayer.java | 5 +++ 14 files changed, 90 insertions(+), 23 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java index 80027675b4..8e319c7c8f 100644 --- a/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/EditFavoriteGroupDialogFragment.java @@ -3,6 +3,7 @@ package net.osmand.plus.activities; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.ContextThemeWrapper; import android.view.Gravity; @@ -197,8 +198,12 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme .create(); items.add(markersGroupItem); + Drawable shareIcon = getContentIcon(R.drawable.ic_action_gshare_dark); + if (shareIcon != null) { + shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon); + } BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder() - .setIcon(getContentIcon(R.drawable.ic_action_gshare_dark)) + .setIcon(shareIcon) .setTitle(getString(R.string.shared_string_share)) .setLayoutId(R.layout.bottom_sheet_item_simple) .setOnClickListener(new View.OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java index 71084c00e2..7f0f1b287d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java @@ -454,7 +454,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen if (!MenuItemCompat.isActionViewExpanded(mi)) { createMenuItem(menu, IMPORT_FAVOURITES_ID, R.string.shared_string_add_to_favorites, R.drawable.ic_action_plus, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); - createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); + createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS, true); createMenuItem(menu, SELECT_MAP_MARKERS_ID, R.string.select_map_markers, R.drawable.ic_action_flag, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); createMenuItem(menu, DELETE_ID, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java index 35bec8bcb0..feed27ec7e 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/ItemMenuBottomSheetDialogFragment.java @@ -1,8 +1,10 @@ package net.osmand.plus.audionotes; +import android.graphics.drawable.Drawable; import android.os.Bundle; import android.view.View; +import net.osmand.AndroidUtils; import net.osmand.plus.R; import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording; import net.osmand.plus.base.MenuBottomSheetDialogFragment; @@ -49,8 +51,12 @@ public class ItemMenuBottomSheetDialogFragment extends MenuBottomSheetDialogFrag .create(); items.add(playItem); + Drawable shareIcon = getContentIcon(R.drawable.ic_action_gshare_dark); + if (shareIcon != null) { + AndroidUtils.getDrawableForDirection(requireContext(), shareIcon); + } BaseBottomSheetItem shareItem = new SimpleBottomSheetItem.Builder() - .setIcon(getContentIcon(R.drawable.ic_action_gshare_dark)) + .setIcon(shareIcon) .setTitle(getString(R.string.shared_string_share)) .setLayoutId(R.layout.bottom_sheet_item_simple) .setOnClickListener(new View.OnClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index 9ebd955757..09acdca8d8 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -3,6 +3,7 @@ package net.osmand.plus.audionotes; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.graphics.drawable.Drawable; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Build; @@ -21,10 +22,12 @@ import android.widget.ImageView; import android.widget.ListView; import android.widget.Toast; +import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.view.ActionMode; import androidx.fragment.app.Fragment; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import net.osmand.AndroidUtils; @@ -33,6 +36,7 @@ import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.WptPt; import net.osmand.PlatformUtil; import net.osmand.data.PointDescription; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.settings.backend.OsmandSettings.NotesSortByMode; import net.osmand.plus.R; @@ -163,14 +167,18 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme } @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - menu.clear(); - if (AndroidUiHelper.isOrientationPortrait(getActivity())) { - menu = ((ActionBarProgressActivity) getActivity()).getClearToolbar(true).getMenu(); - } else { - ((ActionBarProgressActivity) getActivity()).getClearToolbar(false); + public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) { + FragmentActivity activity = getActivity(); + if (activity == null) { + return; } - ((ActionBarProgressActivity) getActivity()).updateListViewFooter(footerView); + menu.clear(); + if (AndroidUiHelper.isOrientationPortrait(activity)) { + menu = ((ActionBarProgressActivity) activity).getClearToolbar(true).getMenu(); + } else { + ((ActionBarProgressActivity) activity).getClearToolbar(false); + } + ((ActionBarProgressActivity) activity).updateListViewFooter(footerView); MenuItem item = menu.add(R.string.shared_string_sort).setIcon(R.drawable.ic_action_list_sort); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @@ -182,7 +190,9 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme }); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark); + Drawable shareIcon = AndroidUtils.getDrawableForDirection(activity, + getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark)); + item = menu.add(R.string.shared_string_share).setIcon(shareIcon); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { @@ -377,13 +387,16 @@ public class NotesFragment extends OsmAndListFragment implements FavoritesFragme @Override public boolean onCreateActionMode(final ActionMode mode, Menu menu) { LOG.debug("onCreateActionMode"); + OsmandApplication app = getMyApplication(); if (type == MODE_SHARE) { listAdapter.insert(SHARE_LOCATION_FILE, 0); } switchSelectionMode(true); int titleRes = type == MODE_DELETE ? R.string.shared_string_delete_all : R.string.shared_string_share; int iconRes = type == MODE_DELETE ? R.drawable.ic_action_delete_dark : R.drawable.ic_action_gshare_dark; - MenuItem item = menu.add(titleRes).setIcon(iconRes); + Drawable icon = AndroidUtils.getDrawableForDirection(app, + app.getUIUtilities().getIcon(iconRes)); + MenuItem item = menu.add(titleRes).setIcon(icon); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { diff --git a/OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java b/OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java index e28adac58e..2293f74ef8 100644 --- a/OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java +++ b/OsmAnd/src/net/osmand/plus/base/OsmandExpandableListFragment.java @@ -15,6 +15,7 @@ import android.widget.ExpandableListView.OnChildClickListener; import androidx.annotation.NonNull; import androidx.core.view.MenuItemCompat; +import net.osmand.AndroidUtils; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.OsmandActionBarActivity; @@ -83,10 +84,20 @@ public abstract class OsmandExpandableListFragment extends BaseOsmAndFragment } public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType) { - Drawable d = iconId == 0 ? null : requireMyApplication().getUIUtilities().getIcon(iconId, - isLightActionBar() ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark); + return createMenuItem(m, id, titleRes, iconId, menuItemType, false); + } + + public MenuItem createMenuItem(Menu m, int id, int titleRes, int iconId, int menuItemType, + boolean useLayoutDirectionForIcon) { + OsmandApplication app = requireMyApplication(); + Drawable d = iconId == 0 ? null : app.getUIUtilities().getIcon(iconId, isLightActionBar() ? + R.color.active_buttons_and_links_text_light : + R.color.active_buttons_and_links_text_dark); MenuItem menuItem = m.add(0, id, 0, titleRes); if (d != null) { + if (useLayoutDirectionForIcon) { + d = AndroidUtils.getDrawableForDirection(app, d); + } menuItem.setIcon(d); } menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { diff --git a/OsmAnd/src/net/osmand/plus/development/LogcatActivity.java b/OsmAnd/src/net/osmand/plus/development/LogcatActivity.java index 65f8ac210d..20f5c4ba4a 100644 --- a/OsmAnd/src/net/osmand/plus/development/LogcatActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/LogcatActivity.java @@ -1,5 +1,6 @@ package net.osmand.plus.development; +import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Bundle; import android.view.Gravity; @@ -15,6 +16,7 @@ import androidx.appcompat.app.ActionBar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; @@ -94,8 +96,10 @@ public class LogcatActivity extends ActionBarProgressActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { + OsmandApplication app = getMyApplication(); + Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark); MenuItem share = menu.add(0, SHARE_ID, 0, R.string.shared_string_export); - share.setIcon(R.drawable.ic_action_gshare_dark); + share.setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon)); share.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index 2e5bafeecd..fb317dc696 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -1492,8 +1492,9 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement return true; } }); + Drawable shareIcon = iconsCache.getThemedIcon((R.drawable.ic_action_gshare_dark)); item = optionsMenu.getMenu().add(R.string.shared_string_share) - .setIcon(iconsCache.getThemedIcon(R.drawable.ic_action_gshare_dark)); + .setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon)); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java index 274dd3a379..b33ff20497 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackPointFragment.java @@ -393,7 +393,7 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements if (!mi.isActionViewExpanded()) { - createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER); + createMenuItem(menu, SHARE_ID, R.string.shared_string_share, R.drawable.ic_action_gshare_dark, MenuItem.SHOW_AS_ACTION_NEVER, true); GPXFile gpxFile = getGpx(); if (gpxFile != null && gpxFile.path != null) { final MapMarkersHelper markersHelper = app.getMapMarkersHelper(); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java index 71e229030c..8207d401ff 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/TrackSegmentFragment.java @@ -6,6 +6,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.Matrix; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; @@ -152,7 +153,9 @@ public class TrackSegmentFragment extends OsmAndListFragment implements TrackBit GPXFile gpxFile = getGpx(); if (gpxFile != null) { if (gpxFile.path != null && !gpxFile.showCurrentTrack) { - MenuItem item = menu.add(R.string.shared_string_share).setIcon(R.drawable.ic_action_gshare_dark) + Drawable shareIcon = app.getUIUtilities().getIcon((R.drawable.ic_action_gshare_dark)); + MenuItem item = menu.add(R.string.shared_string_share) + .setIcon(AndroidUtils.getDrawableForDirection(app, shareIcon)) .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { diff --git a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java index 4a7334bd0f..5d4dcff60f 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/OsmEditsFragment.java @@ -4,6 +4,7 @@ import android.app.Dialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; +import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -248,7 +249,9 @@ public class OsmEditsFragment extends OsmAndListFragment implements SendPoiDialo }); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); - item = menu.add(R.string.shared_string_export).setIcon(R.drawable.ic_action_gshare_dark); + Drawable shareIcon = getMyApplication().getUIUtilities().getIcon((R.drawable.ic_action_gshare_dark)); + item = menu.add(R.string.shared_string_export) + .setIcon(AndroidUtils.getDrawableForDirection(getMyApplication(), shareIcon)); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java index 1d925023bb..205993a316 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/ChooseRouteFragment.java @@ -19,6 +19,7 @@ import android.view.ViewGroup; import android.view.animation.DecelerateInterpolator; import android.widget.FrameLayout; import android.widget.ImageButton; +import android.widget.ImageView; import android.widget.LinearLayout; import androidx.annotation.DrawableRes; @@ -485,6 +486,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe } private void buildMenuButtons(@NonNull View view) { + OsmandApplication app = getMyApplication(); AppCompatImageView backButton = (AppCompatImageView) view.findViewById(R.id.back_button); AppCompatImageButton backButtonFlow = (AppCompatImageButton) view.findViewById(R.id.back_button_flow); OnClickListener backOnClick = new OnClickListener() { @@ -525,8 +527,13 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe saveRoute.setOnClickListener(saveOnClick); saveRouteFlow.setOnClickListener(saveOnClick); - View shareRoute = view.findViewById(R.id.share_as_gpx); - View shareRouteFlow = view.findViewById(R.id.share_as_gpx_flow); + ImageView shareRoute = (ImageView) view.findViewById(R.id.share_as_gpx); + ImageView shareRouteFlow = (ImageView) view.findViewById(R.id.share_as_gpx_flow); + Drawable shareIcon = getIcon(R.drawable.ic_action_gshare_dark, nightMode ? + R.color.text_color_secondary_dark : R.color.text_color_secondary_light); + shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon); + shareRoute.setImageDrawable(shareIcon); + shareRouteFlow.setImageDrawable(shareIcon); OnClickListener shareOnClick = new OnClickListener() { @Override public void onClick(View v) { diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 9e623cd7bd..1bbd71e61d 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -967,6 +967,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener RoutingHelper routingHelper = app.getRoutingHelper(); final ApplicationMode applicationMode = routingHelper.getAppMode(); final RouteMenuAppModes mode = app.getRoutingOptionsHelper().getRouteMenuAppMode(applicationMode); + boolean isLayoutRTL = AndroidUtils.isLayoutRtl(app); updateControlButtons(mapActivity, mainView); LinearLayout optionsButton = (LinearLayout) mainView.findViewById(R.id.map_options_route_button); @@ -984,7 +985,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener clickRouteParams(); } }); - AndroidUtils.setBackground(app, optionsButton, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark); + AndroidUtils.setBackground(app, optionsButton, nightMode, + isLayoutRTL ? R.drawable.route_info_trans_gradient_left_light : R.drawable.route_info_trans_gradient_light, + isLayoutRTL ? R.drawable.route_info_trans_gradient_left_dark :R.drawable.route_info_trans_gradient_dark); HorizontalScrollView scrollView = mainView.findViewById(R.id.route_options_scroll_container); scrollView.setVerticalScrollBarEnabled(false); diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java index 673af0c9e1..0ef39d0299 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java @@ -242,6 +242,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC Bundle savedInstanceState) { final MapActivity mapActivity = getMapActivity(); final View view = inflater.inflate(R.layout.search_dialog_fragment, container, false); + final boolean nightMode = !app.getSettings().isLightContent(); toolbarController = new QuickSearchToolbarController(); toolbarController.setOnBackButtonClickListener(new OnClickListener() { @@ -483,7 +484,12 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC ); titleEdit = (TextView) view.findViewById(R.id.titleEdit); - view.findViewById(R.id.shareButton).setOnClickListener( + Drawable shareIcon = app.getUIUtilities().getIcon(R.drawable.ic_action_gshare_dark, + nightMode ? R.color.text_color_secondary_dark : R.color.text_color_secondary_light); + shareIcon = AndroidUtils.getDrawableForDirection(app, shareIcon); + ImageView shareButton = (ImageView) view.findViewById(R.id.shareButton); + shareButton.setImageDrawable(shareIcon); + shareButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index c308dce187..545804fd23 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -396,6 +396,7 @@ public class MapControlsLayer extends OsmandMapLayer { routePlanningBtn = createHudButton(routePlanButton, R.drawable.ic_action_gdirections_dark, ROUTE_PLANNING_HUD_ID) .setIconColorId(R.color.map_button_icon_color_light, R.color.map_button_icon_color_dark) .setBg(R.drawable.btn_round, R.drawable.btn_round_night); + routePlanningBtn.flipIconForRtl = true; controls.add(routePlanningBtn); routePlanButton.setOnClickListener(new View.OnClickListener() { @Override @@ -990,6 +991,7 @@ public class MapControlsLayer extends OsmandMapLayer { int resClrLight = R.color.map_button_icon_color_light; int resClrDark = R.color.map_button_icon_color_dark; String id; + boolean flipIconForRtl; boolean nightMode = false; boolean f = true; @@ -1158,6 +1160,9 @@ public class MapControlsLayer extends OsmandMapLayer { d = ctx.getUIUtilities().getIcon(resLightId); } else if (resId != 0) { d = ctx.getUIUtilities().getIcon(resId, nightMode ? resClrDark : resClrLight); + if (flipIconForRtl) { + d = AndroidUtils.getDrawableForDirection(ctx, d); + } } if (iv instanceof ImageView) { if (compass) {