RTL - Step 3

This commit is contained in:
Nazar-Kutz 2020-06-11 10:32:26 +03:00
parent 20a91eafef
commit 0ec0609b4f
14 changed files with 44 additions and 15 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="100%p" android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="100%p"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>

View file

@ -12,8 +12,7 @@
android:id="@+id/main_view" android:id="@+id/main_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical">
android:background="@drawable/bg_left_menu_dark">
<LinearLayout <LinearLayout
android:id="@+id/top_bar_layout" android:id="@+id/top_bar_layout"

View file

@ -30,17 +30,17 @@
android:id="@+id/title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical|start"
android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start" android:layout_marginLeft="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginRight="@dimen/bottom_sheet_divider_margin_start" android:layout_marginRight="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginEnd="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textAppearance="@style/TextAppearance.ListItemTitle" android:textAppearance="@style/TextAppearance.ListItemTitle"
android:textColor="?attr/active_color_basic" android:textColor="?attr/active_color_basic"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
tools:text="Some Title" tools:text="Some Title" />
android:layout_marginEnd="@dimen/bottom_sheet_divider_margin_start"
android:layout_marginStart="@dimen/bottom_sheet_divider_margin_start" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/compound_button" android:id="@+id/compound_button"

View file

@ -77,7 +77,7 @@
android:id="@+id/show_all_title" android:id="@+id/show_all_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical|start"
android:paddingTop="@dimen/list_header_padding" android:paddingTop="@dimen/list_header_padding"
android:paddingBottom="@dimen/list_header_padding" android:paddingBottom="@dimen/list_header_padding"
android:layout_marginStart="@dimen/route_info_list_text_padding" android:layout_marginStart="@dimen/route_info_list_text_padding"

View file

@ -154,6 +154,7 @@
<item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item> <item name="bg_map_context_menu">@drawable/bg_map_context_menu_light</item>
<item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item> <item name="bottom_menu_view_bg">@drawable/bg_bottom_menu_light</item>
<item name="left_menu_view_bg">@drawable/bg_left_menu_light</item> <item name="left_menu_view_bg">@drawable/bg_left_menu_light</item>
<item name="right_menu_view_bg">@drawable/bg_right_menu_light</item>
<item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item> <item name="bg_point_editor_view">@drawable/bg_point_editor_view_light</item>
<item name="dashboard_divider">@color/divider_color_light</item> <item name="dashboard_divider">@color/divider_color_light</item>
<item name="divider_color">@color/divider_color</item> <item name="divider_color">@color/divider_color</item>

View file

@ -5,6 +5,7 @@ import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import net.osmand.AndroidUtils;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities; import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.MapActivity;
@ -67,7 +68,8 @@ public abstract class BaseMenuController {
public int getSlideInAnimation() { public int getSlideInAnimation() {
if (isLandscapeLayout()) { if (isLandscapeLayout()) {
return R.anim.slide_in_left; return AndroidUtils.isLayoutRtl(getMapActivity())
? R.anim.slide_in_right : R.anim.slide_in_left;
} else { } else {
return R.anim.slide_in_bottom; return R.anim.slide_in_bottom;
} }
@ -75,7 +77,8 @@ public abstract class BaseMenuController {
public int getSlideOutAnimation() { public int getSlideOutAnimation() {
if (isLandscapeLayout()) { if (isLandscapeLayout()) {
return R.anim.slide_out_left; return AndroidUtils.isLayoutRtl(getMapActivity())
? R.anim.slide_out_right : R.anim.slide_out_left;
} else { } else {
return R.anim.slide_out_bottom; return R.anim.slide_out_bottom;
} }

View file

@ -278,7 +278,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n); light ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
Drawable pressed = app.getUIUtilities().getIcon(R.drawable.ic_action_read_text, Drawable pressed = app.getUIUtilities().getIcon(R.drawable.ic_action_read_text,
light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p); light ? R.color.ctx_menu_controller_button_text_color_light_p : R.color.ctx_menu_controller_button_text_color_dark_p);
button.setCompoundDrawablesWithIntrinsicBounds(Build.VERSION.SDK_INT >= 21 AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(button, Build.VERSION.SDK_INT >= 21
? AndroidUtils.createPressedStateListDrawable(normal, pressed) : normal, null, null, null); ? AndroidUtils.createPressedStateListDrawable(normal, pressed) : normal, null, null, null);
button.setCompoundDrawablePadding(dpToPx(8f)); button.setCompoundDrawablePadding(dpToPx(8f));
llText.addView(button); llText.addView(button);

View file

@ -172,6 +172,8 @@ public class TrackDetailsMenu {
} }
} }
}); });
int navigationIconResId = AndroidUtils.getNavigationIconResId(mapActivity);
toolbarController.setBackBtnIconIds(navigationIconResId, navigationIconResId);
toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() { toolbarController.setOnCloseButtonClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {

View file

@ -511,8 +511,9 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
slideInAnim = R.anim.slide_in_bottom; slideInAnim = R.anim.slide_in_bottom;
slideOutAnim = R.anim.slide_out_bottom; slideOutAnim = R.anim.slide_out_bottom;
} else { } else {
slideInAnim = R.anim.slide_in_left; boolean isLayoutRtl = AndroidUtils.isLayoutRtl(mapActivity);
slideOutAnim = R.anim.slide_out_left; slideInAnim = isLayoutRtl ? R.anim.slide_in_right : R.anim.slide_in_left;
slideOutAnim = isLayoutRtl ? R.anim.slide_out_right : R.anim.slide_out_left;
} }
} }

View file

@ -82,7 +82,8 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
int expandType = args.getInt(EXPAND_TYPE_KEY, -1); int expandType = args.getInt(EXPAND_TYPE_KEY, -1);
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.bottom_sheet_item_toolbar_title, null); final View titleView = View.inflate(new ContextThemeWrapper(getContext(), themeRes),
R.layout.bottom_sheet_item_toolbar_title, null);
TextView textView = (TextView) titleView.findViewById(R.id.title); TextView textView = (TextView) titleView.findViewById(R.id.title);
textView.setText(R.string.show_along_the_route); textView.setText(R.string.show_along_the_route);

View file

@ -114,7 +114,7 @@ public class MapMarkersCard extends BaseCard {
if (i > 0) { if (i > 0) {
View div = new View(ctx); View div = new View(ctx);
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(ctx, 1f)); LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, AndroidUtils.dpToPx(ctx, 1f));
p.setMargins(listTextPadding, 0, 0, 0); AndroidUtils.setMargins(p, listTextPadding, 0, 0, 0);
div.setLayoutParams(p); div.setLayoutParams(p);
AndroidUtils.setBackgroundColor(ctx, div, nightMode, R.color.divider_color_light, R.color.divider_color_dark); AndroidUtils.setBackgroundColor(ctx, div, nightMode, R.color.divider_color_light, R.color.divider_color_dark);
div.setVisibility(View.VISIBLE); div.setVisibility(View.VISIBLE);

View file

@ -1,12 +1,14 @@
package net.osmand.plus.routepreparationmenu.cards; package net.osmand.plus.routepreparationmenu.cards;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.text.SpannableString; import android.text.SpannableString;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.view.View; import android.view.View;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -59,6 +61,11 @@ public class PedestrianRouteCard extends BaseCard {
} else { } else {
AndroidUtils.setBackground(app, buttonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark); AndroidUtils.setBackground(app, buttonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
} }
Drawable icPedestrian = app.getUIUtilities().getIcon(
R.drawable.ic_action_pedestrian_dark,
R.color.description_font_and_bottom_sheet_icons);
((ImageView) view.findViewById(R.id.image)).setImageDrawable(
AndroidUtils.getDrawableForDirection(app, icPedestrian));
view.findViewById(R.id.card_divider).setVisibility(View.VISIBLE); view.findViewById(R.id.card_divider).setVisibility(View.VISIBLE);
view.findViewById(R.id.top_divider).setVisibility(View.GONE); view.findViewById(R.id.top_divider).setVisibility(View.GONE);
} }

View file

@ -11,6 +11,7 @@ import androidx.annotation.NonNull;
import androidx.appcompat.view.ContextThemeWrapper; import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import net.osmand.AndroidUtils;
import net.osmand.GPXUtilities.GPXFile; import net.osmand.GPXUtilities.GPXFile;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.plus.GPXDatabase.GpxDataItem; import net.osmand.plus.GPXDatabase.GpxDataItem;
@ -110,7 +111,7 @@ public class TracksCard extends BaseCard {
img.setVisibility(View.VISIBLE); img.setVisibility(View.VISIBLE);
LinearLayout container = (LinearLayout) v.findViewById(R.id.container); LinearLayout container = (LinearLayout) v.findViewById(R.id.container);
container.setMinimumHeight(minCardHeight); container.setMinimumHeight(minCardHeight);
container.setPadding(listContentPadding, 0, 0, 0); AndroidUtils.setPadding(container, listContentPadding, 0, 0, 0);
v.setOnClickListener(new View.OnClickListener() { v.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {