diff options
author | Tobrun <tobrun@mapbox.com> | 2016-05-23 13:07:04 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2016-05-23 14:04:53 +0200 |
commit | 3ef740c7531db5ef40b9c7f7c263a082a2405f94 (patch) | |
tree | d5d5e2bec154ebf7f3d3fa497e6c9e20d48af09c | |
parent | 3a251dda46417067f5f0053159b9c49968179be4 (diff) | |
download | qtlocation-mapboxgl-3ef740c7531db5ef40b9c7f7c263a082a2405f94.tar.gz |
[android] #5083 - add InfoWindow offset based on height of associated MarkerView, removed unused icons, renamed feature activity
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java | 12 | ||||
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml | 2 | ||||
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java (renamed from platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/ViewMarkerAdapterActivity.java) | 13 | ||||
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_brazil.png | bin | 2178 -> 0 bytes | |||
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_china.png | bin | 745 -> 0 bytes | |||
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_germany.png | bin | 168 -> 0 bytes | |||
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_us.png | bin | 323 -> 418 bytes |
7 files changed, 13 insertions, 14 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java index aaf6a733f2..982d279caf 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/MarkerViewManager.java @@ -170,12 +170,6 @@ public class MarkerViewManager { if (adapter.getMarkerClass() == marker.getClass()) { convertView = (View) adapter.getViewReusePool().acquire(); View adaptedView = adapter.getView(marker, convertView, mapView); - - // InfoWindow offset - Point infoWindowOffset = marker.getInfoWindowOffset(); - marker.setTopOffsetPixels(-infoWindowOffset.y); - marker.setRightOffsetPixels(infoWindowOffset.x); - if (adaptedView != null) { // tilt @@ -206,6 +200,12 @@ public class MarkerViewManager { } if (!clickHandled) { + + // InfoWindow offset + Point infoWindowOffset = marker.getInfoWindowOffset(); + marker.setTopOffsetPixels(-(v.getHeight() / 2) - infoWindowOffset.y); + marker.setRightOffsetPixels(infoWindowOffset.x); + if (animSelectRes != 0) { AnimatorUtils.animate(v, animSelectRes, new AnimatorUtils.OnAnimationEndListener() { @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 699f4be891..7268b7d551 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -254,7 +254,7 @@ </activity> <activity - android:name=".activity.annotation.ViewMarkerAdapterActivity" + android:name=".activity.annotation.MarkerViewActivity" android:description="@string/description_view_marker" android:label="@string/activity_view_marker"> <meta-data diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/ViewMarkerAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java index 2fd21a04ab..e9a3401548 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/ViewMarkerAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java @@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.testapp.activity.annotation; import android.content.Context; import android.graphics.Point; import android.os.Bundle; +import android.os.Handler; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v7.app.ActionBar; @@ -29,7 +30,7 @@ import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerOptions; import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerView; import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerViewOptions; -public class ViewMarkerAdapterActivity extends AppCompatActivity { +public class MarkerViewActivity extends AppCompatActivity { private MapboxMap mMapboxMap; private MapView mMapView; @@ -72,7 +73,7 @@ public class ViewMarkerAdapterActivity extends AppCompatActivity { mMapboxMap.addMarker(new MarkerViewOptions() .position(LAT_LNGS[i]) .title(String.valueOf(i)) - .infoWindowOffset(new Point(0, 86)) + .infoWindowOffset(new Point(0, (int) getResources().getDimension(R.dimen.fab_margin))) .selectAnimatorResource(R.animator.scale_up) .deselectAnimatorResource(R.animator.scale_down) ); @@ -86,9 +87,7 @@ public class ViewMarkerAdapterActivity extends AppCompatActivity { options.position(new LatLng(38.899774, -77.023237)); options.selectAnimatorResource(R.animator.rotate_360); options.deselectAnimatorResource(R.animator.rotate_360); - options.infoWindowOffset(new Point(0, 64)); options.flat(true); - mapboxMap.addMarker(options); // default GL marker @@ -99,8 +98,8 @@ public class ViewMarkerAdapterActivity extends AppCompatActivity { // set adapters final MarkerViewManager markerViewManager = mapboxMap.getMarkerViewManager(); - markerViewManager.addMarkerViewAdapter(new TextAdapter(ViewMarkerAdapterActivity.this)); - markerViewManager.addMarkerViewAdapter(new CountryAdapter(ViewMarkerAdapterActivity.this)); + markerViewManager.addMarkerViewAdapter(new TextAdapter(MarkerViewActivity.this)); + markerViewManager.addMarkerViewAdapter(new CountryAdapter(MarkerViewActivity.this)); mMapView.addOnMapChangedListener(new MapView.OnMapChangedListener() { @Override @@ -116,7 +115,7 @@ public class ViewMarkerAdapterActivity extends AppCompatActivity { mMapboxMap.getMarkerViewManager().setOnMarkerViewClickListener(new MapboxMap.OnMarkerViewClickListener() { @Override public boolean onMarkerClick(@NonNull Marker marker, @NonNull View view, @NonNull MapboxMap.MarkerViewAdapter adapter) { - Toast.makeText(ViewMarkerAdapterActivity.this, "Hello " + marker.getId(), Toast.LENGTH_SHORT).show(); + Toast.makeText(MarkerViewActivity.this, "Hello " + marker.getId(), Toast.LENGTH_SHORT).show(); return false; } }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_brazil.png b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_brazil.png Binary files differdeleted file mode 100644 index 13bce838ff..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_brazil.png +++ /dev/null diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_china.png b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_china.png Binary files differdeleted file mode 100644 index d75026aac0..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_china.png +++ /dev/null diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_germany.png b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_germany.png Binary files differdeleted file mode 100644 index 07707aa0ff..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_germany.png +++ /dev/null diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_us.png b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_us.png Binary files differindex 57f3cbe654..d09e068fe9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_us.png +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_us.png |