Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] #3435 - updated MapView for swallowing SecurityExceptions i… #3459

Merged
merged 1 commit into from
Jan 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,12 @@ private void initialize(Context context, AttributeSet attrs) {
, typedArray.getDimension(R.styleable.MapView_attribution_margin_bottom, DIMENSION_SEVEN_DP));

// User location
setMyLocationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false));
try {
setMyLocationEnabled(typedArray.getBoolean(R.styleable.MapView_my_location_enabled, false));
}catch (SecurityException ignore){
// User did not accept location permissions
}

} finally {
typedArray.recycle();
}
Expand Down Expand Up @@ -918,7 +923,13 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
}
mNativeMapView.setDefaultTransitionDuration(
savedInstanceState.getLong(STATE_DEFAULT_TRANSITION_DURATION));
setMyLocationEnabled(savedInstanceState.getBoolean(STATE_MY_LOCATION_ENABLED));

// User location
try {
setMyLocationEnabled(savedInstanceState.getBoolean(STATE_MY_LOCATION_ENABLED));
}catch (SecurityException ignore){
// User did not accept location permissions
}

// Compass
setCompassEnabled(savedInstanceState.getBoolean(STATE_COMPASS_ENABLED));
Expand Down Expand Up @@ -2929,14 +2940,20 @@ private class GestureListener extends

// Must always return true otherwise all events are ignored
@Override
public boolean onDown(MotionEvent e) {
public boolean onDown(MotionEvent event) {
// Show the zoom controls
if (mZoomControlsEnabled && mZoomEnabled) {
mZoomButtonsController.setVisible(true);
}

setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
setMyBearingTrackingMode(MyBearingTracking.NONE);
// Disable tracking mode if a gesture occurs
try {
setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE);
setMyBearingTrackingMode(MyBearingTracking.NONE);
}catch(SecurityException ignore){
// User did not accept location permissions
}

return true;
}

Expand Down