Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #116 from mapbox/next-sdk-release-work
Browse files Browse the repository at this point in the history
Examples for 4.2.0
  • Loading branch information
Cameron Mace authored Aug 9, 2016
2 parents d256bb8 + cc5f4c7 commit 58d18b3
Show file tree
Hide file tree
Showing 31 changed files with 1,552 additions and 99 deletions.
6 changes: 3 additions & 3 deletions MapboxAndroidDemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ext {

android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
buildToolsVersion "24.0.1"

defaultConfig {
minSdkVersion 15
Expand All @@ -47,8 +47,8 @@ dependencies {
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile 'com.github.javiersantos:MaterialStyledDialogs:1.5.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-beta.1@aar') {
transitive = true
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:4.2.0-beta.1@aar'){
transitive=true
}
compile('com.mapbox.mapboxsdk:mapbox-android-services:1.2.1@aar') {
transitive = true
Expand Down
64 changes: 64 additions & 0 deletions MapboxAndroidDemo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,69 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.ShowHideLayersActivity"
android:label="@string/activity_styles_show_hide_layer_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.LanguageSwitchActivity"
android:label="@string/activity_styles_langauge_switch_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.ColorSwitcherActivity"
android:label="@string/activity_styles_color_switcher_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.AdjustLayerOpacityActivity"
android:label="@string/activity_styles_adjust_layer_opacity_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.GeojsonLayerInStackActivity"
android:label="@string/activity_styles_geojson_layer_in_stack_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.VectorSourceActivity"
android:label="@string/activity_styles_vector_source_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.annotations.AnimatedCircleMarkerActivity"
android:label="@string/activity_annotation_animated_circle_marker_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>

<activity
android:name=".examples.styles.ZoomDependentFillColorActivity"
android:label="@string/activity_style_zoom_dependent_fill_color_title">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity>
</application>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,39 @@
import com.afollestad.materialdialogs.MaterialDialog;
import com.github.javiersantos.materialstyleddialogs.MaterialStyledDialog;
import com.mapbox.mapboxandroiddemo.adapter.ExampleAdapter;
import com.mapbox.mapboxandroiddemo.examples.camera.AnimateMapCameraActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.AnimatedCircleMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.AnimatedMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.BasicMarkerViewActivity;
import com.mapbox.mapboxandroiddemo.examples.location.BasicUserLocation;
import com.mapbox.mapboxandroiddemo.examples.camera.BoundingBoxCameraActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.CustomInfoWindowActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.CustomRasterStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.DefaultStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.DirectionsActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawCustomMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawGeojsonLineActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawPolygonActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.GeocodingActivity;
import com.mapbox.mapboxandroiddemo.examples.location.LocationTrackingActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.MapMatchingActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.SupportMapFragmentActivity;
import com.mapbox.mapboxandroiddemo.examples.basics.MapboxMapOptionActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.MapboxStudioStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.offline.OfflineManagerActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.SatelliteStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.basics.SimpleMapViewActivity;
import com.mapbox.mapboxandroiddemo.examples.offline.SimpleOfflineMapActivity;
import com.mapbox.mapboxandroiddemo.examples.camera.AnimateMapCameraActivity;
import com.mapbox.mapboxandroiddemo.examples.camera.BoundingBoxCameraActivity;
import com.mapbox.mapboxandroiddemo.examples.location.BasicUserLocation;
import com.mapbox.mapboxandroiddemo.examples.location.LocationTrackingActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.DirectionsActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.GeocodingActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.MapMatchingActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.SimplifyPolylineActivity;
import com.mapbox.mapboxandroiddemo.examples.mas.StaticImageActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.SupportMapFragmentActivity;
import com.mapbox.mapboxandroiddemo.examples.offline.OfflineManagerActivity;
import com.mapbox.mapboxandroiddemo.examples.offline.SimpleOfflineMapActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.AdjustLayerOpacityActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.ColorSwitcherActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.CustomRasterStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.DefaultStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.GeojsonLayerInStackActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.LanguageSwitchActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.MapboxStudioStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.SatelliteStyleActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.ShowHideLayersActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.VectorSourceActivity;
import com.mapbox.mapboxandroiddemo.examples.styles.ZoomDependentFillColorActivity;
import com.mapbox.mapboxandroiddemo.labs.LocationPickerActivity;
import com.mapbox.mapboxandroiddemo.labs.MarkerFollowingRouteActivity;
import com.mapbox.mapboxandroiddemo.labs.SpaceStationLocationActivity;
Expand Down Expand Up @@ -152,21 +160,28 @@ private void listItems(int id) {
exampleItemModel.clear();
switch (id) {
case R.id.nav_basics:

exampleItemModel.add(new ExampleItemModel(R.string.activity_basic_simple_mapview_title, R.string.activity_basic_simple_mapview_description, new Intent(MainActivity.this, SimpleMapViewActivity.class), R.string.activity_basic_simple_mapview_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_basic_support_map_frag_title, R.string.activity_basic_support_map_frag_description, new Intent(MainActivity.this, SupportMapFragmentActivity.class), R.string.activity_basic_support_map_frag_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_basic_mapbox_options_title, R.string.activity_basic_mapbox_options_description, new Intent(MainActivity.this, MapboxMapOptionActivity.class), R.string.activity_basic_mapbox_options_url));
currentCategory = R.id.nav_basics;
break;

case R.id.nav_styles:
exampleItemModel.add(new ExampleItemModel(R.string.activity_styles_color_switcher_title, R.string.activity_styles_color_switcher_description, new Intent(MainActivity.this, ColorSwitcherActivity.class), R.string.activity_styles_color_switcher_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_styles_vector_source_title, R.string.activity_styles_vector_source_description, new Intent(MainActivity.this, VectorSourceActivity.class), R.string.activity_styles_vector_source_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_styles_geojson_layer_in_stack_title, R.string.activity_styles_geojson_layer_in_stack_description, new Intent(MainActivity.this, GeojsonLayerInStackActivity.class), R.string.activity_styles_geojson_layer_in_stack_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_style_zoom_dependent_fill_color_title, R.string.activity_style_zoom_dependent_fill_color_description, new Intent(MainActivity.this, ZoomDependentFillColorActivity.class), R.string.activity_style_zoom_dependent_fill_color_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_styles_adjust_layer_opacity_title, R.string.activity_styles_adjust_layer_opacity_description, new Intent(MainActivity.this, AdjustLayerOpacityActivity.class), R.string.activity_styles_adjust_layer_opacity_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_styles_langauge_switch_title, R.string.activity_styles_langauge_switch_description, new Intent(MainActivity.this, LanguageSwitchActivity.class), R.string.activity_styles_langauge_switch_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_styles_show_hide_layer_title, R.string.activity_styles_show_hide_layer_description, new Intent(MainActivity.this, ShowHideLayersActivity.class), R.string.activity_styles_show_hide_layer_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_style_mapbox_studio_title, R.string.activity_style_mapbox_studio_description, new Intent(MainActivity.this, MapboxStudioStyleActivity.class), R.string.activity_style_mapbox_studio_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_style_satellite_title, R.string.activity_style_satellite_description, new Intent(MainActivity.this, SatelliteStyleActivity.class), R.string.activity_style_satellite_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_style_raster_title, R.string.activity_style_raster_description, new Intent(MainActivity.this, CustomRasterStyleActivity.class), R.string.activity_style_raster_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_style_default_title, R.string.activity_style_default_description, new Intent(MainActivity.this, DefaultStyleActivity.class), R.string.activity_style_default_url));
currentCategory = R.id.nav_styles;
break;
case R.id.nav_annotations:
exampleItemModel.add(new ExampleItemModel(R.string.activity_annotation_animated_circle_marker_title, R.string.activity_annotation_animated_circle_marker_description, new Intent(MainActivity.this, AnimatedCircleMarkerActivity.class), R.string.activity_annotation_animated_circle_marker_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_annotation_marker_title, R.string.activity_annotation_custom_marker_description, new Intent(MainActivity.this, DrawMarkerActivity.class), R.string.activity_annotation_marker_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_annotation_custom_marker_title, R.string.activity_annotation_custom_marker_description, new Intent(MainActivity.this, DrawCustomMarkerActivity.class), R.string.activity_annotation_custom_marker_url));
exampleItemModel.add(new ExampleItemModel(R.string.activity_annotation_geojson_line_title, R.string.activity_annotation_geojson_line_description, new Intent(MainActivity.this, DrawGeojsonLineActivity.class), R.string.activity_annotation_geojson_line_url));
Expand Down Expand Up @@ -204,7 +219,7 @@ private void listItems(int id) {
case R.id.nav_lab:
exampleItemModel.add(null);
exampleItemModel.add(new ExampleItemModel(R.string.activity_lab_location_picker_title, R.string.activity_lab_location_picker_description, new Intent(MainActivity.this, LocationPickerActivity.class), R.string.activity_lab_location_picker_url));
// exampleItemModel.add(new ExampleItemModel(R.string.activity_lab_marker_following_route_title, R.string.activity_lab_marker_following_route_description, new Intent(MainActivity.this, MarkerFollowingRouteActivity.class), R.string.activity_lab_marker_following_route_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_lab_marker_following_route_title, R.string.activity_lab_marker_following_route_description, new Intent(MainActivity.this, MarkerFollowingRouteActivity.class), R.string.activity_lab_marker_following_route_url, true));
exampleItemModel.add(new ExampleItemModel(R.string.activity_lab_space_station_location_title, R.string.activity_lab_space_station_location_description, new Intent(MainActivity.this, SpaceStationLocationActivity.class), R.string.activity_lab_space_station_location_url));
currentCategory = R.id.nav_lab;
break;
Expand Down
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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public class MapboxMapOptionActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

LinearLayout layout = new LinearLayout(this);
LinearLayoutCompat.LayoutParams params = new LinearLayoutCompat
.LayoutParams(LinearLayoutCompat.LayoutParams.MATCH_PARENT,
LinearLayoutCompat.LayoutParams.MATCH_PARENT);

MapboxMapOptions options = new MapboxMapOptions()
.styleUrl(Style.OUTDOORS)
.camera(new CameraPosition.Builder()
Expand All @@ -45,8 +40,36 @@ public void onMapReady(MapboxMap mapboxMap) {
}
});

layout.addView(mapView, params);
setContentView(mapView);
}

@Override
public void onResume() {
super.onResume();
mapView.onResume();
}

@Override
public void onPause() {
super.onPause();
mapView.onPause();
}

setContentView(layout);
@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);
}
}
Loading

0 comments on commit 58d18b3

Please sign in to comment.