[android] #2758 - add my location tracking mode
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package com.mapbox.mapboxsdk.constants;
|
||||
|
||||
import android.support.annotation.IntDef;
|
||||
|
||||
import com.mapbox.mapboxsdk.views.MapView;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* MyLocationTracking exposes different types location tracking modes.
|
||||
*
|
||||
* @see MapView#setMyLocationTrackingMode(int)
|
||||
* @see com.mapbox.mapboxsdk.views.UserLocationView#setMyLocationTrackingMode(int)
|
||||
*/
|
||||
public class MyLocationTracking {
|
||||
|
||||
/**
|
||||
* Indicates the parameter accepts one of the values from {@link MyLocationTracking}.
|
||||
*/
|
||||
@IntDef({TRACKING_NONE, TRACKING_FOLLOW, /**TRACKING_FOLLOW_BEARING_GPS, TRACKING_FOLLOW_BEARING_COMPASS, TRACKING_FOLLOW_BEARING**/})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Mode {
|
||||
}
|
||||
|
||||
/**
|
||||
* Not tracking user
|
||||
*/
|
||||
public static final int TRACKING_NONE = 0x00000000;
|
||||
|
||||
/**
|
||||
* Tracking the location of the user
|
||||
*/
|
||||
public static final int TRACKING_FOLLOW = 0x00000004;
|
||||
|
||||
// /**
|
||||
// * Tracking the location of the user with bearing from GPS
|
||||
// */
|
||||
// public static final int TRACKING_FOLLOW_BEARING_GPS = 0x00000008;
|
||||
//
|
||||
// /**
|
||||
// * Tracking the location of the user with bearing from compass
|
||||
// */
|
||||
// public static final int TRACKING_FOLLOW_BEARING_COMPASS = 0x00000012;
|
||||
//
|
||||
// /**
|
||||
// * Tracking the location fot the user with bearing from GPS and compass
|
||||
// */
|
||||
// public static final int TRACKING_FOLLOW_BEARING = 0x00000016;
|
||||
|
||||
}
|
||||
@@ -64,6 +64,7 @@ import com.mapbox.mapboxsdk.annotations.Polyline;
|
||||
import com.mapbox.mapboxsdk.annotations.PolylineOptions;
|
||||
import com.mapbox.mapboxsdk.annotations.Sprite;
|
||||
import com.mapbox.mapboxsdk.annotations.SpriteFactory;
|
||||
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
|
||||
import com.mapbox.mapboxsdk.constants.Style;
|
||||
import com.mapbox.mapboxsdk.exceptions.InvalidAccessTokenException;
|
||||
import com.mapbox.mapboxsdk.exceptions.SpriteBitmapChangedException;
|
||||
@@ -121,6 +122,7 @@ public final class MapView extends FrameLayout {
|
||||
private static final String STATE_STYLE_CLASSES = "styleClasses";
|
||||
private static final String STATE_DEFAULT_TRANSITION_DURATION = "defaultTransitionDuration";
|
||||
private static final String STATE_MY_LOCATION_ENABLED = "myLocationEnabled";
|
||||
private static final String STATE_MY_LOCATION_TRACKING_MODE = "myLocationTracking";
|
||||
private static final String STATE_COMPASS_ENABLED = "compassEnabled";
|
||||
private static final String STATE_COMPASS_GRAVITY = "compassGravity";
|
||||
private static final String STATE_COMPASS_MARGIN_LEFT = "compassMarginLeft";
|
||||
@@ -801,6 +803,9 @@ public final class MapView extends FrameLayout {
|
||||
, savedInstanceState.getInt(STATE_ATTRIBUTION_MARGIN_TOP)
|
||||
, savedInstanceState.getInt(STATE_ATTRIBUTION_MARGIN_RIGHT)
|
||||
, savedInstanceState.getInt(STATE_ATTRIBUTION_MARGIN_BOTTOM));
|
||||
|
||||
//noinspection ResourceType
|
||||
setMyLocationTrackingMode(savedInstanceState.getInt(STATE_MY_LOCATION_TRACKING_MODE, MyLocationTracking.TRACKING_NONE));
|
||||
}
|
||||
|
||||
// Force a check for an access token
|
||||
@@ -852,6 +857,7 @@ public final class MapView extends FrameLayout {
|
||||
outState.putStringArrayList(STATE_STYLE_CLASSES, new ArrayList<>(getStyleClasses()));
|
||||
outState.putLong(STATE_DEFAULT_TRANSITION_DURATION, mNativeMapView.getDefaultTransitionDuration());
|
||||
outState.putBoolean(STATE_MY_LOCATION_ENABLED, isMyLocationEnabled());
|
||||
outState.putInt(STATE_MY_LOCATION_TRACKING_MODE, mUserLocationView.getMyLocationTrackingMode());
|
||||
|
||||
// Compass
|
||||
LayoutParams compassParams = (LayoutParams) mCompassView.getLayoutParams();
|
||||
@@ -2493,8 +2499,13 @@ public final class MapView extends FrameLayout {
|
||||
mNativeMapView.cancelTransitions();
|
||||
|
||||
// Scale the map
|
||||
mNativeMapView.scaleBy(detector.getScaleFactor(), detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
|
||||
|
||||
if (mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
|
||||
// around gesture
|
||||
mNativeMapView.scaleBy(detector.getScaleFactor(), detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
|
||||
} else {
|
||||
// around center map
|
||||
mNativeMapView.scaleBy(detector.getScaleFactor(), (getWidth() / 2) / mScreenDensity, (getHeight() / 2) / mScreenDensity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2559,11 +2570,18 @@ public final class MapView extends FrameLayout {
|
||||
// Cancel any animation
|
||||
mNativeMapView.cancelTransitions();
|
||||
|
||||
// Rotate the map
|
||||
// Get rotate value
|
||||
double bearing = mNativeMapView.getBearing();
|
||||
bearing += detector.getRotationDegreesDelta();
|
||||
mNativeMapView.setBearing(bearing, detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
|
||||
|
||||
// Rotate the map
|
||||
if (mUserLocationView.getMyLocationTrackingMode() == MyLocationTracking.TRACKING_NONE) {
|
||||
// around gesture
|
||||
mNativeMapView.setBearing(bearing, detector.getFocusX() / mScreenDensity, detector.getFocusY() / mScreenDensity);
|
||||
} else {
|
||||
// around center map
|
||||
mNativeMapView.setBearing(bearing, (getWidth() / 2) / mScreenDensity, (getHeight() / 2) / mScreenDensity);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -3116,6 +3134,42 @@ public final class MapView extends FrameLayout {
|
||||
mUserLocationView.setOnMyLocationChangeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the current my location tracking mode.
|
||||
* Tracking my location disbales gestures, automatically moves the viewport
|
||||
* and shows the direction the user is heading.
|
||||
* See {@link MyLocationTracking} for different values.
|
||||
*
|
||||
* @param userLocationTrackingMode to be used.
|
||||
* @see MyLocationTracking
|
||||
*/
|
||||
@UiThread
|
||||
public void setMyLocationTrackingMode(@MyLocationTracking.Mode int userLocationTrackingMode) {
|
||||
mUserLocationView.setMyLocationTrackingMode(userLocationTrackingMode);
|
||||
|
||||
// Enable/disable gestures based on tracking mode
|
||||
if (userLocationTrackingMode == MyLocationTracking.TRACKING_NONE) {
|
||||
mScrollEnabled = true;
|
||||
mRotateEnabled = true;
|
||||
} else {
|
||||
mScrollEnabled = false;
|
||||
mRotateEnabled = (userLocationTrackingMode == MyLocationTracking.TRACKING_FOLLOW);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current user location tracking mode.
|
||||
* See {@link MyLocationTracking} for possible return values.
|
||||
*
|
||||
* @return the current user location tracking mode.
|
||||
* @see MyLocationTracking
|
||||
*/
|
||||
@UiThread
|
||||
@MyLocationTracking.Mode
|
||||
public int getMyLocationTrackingMode() {
|
||||
return mUserLocationView.getMyLocationTrackingMode();
|
||||
}
|
||||
|
||||
//
|
||||
// Compass
|
||||
//
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
@@ -21,17 +20,16 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapbox.mapboxsdk.R;
|
||||
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapzen.android.lost.api.LocationListener;
|
||||
import com.mapzen.android.lost.api.LocationRequest;
|
||||
import com.mapzen.android.lost.api.LocationServices;
|
||||
import com.mapzen.android.lost.api.LostApiClient;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
final class UserLocationView extends View {
|
||||
|
||||
private WeakReference<MapView> mMapView;
|
||||
private MapView mMapView;
|
||||
|
||||
private static final int BLUE_COLOR = 0x39ACCBFF;
|
||||
|
||||
@@ -79,6 +77,9 @@ final class UserLocationView extends View {
|
||||
|
||||
MapView.OnMyLocationChangeListener mOnMyLocationChangeListener;
|
||||
|
||||
@MyLocationTracking.Mode
|
||||
private int mMyLocationTrackingMode;
|
||||
|
||||
public UserLocationView(MapView mapView, Context context) {
|
||||
super(context);
|
||||
initialize(mapView, context);
|
||||
@@ -95,7 +96,7 @@ final class UserLocationView extends View {
|
||||
}
|
||||
|
||||
private void initialize(MapView mapView, Context context) {
|
||||
mMapView = new WeakReference<MapView>(mapView);
|
||||
mMapView = mapView;
|
||||
|
||||
// View configuration
|
||||
setEnabled(false);
|
||||
@@ -208,6 +209,20 @@ final class UserLocationView extends View {
|
||||
}
|
||||
}
|
||||
|
||||
public void setMyLocationTrackingMode(@MyLocationTracking.Mode int myLocationTrackingMode) {
|
||||
mMyLocationTrackingMode = myLocationTrackingMode;
|
||||
|
||||
if (myLocationTrackingMode != MyLocationTracking.TRACKING_NONE && mUserLocation != null) {
|
||||
// center map directly if we have a location fix
|
||||
mMapView.setCenterCoordinate(new LatLng(mUserLocation.getLatitude(), mUserLocation.getLongitude()));
|
||||
}
|
||||
}
|
||||
|
||||
@MyLocationTracking.Mode
|
||||
public int getMyLocationTrackingMode() {
|
||||
return mMyLocationTrackingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEnabled(boolean enabled) {
|
||||
super.setEnabled(enabled);
|
||||
@@ -221,7 +236,7 @@ final class UserLocationView extends View {
|
||||
|
||||
// compute new marker position
|
||||
// TODO add JNI method that takes existing pointf
|
||||
mMarkerScreenPoint = mMapView.get().toScreenLocation(mMarkerCoordinate);
|
||||
mMarkerScreenPoint = mMapView.toScreenLocation(mMarkerCoordinate);
|
||||
mMarkerScreenMatrix.reset();
|
||||
mMarkerScreenMatrix.setTranslate(
|
||||
mMarkerScreenPoint.x,
|
||||
@@ -230,14 +245,14 @@ final class UserLocationView extends View {
|
||||
// rotate so arrow in points to bearing
|
||||
if (mShowDirection) {
|
||||
mMarkerScreenMatrix.preRotate(mMarkerDirection +
|
||||
(float) mMapView.get().getDirection());
|
||||
(float) mMapView.getDirection());
|
||||
}
|
||||
|
||||
// adjust accuracy circle
|
||||
if (mShowAccuracy) {
|
||||
mAccuracyPath.reset();
|
||||
mAccuracyPath.addCircle(0.0f, 0.0f,
|
||||
(float) (mMarkerAccuracy / mMapView.get().getMetersPerPixelAtLatitude(
|
||||
(float) (mMarkerAccuracy / mMapView.getMetersPerPixelAtLatitude(
|
||||
mMarkerCoordinate.getLatitude())),
|
||||
Path.Direction.CW);
|
||||
|
||||
@@ -344,12 +359,19 @@ final class UserLocationView extends View {
|
||||
previousCoordinate = new LatLng(mUserLocation);
|
||||
}
|
||||
|
||||
mMarkerCoordinateAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
|
||||
mMarkerCoordinateAnimator.setDuration(1000);
|
||||
mMarkerCoordinateAnimator.addUpdateListener(new MarkerCoordinateAnimatorListener(
|
||||
previousCoordinate, new LatLng(location)
|
||||
));
|
||||
mMarkerCoordinateAnimator.start();
|
||||
if(mMyLocationTrackingMode== MyLocationTracking.TRACKING_NONE) {
|
||||
// moving marker above map
|
||||
mMarkerCoordinateAnimator = ValueAnimator.ofFloat(0.0f, 1.0f);
|
||||
mMarkerCoordinateAnimator.setDuration(1000);
|
||||
mMarkerCoordinateAnimator.addUpdateListener(new MarkerCoordinateAnimatorListener(
|
||||
previousCoordinate, new LatLng(location)
|
||||
));
|
||||
mMarkerCoordinateAnimator.start();
|
||||
}else{
|
||||
// moving map under the tracker
|
||||
mMarkerCoordinate = new LatLng(location);
|
||||
mMapView.setCenterCoordinate(mMarkerCoordinate, true);
|
||||
}
|
||||
|
||||
mShowDirection = location.hasBearing();
|
||||
if (mShowDirection) {
|
||||
@@ -388,7 +410,7 @@ final class UserLocationView extends View {
|
||||
}
|
||||
|
||||
void updateOnNextFrame() {
|
||||
mMapView.get().update();
|
||||
mMapView.update();
|
||||
}
|
||||
|
||||
public void pause() {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.support.test.rule.ActivityTestRule;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.LargeTest;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Tests on User LocationTrackingModeActivity
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@LargeTest
|
||||
public class MyLocationTrackingModeActivityTest extends BaseTest {
|
||||
|
||||
@Rule
|
||||
public ActivityTestRule<MyLocationTrackingModeActivity> mActivityRule = new ActivityTestRule<>(MyLocationTrackingModeActivity.class);
|
||||
|
||||
private MyLocationTrackingModeActivity mActivity = null;
|
||||
|
||||
@Before
|
||||
public void setActivity() {
|
||||
mActivity = mActivityRule.getActivity();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
checkViewIsDisplayed(R.id.mapView);
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
<activity
|
||||
android:name=".InfoWindowActivity"
|
||||
android:label="@string/activity_info_window" />
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".BulkMarkerActivity"
|
||||
android:label="@string/action_add_bulk_markers" />
|
||||
@@ -49,6 +49,10 @@
|
||||
android:name=".PressForMarkerActivity"
|
||||
android:label="@string/activity_press_for_marker" />
|
||||
|
||||
<activity
|
||||
android:name=".MyLocationTrackingModeActivity"
|
||||
android:label="@string/activity_user_tracking_mode" />
|
||||
|
||||
<meta-data
|
||||
android:name="io.fabric.ApiKey"
|
||||
android:value="9724157045ff7d083492c6d9ae03e60e8609d461" />
|
||||
|
||||
@@ -339,6 +339,10 @@ public class MainActivity extends AppCompatActivity {
|
||||
startActivity(new Intent(getApplicationContext(), VisibleCoordinateBoundsActivity.class));
|
||||
return true;
|
||||
|
||||
case R.id.action_user_tracking_mode:
|
||||
startActivity(new Intent(getApplicationContext(), MyLocationTrackingModeActivity.class));
|
||||
return true;
|
||||
|
||||
default:
|
||||
return changeMapStyle(menuItem.getItemId());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.mapbox.mapboxsdk.testapp;
|
||||
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import com.mapbox.mapboxsdk.constants.MyLocationTracking;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.utils.ApiAccess;
|
||||
import com.mapbox.mapboxsdk.views.MapView;
|
||||
|
||||
public class MyLocationTrackingModeActivity extends AppCompatActivity implements MapView.OnMyLocationChangeListener, AdapterView.OnItemSelectedListener {
|
||||
|
||||
private MapView mMapView;
|
||||
private Spinner mSpinner;
|
||||
private Location mLocation;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_my_location_tracking);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
ArrayAdapter<CharSequence> spinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.user_tracking_mode, android.R.layout.simple_spinner_item);
|
||||
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
mSpinner = (Spinner) findViewById(R.id.spinner);
|
||||
mSpinner.setAdapter(spinnerAdapter);
|
||||
mSpinner.setOnItemSelectedListener(this);
|
||||
mSpinner.setEnabled(false);
|
||||
|
||||
mMapView = (MapView) findViewById(R.id.mapView);
|
||||
mMapView.setAccessToken(ApiAccess.getToken(this));
|
||||
mMapView.onCreate(savedInstanceState);
|
||||
mMapView.setOnMyLocationChangeListener(this);
|
||||
mMapView.setMyLocationEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMyLocationChange(@Nullable Location location) {
|
||||
if (location != null) {
|
||||
if (mLocation == null) {
|
||||
// initial location to reposition map
|
||||
mMapView.setCenterCoordinate(new LatLng(location.getLatitude(), location.getLongitude()));
|
||||
mSpinner.setEnabled(true);
|
||||
}
|
||||
mLocation = location;
|
||||
showSnackBar();
|
||||
}
|
||||
}
|
||||
|
||||
private void showSnackBar() {
|
||||
String desc = "Loc Chg: ";
|
||||
boolean noInfo = true;
|
||||
if (mLocation.hasSpeed()) {
|
||||
desc += String.format("Spd = %.1f km/h ", mLocation.getSpeed() * 3.6f);
|
||||
noInfo = false;
|
||||
}
|
||||
if (mLocation.hasAltitude()) {
|
||||
desc += String.format("Alt = %.0f m ", mLocation.getAltitude());
|
||||
noInfo = false;
|
||||
}
|
||||
if (noInfo) {
|
||||
desc += "No extra info";
|
||||
}
|
||||
Snackbar.make(findViewById(android.R.id.content), desc, Snackbar.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
mMapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
mMapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
|
||||
break;
|
||||
|
||||
// case 2:
|
||||
// mMapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW_BEARING_GPS);
|
||||
// break;
|
||||
//
|
||||
// case 3:
|
||||
// mMapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW_BEARING_COMPASS);
|
||||
// break;
|
||||
//
|
||||
// case 4:
|
||||
// mMapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW_BEARING);
|
||||
// break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
|
||||
@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 onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mMapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mMapView.onStop();
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 546 B |
Binary file not shown.
|
After Width: | Height: | Size: 350 B |
Binary file not shown.
|
After Width: | Height: | Size: 687 B |
Binary file not shown.
|
After Width: | Height: | Size: 1012 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -0,0 +1,29 @@
|
||||
<?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">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<com.mapbox.mapboxsdk.views.MapView
|
||||
android:id="@+id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:style_url="@string/style_mapbox_streets"
|
||||
app:zoom_level="15" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -59,20 +59,6 @@
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
<!--
|
||||
<group android:id="@+id/locationFollowModesSeparator"/>
|
||||
|
||||
<group android:id="@+id/locationFollowModes" android:checkableBehavior="single">
|
||||
<item android:id="@+id/followNone"
|
||||
android:title="@string/action_location_none"/>
|
||||
<item android:id="@+id/followFollow"
|
||||
android:title="@string/action_location_follow"/>
|
||||
<item android:id="@+id/followBearing"
|
||||
android:title="@string/action_location_bearing"/>
|
||||
</group>
|
||||
-->
|
||||
|
||||
|
||||
<group android:id="@+id/testsSeparator" />
|
||||
|
||||
<item
|
||||
@@ -116,6 +102,12 @@
|
||||
android:icon="@drawable/ic_blur_on_white_24dp"
|
||||
android:title="@string/action_add_bulk_markers" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_user_tracking_mode"
|
||||
android:checkable="false"
|
||||
android:icon="@drawable/ic_gps_fixed_white_24dp"
|
||||
android:title="@string/activity_user_tracking_mode" />
|
||||
|
||||
</menu>
|
||||
</item>
|
||||
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
<string name="activity_marker_in_bulk">Add Bulk Markers Activity</string>
|
||||
<string name="activity_info_window">InfoWindow Activity</string>
|
||||
<string name="activity_visible_coordinate_bounds">Visible Coordinate Bounds</string>
|
||||
<string name="activity_user_tracking_mode">User tracking mode</string>
|
||||
|
||||
<string name="navdrawer_menu_title_mainactivity_controls">Main Activity Controls</string>
|
||||
<string name="navdrawer_menu_title_mainactivity_styles">Main Activity Styles</string>
|
||||
<string name="navdrawer_menu_title_individual_tests">Individual Tests</string>
|
||||
<string name="action_gps">Toggle GPS location</string>
|
||||
<string name="action_location_none">Disable tracking</string>
|
||||
<string name="action_location_follow">Use follow tracking mode</string>
|
||||
<string name="action_location_bearing">Use bearing tracking mode tracking</string>
|
||||
<string name="action_user_location_tracking">User location tracking</string>
|
||||
<string name="action_compass">Toggle compass</string>
|
||||
<string name="action_debug">Toggle debug mode</string>
|
||||
<string name="action_point_annotations">Toggle point annotations</string>
|
||||
@@ -50,4 +49,12 @@
|
||||
<item>10000</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="user_tracking_mode">
|
||||
<item>Disable tracking</item>
|
||||
<item>Follow tracking mode</item>
|
||||
<!--<item>Bearing tracking GPS mode</item>-->
|
||||
<!--<item>Bearing tracking Compass mode</item>-->
|
||||
<!--<item>Bearing tracking mode</item>-->
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user