当前位置: 首页>>代码示例>>Java>>正文


Java MapStyleOptions.loadRawResourceStyle方法代码示例

本文整理汇总了Java中com.google.android.gms.maps.model.MapStyleOptions.loadRawResourceStyle方法的典型用法代码示例。如果您正苦于以下问题:Java MapStyleOptions.loadRawResourceStyle方法的具体用法?Java MapStyleOptions.loadRawResourceStyle怎么用?Java MapStyleOptions.loadRawResourceStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.maps.model.MapStyleOptions的用法示例。


在下文中一共展示了MapStyleOptions.loadRawResourceStyle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setSelectedStyle

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
private static void setSelectedStyle(StyleDef styleName, GoogleMap googleMap, Context context) {
    MapStyleOptions style;
    switch (styleName) {
        case RETRO:
            style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_retro);
            break;
        case NIGHT:
            style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_night);
            break;
        case GRAY_SCALE:
            style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_grayscale);
            break;
        case DEFAULT:
            style = null;
            break;
        default:
            return;
    }
    googleMap.setMapStyle(style);
}
 
开发者ID:bkhezry,项目名称:ExtraMapUtils,代码行数:21,代码来源:MapUtils.java

示例2: getMapStyle

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
protected MapStyleOptions getMapStyle() {
    if (mStyleEnum == NiboStyle.CUSTOM) {
        if (mStyleFileID != DEFAULT_MARKER_ICON_RES) {
            return MapStyleOptions.loadRawResourceStyle(
                    getActivity(), mStyleFileID);
        } else {
            throw new IllegalStateException("NiboStyle.CUSTOM requires that you supply a custom style file, you can get one at https://snazzymaps.com/explore");
        }
    } else if (mStyleEnum == NiboStyle.DEFAULT) {
        return null;
    } else {
        if (mStyleEnum == null) {
            return null;
        }
        {
            return MapStyleOptions.loadRawResourceStyle(
                    getActivity(), mStyleEnum.getValue());
        }
    }
}
 
开发者ID:aliumujib,项目名称:Nibo,代码行数:21,代码来源:BaseNiboFragment.java

示例3: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
// Basic thing to do when the map is setup
// Callback for when the googleMap object is set up
public void onMapReady(GoogleMap googleMap) {
    // Make our map a map
    map = googleMap;

    Calendar current = Calendar.getInstance();

    // Add night view for nice viewing when it's dark out
    // Dark styling is easier on the eyes
    SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
    if (nightTime(time.format(current.getTime()))) {
        MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_night_style);
        map.setMapStyle(style);
    }

    // Let's listen for clicks on our markers to display information
    map.setOnMarkerClickListener(showInfoWindow);


}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:23,代码来源:RideView.java

示例4: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    gMap = googleMap;

    Calendar current = Calendar.getInstance();

    // Add night view for nice viewing when it's dark out
    // Dark styling is easier on the eyes
    SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
    if (nightTime(time.format(current.getTime()))) {
        MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_night_style);
        gMap.setMapStyle(style);
    }

    setupMap(request);

}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:18,代码来源:AcceptRiderView.java

示例5: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    this.googleMap = googleMap;
    //googleMap.getUiSettings().setScrollGesturesEnabled(false);
    //googleMap.getUiSettings().setZoomControlsEnabled(false);
    //googleMap.getUiSettings().setZoomGesturesEnabled(false);
    googleMap.getUiSettings().setAllGesturesEnabled(false);
    googleMap.getUiSettings().setMapToolbarEnabled(false);
    googleMap.setOnMarkerClickListener(
            new GoogleMap.OnMarkerClickListener() {
                public boolean onMarkerClick(Marker marker) {
                    return true;
                }
            });

    MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_json_styling);
    googleMap.setContentDescription("Map displaying selected route between " + start.getStopName() + " and " + destination.getStopName() + " with your vehicle location.");

    googleMap.setMapStyle(mapStyle);

    updateMap();
}
 
开发者ID:septadev,项目名称:SEPTA-Android,代码行数:23,代码来源:NextToArriveTripDetailActivity.java

示例6: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    MapsInitializer.initialize(context);
    MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(context, R.raw.mapstyle_night);
    map = googleMap;
    map.setMapStyle(style);
    final ViewOption viewOption = (ViewOption) mapView.getTag();
    if (viewOption != null) {
        setMapLocation(viewOption, map, context);
    }
}
 
开发者ID:bkhezry,项目名称:ExtraMapUtils,代码行数:12,代码来源:ListViewFragment.java

示例7: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
/**
 * Called when the <code>GoogleMap</code> is ready. Initialize a MapHandler.
 *
 * @param googleMap     the <code>GoogleMap</code>
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
    googleMap.setMapStyle(mapStyle);

    UtilsUI.recapDisplayTrackSetupUI(googleMap);
    UtilsUI.recapDisplayTrack(runToBeDisplayed.getTrack(), googleMap,
            ContextCompat.getColor(getContext(), R.color.colorAccent));
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:15,代码来源:DisplayRunFragment.java

示例8: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
/**
 * Called when the GoogleMap is ready. Initializes a MapHandler.
 *
 * @param googleMap     The GoogleMap, must be non null.
 */
@Override
public void onMapReady(GoogleMap googleMap) {

    if (googleMap == null) {
        throw new IllegalArgumentException("The GoogleMap can't be null");
    }

    MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
    googleMap.setMapStyle(mapStyle);

    mapHandler = new MapHandler(googleMap, ContextCompat.getColor(getContext(), R.color.colorAccent));
    mapHandler.setupRunningMapUI();
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:19,代码来源:ChallengeReceiverFragment.java

示例9: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
/**
 * Called when the GoogleMap is ready. Initialize a MapHandler.
 *
 * @param googleMap     The GoogleMap must be non null.
 */
@Override
public void onMapReady(GoogleMap googleMap) {

    if (googleMap == null) {
        throw new IllegalArgumentException("The GoogleMap must be non null");
    }

    MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);
    googleMap.setMapStyle(mapStyle);
    mapHandler = new MapHandler(googleMap, ContextCompat.getColor(getContext(), R.color.colorAccent));
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:17,代码来源:RunFragment.java

示例10: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
/**
 * Called when the <code>GoogleMap</code> is ready. Initialize a MapHandler.
 *
 * @param googleMap     the <code>GoogleMap</code>
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    MapStyleOptions mapStyle = MapStyleOptions.loadRawResourceStyle(getActivity(), R.raw.map_style_no_label);

    switch(currentMapType) {

        case USER_MAP:
            Track userTrack = challengeToBeDisplayed.getMyRun().getTrack();
            googleMap.setMapStyle(mapStyle);

            UtilsUI.recapDisplayTrack(userTrack, googleMap, userColor);
            UtilsUI.recapDisplayTrackSetupUI(googleMap);

            currentMapType = MapType.OPPONENT_MAP;
            opponentMapView.getMapAsync(this);
            break;
        case OPPONENT_MAP:
            Track opponentTrack = challengeToBeDisplayed.getOpponentRun().getTrack();
            googleMap.setMapStyle(mapStyle);

            UtilsUI.recapDisplayTrack(opponentTrack, googleMap, opponentColor);
            UtilsUI.recapDisplayTrackSetupUI(googleMap);
            break;
        default:
            throw new IllegalStateException("unknown map type");
    }
}
 
开发者ID:IrrilevantHappyLlamas,项目名称:Runnest,代码行数:33,代码来源:DisplayChallengeFragment.java

示例11: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
// Basic thing to do when the map is setup
// Callback for when the googleMap object is set up
public void onMapReady(GoogleMap googleMap) {
    // Make our map a map
    map = googleMap;

    // Allow the user to go home at any time
    map.setMyLocationEnabled(true);

    map.setOnMapLongClickListener(searchAtPoint);
    // What time is it?
    Calendar current = Calendar.getInstance();

    // Add night view for nice viewing when it's dark out
    // Dark styling is easier on the eyes
    SimpleDateFormat time = new SimpleDateFormat("HH:mm:ss");
    if (nightTime(time.format(current.getTime()))) {
        MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(this, R.raw.maps_night_style);
        map.setMapStyle(style);
    }

    // Let's listen for clicks on our markers to display information
    map.setOnMarkerClickListener(showInfoWindow);
    map.setOnInfoWindowClickListener(goToRequest);
    map.setInfoWindowAdapter(displayRequest);

}
 
开发者ID:CMPUT301F16T04,项目名称:Ridr,代码行数:29,代码来源:GeoView.java

示例12: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(mContext, R.raw.map_style);
    mMap.setMapStyle(style);
    checkPermissions();
    configureMapClickListener();
}
 
开发者ID:matbrandao,项目名称:Saude-no-Mapa,代码行数:9,代码来源:EstablishmentPresenterImpl.java

示例13: onCreate

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_projection_route);

    View view = new FrameLayout(this);

    mSpinner = findViewById(R.id.spinner_location);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
        R.array.array_place, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    mSpinner.setAdapter(adapter);
    mSpinner.setOnItemSelectedListener(this);

    mSwitchCompat = findViewById(R.id.switch_btn);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window w = getWindow();
        w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }

    mapFragment = (TrailSupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    route = Data.getRoute();

    mapStyle = MapStyleOptions.loadRawResourceStyle(getApplicationContext(), R.raw.mapstyle);
}
 
开发者ID:amalChandran,项目名称:trail-android,代码行数:30,代码来源:OverlayRouteActivity.java

示例14: setup

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
public void setup() {
    MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(Application.getContext(), R.raw.map_style);
    this.googleMap.setMapStyle(style);

    if (ActivityCompat.checkSelfPermission(Application.getContext(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
            && ActivityCompat.checkSelfPermission(Application.getContext(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        requestPermissions(new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, GET_PERMS);
        return;
    }

    setupLocationChangeListener();

    if (!locationServiceEnabled) {
        locationSettingsRequest(Application.getContext());
        return;
    }

    isTracking = true;

    if (gpsTracking == null) {
        gpsTracking = new GPSTracking(getContext());
    }

    googleMap.setMyLocationEnabled(false);
    googleMap.setBuildingsEnabled(false);
    googleMap.getUiSettings().setCompassEnabled(false);
    googleMap.getUiSettings().setMyLocationButtonEnabled(false);
    googleMap.getUiSettings().setMapToolbarEnabled(false);

    /* FIREBASE TRACKING SETUP */
    setTrackingReference();

    /* USING CUSTOM GPS TRACKING MARKER */
    LatLng currentLocation = new LatLng(gpsTracking.getLatitude(), gpsTracking.getLongitude());

    Bitmap myLocationMarker = BitmapFactory.decodeResource(getResources(), R.drawable.navigation);
    Bitmap scaledLocation = Bitmap.createScaledBitmap(myLocationMarker, 72, 72, false);

    setCameraPosition(gpsTracking.getLatitude(), gpsTracking.getLongitude(), standardZoomLevel, false);
    myLocation = googleMap.addMarker(new MarkerOptions()
            .position(currentLocation)
            .flat(true)
            .icon(BitmapDescriptorFactory.fromBitmap(scaledLocation))
            .anchor(0.5f, 0.5f)
    );
    myLocation.setTag(0);

    nearbyRadius(currentLocation);
    //accuracyCircle(currentLocation, gpsTracking.getLocation().getAccuracy());

    trackingButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (!isTracking) {
                isTracking = true;
                trackingButton.setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.colorPrimary)));

                if (listenerLocation != null) {
                    setCameraPosition(listenerLocation.getLatitude(), listenerLocation.getLongitude(), standardZoomLevel, true);
                } else {
                    setCameraPosition(gpsTracking.getLatitude(), gpsTracking.getLongitude(), standardZoomLevel, true);
                }

                if (selectedMarker != null) resetMarkerIcon(selectedMarker);
            }
        }
    });

    if (user != null) {
        shareReference.addChildEventListener(staticLocationListener);
    }
}
 
开发者ID:STUDIO-apps,项目名称:GeoShare_Android,代码行数:73,代码来源:MapsFragment.java

示例15: onMapReady

import com.google.android.gms.maps.model.MapStyleOptions; //导入方法依赖的package包/类
@SuppressWarnings("MissingPermission")
@Override
public void onMapReady(final GoogleMap mMap) {
    MapStyleOptions style = MapStyleOptions.loadRawResourceStyle(this, R.raw.map);
    mMap.setMapStyle(style);
    LatLng location = getIntent().getParcelableExtra("location");
    if (location == null) {
        mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(LocationServices.API)
                .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
                    @Override
                    public void onConnected(final Bundle bundle) {
                        android.location.Location l = LocationServices.FusedLocationApi
                                .getLastLocation(mGoogleApiClient);
                        if (l != null && mMap.getCameraPosition().zoom <= 2) {
                            mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
                                    new LatLng(l.getLatitude(), l.getLongitude()), 16));
                        }
                        mGoogleApiClient.disconnect();
                    }

                    @Override
                    public void onConnectionSuspended(int cause) {
                        if (BuildConfig.DEBUG) Logger.log("connection suspended: " + cause);
                    }
                }).build();

        mGoogleApiClient.connect();

        mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
            @Override
            public void onMapClick(final LatLng center) {
                getIntent().putExtra("location", center);
                setResult(RESULT_OK, getIntent());
                finish();
            }
        });
    } else {
        mMap.addCircle(new CircleOptions().center(location).radius(100).strokeColor(Color.BLUE)
                .fillColor(Color.argb(64, 0, 0, 255)));
        mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 16));
    }

    mMap.setMyLocationEnabled(true);
}
 
开发者ID:j4velin,项目名称:WiFi-Automatic,代码行数:45,代码来源:Map.java


注:本文中的com.google.android.gms.maps.model.MapStyleOptions.loadRawResourceStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。