diff --git a/MapboxAndroidDemo/build.gradle b/MapboxAndroidDemo/build.gradle
index 2b0d021c3..4588c222d 100644
--- a/MapboxAndroidDemo/build.gradle
+++ b/MapboxAndroidDemo/build.gradle
@@ -79,7 +79,7 @@ dependencies {
compile 'com.google.code.gson:gson:2.8'
// Mapbox dependencies
- compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.2.0-beta.2@aar') {
+ compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.4@aar') {
transitive = true
}
@@ -104,6 +104,7 @@ dependencies {
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.afollestad.material-dialogs:commons:0.9.4.5'
compile 'com.github.Cutta:GifView:1.1'
+
gpservicesCompile 'com.google.firebase:firebase-crash:11.0.4'
compile project(':SharedCode')
}
diff --git a/MapboxAndroidDemo/src/main/AndroidManifest.xml b/MapboxAndroidDemo/src/main/AndroidManifest.xml
index 8a752c705..32d03148d 100644
--- a/MapboxAndroidDemo/src/main/AndroidManifest.xml
+++ b/MapboxAndroidDemo/src/main/AndroidManifest.xml
@@ -388,6 +388,13 @@
android:name="android.support.PARENT_ACTIVITY"
android:value="com.mapbox.mapboxandroiddemo.MainActivity"/>
+
+
+
diff --git a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/MainActivity.java b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/MainActivity.java
index 267d7633a..feb9cbabf 100644
--- a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/MainActivity.java
+++ b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/MainActivity.java
@@ -96,6 +96,7 @@
import com.mapbox.mapboxandroiddemo.labs.PictureInPictureActivity;
import com.mapbox.mapboxandroiddemo.labs.RecyclerViewOnMapActivity;
import com.mapbox.mapboxandroiddemo.labs.RecyclerViewSymbolLayerActivity;
+import com.mapbox.mapboxandroiddemo.labs.SliderCompareActivity;
import com.mapbox.mapboxandroiddemo.labs.SpaceStationLocationActivity;
import com.mapbox.mapboxandroiddemo.model.ExampleItemModel;
import com.mapbox.mapboxandroiddemo.utils.ItemClickSupport;
@@ -618,6 +619,12 @@ private void listItems(int id) {
new Intent(MainActivity.this, RecyclerViewSymbolLayerActivity.class),
R.string.activity_lab_rv_symbol_layer_on_map_url, true
));
+ exampleItemModel.add(new ExampleItemModel(
+ R.string.activity_labs_slider_compare_title,
+ R.string.activity_labs_slider_compare_description,
+ new Intent(MainActivity.this, SliderCompareActivity.class),
+ R.string.activity_labs_slider_compare_url, true
+ ));
currentCategory = R.id.nav_lab;
break;
case R.id.nav_dds:
diff --git a/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/labs/SliderCompareActivity.java b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/labs/SliderCompareActivity.java
new file mode 100644
index 000000000..9ae8c1f85
--- /dev/null
+++ b/MapboxAndroidDemo/src/main/java/com/mapbox/mapboxandroiddemo/labs/SliderCompareActivity.java
@@ -0,0 +1,127 @@
+package com.mapbox.mapboxandroiddemo.labs;
+
+import android.os.Bundle;
+import android.support.design.widget.CoordinatorLayout;
+import android.support.v7.app.AppCompatActivity;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.widget.FrameLayout;
+import android.widget.SeekBar;
+
+import com.mapbox.mapboxandroiddemo.R;
+import com.mapbox.mapboxsdk.Mapbox;
+import com.mapbox.mapboxsdk.maps.MapView;
+import com.mapbox.mapboxsdk.maps.MapboxMap;
+import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
+
+public class SliderCompareActivity extends AppCompatActivity {
+
+ private MapView mapViewOne;
+ private MapView mapViewTwo;
+ private SeekBar seekBar;
+ private String TAG = "SliderCompareActivity";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Mapbox access token is configured here. This needs to be called either in your application
+ // object or in the same activity which contains the mapview.
+ Mapbox.getInstance(this, getString(R.string.access_token));
+
+ // This contains the MapView in XML and needs to be called after the access token is configured.
+ setContentView(R.layout.activity_slider_compare);
+
+ mapViewOne = (MapView) findViewById(R.id.mapViewOne);
+ mapViewTwo = (MapView) findViewById(R.id.mapViewTwo);
+ seekBar = (SeekBar) findViewById(R.id.slider_compare_seek_bar);
+
+ mapViewOne.onCreate(savedInstanceState);
+ mapViewTwo.onCreate(savedInstanceState);
+ mapViewOne.getMapAsync(new OnMapReadyCallback() {
+ @Override
+ public void onMapReady(MapboxMap mapboxMap) {
+
+ findViewById(R.id.slider_compare_container).setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ Log.d(TAG, "onTouch: ");
+ mapViewOne.onTouchEvent(event);
+ mapViewTwo.onTouchEvent(event);
+ return false;
+ }
+ });
+ }
+ });
+
+ seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) {
+ Log.d(TAG, "onProgressChanged: progressValue = " + progressValue);
+ FrameLayout frameLayout = (FrameLayout) findViewById(R.id.target_framelayout);
+ frameLayout.setLayoutParams(new CoordinatorLayout.LayoutParams(progressValue, frameLayout.getLayoutParams().height));
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+
+ }
+ });
+ }
+
+ // Add the mapViewOne lifecycle to the activity's lifecycle methods
+ @Override
+ public void onResume() {
+ super.onResume();
+ mapViewOne.onResume();
+ mapViewTwo.onResume();
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ mapViewOne.onStart();
+ mapViewTwo.onStart();
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ mapViewOne.onStop();
+ mapViewTwo.onStop();
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ mapViewOne.onPause();
+ mapViewTwo.onPause();
+ }
+
+ @Override
+ public void onLowMemory() {
+ super.onLowMemory();
+ mapViewOne.onLowMemory();
+ mapViewTwo.onLowMemory();
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ mapViewOne.onDestroy();
+ mapViewTwo.onDestroy();
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ mapViewOne.onSaveInstanceState(outState);
+ mapViewTwo.onSaveInstanceState(outState);
+ }
+}
\ No newline at end of file
diff --git a/MapboxAndroidDemo/src/main/res/layout/activity_slider_compare.xml b/MapboxAndroidDemo/src/main/res/layout/activity_slider_compare.xml
new file mode 100644
index 000000000..0863f79cd
--- /dev/null
+++ b/MapboxAndroidDemo/src/main/res/layout/activity_slider_compare.xml
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MapboxAndroidDemo/src/main/res/values/descriptions_strings.xml b/MapboxAndroidDemo/src/main/res/values/descriptions_strings.xml
index 69f4f6b47..637fe2466 100644
--- a/MapboxAndroidDemo/src/main/res/values/descriptions_strings.xml
+++ b/MapboxAndroidDemo/src/main/res/values/descriptions_strings.xml
@@ -74,5 +74,6 @@
Add markers via SymbolLayer and manipulate the map based on recyclerview interactions.
Add Mapillary vector tiles to a map
Show a smaller inset map fragment and link it to a larger map for two map interaction. Great for gaming!
+ Compare two different maps by sliding a comparison bar across them
diff --git a/MapboxAndroidDemo/src/main/res/values/titles_strings.xml b/MapboxAndroidDemo/src/main/res/values/titles_strings.xml
index a0a947495..f0e5d9890 100644
--- a/MapboxAndroidDemo/src/main/res/values/titles_strings.xml
+++ b/MapboxAndroidDemo/src/main/res/values/titles_strings.xml
@@ -72,5 +72,6 @@
Indoor Map
Mapillary integration
Inset map
+ Slider compare
diff --git a/MapboxAndroidDemo/src/main/res/values/urls_strings.xml b/MapboxAndroidDemo/src/main/res/values/urls_strings.xml
index c577db7d8..e8f01e30a 100644
--- a/MapboxAndroidDemo/src/main/res/values/urls_strings.xml
+++ b/MapboxAndroidDemo/src/main/res/values/urls_strings.xml
@@ -75,5 +75,6 @@
https://i.imgur.com/YQlJL3x.jpg
http://i.imgur.com/w4SSif1.png
https://i.imgur.com/jp4wc24.png
+ https://i.imgur.com/3LxODOu.png
diff --git a/MapboxAndroidWearDemo/src/main/AndroidManifest.xml b/MapboxAndroidWearDemo/src/main/AndroidManifest.xml
index 571167591..33986e626 100644
--- a/MapboxAndroidWearDemo/src/main/AndroidManifest.xml
+++ b/MapboxAndroidWearDemo/src/main/AndroidManifest.xml
@@ -23,6 +23,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
+ tools:node="replace"
android:theme="@android:style/Theme.DeviceDefault">