summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-01-04 13:40:34 +0100
committerTobrun <tobrun@mapbox.com>2018-01-05 11:16:44 +0100
commit5f8b61351fe240becba8073da00ecce37ff8f804 (patch)
treebc7ad59a58488c45c3c3ce3c8fb2049ed05e5d31 /platform
parentaa158bb20c7a8b37b3a6def0ea246f0a952bb27a (diff)
downloadqtlocation-mapboxgl-5f8b61351fe240becba8073da00ecce37ff8f804.tar.gz
[android] - RTL support
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java10
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java2
3 files changed, 12 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
index 34be958329..46dba28b98 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMapOptions.java
@@ -55,7 +55,7 @@ public class MapboxMapOptions implements Parcelable {
@ColorInt
private int attributionTintColor = UNDEFINED_COLOR;
private boolean attributionEnabled = true;
- private int attributionGravity = Gravity.BOTTOM;
+ private int attributionGravity = Gravity.BOTTOM | Gravity.START;
private int[] attributionMargins;
private double minZoom = MapboxConstants.MINIMUM_ZOOM;
@@ -234,7 +234,7 @@ public class MapboxMapOptions implements Parcelable {
mapboxMapOptions.attributionEnabled(typedArray.getBoolean(
R.styleable.mapbox_MapView_mapbox_uiAttribution, true));
mapboxMapOptions.attributionGravity(typedArray.getInt(
- R.styleable.mapbox_MapView_mapbox_uiAttributionGravity, Gravity.BOTTOM));
+ R.styleable.mapbox_MapView_mapbox_uiAttributionGravity, Gravity.BOTTOM | Gravity.START));
mapboxMapOptions.attributionMargins(new int[] {
(int) (typedArray.getDimension(R.styleable.mapbox_MapView_mapbox_uiAttributionMarginLeft,
NINETY_TWO_DP * pxlRatio)),
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
index 0843828554..4f37dd6f36 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
@@ -6,6 +6,7 @@ import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.PointF;
import android.graphics.drawable.Drawable;
+import android.os.Build;
import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.NonNull;
@@ -925,7 +926,7 @@ public final class UiSettings {
initMargins[2] = right;
initMargins[3] = bottom;
- // convert inital margins with padding
+ // convert initial margins with padding
int[] contentPadding = projection.getContentPadding();
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) view.getLayoutParams();
left += contentPadding[0];
@@ -933,6 +934,13 @@ public final class UiSettings {
right += contentPadding[2];
bottom += contentPadding[3];
layoutParams.setMargins(left, top, right, bottom);
+
+ // support RTL
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ layoutParams.setMarginStart(left);
+ layoutParams.setMarginEnd(right);
+ }
+
view.setLayoutParams(layoutParams);
}
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java
index 4f929641f3..65bdff41ab 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/maps/MapboxMapOptionsTest.java
@@ -91,7 +91,7 @@ public class MapboxMapOptionsTest {
@Test
public void testAttributionGravity() {
- assertEquals(Gravity.BOTTOM, new MapboxMapOptions().getAttributionGravity());
+ assertEquals(Gravity.BOTTOM | Gravity.START, new MapboxMapOptions().getAttributionGravity());
assertEquals(Gravity.BOTTOM, new MapboxMapOptions().attributionGravity(Gravity.BOTTOM).getAttributionGravity());
assertNotEquals(Gravity.START, new MapboxMapOptions().attributionGravity(Gravity.BOTTOM).getAttributionGravity());
}