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

Commit

Permalink
Maps SDK 7.0.0 bump (#917)
Browse files Browse the repository at this point in the history
* bump to 7.0.0-alpha.1

* bump to 7.0.0-alpha.2

* removed mapbox_styleUrl from examples' XML files

* LocationEngine adjustments in magic window example

* needed refactoring to use the new Style class and getStyle()

* wearable location tracking refactoring

* Refactored DrawGeojsonLineActivity to use data driven styling with source and layers

* Building plugin activity tweak

* fix to KotlinStyleCirclesCategoricallyActivity

style setup refactoring

* gradle cleanup

* bump to beta.2

* fixed InsetMapActivity's custom fragment

* use SupportMapFragment as InsetMapActivity's custom fragment

* KotlinLocationComponentActivity refactor

* SimpleMapViewActivityKotlin refactoring

* more cleanup

* More various cleanup and refactoring for 7.0.0

* added NonNull annotation to onMapReady

* initial annotation package refactoring

* bumped maps sdk to stable 7.0.0

* Bumped plugins to new versions

* plugin re-initialization

* removed lambda usage

* removed style xml from china layouts

* initial refactoring examples to not use annotation options classes

* simple china activity fix

* draw polygon refactoring

* China MainActivity lambda removal

* more china cleanup

* building plugin xml cleanup

* added missing ; to china mapview example

* removed duplicate import line

* SimpleChinaMapViewActivity tweaks

* adding nullcheck to solve failing firebase test

* added getStyle nullcheck for failing Firebase test

* null check on handler in animated gif example

* nullcheck to HighlightedLineActivity

* HighlightedLineActivity checkstyle

* added InsetMapActivity to exclude activity json list

* BuildingPluginActivity refactor

* import line removal

* SpaceStationLocationActivity refactoring

* Update map matching activity to v7.0.0

* Update map draw polygon activity to v7.0.0

* Update simplify polyline activity to v7.0.0

* changes based on Lukas review

* refactor AnimatedMarkerActivity to use SymbolLayer

* initial adjustments post tobrun review

* more refactoring based on tobrun review

* more refactoring based on tobrun and lukasz feedback

* fix IndoorMapActivity interpolate expression

* fix MarkerFollowingRouteActivity's orientation change crashes

* adjusted all mapboxMap.getStyle() references

* fixed checkstyle
  • Loading branch information
Łukasz Paczos authored and Langston Smith committed Jan 30, 2019
1 parent cb0dff9 commit 0becbb4
Show file tree
Hide file tree
Showing 266 changed files with 6,709 additions and 4,446 deletions.
5 changes: 1 addition & 4 deletions MapboxAndroidDemo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ android {
track = 'alpha'
untrackOld = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

if (isGlobal) {
Expand Down Expand Up @@ -130,6 +126,7 @@ dependencies {
implementation dependenciesList.mapboxPluginPlaces
implementation dependenciesList.mapboxPluginLocalization
implementation dependenciesList.mapboxPluginTraffic
implementation dependenciesList.mapboxPluginMarkerView

// Firebase
globalImplementation dependenciesList.firebaseCrash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import android.widget.TextView;

import com.github.javiersantos.materialstyleddialogs.MaterialStyledDialog;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.mapbox.mapboxandroiddemo.adapter.ExampleAdapter;
import com.mapbox.mapboxandroiddemo.commons.AnalyticsTracker;
import com.mapbox.mapboxandroiddemo.commons.FirstTimeRunChecker;
import com.mapbox.mapboxandroiddemo.examples.SimpleChinaMapViewActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.AnimatedMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawCustomMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.annotations.DrawPolygonActivity;
import com.mapbox.mapboxandroiddemo.examples.labs.AnimatedMarkerActivity;
import com.mapbox.mapboxandroiddemo.examples.dds.DrawPolygonActivity;
import com.mapbox.mapboxandroiddemo.examples.basics.SimpleMapViewActivityKotlin;
import com.mapbox.mapboxandroiddemo.examples.camera.AnimateMapCameraActivity;
import com.mapbox.mapboxandroiddemo.examples.camera.BoundingBoxCameraActivity;
Expand Down Expand Up @@ -147,19 +147,22 @@ protected void onCreate(Bundle savedInstanceState) {
}

// Item click listener
ItemClickSupport.addTo(recyclerView).setOnItemClickListener((recyclerView, position, view) -> {
ExampleItemModel model = adapter.getItemAt(position);

// in case it's an info tile
if (model != null) {
if (showJavaExamples) {
startActivity(model.getJavaActivity());
} else {
startActivity(model.getKotlinActivity());
ItemClickSupport.addTo(recyclerView).setOnItemClickListener(new ItemClickSupport.OnItemClickListener() {
@Override
public void onItemClicked(RecyclerView recyclerView, int position, View view) {
ExampleItemModel model = adapter.getItemAt(position);

// in case it's an info tile
if (model != null) {
if (showJavaExamples) {
startActivity(model.getJavaActivity());
} else {
startActivity(model.getKotlinActivity());
}

analytics.clickedOnIndividualExample(getString(model.getTitle()), loggedIn);
analytics.viewedScreen(getString(model.getTitle()), loggedIn);
}

analytics.clickedOnIndividualExample(getString(model.getTitle()), loggedIn);
analytics.viewedScreen(getString(model.getTitle()), loggedIn);
}
});

Expand Down Expand Up @@ -288,14 +291,22 @@ public boolean onOptionsItemSelected(MenuItem item) {
.setHeaderColor(R.color.mapboxBlue)
.withDivider(true)
.setPositiveText(getString(R.string.info_dialog_positive_button_text))
.onPositive((dialog, which) -> {
analytics.trackEvent(CLICKED_ON_INFO_DIALOG_START_LEARNING, false);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://mapbox.com/android-sdk"));
startActivity(intent);
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
analytics.trackEvent(CLICKED_ON_INFO_DIALOG_START_LEARNING, false);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://mapbox.com/android-sdk"));
startActivity(intent);
}
})
.setNegativeText(getString(R.string.info_dialog_negative_button_text))
.onNegative((dialog, which) -> analytics.trackEvent(CLICKED_ON_INFO_DIALOG_NOT_NOW, loggedIn))
.onNegative(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
analytics.trackEvent(CLICKED_ON_INFO_DIALOG_NOT_NOW, loggedIn);
}
})
.show();
return true;
} else if (id == R.id.action_show_other_language) {
Expand Down Expand Up @@ -340,7 +351,12 @@ private void buildSettingsDialog() {
if (!loggedIn) {
logOutOfMapboxAccountButton.setVisibility(View.GONE);
} else {
logOutOfMapboxAccountButton.setOnClickListener(view -> dialogView.logOut(loggedIn));
logOutOfMapboxAccountButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialogView.logOut(loggedIn);
}
});
}
}

Expand Down Expand Up @@ -488,36 +504,20 @@ private void initializeModels() {
);

exampleItemModels.add(new ExampleItemModel(
R.id.nav_annotations,
R.string.activity_annotation_marker_title,
R.string.activity_annotation_custom_marker_description,
new Intent(MainActivity.this, DrawMarkerActivity.class),
null,
R.string.activity_annotation_marker_url, false, BuildConfig.MIN_SDK_VERSION));

exampleItemModels.add(new ExampleItemModel(
R.id.nav_annotations,
R.string.activity_annotation_custom_marker_title,
R.string.activity_annotation_custom_marker_description,
new Intent(MainActivity.this, DrawCustomMarkerActivity.class),
null,
R.string.activity_annotation_custom_marker_url, false, BuildConfig.MIN_SDK_VERSION));

exampleItemModels.add(new ExampleItemModel(
R.id.nav_annotations,
R.string.activity_annotation_polygon_title,
R.string.activity_annotation_polygon_description,
R.id.nav_dds,
R.string.activity_dds_polygon_title,
R.string.activity_dds_polygon_description,
new Intent(MainActivity.this, DrawPolygonActivity.class),
null,
R.string.activity_annotation_polygon_url, false, BuildConfig.MIN_SDK_VERSION));
R.string.activity_dds_polygon_url, false, BuildConfig.MIN_SDK_VERSION));

exampleItemModels.add(new ExampleItemModel(
R.id.nav_annotations,
R.string.activity_annotation_animated_marker_title,
R.string.activity_annotation_animated_marker_description,
R.id.nav_lab,
R.string.activity_lab_animated_marker_title,
R.string.activity_lab_animated_marker_description,
new Intent(MainActivity.this, AnimatedMarkerActivity.class),
null,
R.string.activity_annotation_animated_marker_url, false, BuildConfig.MIN_SDK_VERSION));
R.string.activity_lab_animated_marker_url, false, BuildConfig.MIN_SDK_VERSION));

exampleItemModels.add(new ExampleItemModel(
R.id.nav_camera,
Expand Down Expand Up @@ -710,6 +710,6 @@ private void initializeModels() {
R.string.activity_basic_mapbox_kotlin_description,
new Intent(MainActivity.this, SimpleMapViewActivityKotlin.class),
null,
R.string.activity_basic_mapbox_kotlin_url, true, BuildConfig.MIN_SDK_VERSION));
R.string.activity_basic_simple_mapview_url, true, BuildConfig.MIN_SDK_VERSION));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.annotation.NonNull;
import android.view.Menu;
import android.view.MenuItem;

Expand All @@ -10,6 +11,8 @@
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.plugins.china.constants.ChinaStyle;
import com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.maps.Style;

/**
* The most basic example of adding a government approved and performant China map to an activity.
Expand All @@ -34,12 +37,20 @@ protected void onCreate(Bundle savedInstanceState) {

mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(mapboxMap -> {
this.mapboxMap = mapboxMap;
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
SimpleChinaMapViewActivity.this.mapboxMap = mapboxMap;
mapboxMap.setStyle(new Style.Builder().fromUrl(ChinaStyle.MAPBOX_STREETS_CHINESE), new Style.OnStyleLoaded() {
@Override
public void onStyleLoaded(@NonNull Style style) {

// Customize map with markers, polylines, etc.
// Map is set up and the style has loaded. Now you can add data or make other map adjustments


}
});
}
});
}

Expand All @@ -55,17 +66,17 @@ public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_streets:
if (mapboxMap != null) {
mapboxMap.setStyleUrl(ChinaStyle.MAPBOX_STREETS_CHINESE);
mapboxMap.setStyle(new Style.Builder().fromUrl(ChinaStyle.MAPBOX_STREETS_CHINESE));
}
return true;
case R.id.menu_dark:
if (mapboxMap != null) {
mapboxMap.setStyleUrl(ChinaStyle.MAPBOX_DARK_CHINESE);
mapboxMap.setStyle(new Style.Builder().fromUrl(ChinaStyle.MAPBOX_DARK_CHINESE));
}
return true;
case R.id.menu_light:
if (mapboxMap != null) {
mapboxMap.setStyleUrl(ChinaStyle.MAPBOX_LIGHT_CHINESE);
mapboxMap.setStyle(new Style.Builder().fromUrl(ChinaStyle.MAPBOX_LIGHT_CHINESE));
}
return true;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
mapbox:mapbox_cameraTargetLat="40.73581"
mapbox:mapbox_cameraTargetLng="-73.99155"
mapbox:mapbox_cameraZoom="3.5"
mapbox:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" />
/>

</android.support.constraint.ConstraintLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".examples.annotations.AnimatedMarkerActivity">
tools:context=".examples.labs.AnimatedMarkerActivity">

<com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="64.900932"
mapbox:mapbox_cameraTargetLng="-18.167040"
mapbox:mapbox_styleUrl="@string/mapbox_style_satellite_streets"
mapbox:mapbox_cameraZoom="4.5" />

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="-33.97753"
mapbox:mapbox_cameraTargetLng="18.52982"
mapbox:mapbox_styleUrl="mapbox://styles/mapbox/outdoors-v10"
mapbox:mapbox_cameraZoom="8"/>

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="48.13726"
mapbox:mapbox_cameraTargetLng="11.57555"
mapbox:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"
mapbox:mapbox_cameraZoom="12"/>

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".examples.annotations.DrawPolygonActivity">
tools:context=".examples.dds.DrawPolygonActivity">

<com.mapbox.mapboxsdk.plugins.china.maps.ChinaMapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="45.520486"
mapbox:mapbox_cameraTargetLng="-122.673541"
mapbox:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"
mapbox:mapbox_cameraZoom="11"/>

</RelativeLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="39.907609"
mapbox:mapbox_cameraTargetLng="116.385602"
mapbox:mapbox_styleUrl="@string/mapbox_style_mapbox_streets_chinese"
mapbox:mapbox_cameraZoom="11"/>

</FrameLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
mapbox:mapbox_cameraTargetLng="-69.837955"
mapbox:mapbox_cameraTilt="54.9710"
mapbox:mapbox_cameraZoom="7.899536"
mapbox:mapbox_styleUrl="@string/mapbox_style_mapbox_streets" />
/>

</FrameLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
android:layout_height="match_parent"
mapbox:mapbox_cameraTargetLat="42.353517"
mapbox:mapbox_cameraTargetLng="-71.078625"
mapbox:mapbox_styleUrl="@string/mapbox_style_mapbox_dark_chinese"
mapbox:mapbox_cameraZoom="12"/>

</FrameLayout>
Loading

0 comments on commit 0becbb4

Please sign in to comment.