diff --git a/OsmAnd/res/layout/dashboard_toolbar.xml b/OsmAnd/res/layout/dashboard_toolbar.xml
index 348a1e4307..8c0eed7069 100644
--- a/OsmAnd/res/layout/dashboard_toolbar.xml
+++ b/OsmAnd/res/layout/dashboard_toolbar.xml
@@ -10,90 +10,106 @@
app:contentInsetLeft="4dp"
app:contentInsetStart="4dp">
-
-
-
-
-
-
-
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/expandable_list_item_category.xml b/OsmAnd/res/layout/expandable_list_item_category.xml
index 4343a05ea3..14c9dcbce2 100644
--- a/OsmAnd/res/layout/expandable_list_item_category.xml
+++ b/OsmAnd/res/layout/expandable_list_item_category.xml
@@ -15,67 +15,74 @@
-
+ android:background="?attr/expandable_list_item_background" >
-
-
-
-
-
+ android:layout_marginStart="@dimen/list_content_padding">
-
+
-
+
-
+
+
+
+
+
+
+
+
+
diff --git a/OsmAnd/res/layout/fragment_search_list.xml b/OsmAnd/res/layout/fragment_search_list.xml
index 89424bd151..bc0eea6acc 100644
--- a/OsmAnd/res/layout/fragment_search_list.xml
+++ b/OsmAnd/res/layout/fragment_search_list.xml
@@ -24,12 +24,12 @@
android:id="@+id/searchEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginLeft="16dp"
+ android:layout_marginLeft="@dimen/content_padding"
+ android:layout_marginStart="@dimen/content_padding"
android:background="@null"
android:gravity="center_vertical"
android:lines="1"
- tools:text="Search request"
- android:layout_marginStart="16dp" />
+ tools:text="Search request" />
+ android:layout_marginLeft="@dimen/dialog_content_margin"
+ android:layout_marginStart="@dimen/dialog_content_margin"
+ android:gravity="center_vertical">
+ android:focusableInTouchMode="false" />
+ android:orientation="vertical">
@@ -198,9 +200,9 @@
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
- android:paddingRight="@dimen/list_content_padding"
- android:gravity="center_vertical"
- android:paddingEnd="@dimen/list_content_padding" />
+ android:layout_marginRight="@dimen/list_content_padding"
+ android:layout_marginEnd="@dimen/list_content_padding"
+ android:gravity="center_vertical" />
+ android:visibility="gone" />
diff --git a/OsmAnd/res/layout/list_menu_item_native.xml b/OsmAnd/res/layout/list_menu_item_native.xml
index 40a5860f6f..1a484146da 100644
--- a/OsmAnd/res/layout/list_menu_item_native.xml
+++ b/OsmAnd/res/layout/list_menu_item_native.xml
@@ -13,43 +13,62 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="24dp"
+ android:layout_marginStart="24dp"
android:gravity="center"
android:visibility="gone"
- tools:visibility="visible"
- android:layout_marginStart="24dp" />
+ tools:visibility="visible" />
-
+ android:layout_marginTop="@dimen/content_padding_small"
+ android:layout_marginBottom="@dimen/content_padding_small"
+ android:layout_weight="1">
-
+
-
-
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/local_index_list_item.xml b/OsmAnd/res/layout/local_index_list_item.xml
index ab39d8fb66..2f4b900dda 100644
--- a/OsmAnd/res/layout/local_index_list_item.xml
+++ b/OsmAnd/res/layout/local_index_list_item.xml
@@ -1,77 +1,84 @@
-
-
-
-
-
+ android:minHeight="@dimen/list_item_height">
+ android:orientation="horizontal"
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginStart="@dimen/list_content_padding">
-
+ android:layout_marginRight="@dimen/local_index_check_right_margin"
+ android:layout_marginEnd="@dimen/local_index_check_right_margin"
+ android:layout_marginTop="@dimen/favorites_icon_top_margin"
+ android:focusable="false"
+ android:visibility="gone"/>
+
+ android:layout_gravity="center_vertical"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ android:textColor="?android:textColorPrimary"
+ android:textSize="@dimen/default_list_text_size"
+ tools:text="Bangladesh"/>
+
+
+
+
+
+
+
+
+
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/main_menu_drawer_btn_configure_profile.xml b/OsmAnd/res/layout/main_menu_drawer_btn_configure_profile.xml
index 1ab1910af6..c3efbab785 100644
--- a/OsmAnd/res/layout/main_menu_drawer_btn_configure_profile.xml
+++ b/OsmAnd/res/layout/main_menu_drawer_btn_configure_profile.xml
@@ -43,9 +43,9 @@
+ android:paddingStart="@dimen/context_menu_padding_margin_default"
+ android:paddingEnd="@dimen/context_menu_padding_margin_default"
+ android:paddingTop="3dp">
+ tools:src="@drawable/ic_action_opening_hour_16" />
+ tools:visibility="visible">
+ tools:visibility="visible">
+ tools:visibility="visible">
+ android:orientation="vertical">
+ tools:textColor="?attr/contextMenuButtonColor" />
+ tools:textColor="?attr/contextMenuButtonColor" />
diff --git a/OsmAnd/res/layout/order_poi_list_item.xml b/OsmAnd/res/layout/order_poi_list_item.xml
index c3a56f7a2f..1fe14f3a31 100644
--- a/OsmAnd/res/layout/order_poi_list_item.xml
+++ b/OsmAnd/res/layout/order_poi_list_item.xml
@@ -51,7 +51,6 @@
android:paddingRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half"
- android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular"
diff --git a/OsmAnd/res/layout/quick_action_add_dialog_item.xml b/OsmAnd/res/layout/quick_action_add_dialog_item.xml
index 342f650b19..901a43ab45 100644
--- a/OsmAnd/res/layout/quick_action_add_dialog_item.xml
+++ b/OsmAnd/res/layout/quick_action_add_dialog_item.xml
@@ -8,10 +8,10 @@
android:minHeight="48dp"
android:paddingRight="24dp"
android:paddingLeft="24dp"
- android:background="?attr/selectableItemBackground"
- android:orientation="horizontal"
android:paddingStart="24dp"
- android:paddingEnd="24dp">
+ android:paddingEnd="24dp"
+ android:background="?attr/selectableItemBackground"
+ android:orientation="horizontal">
+ tools:text="Add marker" />
diff --git a/OsmAnd/res/layout/search_list_item.xml b/OsmAnd/res/layout/search_list_item.xml
index f823df926c..14531a3a05 100644
--- a/OsmAnd/res/layout/search_list_item.xml
+++ b/OsmAnd/res/layout/search_list_item.xml
@@ -58,11 +58,11 @@
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
- android:paddingRight="16dp"
+ android:layout_marginRight="16dp"
+ android:layout_marginEnd="16dp"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
- tools:text="Amsterdam"
- android:paddingEnd="16dp" />
+ tools:text="Amsterdam" />
+ android:layout_marginStart="24dp">
+ android:layout_marginTop="@dimen/content_padding_half"
+ android:layout_marginRight="@dimen/content_padding_half"
+ android:layout_marginEnd="@dimen/content_padding_half"
+ android:orientation="horizontal">
+ android:orientation="horizontal">
+ android:layout_marginRight="@dimen/content_padding_half"
+ android:layout_marginEnd="@dimen/content_padding_half"
+ android:textAppearance="@style/TextAppearance.ListItemTitle" />
+ android:layout_marginLeft="@dimen/list_content_padding"
+ android:layout_marginStart="@dimen/list_content_padding">
= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ tv.setCompoundDrawablesRelativeWithIntrinsicBounds(start, top, end, bottom);
+ } else {
+ tv.setCompoundDrawablesWithIntrinsicBounds(start, top, end, bottom);
+ }
+ }
+
+ public static ArrayList getChildrenViews(ViewGroup vg) {
+ ArrayList result = new ArrayList<>();
+ for (int i = 0; i < vg.getChildCount(); i++) {
+ View child = vg.getChildAt(i);
+ result.add(child);
+ }
+ return result;
+ }
+
+ public static void setPadding(View view, int start, int top, int end, int bottom) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ view.setPaddingRelative(start, top, end, bottom);
+ } else {
+ view.setPadding(start, top, end, bottom);
+ }
+ }
+
+ public static void setMargins(ViewGroup.MarginLayoutParams layoutParams, int start, int top, int end, int bottom) {
+ layoutParams.setMargins(start, top, end, bottom);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ layoutParams.setMarginStart(start);
+ layoutParams.setMarginEnd(end);
+ }
+ }
public static int getLayoutDirection(@NonNull Context ctx) {
Locale currentLocale = ctx.getResources().getConfiguration().locale;
diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
index de7b4e7b07..01cf01da9d 100644
--- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java
@@ -213,7 +213,7 @@ public class ContextMenuAdapter {
TextView title = convertView.findViewById(R.id.title);
title.setText(item.getTitle());
-
+
if (layoutId == R.layout.main_menu_drawer_btn_switch_profile) {
ImageView icon = convertView.findViewById(R.id.icon);
icon.setImageDrawable(mIconsCache.getIcon(item.getIcon(), colorResId));
@@ -340,7 +340,6 @@ public class ContextMenuAdapter {
drawable.setBounds(0, 0, drawableSizeInPixels, drawableSizeInPixels);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
tv.setCompoundDrawablesRelative(drawable, null, null, null);
- UiUtilities.setupLayoutDirection(tv);
} else {
tv.setCompoundDrawables(drawable, null, null, null);
}
diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java
index fde5357591..25c668955f 100644
--- a/OsmAnd/src/net/osmand/plus/UiUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java
@@ -15,6 +15,7 @@ import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
+import android.support.annotation.RequiresApi;
import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
@@ -38,6 +39,7 @@ import net.osmand.data.LatLon;
import net.osmand.plus.views.DirectionDrawable;
import net.osmand.plus.widgets.TextViewEx;
+import java.util.ArrayList;
import java.util.Locale;
import gnu.trove.map.hash.TLongObjectHashMap;
@@ -387,11 +389,36 @@ public class UiUtilities {
image.setRotationY(rotation);
}
- public static void setupLayoutDirection(View layout) {
- int direction = AndroidUtils.getLayoutDirection(layout.getContext());
+ public static void setupLayoutDirection(View view) {
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ return;
+ }
+ int layoutDirection = AndroidUtils.getLayoutDirection(view.getContext());
+ if (view instanceof ViewGroup) {
+ setupLayoutDirection(view, layoutDirection);
+ ArrayList childrenViews = AndroidUtils.getChildrenViews((ViewGroup) view);
+ if (childrenViews != null) {
+ for (View child : childrenViews) {
+ setupLayoutDirection(child);
+ }
+ }
+ } else if (view instanceof TextView) {
+ int textDirection = layoutDirection ==
+ ViewCompat.LAYOUT_DIRECTION_RTL ?
+ View.TEXT_DIRECTION_RTL : View.TEXT_DIRECTION_LTR;
+ setupTextDirection((TextView) view, textDirection);
+ }
+ }
+
+ private static void setupLayoutDirection(View layout, int direction) {
ViewCompat.setLayoutDirection(layout, direction);
}
+ @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
+ private static void setupTextDirection(TextView text, int direction) {
+ text.setTextDirection(direction);
+ }
+
public static void setupCompoundButtonDrawable(Context ctx, boolean nightMode, @ColorInt int activeColor, Drawable drawable) {
int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
int[][] states = new int[][] {
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesSearchFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesSearchFragment.java
index c34b5af973..b8317c51c0 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesSearchFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesSearchFragment.java
@@ -44,6 +44,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;
@@ -480,6 +481,7 @@ public class FavoritesSearchFragment extends DialogFragment {
}
}
ViewCompat.setAccessibilityDelegate(view, accessibilityAssistant);
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
index abb2ce2a38..83f241e450 100644
--- a/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
+++ b/OsmAnd/src/net/osmand/plus/activities/FavoritesTreeFragment.java
@@ -46,6 +46,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.base.OsmandExpandableListFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
@@ -173,8 +174,8 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
View searchView = inflater.inflate(R.layout.search_fav_list_item, null);
searchView.setBackgroundResource(light ? R.color.list_background_color_light : R.color.list_background_color_dark);
TextView title = (TextView) searchView.findViewById(R.id.title);
- title.setCompoundDrawablesWithIntrinsicBounds(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark), null, null, null);
- title.setHint(R.string.shared_string_search);
+ Drawable searchIcon = getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_search_dark);
+ AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(title, searchIcon, null, null, null);
searchView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -237,6 +238,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
listView.setSelection(selection);
}
}
+ UiUtilities.setupLayoutDirection(view);
return view;
}
@@ -904,6 +906,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
} else {
ch.setVisibility(View.GONE);
}
+ UiUtilities.setupLayoutDirection(row);
return row;
}
@@ -1007,6 +1010,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
row.findViewById(R.id.favourite_icon).setVisibility(View.VISIBLE);
ch.setVisibility(View.GONE);
}
+ UiUtilities.setupLayoutDirection(row);
return row;
}
diff --git a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
index 68a5958d50..d8d1d5d8ca 100644
--- a/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/base/MenuBottomSheetDialogFragment.java
@@ -110,6 +110,7 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
}
updateBottomButtons();
setupHeightAndBackground(mainView);
+ UiUtilities.setupLayoutDirection(mainView);
return mainView;
}
diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
index 5b3d0d0b83..2b0c44dcd4 100644
--- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
+++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java
@@ -344,6 +344,8 @@ 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);
diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
index fd778cfb2a..0fc2d4bc36 100644
--- a/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
+++ b/OsmAnd/src/net/osmand/plus/download/DownloadActivity.java
@@ -46,6 +46,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.Version;
import net.osmand.plus.activities.LocalIndexInfo;
import net.osmand.plus.activities.MapActivity;
@@ -141,6 +142,7 @@ public class DownloadActivity extends AbstractDownloadActivity implements Downlo
final View downloadProgressLayout = findViewById(R.id.downloadProgressLayout);
downloadProgressLayout.setVisibility(View.VISIBLE);
updateDescriptionTextWithSize(this, downloadProgressLayout);
+ UiUtilities.setupLayoutDirection(downloadProgressLayout);
int currentTab = DOWNLOAD_TAB_NUMBER;
String tab = getIntent() == null || getIntent().getExtras() == null ? null : getIntent().getExtras().getString(TAB_TO_OPEN);
if (tab != null) {
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java
index 86ef9e6995..2c5547fc83 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadGroupViewHolder.java
@@ -4,6 +4,7 @@ import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.TextView;
+import net.osmand.AndroidUtils;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.R;
import net.osmand.plus.download.DownloadActivity;
@@ -26,20 +27,20 @@ public class DownloadGroupViewHolder {
}
private Drawable getIconForGroup(DownloadResourceGroup group) {
- Drawable iconLeft;
+ Drawable iconStart;
if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroup.DownloadResourceGroupType.VOICE_TTS) {
- iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
+ iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroup.DownloadResourceGroupType.FONTS) {
- iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
+ iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
- iconLeft = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
+ iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
} else {
DownloadResourceGroup ggr = group
.getSubGroupById(DownloadResourceGroup.DownloadResourceGroupType.REGION_MAPS.getDefaultId());
- iconLeft = cache.getThemedIcon(R.drawable.ic_map);
+ iconStart = cache.getThemedIcon(R.drawable.ic_map);
if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
@@ -53,21 +54,21 @@ public class DownloadGroupViewHolder {
}
if (item != null) {
if (item.isOutdated()) {
- iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
+ iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
} else {
- iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
+ iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
}
}
}
}
}
- return iconLeft;
+ return iconStart;
}
public void bindItem(DownloadResourceGroup group) {
- Drawable iconLeft = getIconForGroup(group);
- textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
String name = group.getName(ctx);
textView.setText(name);
+ Drawable iconStart = getIconForGroup(group);
+ AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
}
}
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java
index b46836ba0e..f30c0db279 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadResourceGroupFragment.java
@@ -6,6 +6,7 @@ import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
+import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.MenuItemCompat;
@@ -131,6 +132,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
listView.setOnChildClickListener(this);
listAdapter = new DownloadResourceGroupAdapter(activity);
listView.setAdapter(listAdapter);
+ UiUtilities.setupLayoutDirection(view);
return view;
}
@@ -525,6 +527,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
public DownloadGroupViewHolder(DownloadActivity ctx, View v) {
this.ctx = ctx;
textView = (TextView) v.findViewById(R.id.title);
+ UiUtilities.setupLayoutDirection(textView);
}
private boolean isParentWorld(DownloadResourceGroup group) {
@@ -533,20 +536,20 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
}
private Drawable getIconForGroup(DownloadResourceGroup group) {
- Drawable iconLeft;
+ Drawable iconStart;
if (group.getType() == DownloadResourceGroupType.VOICE_REC
|| group.getType() == DownloadResourceGroupType.VOICE_TTS) {
- iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
+ iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_volume_up);
} else if (group.getType() == DownloadResourceGroupType.FONTS) {
- iconLeft = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
+ iconStart = ctx.getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_action_map_language);
} else {
UiUtilities cache = ctx.getMyApplication().getUIUtilities();
if (isParentWorld(group) || isParentWorld(group.getParentGroup())) {
- iconLeft = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
+ iconStart = cache.getThemedIcon(R.drawable.ic_world_globe_dark);
} else {
DownloadResourceGroup ggr = group
.getSubGroupById(DownloadResourceGroupType.REGION_MAPS.getDefaultId());
- iconLeft = cache.getThemedIcon(R.drawable.ic_map);
+ iconStart = cache.getThemedIcon(R.drawable.ic_map);
if (ggr != null && ggr.getIndividualResources() != null) {
IndexItem item = null;
for (IndexItem ii : ggr.getIndividualResources()) {
@@ -560,22 +563,22 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
}
if (item != null) {
if (item.isOutdated()) {
- iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
+ iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_distance);
} else {
- iconLeft = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
+ iconStart = cache.getIcon(R.drawable.ic_map, R.color.color_ok);
}
}
}
}
}
- return iconLeft;
+ return iconStart;
}
public void bindItem(DownloadResourceGroup group) {
- Drawable iconLeft = getIconForGroup(group);
- textView.setCompoundDrawablesWithIntrinsicBounds(iconLeft, null, null, null);
String name = group.getName(ctx);
textView.setText(name);
+ Drawable iconStart = getIconForGroup(group);
+ AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(textView, iconStart, null, null, null);
}
}
@@ -675,6 +678,7 @@ public class DownloadResourceGroupFragment extends DialogFragment implements Dow
Resources.Theme theme = ctx.getTheme();
theme.resolveAttribute(R.attr.activity_background_color, typedValue, true);
v.setBackgroundColor(typedValue.data);
+ UiUtilities.setupLayoutDirection(v);
return v;
}
diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java
index 89ab85263c..1a53729f1f 100644
--- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java
+++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java
@@ -21,6 +21,7 @@ import android.widget.Toast;
import net.osmand.map.WorldRegion;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.Version;
import net.osmand.plus.activities.LocalIndexHelper.LocalIndexType;
import net.osmand.plus.activities.LocalIndexInfo;
@@ -98,6 +99,7 @@ public class ItemViewHolder {
textColorPrimary = typedValue.data;
theme.resolveAttribute(android.R.attr.textColorSecondary, typedValue, true);
textColorSecondary = typedValue.data;
+ UiUtilities.setupLayoutDirection(view);
}
public void setShowRemoteDate(boolean showRemoteDate) {
diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java
index 9db441bc31..be7cefd79a 100644
--- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java
+++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java
@@ -604,6 +604,7 @@ public class GpxUiHelper {
builder.setTitle(R.string.show_gpx);
} else {
final View apprTitleView = View.inflate(new ContextThemeWrapper(activity, themeRes), R.layout.select_gpx_appearance_title, null);
+ UiUtilities.setupLayoutDirection(apprTitleView);
final OsmandSettings.CommonPreference prefWidth
= app.getSettings().getCustomRenderProperty(CURRENT_TRACK_WIDTH_ATTR);
@@ -619,7 +620,7 @@ public class GpxUiHelper {
popup.setAnchorView(apprTitleView);
popup.setContentWidth(AndroidUtils.dpToPx(activity, 200f));
popup.setModal(true);
- popup.setDropDownGravity(Gravity.RIGHT | Gravity.TOP);
+ popup.setDropDownGravity(Gravity.END | Gravity.TOP);
popup.setVerticalOffset(AndroidUtils.dpToPx(activity, -48f));
popup.setHorizontalOffset(AndroidUtils.dpToPx(activity, -6f));
final GpxAppearanceAdapter gpxApprAdapter = new GpxAppearanceAdapter(new ContextThemeWrapper(activity, themeRes),
diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
index dceab09fdd..1781ffda27 100644
--- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java
@@ -37,6 +37,7 @@ import android.widget.TextView;
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.LocalIndexHelper;
import net.osmand.plus.activities.LocalIndexInfo;
@@ -435,6 +436,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc
} else {
divider.setVisibility(View.VISIBLE);
}
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java
index 456b720968..5a6e69c185 100644
--- a/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/liveupdates/ReportsFragment.java
@@ -31,6 +31,7 @@ import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.osm.io.NetworkUtils;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.liveupdates.CountrySelectionFragment.CountryItem;
@@ -207,6 +208,7 @@ public class ReportsFragment extends BaseOsmAndFragment implements CountrySelect
inactiveColor = getColorFromAttr(R.attr.plugin_details_install_header_bg);
textColorPrimary = getColorFromAttr(android.R.attr.textColorPrimary);
textColorSecondary = getColorFromAttr(android.R.attr.textColorSecondary);
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
index 9d8bd58b2d..2358f29cd4 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java
@@ -627,8 +627,9 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
Drawable drawable = getIcon(iconResId, bottomButtonsColor);
directionsButton.setTextColor(ContextCompat.getColor(mapActivity, bottomButtonsColor));
- directionsButton.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
- directionsButton.setCompoundDrawablePadding(dpToPx(8));
+ AndroidUtils.setCompoundDrawablesWithIntrinsicBounds(directionsButton, null, null, drawable, null);
+ int contentPaddingHalf = (int) getResources().getDimension(R.dimen.content_padding_half);
+ directionsButton.setCompoundDrawablePadding(contentPaddingHalf);
directionsButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -662,6 +663,7 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
}
};
+ UiUtilities.setupLayoutDirection(view);
created = true;
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
index 377df7a9dd..02d2ee28d4 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
@@ -561,7 +561,7 @@ public class MenuBuilder {
ImageView iconView = new ImageView(view.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
- llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
+ AndroidUtils.setMargins(llIconParams, dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconParams.gravity = Gravity.CENTER_VERTICAL;
iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@@ -574,7 +574,7 @@ public class MenuBuilder {
llText.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f;
- llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
+ AndroidUtils.setMargins(llTextViewParams, 0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams);
ll.addView(llText);
@@ -583,7 +583,7 @@ public class MenuBuilder {
if (!Algorithms.isEmpty(textPrefix)) {
textPrefixView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0);
+ AndroidUtils.setMargins(llTextParams, icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0);
textPrefixView.setLayoutParams(llTextParams);
textPrefixView.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textPrefixView.setTextSize(12);
@@ -597,7 +597,8 @@ public class MenuBuilder {
// Primary text
TextViewEx textView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextParams.setMargins(icon != null ? 0 : dpToPx(16f), dpToPx(textPrefixView != null ? 2f : (secondaryText != null ? 10f : 8f)), 0, dpToPx(secondaryText != null ? 6f : 8f));
+ AndroidUtils.setMargins(llTextParams,
+ icon != null ? 0 : dpToPx(16f), dpToPx(textPrefixView != null ? 2f : (secondaryText != null ? 10f : 8f)), 0, dpToPx(secondaryText != null ? 6f : 8f));
textView.setLayoutParams(llTextParams);
textView.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textView.setTextSize(16);
@@ -628,7 +629,7 @@ public class MenuBuilder {
if (!TextUtils.isEmpty(secondaryText)) {
TextViewEx textViewSecondary = new TextViewEx(view.getContext());
LinearLayout.LayoutParams llTextSecondaryParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextSecondaryParams.setMargins(icon != null ? 0 : dpToPx(16f), 0, 0, dpToPx(6f));
+ AndroidUtils.setMargins(llTextSecondaryParams, icon != null ? 0 : dpToPx(16f), 0, 0, dpToPx(6f));
textViewSecondary.setLayoutParams(llTextSecondaryParams);
textViewSecondary.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textViewSecondary.setTextSize(14);
@@ -642,7 +643,7 @@ public class MenuBuilder {
TextViewEx buttonTextView = new TextViewEx(view.getContext());
LinearLayout.LayoutParams buttonTextViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
buttonTextViewParams.gravity = Gravity.CENTER_VERTICAL;
- buttonTextViewParams.setMargins(dpToPx(8), 0, dpToPx(8), 0);
+ AndroidUtils.setMargins(buttonTextViewParams, dpToPx(8), 0, dpToPx(8), 0);
buttonTextView.setLayoutParams(buttonTextViewParams);
buttonTextView.setTypeface(FontCache.getRobotoMedium(view.getContext()));
buttonTextView.setAllCaps(true);
@@ -661,7 +662,7 @@ public class MenuBuilder {
ll.addView(llIconCollapse);
LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
- llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
+ AndroidUtils.setMargins(llIconCollapseParams, 0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@@ -721,6 +722,7 @@ public class MenuBuilder {
});
}
+ UiUtilities.setupLayoutDirection(baseView);
((LinearLayout) view).addView(baseView);
rowBuilt();
@@ -826,7 +828,7 @@ public class MenuBuilder {
Button buttonView = new Button(view.getContext());
LinearLayout.LayoutParams llBtnParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
buttonView.setLayoutParams(llBtnParams);
- buttonView.setPadding(dpToPx(10f), 0, dpToPx(10f), 0);
+ AndroidUtils.setPadding(buttonView, dpToPx(10f), 0, dpToPx(10f), 0);
buttonView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
//buttonView.setTextSize(view.getResources().getDimension(resolveAttribute(view.getContext(), R.dimen.default_desc_text_size)));
buttonView.setTextColor(view.getResources().getColor(AndroidUtils.resolveAttribute(view.getContext(), R.attr.contextMenuButtonColor)));
@@ -850,7 +852,7 @@ public class MenuBuilder {
LinearLayout.LayoutParams llHorLineParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dpToPx(1f));
llHorLineParams.gravity = Gravity.BOTTOM;
if (!matchWidthDivider) {
- llHorLineParams.setMargins(dpToPx(64f), 0, 0, 0);
+ AndroidUtils.setMargins(llHorLineParams, dpToPx(64f), 0, 0, 0);
}
horizontalLine.setLayoutParams(llHorLineParams);
horizontalLine.setBackgroundColor(app.getResources().getColor(light ? R.color.ctx_menu_bottom_view_divider_light : R.color.ctx_menu_bottom_view_divider_dark));
@@ -914,12 +916,12 @@ public class MenuBuilder {
baseView.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams llBaseViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
baseView.setLayoutParams(llBaseViewParams);
- baseView.setPadding(dpToPx(16), 0, dpToPx(16), dpToPx(12));
+ AndroidUtils.setPadding(baseView, dpToPx(16), 0, dpToPx(16), dpToPx(12));
baseView.setBackgroundResource(AndroidUtils.resolveAttribute(view.getContext(), android.R.attr.selectableItemBackground));
TextViewEx transportRect = new TextViewEx(view.getContext());
LinearLayout.LayoutParams trParams = new LinearLayout.LayoutParams(dpToPx(32), dpToPx(18));
- trParams.setMargins(0, dpToPx(16), 0, 0);
+ AndroidUtils.setMargins(trParams, 0, dpToPx(16), 0, 0);
transportRect.setLayoutParams(trParams);
transportRect.setGravity(Gravity.CENTER);
transportRect.setAllCaps(true);
@@ -942,7 +944,7 @@ public class MenuBuilder {
LinearLayout infoView = new LinearLayout(view.getContext());
infoView.setOrientation(LinearLayout.VERTICAL);
LinearLayout.LayoutParams infoViewLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- infoViewLayoutParams.setMargins(dpToPx(16), dpToPx(12), dpToPx(16), 0);
+ AndroidUtils.setMargins(infoViewLayoutParams, dpToPx(16), dpToPx(12), dpToPx(16), 0);
infoView.setLayoutParams(infoViewLayoutParams);
baseView.addView(infoView);
@@ -961,14 +963,14 @@ public class MenuBuilder {
LinearLayout typeView = new LinearLayout(view.getContext());
typeView.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams typeViewParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- typeViewParams.setMargins(0, dpToPx(8), 0, 0);
+ AndroidUtils.setMargins(typeViewParams, 0, dpToPx(8), 0, 0);
typeView.setGravity(Gravity.CENTER);
typeView.setLayoutParams(typeViewParams);
infoView.addView(typeView);
ImageView typeImageView = new ImageView(view.getContext());
LinearLayout.LayoutParams typeImageParams = new LinearLayout.LayoutParams(dpToPx(16), dpToPx(16));
- typeImageParams.setMargins(dpToPx(4), 0, dpToPx(4), 0);
+ AndroidUtils.setMargins(typeImageParams, dpToPx(4), 0, dpToPx(4), 0);
typeImageView.setLayoutParams(typeImageParams);
int drawableResId = route.type == null ? R.drawable.ic_action_polygom_dark : route.type.getResourceId();
typeImageView.setImageDrawable(getRowIcon(drawableResId));
@@ -1036,7 +1038,7 @@ public class MenuBuilder {
final TextViewEx textView = new TextViewEx(context);
textView.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llTextDescParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextDescParams.setMargins(dpToPx(64f), 0, dpToPx(40f), dpToPx(13f));
+ AndroidUtils.setMargins(llTextDescParams, dpToPx(64f), 0, dpToPx(40f), dpToPx(13f));
textView.setLayoutParams(llTextDescParams);
textView.setTypeface(FontCache.getRobotoRegular(context));
textView.setTextSize(16);
@@ -1073,7 +1075,7 @@ public class MenuBuilder {
view.setVisibility(collapsed ? View.GONE : View.VISIBLE);
LinearLayout.LayoutParams llParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
if (needMargin) {
- llParams.setMargins(dpToPx(64f), 0, dpToPx(12f), 0);
+ AndroidUtils.setMargins(llParams, dpToPx(64f), 0, dpToPx(12f), 0);
}
view.setLayoutParams(llParams);
return view;
@@ -1086,7 +1088,7 @@ public class MenuBuilder {
protected TextViewEx buildButtonInCollapsableView(Context context, boolean selected, boolean showAll, boolean singleLine) {
TextViewEx button = new TextViewEx(new ContextThemeWrapper(context, light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llWikiButtonParams.setMargins(0, 0, 0, dpToPx(8f));
+ AndroidUtils.setMargins(llWikiButtonParams, 0, 0, 0, dpToPx(8f));
//button.setMinimumHeight(dpToPx(36f));
button.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoRegular(context));
@@ -1101,7 +1103,7 @@ public class MenuBuilder {
button.setBackgroundResource(bg);
button.setTextSize(14);
int paddingSides = dpToPx(10f);
- button.setPadding(paddingSides, paddingSides, paddingSides, paddingSides);
+ AndroidUtils.setPadding(button, paddingSides, paddingSides, paddingSides, paddingSides);
if (!selected) {
ColorStateList buttonColorStateList = AndroidUtils.createPressedColorStateList(context, !light,
R.color.ctx_menu_controller_button_text_color_light_n, R.color.ctx_menu_controller_button_text_color_light_p,
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
index eb3e9f7112..865d43edfc 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java
@@ -134,7 +134,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ImageView iconView = new ImageView(view.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
- llIconParams.setMargins(dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
+ AndroidUtils.setMargins(llIconParams, dpToPx(16f), dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconParams.gravity = Gravity.CENTER_VERTICAL;
iconView.setLayoutParams(llIconParams);
iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@@ -151,7 +151,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (!Algorithms.isEmpty(textPrefix)) {
textPrefixView = new TextView(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextParams.setMargins(icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0);
+ AndroidUtils.setMargins(llTextParams, icon == null ? dpToPx(16f) : 0, dpToPx(8f), 0, 0);
textPrefixView.setLayoutParams(llTextParams);
textPrefixView.setTextSize(12);
textPrefixView.setTextColor(app.getResources().getColor(R.color.ctx_menu_buttons_text_color));
@@ -163,7 +163,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
TextView textView = new TextView(view.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextParams.setMargins(icon == null ? dpToPx(16f) : 0,
+ AndroidUtils.setMargins(llTextParams, icon == null ? dpToPx(16f) : 0,
textPrefixView == null ? (collapsable ? dpToPx(13f) : dpToPx(8f)) : dpToPx(2f), 0, collapsable && textPrefixView == null ? dpToPx(13f) : dpToPx(8f));
textView.setLayoutParams(llTextParams);
textView.setTextSize(16);
@@ -199,7 +199,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
LinearLayout.LayoutParams llTextViewParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT);
llTextViewParams.weight = 1f;
- llTextViewParams.setMargins(0, 0, dpToPx(10f), 0);
+ AndroidUtils.setMargins(llTextViewParams, 0, 0, dpToPx(10f), 0);
llTextViewParams.gravity = Gravity.CENTER_VERTICAL;
llText.setLayoutParams(llTextViewParams);
if (textPrefixView != null) {
@@ -217,7 +217,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.addView(llIconCollapse);
LinearLayout.LayoutParams llIconCollapseParams = new LinearLayout.LayoutParams(dpToPx(24f), dpToPx(24f));
- llIconCollapseParams.setMargins(0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
+ AndroidUtils.setMargins(llIconCollapseParams, 0, dpToPx(12f), dpToPx(24f), dpToPx(12f));
llIconCollapseParams.gravity = Gravity.CENTER_VERTICAL;
iconViewCollapse.setLayoutParams(llIconCollapseParams);
iconViewCollapse.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
@@ -247,7 +247,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
if (isWiki) {
TextViewEx button = new TextViewEx(new ContextThemeWrapper(view.getContext(), light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme));
LinearLayout.LayoutParams llWikiButtonParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, dpToPx(36f));
- llWikiButtonParams.setMargins(dpToPx(16f), 0, 0, dpToPx(16f));
+ AndroidUtils.setMargins(llWikiButtonParams, dpToPx(16f), 0, 0, dpToPx(16f));
button.setLayoutParams(llWikiButtonParams);
button.setTypeface(FontCache.getRobotoMedium(app));
button.setBackgroundResource(light ? R.drawable.context_menu_controller_bg_light : R.drawable.context_menu_controller_bg_dark);
diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java
index fa79c17c72..d8d5d43e0c 100644
--- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java
+++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/GpxItemMenuBuilder.java
@@ -10,6 +10,7 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import net.osmand.AndroidUtils;
import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
@@ -64,7 +65,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
private void buildIcon(LinearLayout ll, int gpxSmallIconMargin, int iconId) {
ImageView icon = new ImageView(ll.getContext());
LinearLayout.LayoutParams llIconParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llIconParams.setMargins(0, 0, gpxSmallIconMargin, 0);
+ AndroidUtils.setMargins(llIconParams, 0, 0, gpxSmallIconMargin, 0);
llIconParams.gravity = Gravity.CENTER_VERTICAL;
icon.setLayoutParams(llIconParams);
icon.setImageDrawable(app.getUIUtilities().getThemedIcon(iconId));
@@ -74,7 +75,7 @@ public class GpxItemMenuBuilder extends MenuBuilder {
private void buildTextView(LinearLayout ll, int gpxSmallTextMargin, float gpxTextSize, int textColor, String text) {
TextView textView = new TextView(ll.getContext());
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
- llTextParams.setMargins(0, 0, gpxSmallTextMargin, 0);
+ AndroidUtils.setMargins(llTextParams, 0, 0, gpxSmallTextMargin, 0);
textView.setLayoutParams(llTextParams);
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, gpxTextSize);
textView.setTextColor(textColor);
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
index 0caa56c355..b27bb51596 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java
@@ -213,6 +213,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
}
}
});
+ UiUtilities.setupLayoutDirection(mainView);
return mainView;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/OptionsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/OptionsBottomSheetDialogFragment.java
index 32f80ffc7f..065da138af 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/OptionsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/OptionsBottomSheetDialogFragment.java
@@ -15,6 +15,7 @@ import android.widget.ImageView;
import net.osmand.AndroidUtils;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.base.BottomSheetDialogFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
@@ -182,6 +183,7 @@ public class OptionsBottomSheetDialogFragment extends BottomSheetDialogFragment
}
}
});
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
index 3d487e3831..3cec9eb93e 100644
--- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java
@@ -63,6 +63,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter newCards, @NonNull List prevCards) {
@@ -953,7 +954,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
}
};
ll.getViewTreeObserver().addOnGlobalLayoutListener(globalListener);
-
+ UiUtilities.setupLayoutDirection(ll);
}
private void updateOptionsButtons() {
@@ -1007,6 +1008,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
} else { // LTR
optionsContainer.setPadding(optionsContainer.getPaddingLeft(), optionsContainer.getPaddingTop(), endPadding, optionsContainer.getPaddingBottom());
}
+ UiUtilities.setupLayoutDirection(optionsContainer);
}
private void updateControlButtons(MapActivity mapActivity, View mainView) {
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java
index 9463a42981..ebd892fe9e 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchCoordinatesFragment.java
@@ -350,6 +350,7 @@ public class QuickSearchCoordinatesFragment extends DialogFragment implements Os
parseLocation();
updateControlsVisibility();
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
index 495b341b1e..25b3415aa2 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchDialogFragment.java
@@ -71,6 +71,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;
@@ -676,6 +677,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
}
});
updateFab();
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java
index 016cae3dfd..92edd78975 100644
--- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java
+++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java
@@ -23,6 +23,7 @@ import net.osmand.osm.AbstractPoiType;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
+import net.osmand.plus.UiUtilities;
import net.osmand.plus.UiUtilities.UpdateLocationViewCache;
import net.osmand.plus.search.listitems.QuickSearchHeaderListItem;
import net.osmand.plus.search.listitems.QuickSearchListItem;
@@ -438,12 +439,13 @@ public class QuickSearchListAdapter extends ArrayAdapter {
divider.setLayoutParams(p);
} else {
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp1);
- p.setMargins(dp56, 0, 0 ,0);
+ AndroidUtils.setMargins(p, dp56, 0, 0, 0);
divider.setLayoutParams(p);
}
}
}
ViewCompat.setAccessibilityDelegate(view, accessibilityAssistant);
+ UiUtilities.setupLayoutDirection(view);
return view;
}
diff --git a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java
index aa478a2705..4f7e75260a 100644
--- a/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java
+++ b/OsmAnd/src/net/osmand/plus/settings/BaseSettingsFragment.java
@@ -413,6 +413,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
imageView.setEnabled(enabled);
}
}
+ UiUtilities.setupLayoutDirection(holder.itemView);
}
@SuppressLint("RestrictedApi")