[android] #3276 - make view marker only visible after first x,y update

This commit is contained in:
Tobrun
2016-05-06 11:53:23 +02:00
committed by Tobrun
parent b7d47d4c3f
commit 20e7b140b7
2 changed files with 11 additions and 8 deletions

View File

@@ -455,15 +455,16 @@ public class MapView extends FrameLayout {
}
}
} else if (change == REGION_IS_CHANGING || change == REGION_DID_CHANGE) {
if (mMapboxMap.getMarkerViewAdapter() != null) {
long currentTime = SystemClock.elapsedRealtime();
long currentTime = SystemClock.elapsedRealtime();
if (mViewMarkersUpdateRunning || currentTime < mViewMarkerBoundsUpdateTime) {
return;
}
if (mViewMarkersUpdateRunning || currentTime < mViewMarkerBoundsUpdateTime) {
return;
mViewMarkerBoundsUpdateTime = currentTime + 300;
new MarkerInBoundsTask().execute();
}
mViewMarkerBoundsUpdateTime = currentTime + 300;
new MarkerInBoundsTask().execute();
}
}
});
@@ -1456,6 +1457,10 @@ public class MapView extends FrameLayout {
PointF point = mMapboxMap.getProjection().toScreenLocation(marker.getPosition());
mViewHolder.setX(point.x - (mViewHolder.getMeasuredWidth() / 2));
mViewHolder.setY(point.y - (mViewHolder.getMeasuredHeight() / 2));
if (mViewHolder.getVisibility() == View.GONE) {
mViewHolder.setVisibility(View.VISIBLE);
}
}
}

View File

@@ -656,8 +656,6 @@ public class MapboxMap {
mMarkerViews.append(marker.getId(), adaptedView);
if (convertView == null) {
mMapView.addView(adaptedView);
} else {
convertView.setVisibility(View.VISIBLE);
}
}
}