Merge pull request #8628 from osmandapp/FixRTL2
Fix "Back button (arrow)"
This commit is contained in:
commit
3ba8f07384
34 changed files with 132 additions and 69 deletions
|
@ -35,13 +35,13 @@
|
|||
android:id="@+id/back_button_flow"
|
||||
android:layout_width="@dimen/route_info_toolbar_button_size"
|
||||
android:layout_height="@dimen/route_info_toolbar_button_size"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginLeft="@dimen/content_padding_half"
|
||||
android:layout_marginTop="@dimen/content_padding_half"
|
||||
android:layout_marginStart="@dimen/content_padding_half"
|
||||
android:background="@drawable/btn_circle_transparent_full"
|
||||
android:contentDescription="@string/shared_string_back"
|
||||
android:src="@drawable/ic_arrow_back"
|
||||
android:tint="?attr/text_color_tab_active_white"
|
||||
android:layout_marginStart="8dp" />
|
||||
android:tint="?attr/text_color_tab_active_white" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/toolbar_options_flow_bg"
|
||||
|
|
|
@ -679,11 +679,16 @@
|
|||
app:contentInsetLeft="4dp"
|
||||
app:contentInsetStart="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|start"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/context_menu_toolbar_back"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:contentDescription="@string/shared_string_collapse"
|
||||
android:scaleType="center"
|
||||
|
@ -694,7 +699,6 @@
|
|||
android:id="@+id/context_menu_toolbar_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
|
@ -705,6 +709,8 @@
|
|||
tools:text="Toolbar"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
|
|
@ -683,6 +683,11 @@ public class AndroidUtils {
|
|||
return TextUtilsCompat.getLayoutDirectionFromLocale(currentLocale);
|
||||
}
|
||||
|
||||
public static int getNavigationIconResId(@NonNull Context ctx) {
|
||||
return getLayoutDirection(ctx) == ViewCompat.LAYOUT_DIRECTION_RTL ?
|
||||
R.drawable.ic_arrow_forward : R.drawable.ic_arrow_back;
|
||||
}
|
||||
|
||||
public static boolean isSupportRTL() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1;
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ public class UiUtilities {
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -15,6 +16,7 @@ import android.widget.TextView;
|
|||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -50,7 +52,9 @@ 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));
|
||||
int navigationIconResId = AndroidUtils.getNavigationIconResId(getApplication());
|
||||
Drawable icBack = ((OsmandApplication) getApplication()).getUIUtilities().getIcon(navigationIconResId, activeButtonsAndLinksTextColorResId);
|
||||
tb.setNavigationIcon(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)));
|
||||
|
|
|
@ -106,7 +106,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(AndroidUtils.getNavigationIconResId(activity));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -18,7 +19,7 @@ public class OsmandActionBarActivity extends OsmandInAppPurchaseActivity {
|
|||
//should be called after set content view
|
||||
protected void setupHomeButton() {
|
||||
boolean lightTheme = getMyApplication().getSettings().isLightContent();
|
||||
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
||||
Drawable back = ((OsmandApplication)getApplication()).getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(getApplication()),
|
||||
lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
final ActionBar supportActionBar = getSupportActionBar();
|
||||
if (supportActionBar != null) {
|
||||
|
|
|
@ -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;
|
||||
|
@ -10,6 +11,7 @@ import android.widget.CompoundButton;
|
|||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
|
@ -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(AndroidUtils.getNavigationIconResId(app));
|
||||
tb.setNavigationIcon(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)));
|
||||
|
|
|
@ -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(AndroidUtils.getNavigationIconResId(mapActivity));
|
||||
back.setImageDrawable(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);
|
||||
|
|
|
@ -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(AndroidUtils.getNavigationIconResId(activity));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -28,6 +28,7 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Collator;
|
||||
import net.osmand.CollatorStringMatcher;
|
||||
import net.osmand.OsmAndCollator;
|
||||
|
@ -113,7 +114,8 @@ public class SearchDialogFragment extends DialogFragment implements DownloadEven
|
|||
int iconColorResId = isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark;
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
Drawable icBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back, iconColorResId);
|
||||
Drawable icBack = getMyApplication().getUIUtilities().getIcon(
|
||||
AndroidUtils.getNavigationIconResId(getContext()), iconColorResId);
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -103,7 +103,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
|
||||
private View toolbarContainer;
|
||||
private View toolbarView;
|
||||
private View toolbarBackButton;
|
||||
private ImageView toolbarBackButton;
|
||||
private TextView toolbarTextView;
|
||||
private View topButtonContainer;
|
||||
private LockableScrollView menuScrollView;
|
||||
|
@ -208,14 +208,17 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
openMenuHeaderOnly();
|
||||
}
|
||||
});
|
||||
toolbarBackButton.setImageResource(AndroidUtils.getNavigationIconResId(mapActivity));
|
||||
|
||||
topButtonContainer = view.findViewById(R.id.context_menu_top_button_container);
|
||||
view.findViewById(R.id.context_menu_top_back).setOnClickListener(new View.OnClickListener() {
|
||||
ImageView backButton = (ImageView) view.findViewById(R.id.context_menu_top_back);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
openMenuHeaderOnly();
|
||||
}
|
||||
});
|
||||
backButton.setImageResource(AndroidUtils.getNavigationIconResId(mapActivity));
|
||||
updateVisibility(topButtonContainer, 0);
|
||||
|
||||
map = mapActivity.getMapView();
|
||||
|
|
|
@ -64,7 +64,8 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
toolbar.setTitle(getToolbarTitle());
|
||||
|
||||
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);
|
||||
Drawable icBack = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app),
|
||||
!editor.isLight() ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light);
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setTitleTextColor(getResources().getColor(getResIdFromAttribute(getMapActivity(), R.attr.pstsTextColor)));
|
||||
|
|
|
@ -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;
|
||||
|
@ -207,7 +208,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(AndroidUtils.getNavigationIconResId(ctx), R.color.color_white);
|
||||
backButton.setImageDrawable(icBack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(AndroidUtils.getNavigationIconResId(getContext()), lightTheme ? R.color.color_black : R.color.active_buttons_and_links_text_dark);
|
||||
backBtn.setImageDrawable(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(AndroidUtils.getNavigationIconResId(getContext()), lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
backBtn.setImageDrawable(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));
|
||||
|
|
|
@ -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));
|
||||
int navigationIconResId = AndroidUtils.getNavigationIconResId(getContext());
|
||||
toolbar.setNavigationIcon(getIconsCache().getIcon(navigationIconResId));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -25,6 +25,7 @@ import androidx.fragment.app.FragmentPagerAdapter;
|
|||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.LockableViewPager;
|
||||
|
@ -150,7 +151,7 @@ public class MapMarkersDialogFragment extends DialogFragment implements OnGroupS
|
|||
View mainView = inflater.inflate(R.layout.fragment_map_markers_dialog, container);
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.map_markers_toolbar);
|
||||
Drawable icArrowBack = getMyApplication().getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
||||
Drawable icArrowBack = getMyApplication().getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(getContext()),
|
||||
lightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
toolbar.setNavigationIcon(icArrowBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
|
|
|
@ -251,7 +251,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(AndroidUtils.getNavigationIconResId(mapActivity));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -32,8 +32,8 @@ 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);
|
||||
Drawable icBack = getMyApplication().getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(ctx));
|
||||
topBar.setNavigationIcon(icBack);
|
||||
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)));
|
||||
|
|
|
@ -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(AndroidUtils.getNavigationIconResId(app));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
@ -145,7 +146,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(AndroidUtils.getNavigationIconResId(getContext()));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
@ -21,6 +22,7 @@ import androidx.appcompat.widget.Toolbar;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
|
@ -152,7 +154,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(AndroidUtils.getNavigationIconResId(getContext()), buttonsAndLinksTextColorResId);
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
|
||||
|
|
|
@ -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 icBack = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app),
|
||||
isLightContent ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
toolbar.setNavigationIcon(back);
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -102,7 +102,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));
|
||||
int icBackResId = AndroidUtils.getNavigationIconResId(app);
|
||||
toolbar.setNavigationIcon(getContentIcon(icBackResId));
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -25,6 +25,8 @@ import androidx.annotation.DrawableRes;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import androidx.appcompat.widget.AppCompatImageButton;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
@ -482,8 +484,8 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
}
|
||||
|
||||
private void buildMenuButtons(@NonNull View view) {
|
||||
View backButton = view.findViewById(R.id.back_button);
|
||||
View backButtonFlow = view.findViewById(R.id.back_button_flow);
|
||||
AppCompatImageView backButton = (AppCompatImageView) view.findViewById(R.id.back_button);
|
||||
AppCompatImageButton backButtonFlow = (AppCompatImageButton) view.findViewById(R.id.back_button_flow);
|
||||
OnClickListener backOnClick = new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -492,6 +494,9 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
};
|
||||
backButton.setOnClickListener(backOnClick);
|
||||
backButtonFlow.setOnClickListener(backOnClick);
|
||||
int navigationIconResId = AndroidUtils.getNavigationIconResId(getContext());
|
||||
backButton.setImageResource(navigationIconResId);
|
||||
backButtonFlow.setImageResource(navigationIconResId);
|
||||
|
||||
OnClickListener printOnClick = new OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import androidx.appcompat.widget.Toolbar;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.ValueHolder;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.DialogListItemAdapter;
|
||||
|
@ -85,7 +86,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(AndroidUtils.getNavigationIconResId(ctx));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -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(AndroidUtils.getNavigationIconResId(mapActivity));
|
||||
backButton.setImageDrawable(icBack);
|
||||
backButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.google.openlocationcode.OpenLocationCode;
|
|||
import com.jwetherell.openmap.common.LatLonPoint;
|
||||
import com.jwetherell.openmap.common.UTMPoint;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Collator;
|
||||
import net.osmand.CollatorStringMatcher;
|
||||
import net.osmand.LocationConvert;
|
||||
|
@ -131,7 +132,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
|
|||
view = inflater.inflate(R.layout.search_advanced_coords, container, false);
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
Drawable icBack = app.getUIUtilities().getIcon(R.drawable.ic_arrow_back,
|
||||
Drawable icBack = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(app),
|
||||
isLightTheme ? R.color.active_buttons_and_links_text_light : R.color.active_buttons_and_links_text_dark);
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
|
|
|
@ -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;
|
||||
|
@ -451,7 +452,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(AndroidUtils.getNavigationIconResId(app));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(
|
||||
new OnClickListener() {
|
||||
|
|
|
@ -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(AndroidUtils.getNavigationIconResId(getContext()),
|
||||
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(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@ import android.widget.TextView;
|
|||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.ResultMatcher;
|
||||
import net.osmand.ValueHolder;
|
||||
|
@ -313,8 +314,8 @@ 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);
|
||||
Drawable icBack = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(ctx));
|
||||
topBar.setNavigationIcon(icBack);
|
||||
topBar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
topBar.setTitle(title);
|
||||
topBar.setBackgroundColor(ContextCompat.getColor(ctx, getResIdFromAttribute(ctx, R.attr.pstsTabBackground)));
|
||||
|
|
|
@ -21,6 +21,7 @@ import androidx.core.content.ContextCompat;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.base.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(AndroidUtils.getNavigationIconResId(getContext()));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -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;
|
||||
|
@ -13,6 +14,7 @@ import androidx.annotation.Nullable;
|
|||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
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(AndroidUtils.getNavigationIconResId(getContext()));
|
||||
ImageView backBtn = (ImageView) mainView.findViewById(R.id.back_button);
|
||||
backBtn.setImageDrawable(getContentIcon(R.drawable.ic_arrow_back));
|
||||
backBtn.setImageDrawable(icBack);
|
||||
backBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
|
@ -85,7 +85,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(AndroidUtils.getNavigationIconResId(app));
|
||||
toolbar.setNavigationIcon(icBack);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue