[android] #4835 - Initial setup of MyLocationToggle UI

This commit is contained in:
Brad Leege
2016-04-25 18:23:14 -05:00
parent 8d5a6b515f
commit 0b5a994246
4 changed files with 93 additions and 0 deletions

View File

@@ -145,6 +145,14 @@
android:name="@string/category"
android:value="@string/category_userlocation" />
</activity>
<activity
android:name=".activity.userlocation.MyLocationToggleActivity"
android:description="@string/description_user_location_toggle"
android:label="@string/activity_user_location_toggle">
<meta-data
android:name="@string/category"
android:value="@string/category_userlocation" />
</activity>
<activity
android:name=".activity.annotation.PolygonActivity"
android:description="@string/description_polygon"

View File

@@ -0,0 +1,60 @@
package com.mapbox.mapboxsdk.testapp.activity.userlocation;
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.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.testapp.R;
public class MyLocationToggleActivity extends AppCompatActivity {
private MapView mapView;
private MapboxMap mapboxMap;
@Override
protected void onCreate(Bundle savedInstanceState
@Override
public void onResume() {
super.onResume();
mapView.onResume();
}
@Override
public void onPause() {
super.onPause();
mapView.onPause();
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mapView.onSaveInstanceState(outState);
}
@Override
protected void onDestroy() {
super.onDestroy();
mapView.onDestroy();
}
@Override
public void onLowMemory() {
super.onLowMemory();
mapView.onLowMemory();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
onBackPressed();
return true;
default:
return false;
}
}
}

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:access_token="@string/mapbox_access_token"
app:style_url="@string/style_mapbox_streets"
app:zoom="15" />
</LinearLayout>

View File

@@ -37,6 +37,7 @@
<string name="activity_snapshot">Snapshot Activity</string>
<string name="activity_user_tracking_mode">User tracking mode</string>
<string name="activity_user_tracking_customization">User location customization</string>
<string name="activity_user_location_toggle">User location toggle</string>
<string name="activity_custom_layer">Custom Layer</string>
<string name="activity_map_padding">Map Padding</string>
<string name="activity_debug_mode">Debug Mode</string>
@@ -46,6 +47,7 @@
<!-- Description -->
<string name="description_user_location_tracking">Tracks the location of the user</string>
<string name="description_user_location_customization">Customize the location of the user</string>
<string name="description_user_location_toggle">Toggle location of the user on and off</string>
<string name="description_custom_layer">Overlay a custom native layer on the map</string>
<string name="description_info_window_adapter">Learn how to create a custom InfoWindow</string>
<string name="description_cameraposition">CameraPosition capabilities</string>