Java Code Examples for com.mapbox.mapboxsdk.maps.MapboxMap#setStyle()

The following examples show how to use com.mapbox.mapboxsdk.maps.MapboxMap#setStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegionSelectionFragment.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void onMapReady(final MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;
  mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
    @Override
    public void onStyleLoaded(@NonNull Style style) {
      RegionSelectionFragment.this.style = style;
      mapboxMap.addOnCameraIdleListener(RegionSelectionFragment.this);
      if (options != null) {
        if (options.startingBounds() != null) {
          mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(options.startingBounds(), 0));
        } else if (options.statingCameraPosition() != null) {
          mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(options.statingCameraPosition()));
        }
      }
    }
  });
}
 
Example 2
Source File: FillChangeActivity.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void onMapReady(@NonNull MapboxMap map) {
  map.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> {
    fillManager = new FillManager(mapView, map, style, "aerialway");
    fillManager.addClickListener(fill -> {
      Toast.makeText(
          FillChangeActivity.this,
          "Clicked: " + fill.getId(),
          Toast.LENGTH_SHORT).show();
      return false;
    });

    fill = fillManager.create(new FillOptions()
      .withLatLngs(STAR_SHAPE_POINTS)
      .withFillColor(ColorUtils.colorToRgbaString(BLUE_COLOR))
    );
  });
}
 
Example 3
Source File: PlacePickerActivity.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void onMapReady(final MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;
  mapboxMap.setStyle(Style.MAPBOX_STREETS, new Style.OnStyleLoaded() {
    @Override
    public void onStyleLoaded(@NonNull Style style) {
      adjustCameraBasedOnOptions();
      if (includeReverseGeocode) {
        // Initialize with the marker's current coordinates.
        makeReverseGeocodingSearch();
      }
      bindListeners();

      if (options != null && options.includeDeviceLocationButton()) {
        enableLocationComponent(style);
      } else {
        userLocationButton.hide();
      }
    }
  });
}
 
Example 4
Source File: BulkSymbolActivity.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void initMap(MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;
  mapboxMap.moveCamera(
    CameraUpdateFactory.newLatLngZoom(
      new LatLng(38.87031, -77.00897), 10
    )
  );

  mapboxMap.setStyle(new Style.Builder().fromUri(Style.MAPBOX_STREETS), style -> {
    findViewById(R.id.fabStyles).setOnClickListener(v -> mapboxMap.setStyle(Utils.INSTANCE.getNextStyle()));
    symbolManager = new SymbolManager(mapView, mapboxMap, style);
    symbolManager.setIconAllowOverlap(true);
    loadData(0);
  });
}
 
Example 5
Source File: OnMapReadyIdlingResource.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void onMapReady(@NonNull MapboxMap mapboxMap) {
  this.mapboxMap = mapboxMap;
  mapboxMap.setStyle(Style.MAPBOX_STREETS, style -> {
    if (resourceCallback != null) {
      resourceCallback.onTransitionToIdle();
    }
  });
}
 
Example 6
Source File: MainActivity.java    From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void onMapReady(@NonNull MapboxMap mapboxMap) {

        mapboxMap.setStyle(Style.TRAFFIC_NIGHT, new Style.OnStyleLoaded() {
            @Override
            public void onStyleLoaded(@NonNull Style style) {

                enableLocationComponent();


            }
        });
//        mapboxMap.setStyle(Style.LIGHT);

        this.mapboxMap = mapboxMap;
        mapboxMap.addOnMapClickListener(this);


//        if (locationComponent == null) {
//            mapboxMap.setStyle(Style.LIGHT);
//            enableLocationComponent();
//        }


    }