diff options
2 files changed, 107 insertions, 0 deletions
diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ManualZoomActivity.java b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ManualZoomActivity.java new file mode 100644 index 0000000000..841cfa6a69 --- /dev/null +++ b/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/ManualZoomActivity.java @@ -0,0 +1,88 @@ +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 android.view.MenuItem; +import com.mapbox.mapboxsdk.constants.Style; +import com.mapbox.mapboxsdk.utils.ApiAccess; +import com.mapbox.mapboxsdk.views.MapView; + +public class ManualZoomActivity extends AppCompatActivity { + + private MapView mMapView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_manual_zoom); + + 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.manualZoomMapView); + 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(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_manual_zoom.xml b/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_manual_zoom.xml new file mode 100644 index 0000000000..70f38875a2 --- /dev/null +++ b/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_manual_zoom.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="@color/primary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /> + + <com.mapbox.mapboxsdk.views.MapView + android:id="@+id/manualZoomMapView" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + +</LinearLayout> |