From 4b9c7f5837c2722e444e9312c48c43eed2a0097d Mon Sep 17 00:00:00 2001 From: Brad Leege Date: Thu, 10 Dec 2015 12:22:07 -0800 Subject: [PATCH] [android] #3244 -Camera activity for TestApp --- .../src/main/AndroidManifest.xml | 4 +- .../mapboxsdk/testapp/CameraActivity.java | 76 +++++++++++++++++++ .../mapboxsdk/testapp/MainActivity.java | 3 + .../src/main/res/layout/activity_camera.xml | 33 ++++++++ .../src/main/res/menu/menu_drawer.xml | 4 + .../src/main/res/values/strings.xml | 3 + 6 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CameraActivity.java create mode 100644 android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera.xml diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 44ebc8c9490..3188d717a1a 100644 --- a/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -37,7 +37,9 @@ + android:label="@string/activity_add_bulk_markers" /> + diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CameraActivity.java b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CameraActivity.java new file mode 100644 index 00000000000..d4c31735298 --- /dev/null +++ b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/CameraActivity.java @@ -0,0 +1,76 @@ +package com.mapbox.mapboxsdk.testapp; + +import android.os.Bundle; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import com.mapbox.mapboxsdk.constants.Style; +import com.mapbox.mapboxsdk.utils.ApiAccess; +import com.mapbox.mapboxsdk.views.MapView; + +public class CameraActivity extends AppCompatActivity { + + private MapView mMapView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_camera); + + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setDisplayShowHomeEnabled(true); + } + + mMapView = (MapView) findViewById(R.id.mapView); + mMapView.setAccessToken(ApiAccess.getToken(this)); + mMapView.setStyle(Style.MAPBOX_STREETS); + mMapView.onCreate(savedInstanceState); + } + + @Override + protected void onStart() { + super.onStart(); + mMapView.onStart(); + } + + @Override + public void onResume() { + super.onResume(); + mMapView.onResume(); + } + + @Override + public void onPause() { + super.onPause(); + mMapView.onPause(); + } + + @Override + protected void onStop() { + super.onStop(); + mMapView.onStop(); + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + mMapView.onSaveInstanceState(outState); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mMapView.onDestroy(); + } + + @Override + public void onLowMemory() { + super.onLowMemory(); + mMapView.onLowMemory(); + } +} diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java index c303d94cdc1..44fc9f1756b 100644 --- a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java +++ b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MainActivity.java @@ -340,6 +340,9 @@ public boolean onNavigationItemSelected(MenuItem menuItem) { startActivity(new Intent(getApplicationContext(), InfoWindowAdapterActivity.class)); return true; + case R.id.camera: + startActivity(new Intent(getApplicationContext(), CameraActivity.class)); + case R.id.action_tilt: startActivity(new Intent(getApplicationContext(), TiltActivity.class)); return true; diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera.xml b/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera.xml new file mode 100644 index 00000000000..446c0df4bc1 --- /dev/null +++ b/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera.xml @@ -0,0 +1,33 @@ + + + + + + + + + + diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml b/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml index bfd70a936f5..1a3500ab3a2 100644 --- a/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml +++ b/android/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml @@ -72,6 +72,10 @@ android:icon="@drawable/ic_tilt" android:title="@string/action_tilt" /> + + InfoWindow Activity (Concurrent) Visible Coordinate Bounds User tracking mode + Add Markers In Bulk + Camera Polyline Activity Animate Coordinate Change @@ -34,6 +36,7 @@ Animate Coordinate Change InfoWindow (Concurrent) Add Markers in bulk + Camera Set Visible Bounds Center map around 2 markers Remove polylines