This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from mapbox/next-sdk-release-work
Examples for 4.2.0
- Loading branch information
Showing
31 changed files
with
1,552 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
.../java/com/mapbox/mapboxandroiddemo/examples/annotations/AnimatedCircleMarkerActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.mapbox.mapboxandroiddemo.examples.annotations; | ||
|
||
import android.animation.AnimatorSet; | ||
import android.animation.ObjectAnimator; | ||
import android.animation.ValueAnimator; | ||
import android.graphics.drawable.Drawable; | ||
import android.os.Bundle; | ||
import android.support.v4.content.ContextCompat; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
|
||
import com.mapbox.mapboxandroiddemo.R; | ||
import com.mapbox.mapboxsdk.annotations.Icon; | ||
import com.mapbox.mapboxsdk.annotations.IconFactory; | ||
import com.mapbox.mapboxsdk.annotations.MarkerView; | ||
import com.mapbox.mapboxsdk.annotations.MarkerViewOptions; | ||
import com.mapbox.mapboxsdk.geometry.LatLng; | ||
import com.mapbox.mapboxsdk.maps.MapView; | ||
import com.mapbox.mapboxsdk.maps.MapboxMap; | ||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; | ||
|
||
public class AnimatedCircleMarkerActivity extends AppCompatActivity { | ||
|
||
private MapView mapView; | ||
private MarkerView circle; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_annotation_animated_circle_marker); | ||
|
||
mapView = (MapView) findViewById(R.id.mapView); | ||
mapView.onCreate(savedInstanceState); | ||
mapView.getMapAsync(new OnMapReadyCallback() { | ||
@Override | ||
public void onMapReady(final MapboxMap mapboxMap) { | ||
|
||
IconFactory iconFactory = IconFactory.getInstance(AnimatedCircleMarkerActivity.this); | ||
Drawable iconDrawable = ContextCompat.getDrawable(AnimatedCircleMarkerActivity.this, R.drawable.circle_icon); | ||
Icon icon = iconFactory.fromDrawable(iconDrawable); | ||
|
||
circle = mapboxMap.addMarker(new MarkerViewOptions() | ||
.position(new LatLng(40.73581, -73.99155)) | ||
.anchor(0.5f, 0.5f) | ||
.icon(icon)); | ||
|
||
View view = mapboxMap.getMarkerViewManager().getView(circle); | ||
|
||
ValueAnimator scaleCircleX = ObjectAnimator.ofFloat(view, "scaleX", 1.5f); | ||
ValueAnimator scaleCircleY = ObjectAnimator.ofFloat(view, "scaleY", 1.5f); | ||
scaleCircleX.setDuration(3000); | ||
scaleCircleY.setDuration(3000); | ||
scaleCircleX.setRepeatCount(ValueAnimator.INFINITE); | ||
scaleCircleY.setRepeatCount(ValueAnimator.INFINITE); | ||
scaleCircleX.setRepeatMode(ObjectAnimator.REVERSE); | ||
scaleCircleY.setRepeatMode(ObjectAnimator.REVERSE); | ||
|
||
AnimatorSet animatorSet = new AnimatorSet(); | ||
animatorSet.play(scaleCircleX).with(scaleCircleY); | ||
animatorSet.start(); | ||
|
||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void onResume() { | ||
super.onResume(); | ||
mapView.onResume(); | ||
} | ||
|
||
@Override | ||
public void onPause() { | ||
super.onPause(); | ||
mapView.onPause(); | ||
} | ||
|
||
@Override | ||
public void onLowMemory() { | ||
super.onLowMemory(); | ||
mapView.onLowMemory(); | ||
} | ||
|
||
@Override | ||
protected void onDestroy() { | ||
super.onDestroy(); | ||
mapView.onDestroy(); | ||
} | ||
|
||
@Override | ||
protected void onSaveInstanceState(Bundle outState) { | ||
super.onSaveInstanceState(outState); | ||
mapView.onSaveInstanceState(outState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.