Java Examples for com.google.android.gms.maps.UiSettings
The following java examples will help you to understand the usage of com.google.android.gms.maps.UiSettings. These source code samples are taken from different open source projects.
Example 1
Project: AnyMaps-master File: AnyMapAdapter.java View source code |
private void registerGoogleToAnyMapMappers() {
registerMapper(LatLng.class, new LatLngMapper());
registerMapper(LatLngBounds.class, new LatLngBoundsMapper());
registerMapper(CameraPosition.class, new CameraPositionMapper());
registerMapper(Projection.class, new ProjectionMapper());
registerMapper(VisibleRegion.class, new VisibleRegionMapper());
registerMapper(UiSettings.class, new UiSettingsMapper());
registerMapper(Marker.class, new MarkerMapper());
registerMapper(Circle.class, new CircleMapper());
registerMapper(Polygon.class, new PolygonMapper());
registerMapper(Polyline.class, new PolylineMapper());
}
Example 2
Project: flisol-guide-master File: LocationFragmentActivity.java View source code |
private void setUpMap() {
final UiSettings uiSettings = mMap.getUiSettings();
uiSettings.setZoomControlsEnabled(true);
uiSettings.setCompassEnabled(true);
uiSettings.setMyLocationButtonEnabled(true);
Marker flisolMarker = mMap.addMarker(new MarkerOptions().title(getResources().getString(R.string.map_marker_title)).snippet(getResources().getString(R.string.map_marker_snippet)).position(FLISOLSAOCARLOS).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)).alpha(0.8f));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(FLISOLSAOCARLOS, 10));
mMap.animateCamera(CameraUpdateFactory.zoomTo(14), 1500, null);
flisolMarker.showInfoWindow();
}
Example 3
Project: android-maps-v2-demo-master File: ConfigurationExampleActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.configuration_example);
GoogleMap map = GoogleMapHelper.getMap(this, R.id.confugured_map);
final UiSettings settings = map.getUiSettings();
map.setMyLocationEnabled(true);
settings.setMyLocationButtonEnabled(false);
infoTextView = (TextView) findViewById(R.id.info_textview);
map.setOnCameraChangeListener(new OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition position) {
updatePositionInfo(position);
}
});
updatePositionInfo(map.getCameraPosition());
CheckBox controlsCheckBox = (CheckBox) findViewById(R.id.controls_checkbox);
controlsCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
settings.setCompassEnabled(isChecked);
settings.setMyLocationButtonEnabled(isChecked);
settings.setZoomControlsEnabled(isChecked);
}
});
CheckBox gesturesCheckBox = (CheckBox) findViewById(R.id.gestures_checkbox);
gesturesCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
settings.setAllGesturesEnabled(isChecked);
// or
settings.setRotateGesturesEnabled(isChecked);
settings.setScrollGesturesEnabled(isChecked);
settings.setTiltGesturesEnabled(isChecked);
settings.setZoomGesturesEnabled(isChecked);
}
});
}
Example 4
Project: Android-Templates-And-Utilities-master File: ExampleFragment.java View source code |
private void setupMap() {
// reference
GoogleMap map = ((MapView) mRootView.findViewById(R.id.fragment_example_map)).getMap();
// settings
if (map != null) {
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.setMyLocationEnabled(true);
UiSettings settings = map.getUiSettings();
settings.setAllGesturesEnabled(true);
settings.setMyLocationButtonEnabled(true);
settings.setZoomControlsEnabled(true);
CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng(49.194696, 16.608595)).zoom(11).bearing(0).tilt(30).build();
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
}
Example 5
Project: otm-android-master File: TreeDisplay.java View source code |
private void setUpMap() {
UiSettings mUiSettings = mMap.getUiSettings();
mUiSettings.setZoomControlsEnabled(false);
mUiSettings.setScrollGesturesEnabled(false);
mUiSettings.setZoomGesturesEnabled(false);
mUiSettings.setTiltGesturesEnabled(false);
mUiSettings.setRotateGesturesEnabled(false);
mMap.setOnMarkerDragListener(new GoogleMapsListeners.NoopDragListener());
}
Example 6
Project: Fake-Checkin-master File: CheckIn.java View source code |
private LatLng adjustMap(Location lastKnownLocation) {
UiSettings ui = myMap.getUiSettings();
// ui.setAllGesturesEnabled(false);
// ui.setMyLocationButtonEnabled(false);
// ui.setZoomControlsEnabled(false);
myMap.setMyLocationEnabled(true);
double lat = lastKnownLocation.getLatitude();
double lng = lastKnownLocation.getLongitude();
LatLng ll = new LatLng(lat, lng);
myMap.moveCamera(CameraUpdateFactory.newLatLngZoom(ll, 16));
return ll;
}
Example 7
Project: kc-android-master File: ItemDetailActivity.java View source code |
@Override
public void onMapReady(GoogleMap googleMap) {
// disable map click
googleMap.setOnMapClickListener( latLng -> {
});
// remove map buttons
UiSettings uiSettings = googleMap.getUiSettings();
uiSettings.setMapToolbarEnabled(false);
LatLng location = new LatLng(mVenue.getLattitude(), mVenue.getLongitude());
googleMap.addMarker(new MarkerOptions().position(location).title(mVenue.getName()));
googleMap.animateCamera(CameraUpdateFactory.newLatLngZoom(location, 15));
}
Example 8
Project: TruckMuncher-Android-master File: VendorMapFragment.java View source code |
public void setMapControlsEnabled(boolean enabled) {
UiSettings settings = mapView.getMap().getUiSettings();
settings.setScrollGesturesEnabled(enabled);
settings.setRotateGesturesEnabled(enabled);
settings.setZoomControlsEnabled(enabled);
settings.setZoomGesturesEnabled(enabled);
settings.setMyLocationButtonEnabled(enabled);
if (enabled) {
LocationServices.FusedLocationApi.requestLocationUpdates(apiClient, request, this);
} else {
LocationServices.FusedLocationApi.removeLocationUpdates(apiClient, this);
}
}
Example 9
Project: android-samples-master File: TagsDemoActivity.java View source code |
@Override
public void onMapReady(GoogleMap map) {
mMap = map;
UiSettings mUiSettings = mMap.getUiSettings();
// Turn off the map toolbar.
mUiSettings.setMapToolbarEnabled(false);
// Disable interaction with the map - other than clicking.
mUiSettings.setZoomControlsEnabled(false);
mUiSettings.setScrollGesturesEnabled(false);
mUiSettings.setZoomGesturesEnabled(false);
mUiSettings.setTiltGesturesEnabled(false);
mUiSettings.setRotateGesturesEnabled(false);
// Add a circle, a ground overlay, a marker, a polygon and a polyline to the map.
addObjectsToMap();
// Set listeners for click events. See the bottom of this class for their behavior.
mMap.setOnCircleClickListener(this);
mMap.setOnGroundOverlayClickListener(this);
mMap.setOnMarkerClickListener(this);
mMap.setOnPolygonClickListener(this);
mMap.setOnPolylineClickListener(this);
// Override the default content description on the view, for accessibility mode.
// Ideally this string would be localised.
map.setContentDescription(getString(R.string.tags_demo_map_description));
// Create bounds that include all locations of the map.
LatLngBounds bounds = new LatLngBounds.Builder().include(ADELAIDE).include(BRISBANE).include(DARWIN).include(HOBART).include(PERTH).include(SYDNEY).build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 100));
}
Example 10
Project: android_programmering_2014-master File: MainActivity.java View source code |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
kittyMarkers = new ArrayList<Marker>();
mapDirection = new GMapV2Direction();
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
map = mapFragment.getMap();
map.addMarker(new MarkerOptions().position(HIOF).title("Østfold University College"));
map.addMarker(new MarkerOptions().position(FREDRIKSTAD).title("Fredrikstad Kino"));
if (savedInstanceState == null) {
map.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(HIOF, 13, 0, 0)));
map.animateCamera(CameraUpdateFactory.newLatLng(FREDRIKSTAD), 2000, null);
} else {
Bundle bundle = savedInstanceState.getBundle("lost_kittens");
KittenLocation kittenLocation = bundle.getParcelable("found_kitten");
map.addMarker(new MarkerOptions().position(kittenLocation.getLatLng()).title(kittenLocation.getName()).snippet("Found Kitten").icon(BitmapDescriptorFactory.fromResource(getResources().getIdentifier("kitten_0" + (kittyCounter % 3 + 1), "drawable", "com.capgemini.playingwithgooglemaps"))));
}
map.setOnMapLongClickListener(this);
map.setMyLocationEnabled(true);
UiSettings uiSettings = map.getUiSettings();
uiSettings.setCompassEnabled(false);
uiSettings.setTiltGesturesEnabled(false);
uiSettings.setZoomControlsEnabled(false);
Spinner spinner = (Spinner) findViewById(R.id.layers_spinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.layers_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
}
Example 11
Project: assassins-master File: MapFragment.java View source code |
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
map = getMap();
UiSettings uiSettings = map.getUiSettings();
uiSettings.setCompassEnabled(true);
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
uiSettings.setScrollGesturesEnabled(false);
uiSettings.setRotateGesturesEnabled(false);
uiSettings.setZoomGesturesEnabled(true);
uiSettings.setZoomControlsEnabled(true);
Location lastLocation = getBestLastKnownLocation();
LatLng lastLatLng;
Repository model = App.getRepo();
User user = model.getUser();
Player player = model.getMyFocusedPlayer();
if (lastLocation == null) {
lastLatLng = user.getLocation();
} else {
lastLatLng = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
if (user.getLocation() == null) {
user.setLocation(lastLocation);
}
}
if (lastLatLng != null)
showMyLocation(lastLatLng);
if (model.inActiveMatch()) {
showGameBoundary();
showRangeCircles(lastLatLng);
showDirectionToTarget(tBearing);
showTargetLocation(player.getTargetLatLng());
}
moveMapPositionTo(lastLatLng, DEFAULT_ZOOM, DEFAULT_TILT, true, 2000);
super.onViewCreated(view, savedInstanceState);
}
Example 12
Project: clusterkraf-master File: SampleActivity.java View source code |
private void initMap() {
if (map == null) {
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
if (mapFragment != null) {
map = mapFragment.getMap();
if (map != null) {
UiSettings uiSettings = map.getUiSettings();
uiSettings.setAllGesturesEnabled(false);
uiSettings.setScrollGesturesEnabled(true);
uiSettings.setZoomGesturesEnabled(true);
map.setOnCameraChangeListener(new OnCameraChangeListener() {
@Override
public void onCameraChange(CameraPosition arg0) {
moveMapCameraToBoundsAndInitClusterkraf();
}
});
}
}
} else {
moveMapCameraToBoundsAndInitClusterkraf();
}
}
Example 13
Project: droidkaigi2016-master File: MapFragment.java View source code |
@NeedsPermission(Manifest.permission.ACCESS_FINE_LOCATION)
void initGoogleMap() {
SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync( googleMap -> {
googleMap.setMyLocationEnabled(true);
binding.mapSearchView.bindData(placeMapList, placeMap -> {
LatLng latLng = new LatLng(placeMap.latitude, placeMap.longitude);
int duration = getResources().getInteger(R.integer.map_camera_move_mills);
googleMap.animateCamera(CameraUpdateFactory.newLatLng(latLng), duration, null);
Marker marker = markers.get(placeMap.nameRes);
if (marker != null)
marker.showInfoWindow();
});
binding.loadingView.setVisibility(View.GONE);
googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.setIndoorEnabled(true);
googleMap.setBuildingsEnabled(true);
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LAT_LNG_CENTER, DEFAULT_ZOOM));
UiSettings mapUiSettings = googleMap.getUiSettings();
mapUiSettings.setCompassEnabled(true);
renderMarkers(placeMapList, googleMap);
});
}
Example 14
Project: FoodBookBeta-master File: MapDragger.java View source code |
// Set up map
public void setUpMapifNeeded() {
if (googleMap == null) {
googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map_dragger)).getMap();
//²V¦X¹Ï
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
//test for bug
googleMap.moveCamera(CameraUpdateFactory.zoomTo(16));
googleMap.setOnMarkerDragListener(this);
// Åã¥Ü¡u¦Û¤v¡vªº©w¦ìÂI
googleMap.setMyLocationEnabled(true);
// Åã¥Ü¥æ³q¸ê°T
googleMap.setTrafficEnabled(false);
// ³]©wUI
UiSettings uiSettings = googleMap.getUiSettings();
uiSettings.setScrollGesturesEnabled(false);
uiSettings.setTiltGesturesEnabled(false);
uiSettings.setRotateGesturesEnabled(false);
uiSettings.setZoomGesturesEnabled(false);
// §Ú¦bþ¸Ì©w¦ì«ö¶sÃö³¬
uiSettings.setMyLocationButtonEnabled(false);
// ÁY©ñ±±¨î°Ï°ìÃö³¬
uiSettings.setZoomControlsEnabled(false);
if (tag.equals("EditItem"))
new GetAllStore().execute();
if (tag.equals("AddItem"))
setMapforComfirm();
}
}
Example 15
Project: Kv-009-master File: EcoMapFragment.java View source code |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setRetainInstance(true);
Log.i(tag, "onCreateView");
//getActivity().invalidateOptionsMenu();
View v = inflater.inflate(R.layout.map_layout_main, container, false);
mapView = (MapView) v.findViewById(R.id.mapview);
//Temporary is to initialize mapView by null to get rotation works without exceptions.
mapView.onCreate(null);
mMap = mapView.getMap();
mMap.setMyLocationEnabled(true);
MapsInitializer.initialize(getActivity());
UiSettings UISettings = mMap.getUiSettings();
UISettings.setMapToolbarEnabled(false);
UISettings.setMyLocationButtonEnabled(false);
values = new ArrayList<>();
mContext = getActivity();
fabAddProblem = (FloatingActionButton) v.findViewById(R.id.fabAddProblem);
rootLayout = (CoordinatorLayout) v.findViewById(R.id.rootLayout);
FloatingActionButton fabUkraine = (FloatingActionButton) v.findViewById(R.id.fabUkraine);
fabUkraine.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSlidingLayer.closeLayer(true);
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(50.461166, 30.417397), 5f));
}
});
FloatingActionButton fabToMe = (FloatingActionButton) v.findViewById(R.id.fabToMe);
fabToMe.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Location loc = mMap.getMyLocation();
if (loc != null) {
mSlidingLayer.closeLayer(true);
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(loc.getLatitude(), loc.getLongitude()), 14.0f));
}
}
});
showTypeImage = (ImageView) v.findViewById(R.id.show_type_image);
showLike = (ImageView) v.findViewById(R.id.show_like);
showTitle = (TextView) v.findViewById(R.id.show_title);
showByTime = (TextView) v.findViewById(R.id.show_date_added);
showContent = (TextView) v.findViewById(R.id.show_content);
showProposal = (TextView) v.findViewById(R.id.show_proposal);
showNumOfLikes = (TextView) v.findViewById(R.id.show_numOfLikes);
showStatus = (TextView) v.findViewById(R.id.show_status);
detailedScrollView = (ScrollView) v.findViewById(R.id.details_scrollview);
problemRating = (RatingBar) v.findViewById(R.id.problemRating);
//deleteProblem = (ImageView) v.findViewById(R.id.action_delete_problem);
mSlidingLayer = (EcoMapSlidingLayer) v.findViewById(R.id.show_problem_sliding_layer);
MainActivity.slidingLayer = mSlidingLayer;
mSlidingLayer.setOnInteractListener(new EcoMapSlidingLayer.OnInteractListener() {
@Override
public void onOpen() {
//If onOpen, we show all lines of title
showTitle.setMaxLines(5);
showTitle.setEllipsize(TextUtils.TruncateAt.END);
//set scroll UP
//if you move at the end of the scroll
detailedScrollView.fullScroll(View.FOCUS_UP);
//if you move at the middle of the scroll
detailedScrollView.pageScroll(View.FOCUS_UP);
isOpenSlidingLayer = true;
}
@Override
public void onShowPreview() {
//If onPreview, we show only 1 line of title
showTitle.setMaxLines(1);
showTitle.setEllipsize(TextUtils.TruncateAt.END);
isOpenSlidingLayer = true;
}
@Override
public void onClose() {
isOpenSlidingLayer = false;
}
@Override
public void onOpened() {
isOpenSlidingLayer = true;
}
@Override
public void onPreviewShowed() {
}
@Override
public void onClosed() {
//isOpenSlidingLayer = false;
getActivity().invalidateOptionsMenu();
}
});
ExpandableHeightGridView gridview = (ExpandableHeightGridView) v.findViewById(R.id.gridview);
gridview.setExpanded(true);
imgAdapter = new ImageAdapter(mContext, new ArrayList<ProblemPhotoEntry>());
gridview.setAdapter(imgAdapter);
final ScrollView mScrollView = detailedScrollView;
mScrollView.post(new Runnable() {
public void run() {
mScrollView.scrollTo(0, 0);
}
});
Button addPhotoButton = (Button) v.findViewById(R.id.add_photo);
addPhotoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Send intent to library for picking photos
if (MainActivity.isUserIdSet()) {
PhotoPickerIntent intent = new PhotoPickerIntent(mContext);
intent.setPhotoCount(8);
intent.setShowCamera(true);
startActivityForResult(intent, REQUEST_CODE);
} else {
signInAlertDialog();
}
}
});
return v;
}
Example 16
Project: SayItFromTheSky-master File: DrawingFragment.java View source code |
@Override
public void onMapReady() {
if (mGoogleMap == null) {
mGoogleMap = mMapFragment.getMap();
if (mGoogleMap != null) {
// The map is now active and can be manipulated
// Enable my location
mGoogleMap.setMyLocationEnabled(true);
// Setup the map UI
final UiSettings uiSettings = mGoogleMap.getUiSettings();
uiSettings.setCompassEnabled(false);
uiSettings.setZoomControlsEnabled(false);
uiSettings.setMyLocationButtonEnabled(true);
int actionBarSize = ActionBarHelper.getActionBarSize(getActivity());
mGoogleMap.setPadding(0, actionBarSize, 0, 0);
// Add the preview polyline
mPreviewPolyline = mGoogleMap.addPolyline(mPolylineOptionsPreview);
// Add ask to draw them
if (mLastSavedInstanceState != null) {
restoreEncodedPolyline(true);
restoreCurrentPolyline(true);
}
// Try to restore last known location
if (mLastKnownLocation != null) {
initMapLocation();
}
mGoogleMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
@Override
public void onMyLocationChange(Location location) {
if (mProgressBar.getVisibility() != View.GONE) {
mProgressBar.setVisibility(View.GONE);
}
if (mLastKnownLocation == null) {
// First location
setLastKnownLocation(location);
initMapLocation();
} else {
// New location
setNewLocation(location);
}
}
});
}
} else {
// Setup the circle buttons
initCircleButtons();
}
}
Example 17
Project: sthlmtraveling-master File: ViewOnMapActivity.java View source code |
private void setUpMap() {
if (mTransitRoute != null && mJourneyQuery != null) {
showTransitRoute(mTransitRoute);
loadIntermediateStops(mTransitRoute);
mMap.moveCamera(CameraUpdateFactory.newCameraPosition(CameraPosition.fromLatLngZoom(mFocusedLatLng, 16)));
} else if (mRoute != null) {
List<LatLng> latLngs = showRoute(mRoute);
zoomToFit(latLngs);
}
UiSettings settings = mMap.getUiSettings();
settings.setAllGesturesEnabled(true);
settings.setMapToolbarEnabled(false);
verifyLocationPermission();
}
Example 18
Project: AirMapView-master File: NativeGoogleMapFragment.java View source code |
@Override
public void onMapReady(GoogleMap googleMap) {
if (googleMap != null && getActivity() != null) {
NativeGoogleMapFragment.this.googleMap = googleMap;
UiSettings settings = NativeGoogleMapFragment.this.googleMap.getUiSettings();
settings.setZoomControlsEnabled(false);
settings.setMyLocationButtonEnabled(false);
setMyLocationEnabled(myLocationEnabled);
if (onMapLoadedListener != null) {
onMapLoadedListener.onMapLoaded();
}
}
}
Example 19
Project: ORCycle_A-master File: FragmentMainInput.java View source code |
/**
* Handler: onResume
* Called when the <code>activity<code/> will start interacting with the user. At this point
* the <code>activity<code/> is at the top of the <code>activity<code/> stack, with user
* input going to it. Always followed by <code>onPause()<code/>.
* @see <code>onPause<code/> class.
*/
@Override
public void onResume() {
super.onResume();
try {
Log.v(MODULE_TAG, "Cycle: onResume()");
setUpMapIfNeeded();
if (map != null) {
UiSettings mUiSettings = map.getUiSettings();
// Keep the UI Settings state in sync with the checkboxes.
mUiSettings.setZoomControlsEnabled(true);
mUiSettings.setCompassEnabled(true);
mUiSettings.setMyLocationButtonEnabled(true);
map.setMyLocationEnabled(true);
mUiSettings.setScrollGesturesEnabled(true);
mUiSettings.setZoomGesturesEnabled(true);
mUiSettings.setTiltGesturesEnabled(true);
mUiSettings.setRotateGesturesEnabled(true);
}
enableLocationClient();
Intent intent;
Bundle bundle;
if (backFromInstructions) {
backFromInstructions = false;
if (myApp.getUserWelcomeEnabled()) {
controller.finish(setResult(Result.SHOW_WELCOME));
return;
}
} else // Check for responses from User dialogs
if (null != (intent = getActivity().getIntent())) {
if (null != (bundle = intent.getExtras())) {
String src = bundle.getString(TabsConfig.EXTRA_DSA_ACTIVITY);
if (null != src) {
// Respond to the dialog button that was pressed
int dialogId = bundle.getInt(TabsConfig.EXTRA_DSA_DIALOG_ID, -1);
int buttonPressed = bundle.getInt(TabsConfig.EXTRA_DSA_BUTTON_PRESSED, -1);
boolean ischecked = bundle.getBoolean(DsaDialogActivity.EXTRA_IS_CHECKED, false);
// Check for Welcome Dialog
if (Controller.DSA_ID_WELCOME_DIALOG_ID == dialogId) {
if (ischecked) {
myApp.setUserWelcomeEnabled(false);
}
if (Controller.DSA_ID_WELCOME_DIALOG_INSTRUCTIONS == buttonPressed) {
controller.finish(setResult(Result.SHOW_INSTRUCTIONS));
backFromInstructions = false;
return;
}
} else // Check for HowTo dialog
if (Controller.DSA_ID_HOW_TO_DIALOG_ID == dialogId) {
if (ischecked) {
myApp.setTutorialEnabled(false);
} else if (controller.setNextHowToScreen()) {
controller.finish(setResult(Result.SHOW_TUTORIAL));
return;
}
} else // Check for UserInfo dialog
if (Controller.DSA_ID_USER_PROFILE_DIALOG_ID == dialogId) {
if (ischecked) {
myApp.setUserProfileUploaded(true);
}
if (Controller.DSA_ID_USER_PROFILE_DIALOG_OK == buttonPressed) {
controller.finish(setResult(Result.GET_USER_INFO));
return;
}
} else {
// got a bundle, from unknown dialog?
}
}
}
}
// Show next dialog in sequence
if (!myApp.getCheckedForUserWelcome() && myApp.getUserWelcomeEnabled()) {
myApp.setCheckedForUserWelcome(true);
controller.finish(setResult(Result.SHOW_WELCOME));
} else if (!myApp.getCheckedForTutorial() && myApp.getTutorialEnabled()) {
myApp.setCheckedForTutorial(true);
controller.finish(setResult(Result.SHOW_TUTORIAL));
} else if (!myApp.getCheckedForUserProfile() && !myApp.getUserProfileUploaded() && (myApp.getFirstTripCompleted())) {
myApp.setCheckedForUserProfile(true);
controller.finish(setResult(Result.SHOW_DIALOG_USER_INFO));
} else if (null == recordingService) {
scheduleServiceConnect();
} else {
syncDisplayToRecordingState();
}
} catch (Exception ex) {
Log.e(MODULE_TAG, ex.getMessage());
}
}
Example 20
Project: AreWeThereYet-master File: ZonePicker.java View source code |
private void setUpMap() {
if (checkReady()) {
UiSettings mUiSettings = mMap.getUiSettings();
mUiSettings.setZoomControlsEnabled(false);
mMap.setMyLocationEnabled(true);
mUiSettings.setMyLocationButtonEnabled(false);
mUiSettings.setTiltGesturesEnabled(false);
mUiSettings.setRotateGesturesEnabled(false);
mMap.setOnCameraChangeListener(this);
}
}
Example 21
Project: naonedbus-master File: MapFragment.java View source code |
private void initMap() {
final int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());
if (resultCode == ConnectionResult.SUCCESS) {
mGooglePlayServiceAvailable = true;
final UiSettings uiSettings = mGoogleMap.getUiSettings();
uiSettings.setScrollGesturesEnabled(true);
uiSettings.setZoomGesturesEnabled(true);
uiSettings.setCompassEnabled(true);
mGoogleMap.setMyLocationEnabled(true);
final Location currenLocation = mLocationProvider.getLastLocation();
if (currenLocation != null) {
final CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(currenLocation.getLatitude(), currenLocation.getLongitude()), 15);
mGoogleMap.animateCamera(cameraUpdate);
}
} else {
mGooglePlayServiceAvailable = false;
GooglePlayServicesUtil.getErrorDialog(resultCode, getActivity(), 1).show();
if (mRefreshMenuItem != null) {
mRefreshMenuItem.setVisible(false);
}
}
}
Example 22
Project: santa-tracker-android-master File: SantaMapFragment.java View source code |
/**
* Sets up the map and member variables. This method should be called once
* the map has been initialised.
*/
private void setupMap(GoogleMap map) {
mMap = map;
mInfoWindowAdapter = new DestinationInfoWindowAdapter(getLayoutInflater(null), getActivity().getApplicationContext());
// clear map in case it was restored
mMap.clear();
// Set map theme
mMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style));
// setup map UI - disable zoom controls
UiSettings ui = this.mMap.getUiSettings();
ui.setZoomControlsEnabled(false);
ui.setCompassEnabled(false);
mMap.setInfoWindowAdapter(mInfoWindowAdapter);
mMap.setOnInfoWindowClickListener(mInfoWindowClickListener);
mMap.setOnMapClickListener(mMapClickListener);
mMap.setOnCameraChangeListener(mCameraChangeListener);
mMap.setOnMarkerClickListener(mMarkerClickListener);
// setup marker icons
mMarkerIconVisited = createMarker(R.drawable.marker_pin);
// add active marker
mActiveMarker = mMap.addMarker(new MarkerOptions().position(BOGUS_LOCATION).icon(createMarker(R.drawable.marker_pin_active)).title(MARKER_ACTIVE).visible(false).snippet("0").anchor(0.5f, 1f));
// required, visible in MarkerOptions
mActiveMarker.setVisible(false);
// does not work
// add next marker
mNextMarker = mMap.addMarker(new MarkerOptions().position(BOGUS_LOCATION).icon(createMarker(R.drawable.marker_pin)).alpha(0.6f).visible(false).snippet("0").title(MARKER_NEXT).anchor(0.5f, 1f));
mNextMarker.setVisible(false);
addSanta();
mSantaCamAnimator = new SantaCamAnimator(mMap, mSantaMarker);
}
Example 23
Project: Slimgress-master File: ScannerView.java View source code |
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// retrieve map
mMap = getMap();
if (mMap == null)
throw new RuntimeException("map is invalid");
loadAssets();
mMarkers = new HashMap<String, Marker>();
mLines = new HashMap<String, Polyline>();
mPolygons = new HashMap<String, Polygon>();
// disable most ui elements
UiSettings ui = mMap.getUiSettings();
ui.setAllGesturesEnabled(false);
ui.setCompassEnabled(false);
ui.setScrollGesturesEnabled(true);
ui.setRotateGesturesEnabled(true);
ui.setZoomControlsEnabled(false);
ui.setMyLocationButtonEnabled(false);
mMap.setMyLocationEnabled(true);
mMap.setOnMyLocationChangeListener(new GoogleMap.OnMyLocationChangeListener() {
boolean firstLocation = true;
@Override
public void onMyLocationChange(Location myLocation) {
// update camera position
CameraPosition pos = mMap.getCameraPosition();
CameraPosition newPos = new CameraPosition.Builder(pos).target(new LatLng(myLocation.getLatitude(), myLocation.getLongitude())).zoom(16).tilt(40).build();
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(newPos));
// update game position
mGame.updateLocation(new com.norman0406.slimgress.API.Common.Location(myLocation.getLatitude(), myLocation.getLongitude()));
if (firstLocation) {
firstLocation = false;
}
}
});
//startWorldUpdate();
// deactivate standard map
mMap.setMapType(GoogleMap.MAP_TYPE_NONE);
// add custom map tiles
addIngressTiles();
}
Example 24
Project: iBurn-Android-master File: GoogleMapFragment.java View source code |
private void initMap() {
prefs = new PrefsHelper(getActivity().getApplicationContext());
// TODO : Do full query. Don't run separate POIS, results queries
Observable.combineLatest(cameraUpdate.debounce(250, TimeUnit.MILLISECONDS).startWith(new VisibleRegion(null, null, null, null, null)), DataProvider.getInstance(getActivity().getApplicationContext()), ( newVisibleRegion, dataProvider) -> {
GoogleMapFragment.this.visibleRegion = newVisibleRegion;
return dataProvider;
}).flatMap(this::performQuery).map(SqlBrite.Query::run).observeOn(// Can we do this on bg thread? prolly not
AndroidSchedulers.mainThread()).subscribe(this::processMapItemResult, throwable -> Timber.e(throwable, "Error querying"));
getMapAsync( googleMap -> {
UiSettings settings = googleMap.getUiSettings();
settings.setZoomControlsEnabled(false);
settings.setMapToolbarEnabled(false);
settings.setScrollGesturesEnabled(mState != STATE.SHOWCASE);
if (mState != STATE.SHOWCASE) {
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Geo.MAN_LAT, Geo.MAN_LON), 14));
}
googleMap.setOnMarkerDragListener(new GoogleMap.OnMarkerDragListener() {
@Override
public void onMarkerDragStart(Marker marker) {
}
@Override
public void onMarkerDrag(Marker marker) {
}
@Override
public void onMarkerDragEnd(Marker marker) {
if (mMappedCustomMarkerIds.containsKey(marker.getId())) {
updateCustomPinWithMarker(marker, 0);
}
}
});
googleMap.setOnCameraIdleListener(new GoogleMap.OnCameraIdleListener() {
private final double BUFFER = .00005;
private final double MAX_ZOOM = 19.5;
private final double MIN_ZOOM = 12;
private boolean gotInitialCameraMove;
@Override
public void onCameraIdle() {
Timber.d("onCameraIdle");
if (!gotInitialCameraMove) {
gotInitialCameraMove = true;
return;
}
CameraPosition cameraPosition = googleMap.getCameraPosition();
if (!BRC_BOUNDS.contains(cameraPosition.target) || cameraPosition.zoom > MAX_ZOOM || cameraPosition.zoom < MIN_ZOOM) {
getMapAsync( map -> map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Math.min(MAX_LAT - BUFFER, Math.max(cameraPosition.target.latitude, MIN_LAT + BUFFER)), Math.min(MAX_LON - BUFFER, Math.max(cameraPosition.target.longitude, MIN_LON + BUFFER))), (float) Math.min(Math.max(cameraPosition.zoom, MIN_ZOOM), MAX_ZOOM))));
} else {
currentZoom = cameraPosition.zoom;
if (currentZoom > POI_ZOOM_LEVEL) {
if (mState == STATE.EXPLORE) {
getMapAsync( map -> {
visibleRegion = map.getProjection().getVisibleRegion();
cameraUpdate.onNext(visibleRegion);
});
}
} else if (currentZoom < POI_ZOOM_LEVEL && areMarkersVisible()) {
if (mState == STATE.EXPLORE) {
clearMap(false);
}
}
}
}
});
googleMap.setOnInfoWindowClickListener( marker -> {
if (markerIdToMeta.containsKey(marker.getId())) {
String markerMeta = markerIdToMeta.get(marker.getId());
int model_id = Integer.parseInt(markerMeta.split("-")[1]);
int model_type = Integer.parseInt(markerMeta.split("-")[0]);
Constants.PlayaItemType modelType = DataProvider.getTypeValue(model_type);
Intent i = new Intent(getActivity().getApplicationContext(), PlayaItemViewActivity.class);
i.putExtra(PlayaItemViewActivity.EXTRA_MODEL_ID, model_id);
i.putExtra(PlayaItemViewActivity.EXTRA_MODEL_TYPE, modelType);
getActivity().startActivity(i);
} else if (mMappedCustomMarkerIds.containsKey(marker.getId())) {
showEditPinDialog(marker);
}
});
});
}
Example 25
Project: iosched-master File: MapFragment.java View source code |
@Override
public void onMapReady(GoogleMap googleMap) {
// Initialise marker icons.
ICON_ACTIVE = BitmapDescriptorFactory.fromResource(R.drawable.map_marker_selected);
ICON_NORMAL = BitmapDescriptorFactory.fromResource(R.drawable.map_marker_unselected);
mMap = googleMap;
mMap.setIndoorEnabled(false);
mMap.setOnMarkerClickListener(this);
mMap.setOnMapClickListener(this);
mMap.setOnCameraChangeListener(this);
UiSettings mapUiSettings = mMap.getUiSettings();
mapUiSettings.setZoomControlsEnabled(false);
mapUiSettings.setMapToolbarEnabled(false);
// This state is set via 'setMyLocationLayerEnabled.
//noinspection MissingPermission
mMap.setMyLocationEnabled(mMyLocationEnabled);
addVenueMarker();
// Move camera directly to the venue
centerOnVenue(false);
loadMapData();
LOGD(TAG, "Map setup complete.");
}
Example 26
Project: open-rmbt-master File: RMBTMapFragment.java View source code |
@Override
public void onStart() {
super.onStart();
if (geoLocation != null)
geoLocation.start();
gMap = getMap();
if (gMap != null) {
checkSettingsRunnable = new Runnable() {
@Override
public void run() {
final RMBTMainActivity activity = (RMBTMainActivity) getActivity();
if (activity.getMapOptions() == null) {
activity.fetchMapOptions();
handler.postDelayed(checkSettingsRunnable, 500);
} else {
setFilter();
}
}
};
checkSettingsRunnable.run();
if (firstStart) {
final Bundle bundle = getArguments();
firstStart = false;
final UiSettings uiSettings = gMap.getUiSettings();
// options.isEnableAllGestures());
uiSettings.setZoomControlsEnabled(false);
uiSettings.setMyLocationButtonEnabled(false);
uiSettings.setCompassEnabled(false);
uiSettings.setRotateGesturesEnabled(false);
uiSettings.setScrollGesturesEnabled(options.isEnableAllGestures());
gMap.setTrafficEnabled(false);
gMap.setIndoorEnabled(false);
LatLng latLng = MapProperties.DEFAULT_MAP_CENTER;
float zoom = MapProperties.DEFAULT_MAP_ZOOM;
if (geoLocation != null) {
final Location lastKnownLocation = geoLocation.getLastKnownLocation();
if (lastKnownLocation != null) {
latLng = new LatLng(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude());
zoom = MapProperties.DEFAULT_MAP_ZOOM_LOCATION;
}
}
if (bundle != null) {
final LatLng initialCenter = bundle.getParcelable("initialCenter");
if (initialCenter != null) {
latLng = initialCenter;
zoom = MapProperties.POINT_MAP_ZOOM;
if (balloonMarker != null)
balloonMarker.remove();
balloonMarker = gMap.addMarker(new MarkerOptions().position(initialCenter).draggable(false).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
}
}
gMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom));
gMap.setLocationSource(new LocationSource() {
@Override
public void deactivate() {
onLocationChangedListener = null;
}
@Override
public void activate(OnLocationChangedListener listener) {
onLocationChangedListener = listener;
}
});
if (myLocationEnabled)
gMap.setMyLocationEnabled(true);
gMap.setOnMyLocationChangeListener(this);
gMap.setOnMarkerClickListener(this);
gMap.setOnMapClickListener(this);
gMap.setInfoWindowAdapter(this);
gMap.setOnInfoWindowClickListener(this);
if (myLocationEnabled) {
final Location myLocation = gMap.getMyLocation();
if (myLocation != null)
onMyLocationChange(myLocation);
}
}
}
}
Example 27
Project: DroidPlanner-Tower-master File: GoogleMapFragment.java View source code |
private void setupMapUI(GoogleMap map) {
map.setMyLocationEnabled(false);
UiSettings mUiSettings = map.getUiSettings();
mUiSettings.setMyLocationButtonEnabled(false);
mUiSettings.setMapToolbarEnabled(false);
mUiSettings.setCompassEnabled(false);
mUiSettings.setTiltGesturesEnabled(false);
mUiSettings.setZoomControlsEnabled(false);
mUiSettings.setRotateGesturesEnabled(mAppPrefs.isMapRotationEnabled());
}
Example 28
Project: mobmonkey-android-master File: SearchLocationsFragment.java View source code |
/**
*
*/
private void panAndZoom() {
UiSettings uiSettings = googleMap.getUiSettings();
uiSettings.setCompassEnabled(enablePanAndZoom);
uiSettings.setMyLocationButtonEnabled(enablePanAndZoom);
uiSettings.setRotateGesturesEnabled(enablePanAndZoom);
uiSettings.setScrollGesturesEnabled(enablePanAndZoom);
uiSettings.setTiltGesturesEnabled(enablePanAndZoom);
uiSettings.setZoomControlsEnabled(enablePanAndZoom);
uiSettings.setZoomGesturesEnabled(enablePanAndZoom);
}
Example 29
Project: MyBusEdinburgh-master File: BusStopMapFragment.java View source code |
/**
* {@inheritDoc}
*/
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (map == null) {
map = getMap();
if (map != null) {
getActivity().supportInvalidateOptionsMenu();
final UiSettings uiSettings = map.getUiSettings();
uiSettings.setRotateGesturesEnabled(false);
uiSettings.setCompassEnabled(false);
uiSettings.setMyLocationButtonEnabled(true);
map.setInfoWindowAdapter(new MapInfoWindow(getActivity()));
map.setOnCameraChangeListener(this);
map.setOnMarkerClickListener(this);
map.setOnInfoWindowClickListener(this);
map.setMapType(sp.getInt(PreferencesActivity.PREF_MAP_LAST_MAP_TYPE, GoogleMap.MAP_TYPE_NORMAL));
map.setPadding(0, actionBarHeight, 0, 0);
moveCameraToInitialLocation();
refreshBusStops(null);
// Check to see if a search is to be done.
final Bundle args = getArguments();
if (args != null && args.containsKey(ARG_SEARCH)) {
onSearch(args.getString(ARG_SEARCH));
args.remove(ARG_SEARCH);
}
}
}
}
Example 30
Project: onebusaway-android-master File: BaseMapFragment.java View source code |
private void initMap(Bundle savedInstanceState) {
UiSettings uiSettings = mMap.getUiSettings();
// Show the location on the map
mMap.setMyLocationEnabled(true);
// Set location source
mMap.setLocationSource(this);
// Listener for camera changes
mMap.setOnCameraChangeListener(this);
// Hide MyLocation button on map, since we have our own button
uiSettings.setMyLocationButtonEnabled(false);
// Hide Zoom controls
uiSettings.setZoomControlsEnabled(false);
// Hide Toolbar
uiSettings.setMapToolbarEnabled(false);
// Instantiate class that holds generic markers to be added by outside classes
mSimpleMarkerOverlay = new SimpleMarkerOverlay(mMap);
if (savedInstanceState != null) {
initMapState(savedInstanceState);
} else {
Bundle args = getActivity().getIntent().getExtras();
// The rest of this code assumes a bundle exists, even if it's empty
if (args == null) {
args = new Bundle();
}
double lat = args.getDouble(MapParams.CENTER_LAT, 0.0d);
double lon = args.getDouble(MapParams.CENTER_LON, 0.0d);
if (lat == 0.0d && lon == 0.0d) {
// Try to restore the latest map view location
PreferenceUtils.maybeRestoreMapViewToBundle(args);
}
initMapState(args);
}
}
Example 31
Project: Tower-master File: GoogleMapFragment.java View source code |
private void setupMapUI(GoogleMap map) {
map.setMyLocationEnabled(false);
UiSettings mUiSettings = map.getUiSettings();
mUiSettings.setMyLocationButtonEnabled(false);
mUiSettings.setMapToolbarEnabled(false);
mUiSettings.setCompassEnabled(false);
mUiSettings.setTiltGesturesEnabled(false);
mUiSettings.setZoomControlsEnabled(false);
mUiSettings.setRotateGesturesEnabled(mAppPrefs.isMapRotationEnabled());
}
Example 32
Project: Transit-master File: BaseMapFragment.java View source code |
private void initMap(Bundle savedInstanceState) {
UiSettings uiSettings = mMap.getUiSettings();
// Show the location on the map
mMap.setMyLocationEnabled(true);
// Set location source
mMap.setLocationSource(this);
// Listener for camera changes
mMap.setOnCameraChangeListener(this);
// Hide MyLocation button on map, since we have our own button
uiSettings.setMyLocationButtonEnabled(false);
// Hide Zoom controls
uiSettings.setZoomControlsEnabled(false);
// Hide Toolbar
uiSettings.setMapToolbarEnabled(false);
// Instantiate class that holds generic markers to be added by outside classes
mSimpleMarkerOverlay = new SimpleMarkerOverlay(mMap);
if (savedInstanceState != null) {
initMapState(savedInstanceState);
} else {
Bundle args = getActivity().getIntent().getExtras();
// The rest of this code assumes a bundle exists, even if it's empty
if (args == null) {
args = new Bundle();
}
double lat = args.getDouble(MapParams.CENTER_LAT, 0.0d);
double lon = args.getDouble(MapParams.CENTER_LON, 0.0d);
if (lat == 0.0d && lon == 0.0d) {
// Try to restore the latest map view location
PreferenceUtils.maybeRestoreMapViewToBundle(args);
}
initMapState(args);
}
}
Example 33
Project: geohashdroid-master File: CentralMap.java View source code |
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// I could swear you could do this in XML...
UiSettings set = mMap.getUiSettings();
// The My Location button has to go off, as we're going to have the
// infobox right around there.
set.setMyLocationButtonEnabled(false);
// Go to preferences to figure out what map type we're using.
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(CentralMap.this);
mapTypeSelected(prefs.getInt(GHDConstants.PREF_LAST_MAP_TYPE, GoogleMap.MAP_TYPE_NORMAL));
// Now, set the flag that tells everything else (especially the
// doReadyChecks method) we're ready. Then, call doReadyChecks.
// We might still be waiting on the API.
mMapIsReady = true;
doReadyChecks();
}
Example 34
Project: OpenTripPlanner-for-Android-master File: MainFragment.java View source code |
private void initializeMapInterface(GoogleMap mMap) {
UiSettings uiSettings = mMap.getUiSettings();
mMap.setMyLocationEnabled(true);
mMap.setOnCameraChangeListener(this);
uiSettings.setMyLocationButtonEnabled(false);
uiSettings.setCompassEnabled(true);
uiSettings.setAllGesturesEnabled(true);
uiSettings.setZoomControlsEnabled(false);
updateOverlay(ConversionUtils.getOverlayString(mApplicationContext));
addInterfaceListeners();
}
Example 35
Project: CoinmApp-master File: CoinmapFragment.java View source code |
private void setUpMap() {
if (getMap() != null) {
UiSettings settings = getMap().getUiSettings();
settings.setMyLocationButtonEnabled(true);
getMap().setMyLocationEnabled(true);
mapEntryManager.updateMap(getMap());
}
}
Example 36
Project: assertj-android-master File: Assertions.java View source code |
public static org.assertj.android.playservices.api.maps.UiSettingsAssert assertThat(com.google.android.gms.maps.UiSettings actual) {
return new org.assertj.android.playservices.api.maps.UiSettingsAssert(actual);
}
Example 37
Project: Pokemap-master File: MapWrapperFragment.java View source code |
@Override
public void onMapReady(GoogleMap googleMap) {
mGoogleMap = googleMap;
UiSettings settings = mGoogleMap.getUiSettings();
settings.setCompassEnabled(true);
settings.setTiltGesturesEnabled(true);
settings.setMyLocationButtonEnabled(false);
}
Example 38
Project: android-maps-extensions-master File: GoogleMapWrapper.java View source code |
@Override
public final UiSettings getUiSettings() {
return map.getUiSettings();
}
Example 39
Project: ijoomer-adv-sdk-master File: GoogleMapWrapper.java View source code |
@Override
public final UiSettings getUiSettings() {
return map.getUiSettings();
}
Example 40
Project: mtransit-for-android-master File: GoogleMapWrapper.java View source code |
@Override
public final UiSettings getUiSettings() {
return map.getUiSettings();
}
Example 41
Project: Open-Vehicle-Android-master File: GoogleMapWrapper.java View source code |
@Override
public final UiSettings getUiSettings() {
return map.getUiSettings();
}
Example 42
Project: Polaris2-master File: GoogleMap.java View source code |
public UiSettings getUiSettings() { final com.google.android.gms.maps.UiSettings original = mOriginal.getUiSettings(); return original == null ? null : new UiSettings(original); }
Example 43
Project: google_maps_v2_support-master File: SupportGoogleMap.java View source code |
public UiSettings getUiSettings() {
return mGoogleMap.getUiSettings();
}