Fix "Back button (arrow)"

This commit is contained in:
Nazar-Kutz 2020-03-05 12:25:28 +02:00
parent e2b0ace021
commit e3599ec39e
29 changed files with 103 additions and 35 deletions

View file

@ -2,6 +2,7 @@ package net.osmand.plus;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
@ -379,11 +380,32 @@ public class UiUtilities {
view.setBackgroundColor(ContextCompat.getColor(ctx, backgroundColor));
}
public static Drawable getIconByLayoutDirection(Context ctx, Drawable drawable) {
if (ctx == null) {
return drawable;
}
final int angle = AndroidUtils.getLayoutDirection(ctx) == ViewCompat.LAYOUT_DIRECTION_RTL ? 180 : 0;
return getRotateDrawable(drawable, angle);
}
public static Drawable getRotateDrawable(final Drawable d, final float angle) {
final Drawable[] arD = { d };
return new LayerDrawable(arD) {
@Override
public void draw(final Canvas canvas) {
canvas.save();
canvas.rotate(angle, d.getBounds().width() / 2, d.getBounds().height() / 2);
super.draw(canvas);
canvas.restore();
}
};
}
public static void rotateImageByLayoutDirection(ImageView image, int layoutDirection) {
if (image == null) {
return;
}
int rotation = layoutDirection == View.LAYOUT_DIRECTION_LTR ? 0 : 180;
int rotation = layoutDirection == ViewCompat.LAYOUT_DIRECTION_RTL ? 180 : 0;
image.setRotationY(rotation);
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
@ -18,6 +19,7 @@ import androidx.core.view.ViewCompat;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
public abstract class ActionBarPreferenceActivity extends AppCompatPreferenceActivity {
private Toolbar tb;
@ -50,7 +52,8 @@ public abstract class ActionBarPreferenceActivity extends AppCompatPreferenceAct
}
tb.setClickable(true);
int activeButtonsAndLinksTextColorResId = lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
tb.setNavigationIcon(((OsmandApplication) getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back, activeButtonsAndLinksTextColorResId));
Drawable icBack = ((OsmandApplication) getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back, activeButtonsAndLinksTextColorResId);
tb.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getApplication(), icBack));
tb.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
tb.setBackgroundColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTabBackground)));
tb.setTitleTextColor(getResources().getColor(getResIdFromAttribute(this, R.attr.pstsTextColor)));

View file

@ -45,6 +45,7 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.myplaces.FavoritesActivity;
import net.osmand.util.Algorithms;
@ -106,7 +107,8 @@ public class FavoritesSearchFragment extends DialogFragment {
}
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
Drawable icBack = app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(activity, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(
new View.OnClickListener() {

View file

@ -9,6 +9,7 @@ import androidx.appcompat.app.ActionBar;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@SuppressLint("Registered")
public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
@ -24,7 +25,7 @@ public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
if (supportActionBar != null) {
supportActionBar.setHomeButtonEnabled(true);
supportActionBar.setDisplayHomeAsUpEnabled(true);
supportActionBar.setHomeAsUpIndicator(back);
supportActionBar.setHomeAsUpIndicator(UiUtilities.getIconByLayoutDirection(getApplication(), back));
}
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.activities;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.MenuItem;
@ -12,6 +13,7 @@ import androidx.appcompat.widget.Toolbar;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
public class PrivacyAndSecurityActivity extends OsmandActionBarActivity {
@ -26,7 +28,8 @@ public class PrivacyAndSecurityActivity extends OsmandActionBarActivity {
tb.setTitle(R.string.settings_privacy_and_security);
tb.setClickable(true);
tb.setNavigationIcon(((OsmandApplication) getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back));
Drawable icBack = ((OsmandApplication) getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back);
tb.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
tb.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
tb.setBackgroundColor(getResources().getColor(resolveResourceId(this, R.attr.pstsTabBackground)));
tb.setTitleTextColor(getResources().getColor(resolveResourceId(this, R.attr.pstsTextColor)));

View file

@ -336,8 +336,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
ImageView lst = (ImageView) dashboardView.findViewById(R.id.toolbar_list);
lst.setVisibility(View.GONE);
ImageView back = (ImageView) dashboardView.findViewById(R.id.toolbar_back);
back.setImageDrawable(
getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
Drawable icBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back);
back.setImageDrawable(UiUtilities.getIconByLayoutDirection(mapActivity, icBack));
back.setOnClickListener(new View.OnClickListener() {
@Override
@ -345,8 +345,6 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, IRouteInfo
backPressed();
}
});
int layoutDirection = AndroidUtils.getLayoutDirection(mapActivity);
UiUtilities.rotateImageByLayoutDirection(back, layoutDirection);
if (visibleType == DashboardType.DASHBOARD || visibleType == DashboardType.LIST_MENU) {
settingsButton.setVisibility(View.VISIBLE);

View file

@ -105,7 +105,8 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
activity.getAccessibilityAssistant().registerPage(view, DownloadActivity.DOWNLOAD_TAB_NUMBER);
toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back));
Drawable icBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(activity, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -41,6 +41,7 @@ import net.osmand.map.WorldRegion;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.download.CityItem;
import net.osmand.plus.download.DownloadActivity;
import net.osmand.plus.download.DownloadActivity.BannerAndDownloadFreeVersion;
@ -114,7 +115,7 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
Drawable icBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back, iconColorResId);
toolbar.setNavigationIcon(icBack);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -65,7 +65,7 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
OsmandApplication app = requireMyApplication();
Drawable icBack = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back, !editor.isLight() ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light);
toolbar.setNavigationIcon(icBack);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setTitleTextColor(getResources().getColor(getResIdFromAttribute(getMapActivity(), R.attr.pstsTextColor)));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {

View file

@ -1,5 +1,6 @@
package net.osmand.plus.mapcontextmenu.other;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -18,6 +19,7 @@ import androidx.fragment.app.FragmentManager;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
@ -207,7 +209,8 @@ public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
if (backButton != null) {
backButton.setImageDrawable(getIcon(R.drawable.ic_arrow_back, R.color.color_white));
Drawable icBack = getIcon(R.drawable.ic_arrow_back, R.color.color_white);
backButton.setImageDrawable(UiUtilities.getIconByLayoutDirection(ctx, icBack));
}
}
}

View file

@ -283,7 +283,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
TextView optionsButton = mainView.findViewById(R.id.options_button);
if (orientationPortrait) {
backBtn.setImageDrawable(getColoredIcon(R.drawable.ic_arrow_back, lightTheme ? R.color.color_black : R.color.active_buttons_and_links_text_dark));
Drawable icBack = getColoredIcon(R.drawable.ic_arrow_back, lightTheme ? R.color.color_black : R.color.active_buttons_and_links_text_dark);
backBtn.setImageDrawable(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
optionsButton.setTextColor(getResolvedColor(lightTheme ? R.color.active_color_primary_light : R.color.active_color_primary_dark));
TextView toolbar = (TextView) mainView.findViewById(R.id.toolbar_text);
toolbar.setTextColor(getResolvedColor(lightTheme ? R.color.text_color_primary_light : R.color.text_color_primary_dark));
@ -291,7 +292,8 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
setBackgroundColor(R.id.app_bar, lightTheme ? R.color.route_info_bg_light : R.color.route_info_bg_dark);
setBackgroundColor(mainView, lightTheme ? R.color.activity_background_color_light : R.color.activity_background_color_dark);
} else {
backBtn.setImageDrawable(getColoredIcon(R.drawable.ic_arrow_back, lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark));
Drawable icBack = getColoredIcon(R.drawable.ic_arrow_back, lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
backBtn.setImageDrawable(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
optionsButton.setTextColor(getResolvedColor(lightTheme ? R.color.color_white : R.color.active_color_primary_dark));
TextView toolbar = (TextView) mainView.findViewById(R.id.toolbar_text);
toolbar.setTextColor(getResolvedColor(lightTheme ? R.color.color_white : R.color.text_color_primary_dark));

View file

@ -70,7 +70,8 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
mainView = UiUtilities.getInflater(getContext(), !settings.isLightContent()).inflate(R.layout.fragment_direction_indication_dialog, container);
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
Drawable icBack = getIconsCache().getIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -152,7 +152,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.map_markers_toolbar);
Drawable icArrowBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back,
lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
toolbar.setNavigationIcon(icArrowBack);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icArrowBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -48,6 +48,7 @@ import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
@ -251,7 +252,8 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
}
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.plan_route_toolbar);
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(mapActivity, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -18,6 +18,7 @@ import com.google.android.material.appbar.AppBarLayout;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
public class GpxDescriptionDialogFragment extends BaseOsmAndDialogFragment {
@ -33,7 +34,7 @@ public class GpxDescriptionDialogFragment extends BaseOsmAndDialogFragment {
final Toolbar topBar = new Toolbar(ctx);
topBar.setClickable(true);
Drawable back = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back);
topBar.setNavigationIcon(back);
topBar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(ctx, back));
topBar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
topBar.setTitle(R.string.shared_string_description);
topBar.setBackgroundColor(ContextCompat.getColor(ctx, AndroidUtils.resolveAttribute(ctx, R.attr.pstsTabBackground)));

View file

@ -5,6 +5,7 @@ import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.DisplayMetrics;
@ -118,7 +119,8 @@ public class SplitSegmentDialogFragment extends DialogFragment {
if (trackActivityActionBar != null) {
titleTextView.setText(trackActivityActionBar.getTitle());
}
toolbar.setNavigationIcon(ic.getIcon(R.drawable.ic_arrow_back));
Drawable icBack = ic.getIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -7,6 +7,7 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
@ -67,6 +68,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.osmedit.OsmPoint.Action;
@ -145,7 +147,8 @@ public class EditPoiDialogFragment extends BaseOsmAndDialogFragment {
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setTitle(isAddingPoi ? R.string.poi_create_title : R.string.poi_edit_title);
toolbar.setNavigationIcon(R.drawable.ic_arrow_back);
Drawable icBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -4,6 +4,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@ -152,7 +153,8 @@ public class CreateEditActionDialog extends DialogFragment {
int buttonsAndLinksTextColorResId = isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
toolbar.setTitleTextColor(ContextCompat.getColor(getContext(), buttonsAndLinksTextColorResId));
toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back, buttonsAndLinksTextColorResId));
Drawable icBack = getIconsCache().getIcon(R.drawable.ic_arrow_back, buttonsAndLinksTextColorResId);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);

View file

@ -28,6 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
@ -122,9 +123,10 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
private void setUpToolbar(View view) {
Toolbar toolbar = (Toolbar) view.findViewById(R.id.custom_toolbar);
Drawable back = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back,
OsmandApplication app = requireMyApplication();
Drawable back = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back,
isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
toolbar.setNavigationIcon(back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, back));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -2,6 +2,7 @@ package net.osmand.plus.routepreparationmenu;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
@ -23,6 +24,7 @@ import net.osmand.data.LatLon;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
@ -102,7 +104,8 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr
textView.setText(!hideImpassableRoads ? R.string.impassable_road : R.string.avoid_pt_types);
Toolbar toolbar = (Toolbar) titleView.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -85,7 +85,8 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
textView.setText(R.string.show_along_the_route);
Toolbar toolbar = (Toolbar) titleView.findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(ctx, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -1,6 +1,7 @@
package net.osmand.plus.routepreparationmenu;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
@ -116,7 +117,8 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
listView.setDynamicListViewCallbacks(this);
final ImageView backButton = (ImageView) view.findViewById(R.id.back_button);
backButton.setImageDrawable(getContentIcon(R.drawable.ic_arrow_back));
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
backButton.setImageDrawable(UiUtilities.getIconByLayoutDirection(mapActivity, icBack));
backButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -133,7 +133,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
Drawable icBack = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back,
isLightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
toolbar.setNavigationIcon(icBack);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -5,6 +5,7 @@ import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Editable;
@ -73,6 +74,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.Version;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.MapActivity.ShowQuickSearchMode;
@ -451,7 +453,8 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
if (!app.getSettings().isLightContent()) {
toolbar.setBackgroundColor(ContextCompat.getColor(mapActivity, R.color.app_bar_color_dark));
}
toolbar.setNavigationIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
Drawable icBack = app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(
new OnClickListener() {

View file

@ -1,5 +1,6 @@
package net.osmand.plus.settings;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
@ -241,10 +242,11 @@ public class ImportDuplicatesFragment extends BaseOsmAndFragment implements View
}
private void setupToolbar(Toolbar toolbar) {
toolbar.setNavigationIcon(getPaintedContentIcon(R.drawable.ic_arrow_back,
Drawable icBack = getPaintedContentIcon(R.drawable.ic_arrow_back,
nightMode
? getResources().getColor(R.color.active_buttons_and_links_text_dark)
: getResources().getColor(R.color.active_buttons_and_links_text_light)));
: getResources().getColor(R.color.active_buttons_and_links_text_light));
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -36,6 +36,7 @@ import net.osmand.data.RotatedTileBox;
import net.osmand.osm.PoiType;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.WaypointHelper;
import net.osmand.plus.poi.PoiUIFilter;
@ -314,7 +315,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
final Toolbar topBar = new Toolbar(ctx);
topBar.setClickable(true);
Drawable back = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back);
topBar.setNavigationIcon(back);
topBar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(ctx, back));
topBar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
topBar.setTitle(title);
topBar.setBackgroundColor(ContextCompat.getColor(ctx, getResIdFromAttribute(ctx, R.attr.pstsTabBackground)));

View file

@ -22,6 +22,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndDialogFragment;
public class WikiBaseDialogFragment extends BaseOsmAndDialogFragment {
@ -84,7 +85,8 @@ public class WikiBaseDialogFragment extends BaseOsmAndDialogFragment {
}
protected void setupToolbar(Toolbar toolbar) {
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override

View file

@ -1,6 +1,7 @@
package net.osmand.plus.wikivoyage;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -14,6 +15,7 @@ import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.wikivoyage.explore.WikivoyageExploreActivity;
@ -28,8 +30,9 @@ public class WikivoyageWelcomeDialogFragment extends WikiBaseDialogFragment {
View mainView = inflate(R.layout.fragment_wikivoyage_welcome_dialog, container);
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
ImageView backBtn = (ImageView) mainView.findViewById(R.id.back_button);
backBtn.setImageDrawable(getContentIcon(R.drawable.ic_arrow_back));
backBtn.setImageDrawable(UiUtilities.getIconByLayoutDirection(getContext(), icBack));
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -32,6 +32,7 @@ import net.osmand.plus.OnDialogFragmentResultListener;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.TabActivity;
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
import net.osmand.plus.wikipedia.WikiArticleHelper;
@ -85,7 +86,8 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
Drawable icBack = getContentIcon(R.drawable.ic_arrow_back);
toolbar.setNavigationIcon(UiUtilities.getIconByLayoutDirection(app, icBack));
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override