summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorLeith Bade <leith@mapbox.com>2015-10-22 11:16:39 +1100
committerLeith Bade <leith@mapbox.com>2015-10-22 16:21:03 +1100
commit729a793b0eb55f3016bff54cf7fe22039b10b76e (patch)
tree6d4910f304c14817eb1bcdbdce56bcb6a68da597 /android
parent2daa5f14a8902ef0fe623558097f18644a2a8bf6 (diff)
downloadqtlocation-mapboxgl-729a793b0eb55f3016bff54cf7fe22039b10b76e.tar.gz
Add style string resources
Use _ in public resources ids Make visibility attributes enums Make attrs public Remove info window margin public value Reformat XML code Test app uses XML map properties for InfoWindow activities Fixes #2703
Diffstat (limited to 'android')
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java2
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java66
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res-public/values/public.xml38
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/color/material_bg_selector.xml9
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/drawable/ic_info_selector.xml4
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/layout/attribution_list_item.xml6
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_content.xml33
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_view.xml2
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/values/attrs.xml67
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/values/strings.xml7
-rw-r--r--android/java/MapboxGLAndroidSDK/src/main/res/values/styles.xml1
-rw-r--r--android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java3
-rw-r--r--android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java4
-rw-r--r--android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml13
-rw-r--r--android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml15
15 files changed, 161 insertions, 109 deletions
diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java
index f13fad3357..1b0b16bb7b 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java
+++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/Style.java
@@ -23,6 +23,8 @@ public class Style {
public @interface StyleUrl {
}
+ // IMPORTANT: If you change any of these you also need to edit them in strings.xml
+
/**
* Mapbox Streets: Our signature style.
*/
diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
index 515f1a74d7..dd757082c4 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
+++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/views/MapView.java
@@ -17,7 +17,6 @@ import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.RectF;
import android.graphics.SurfaceTexture;
-import android.graphics.drawable.BitmapDrawable;
import android.location.Location;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -38,7 +37,6 @@ import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
-import android.util.Log;
import android.view.GestureDetector;
import android.view.Gravity;
import android.view.InputDevice;
@@ -684,26 +682,26 @@ public final class MapView extends FrameLayout {
// Load the attributes
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.MapView, 0, 0);
try {
- double centerLatitude = typedArray.getFloat(R.styleable.MapView_centerLatitude, 0.0f);
- double centerLongitude = typedArray.getFloat(R.styleable.MapView_centerLongitude, 0.0f);
+ double centerLatitude = typedArray.getFloat(R.styleable.MapView_center_latitude, 0.0f);
+ double centerLongitude = typedArray.getFloat(R.styleable.MapView_center_longitude, 0.0f);
LatLng centerCoordinate = new LatLng(centerLatitude, centerLongitude);
setCenterCoordinate(centerCoordinate);
// need to set zoom level first because of limitation on rotating when zoomed out
- setZoomLevel(typedArray.getFloat(R.styleable.MapView_zoomLevel, 0.0f));
+ setZoomLevel(typedArray.getFloat(R.styleable.MapView_zoom_level, 0.0f));
setDirection(typedArray.getFloat(R.styleable.MapView_direction, 0.0f));
- setZoomEnabled(typedArray.getBoolean(R.styleable.MapView_zoomEnabled, true));
- setScrollEnabled(typedArray.getBoolean(R.styleable.MapView_scrollEnabled, true));
- setRotateEnabled(typedArray.getBoolean(R.styleable.MapView_rotateEnabled, true));
- setDebugActive(typedArray.getBoolean(R.styleable.MapView_debugActive, false));
- if (typedArray.getString(R.styleable.MapView_styleUrl) != null) {
- setStyleUrl(typedArray.getString(R.styleable.MapView_styleUrl));
+ setZoomEnabled(typedArray.getBoolean(R.styleable.MapView_zoom_enabled, true));
+ setScrollEnabled(typedArray.getBoolean(R.styleable.MapView_scroll_enabled, true));
+ setRotateEnabled(typedArray.getBoolean(R.styleable.MapView_rotate_enabled, true));
+ setDebugActive(typedArray.getBoolean(R.styleable.MapView_debug_active, false));
+ if (typedArray.getString(R.styleable.MapView_style_url) != null) {
+ setStyleUrl(typedArray.getString(R.styleable.MapView_style_url));
}
- if (typedArray.getString(R.styleable.MapView_accessToken) != null) {
- setAccessToken(typedArray.getString(R.styleable.MapView_accessToken));
+ if (typedArray.getString(R.styleable.MapView_access_token) != null) {
+ setAccessToken(typedArray.getString(R.styleable.MapView_access_token));
}
- if (typedArray.getString(R.styleable.MapView_styleClasses) != null) {
+ if (typedArray.getString(R.styleable.MapView_style_classes) != null) {
List<String> styleClasses = Arrays.asList(typedArray
- .getString(R.styleable.MapView_styleClasses).split("\\s*,\\s*"));
+ .getString(R.styleable.MapView_style_classes).split("\\s*,\\s*"));
for (String styleClass : styleClasses) {
if (styleClass.length() == 0) {
styleClasses.remove(styleClass);
@@ -713,31 +711,31 @@ public final class MapView extends FrameLayout {
}
// Compass
- setCompassEnabled(typedArray.getBoolean(R.styleable.MapView_compassEnabled, true));
- setCompassGravity(typedArray.getInt(R.styleable.MapView_compassGravity, Gravity.TOP | Gravity.END));
- setWidgetMargins(mCompassView, typedArray.getDimension(R.styleable.MapView_compassMarginLeft, DIMENSION_TEN_DP)
- , typedArray.getDimension(R.styleable.MapView_compassMarginTop, DIMENSION_TEN_DP)
- , typedArray.getDimension(R.styleable.MapView_compassMarginRight, DIMENSION_TEN_DP)
- , typedArray.getDimension(R.styleable.MapView_compassMarginBottom, DIMENSION_TEN_DP));
+ setCompassEnabled(typedArray.getBoolean(R.styleable.MapView_compass_enabled, true));
+ setCompassGravity(typedArray.getInt(R.styleable.MapView_compass_gravity, Gravity.TOP | Gravity.END));
+ setWidgetMargins(mCompassView, typedArray.getDimension(R.styleable.MapView_compass_margin_left, DIMENSION_TEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_compass_margin_top, DIMENSION_TEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_compass_margin_right, DIMENSION_TEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_compass_margin_bottom, DIMENSION_TEN_DP));
// Logo
- setLogoVisibility(typedArray.getInt(R.styleable.MapView_logoVisibility, VISIBLE));
- setLogoGravity(typedArray.getInt(R.styleable.MapView_logoGravity, Gravity.BOTTOM | Gravity.START));
- setWidgetMargins(mLogoView, typedArray.getDimension(R.styleable.MapView_logoMarginLeft, DIMENSION_SIXTEEN_DP)
- , typedArray.getDimension(R.styleable.MapView_logoMarginTop, DIMENSION_SIXTEEN_DP)
- , typedArray.getDimension(R.styleable.MapView_logoMarginRight, DIMENSION_SIXTEEN_DP)
- , typedArray.getDimension(R.styleable.MapView_logoMarginBottom, DIMENSION_SIXTEEN_DP));
+ setLogoVisibility(typedArray.getInt(R.styleable.MapView_logo_visibility, View.VISIBLE));
+ setLogoGravity(typedArray.getInt(R.styleable.MapView_logo_gravity, Gravity.BOTTOM | Gravity.START));
+ setWidgetMargins(mLogoView, typedArray.getDimension(R.styleable.MapView_logo_margin_left, DIMENSION_SIXTEEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_logo_margin_top, DIMENSION_SIXTEEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_logo_margin_right, DIMENSION_SIXTEEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_logo_margin_bottom, DIMENSION_SIXTEEN_DP));
// Attribution
- setAttributionVisibility(typedArray.getInt(R.styleable.MapView_attributionVisibility, VISIBLE));
- setAttributionGravity(typedArray.getInt(R.styleable.MapView_attributionGravity, Gravity.BOTTOM));
- setWidgetMargins(mAttributionsView, typedArray.getDimension(R.styleable.MapView_attributionMarginLeft, DIMENSION_SEVENTYSIX_DP)
- , typedArray.getDimension(R.styleable.MapView_attributionMarginTop, DIMENSION_SEVEN_DP)
- , typedArray.getDimension(R.styleable.MapView_attributionMarginRight, DIMENSION_SEVEN_DP)
- , typedArray.getDimension(R.styleable.MapView_attributionMarginBottom, DIMENSION_SEVEN_DP));
+ setAttributionVisibility(typedArray.getInt(R.styleable.MapView_attribution_visibility, View.VISIBLE));
+ setAttributionGravity(typedArray.getInt(R.styleable.MapView_attribution_gravity, Gravity.BOTTOM));
+ setWidgetMargins(mAttributionsView, typedArray.getDimension(R.styleable.MapView_attribution_margin_left, DIMENSION_SEVENTYSIX_DP)
+ , typedArray.getDimension(R.styleable.MapView_attribution_margin_top, DIMENSION_SEVEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_attribution_margin_right, DIMENSION_SEVEN_DP)
+ , typedArray.getDimension(R.styleable.MapView_attribution_margin_bottom, DIMENSION_SEVEN_DP));
// User location
- setMyLocationEnabled(typedArray.getBoolean(R.styleable.MapView_myLocationEnabled, false));
+ setMyLocationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false));
} finally {
typedArray.recycle();
}
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/android/java/MapboxGLAndroidSDK/src/main/res-public/values/public.xml
index 64412f3b03..f6cb05662d 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res-public/values/public.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res-public/values/public.xml
@@ -2,5 +2,41 @@
<resources>
<!--Add references to exposed resources-->
<public name="AttributionAlertDialogStyle" type="style" />
- <public name="infowindow_margin" type="dimen" />
+
+ <public name="style_mapbox_streets" type="string" />
+ <public name="style_emerald" type="string" />
+ <public name="style_light" type="string" />
+ <public name="style_dark" type="string" />
+ <public name="style_satellite" type="string" />
+
+ <public name="center_longitude" type="attr" />
+ <public name="center_latitude" type="attr" />
+ <public name="zoom_level" type="attr" />
+ <public name="direction" type="attr" />
+ <public name="zoom_enabled" type="attr" />
+ <public name="scroll_enabled" type="attr" />
+ <public name="rotate_enabled" type="attr" />
+ <public name="debug_active" type="attr" />
+ <public name="style_url" type="attr" />
+ <public name="access_token" type="attr" />
+ <public name="style_classes" type="attr" />
+ <public name="my_location_enabled" type="attr" />
+ <public name="compass_enabled" type="attr" />
+ <public name="compass_gravity" type="attr" />
+ <public name="compass_margin_left" type="attr" />
+ <public name="compass_margin_top" type="attr" />
+ <public name="compass_margin_right" type="attr" />
+ <public name="compass_margin_bottom" type="attr" />
+ <public name="logo_gravity" type="attr" />
+ <public name="logo_margin_left" type="attr" />
+ <public name="logo_margin_top" type="attr" />
+ <public name="logo_margin_right" type="attr" />
+ <public name="logo_margin_bottom" type="attr" />
+ <public name="logo_visibility" type="attr" />
+ <public name="attribution_gravity" type="attr" />
+ <public name="attribution_margin_left" type="attr" />
+ <public name="attribution_margin_top" type="attr" />
+ <public name="attribution_margin_right" type="attr" />
+ <public name="attribution_margin_bottom" type="attr" />
+ <public name="attribution_visibility" type="attr" />
</resources>
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/color/material_bg_selector.xml b/android/java/MapboxGLAndroidSDK/src/main/res/color/material_bg_selector.xml
index 0da674ac74..64d7f46c2d 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/color/material_bg_selector.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/color/material_bg_selector.xml
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<selector xmlns:android="http://schemas.android.com/apk/res/android" >
- <item
- android:color="?attr/colorPrimaryDark"
- android:state_pressed="true"/>
- <item
- android:color="?attr/colorPrimary" />
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:color="?attr/colorPrimaryDark" android:state_pressed="true" />
+ <item android:color="?attr/colorPrimary" />
</selector> \ No newline at end of file
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/drawable/ic_info_selector.xml b/android/java/MapboxGLAndroidSDK/src/main/res/drawable/ic_info_selector.xml
index fdbabbae1b..9f550f66d5 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/drawable/ic_info_selector.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/drawable/ic_info_selector.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:state_pressed="true" android:drawable="@drawable/ic_info_blue_pressed" />
- <item android:drawable="@drawable/ic_info_blue_normal" />
+ <item android:drawable="@drawable/ic_info_blue_pressed" android:state_pressed="true" />
+ <item android:drawable="@drawable/ic_info_blue_normal" />
</selector> \ No newline at end of file
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/layout/attribution_list_item.xml b/android/java/MapboxGLAndroidSDK/src/main/res/layout/attribution_list_item.xml
index f0a9121584..1252fb194f 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/layout/attribution_list_item.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/layout/attribution_list_item.xml
@@ -3,9 +3,9 @@
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceListItemSmall"
- android:textColor="@android:color/white"
android:gravity="center_vertical"
+ android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="16dp"
android:paddingRight="16dp"
- android:minHeight="?android:attr/listPreferredItemHeightSmall" />
+ android:textAppearance="?android:attr/textAppearanceListItemSmall"
+ android:textColor="@android:color/white" />
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_content.xml b/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_content.xml
index eed2f0c2c7..47c5d90d79 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_content.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_content.xml
@@ -1,54 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
-<RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/infowindow_content"
- android:background="@color/white"
- android:padding="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="vertical">
+ android:background="@color/white"
+ android:orientation="vertical"
+ android:padding="5dp">
<TextView
android:id="@+id/infowindow_title"
android:layout_width="wrap_content"
android:layout_height="0dp"
- android:textColor="@color/black"
- android:textSize="18sp"
- android:maxEms="17"
android:layout_gravity="left"
android:layout_weight="1"
- android:text="@string/infoWindowTitle"/>
+ android:maxEms="17"
+ android:text="@string/infoWindowTitle"
+ android:textColor="@color/black"
+ android:textSize="18sp" />
<TextView
android:id="@+id/infowindow_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="@color/black"
- android:textSize="14sp"
android:maxEms="17"
- android:text="@string/infoWindowDescription"/>
+ android:text="@string/infoWindowDescription"
+ android:textColor="@color/black"
+ android:textSize="14sp" />
<TextView
android:id="@+id/infowindow_subdescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textColor="@color/black"
- android:textSize="12sp"
android:maxEms="17"
android:text="@string/infoWindowAddress"
- android:visibility="gone"/>
+ android:textColor="@color/black"
+ android:textSize="12sp"
+ android:visibility="gone" />
</LinearLayout>
<com.mapbox.mapboxsdk.annotations.InfoWindowTipView
android:id="@+id/infowindow_tipview"
- android:layout_below="@+id/infowindow_content"
android:layout_width="@dimen/infowindow_tipview_width"
- android:layout_height="8dp"/>
+ android:layout_height="8dp"
+ android:layout_below="@+id/infowindow_content" />
</RelativeLayout>
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_view.xml b/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_view.xml
index 731abefd49..ff47642426 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_view.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/layout/infowindow_view.xml
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<com.mapbox.mapboxsdk.annotations.InfoWindowView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ android:layout_height="wrap_content" />
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/values/attrs.xml b/android/java/MapboxGLAndroidSDK/src/main/res/values/attrs.xml
index 2eae497b7a..be946714d6 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/values/attrs.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/values/attrs.xml
@@ -1,19 +1,20 @@
<resources>
+ <!-- these are public -->
<declare-styleable name="MapView">
- <attr name="centerLongitude" format="float" />
- <attr name="centerLatitude" format="float" />
- <attr name="zoomLevel" format="float" />
+ <attr name="center_longitude" format="float" />
+ <attr name="center_latitude" format="float" />
+ <attr name="zoom_level" format="float" />
<attr name="direction" format="float" />
- <attr name="zoomEnabled" format="boolean" />
- <attr name="scrollEnabled" format="boolean" />
- <attr name="rotateEnabled" format="boolean" />
- <attr name="debugActive" format="boolean" />
- <attr name="styleUrl" format="string" />
- <attr name="accessToken" format="string"/>
- <attr name="styleClasses" format="string"/>
- <attr name="myLocationEnabled" format="boolean" />
- <attr name="compassEnabled" format="boolean" />
- <attr name="compassGravity">
+ <attr name="zoom_enabled" format="boolean" />
+ <attr name="scroll_enabled" format="boolean" />
+ <attr name="rotate_enabled" format="boolean" />
+ <attr name="debug_active" format="boolean" />
+ <attr name="style_url" format="string" />
+ <attr name="access_token" format="string" />
+ <attr name="style_classes" format="string" />
+ <attr name="my_location_enabled" format="boolean" />
+ <attr name="compass_enabled" format="boolean" />
+ <attr name="compass_gravity">
<flag name="top" value="0x30" />
<flag name="bottom" value="0x50" />
<flag name="left" value="0x03" />
@@ -29,11 +30,11 @@
<flag name="start" value="0x00800003" />
<flag name="end" value="0x00800005" />
</attr>
- <attr name="compassMarginLeft" format="dimension"/>
- <attr name="compassMarginTop" format="dimension"/>
- <attr name="compassMarginRight" format="dimension"/>
- <attr name="compassMarginBottom" format="dimension"/>
- <attr name="logoGravity">
+ <attr name="compass_margin_left" format="dimension" />
+ <attr name="compass_margin_top" format="dimension" />
+ <attr name="compass_margin_right" format="dimension" />
+ <attr name="compass_margin_bottom" format="dimension" />
+ <attr name="logo_gravity">
<flag name="top" value="0x30" />
<flag name="bottom" value="0x50" />
<flag name="left" value="0x03" />
@@ -49,12 +50,16 @@
<flag name="start" value="0x00800003" />
<flag name="end" value="0x00800005" />
</attr>
- <attr name="logoMarginLeft" format="dimension"/>
- <attr name="logoMarginTop" format="dimension"/>
- <attr name="logoMarginRight" format="dimension"/>
- <attr name="logoMarginBottom" format="dimension"/>
- <attr name="logoVisibility" format="integer"/>
- <attr name="attributionGravity">
+ <attr name="logo_margin_left" format="dimension" />
+ <attr name="logo_margin_top" format="dimension" />
+ <attr name="logo_margin_right" format="dimension" />
+ <attr name="logo_margin_bottom" format="dimension" />
+ <attr name="logo_visibility">
+ <enum name="visible" value="0x0" />
+ <enum name="invisible" value="0x4" />
+ <enum name="gone" value="0x8" />
+ </attr>
+ <attr name="attribution_gravity">
<flag name="top" value="0x30" />
<flag name="bottom" value="0x50" />
<flag name="left" value="0x03" />
@@ -70,10 +75,14 @@
<flag name="start" value="0x00800003" />
<flag name="end" value="0x00800005" />
</attr>
- <attr name="attributionMarginLeft" format="dimension"/>
- <attr name="attributionMarginTop" format="dimension"/>
- <attr name="attributionMarginRight" format="dimension"/>
- <attr name="attributionMarginBottom" format="dimension"/>
- <attr name="attributionVisibility" format="integer"/>
+ <attr name="attribution_margin_left" format="dimension" />
+ <attr name="attribution_margin_top" format="dimension" />
+ <attr name="attribution_margin_right" format="dimension" />
+ <attr name="attribution_margin_bottom" format="dimension" />
+ <attr name="attribution_visibility">
+ <enum name="visible" value="0x0" />
+ <enum name="invisible" value="0x4" />
+ <enum name="gone" value="0x8" />
+ </attr>
</declare-styleable>
</resources>
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/values/strings.xml b/android/java/MapboxGLAndroidSDK/src/main/res/values/strings.xml
index be9a1d38cd..a29d7de7ce 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/values/strings.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/values/strings.xml
@@ -7,4 +7,11 @@
<string name="infoWindowTitle">Title</string>
<string name="infoWindowDescription">Description</string>
<string name="infoWindowAddress">Address</string>
+
+ <!-- these are public -->
+ <string name="style_mapbox_streets">asset://styles/streets-v8.json</string>
+ <string name="style_emerald">asset://styles/emerald-v8.json</string>
+ <string name="style_light">asset://styles/light-v8.json</string>
+ <string name="style_dark">asset://styles/dark-v8.json</string>
+ <string name="style_satellite">asset://styles/satellite-v8.json</string>
</resources>
diff --git a/android/java/MapboxGLAndroidSDK/src/main/res/values/styles.xml b/android/java/MapboxGLAndroidSDK/src/main/res/values/styles.xml
index a0859a998c..9ad12f76ad 100644
--- a/android/java/MapboxGLAndroidSDK/src/main/res/values/styles.xml
+++ b/android/java/MapboxGLAndroidSDK/src/main/res/values/styles.xml
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <!-- these are public -->
<style name="AttributionAlertDialogStyle" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:textColorPrimary">@android:color/white</item>
<item name="android:background">@color/mapbox_blue</item>
diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java
index 202653ccbe..f53f923b0e 100644
--- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java
+++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowActivity.java
@@ -34,9 +34,6 @@ public class InfoWindowActivity extends AppCompatActivity {
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setAccessToken(ApiAccess.getToken(this));
mMapView.onCreate(savedInstanceState);
- mMapView.setStyle(Style.MAPBOX_STREETS);
- mMapView.setCenterCoordinate(new LatLng(38.897705003219784, -77.03655168667463));
- mMapView.setZoomLevel(15);
mMapView.addMarker(new MarkerOptions()
.title("Intersection")
diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java
index 10082d5ff2..a5e08f6cd3 100644
--- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java
+++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/InfoWindowAdapterActivity.java
@@ -37,7 +37,6 @@ public class InfoWindowAdapterActivity extends AppCompatActivity {
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setAccessToken(ApiAccess.getToken(this));
mMapView.onCreate(savedInstanceState);
- mMapView.setStyle(Style.MAPBOX_STREETS);
mMapView.setInfoWindowAdapter(new MapView.InfoWindowAdapter() {
private int tenDp = (int) getResources().getDimension(R.dimen.attr_margin);
@@ -59,9 +58,6 @@ public class InfoWindowAdapterActivity extends AppCompatActivity {
mMapView.addMarker(generateMarker("Vatican City", 41.902916, 12.453389, "#009688"));
mMapView.addMarker(generateMarker("San Marino", 43.942360, 12.457777, "#795548"));
mMapView.addMarker(generateMarker("Liechtenstein", 47.166000, 9.555373, "#FF5722"));
-
- mMapView.setCenterCoordinate(new LatLng(47.798202, 7.573781));
- mMapView.setZoomLevel(4);
}
private MarkerOptions generateMarker(String title, double lat, double lng, String color) {
diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml
index cf020bb91a..b84f05143d 100644
--- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml
+++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow.xml
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@@ -10,11 +11,15 @@
android:layout_height="wrap_content"
android:background="@color/primary"
android:minHeight="?attr/actionBarSize"
- android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
+ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<com.mapbox.mapboxsdk.views.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ app:style_url="@string/style_mapbox_streets"
+ app:center_latitude="38.897705003219784"
+ app:center_longitude="-77.03655168667463"
+ app:zoom_level="15" />
</LinearLayout>
diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml
index 52c1c97175..371219cb5d 100644
--- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml
+++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_infowindow_adapter.xml
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
@@ -10,11 +11,15 @@
android:layout_height="wrap_content"
android:background="@color/primary"
android:minHeight="?attr/actionBarSize"
- android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
+ android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<com.mapbox.mapboxsdk.views.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ app:style_url="@string/style_mapbox_streets"
+ app:center_latitude="47.798202"
+ app:center_longitude="7.573781"
+ app:zoom_level="4" />
</LinearLayout>