Java Code Examples for com.google.android.gms.maps.model.BitmapDescriptorFactory#fromResource()
The following examples show how to use
com.google.android.gms.maps.model.BitmapDescriptorFactory#fromResource() .
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: EstablishmentInteractorImpl.java From Saude-no-Mapa with MIT License | 6 votes |
private BitmapDescriptor getBitmapDescriptorForCategory(String categoria) { BitmapDescriptor mapIcon; if (categoria.contains("consultório")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_consultorio); } else if (categoria.contains("clínica")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_clinica); } else if (categoria.contains("laboratório")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_laboratorio); } else if (categoria.contains("urgência")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_urgente); } else if (categoria.contains("hospital")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_hospital); } else if (categoria.contains("atendimento domiciliar")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_domiciliar); } else if (categoria.contains("posto de saúde")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_urgente); } else if (categoria.contains("samu")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_samu); } else { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_urgente); } return mapIcon; }
Example 2
Source File: EmergencyInteractorImpl.java From Saude-no-Mapa with MIT License | 6 votes |
private BitmapDescriptor getBitmapDescriptorForCategory(String categoria) { BitmapDescriptor mapIcon; if (categoria.contains("consultório")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_consultorio); } else if (categoria.contains("clínica")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_clinica); } else if (categoria.contains("laboratório")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_laboratorio); } else if (categoria.contains("urgência")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_urgente); } else if (categoria.contains("hospital")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_hospital); } else if (categoria.contains("atendimento domiciliar")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_domiciliar); } else if (categoria.contains("posto de saúde")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_urgente); } else if (categoria.contains("samu")) { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_samu); } else { mapIcon = BitmapDescriptorFactory.fromResource(R.drawable.ic_urgente); } return mapIcon; }
Example 3
Source File: MainActivity.java From AndroidLocationStarterKit with MIT License | 6 votes |
private void drawUserPositionMarker(Location location){ LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude()); if(this.userPositionMarkerBitmapDescriptor == null){ userPositionMarkerBitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.user_position_point); } if (userPositionMarker == null) { userPositionMarker = map.addMarker(new MarkerOptions() .position(latLng) .flat(true) .anchor(0.5f, 0.5f) .icon(this.userPositionMarkerBitmapDescriptor)); } else { userPositionMarker.setPosition(latLng); } }
Example 4
Source File: MapMarker.java From android-app with GNU General Public License v2.0 | 6 votes |
private BitmapDescriptor getIcon(Date data) { DateTime current = new DateTime(Calendar.getInstance()); DateTime last = new DateTime(data); int diff = Minutes.minutesBetween(last, current).getMinutes(); BitmapDescriptor bitmap; if(diff >= 5 && diff < 10 ) { bitmap = BitmapDescriptorFactory .fromResource(R.drawable.bus_yellow); } else if(diff >= 10 ) { bitmap = BitmapDescriptorFactory .fromResource(R.drawable.bus_red); } else { bitmap = BitmapDescriptorFactory .fromResource(R.drawable.bus_green); } return bitmap; }
Example 5
Source File: IconMarker.java From android-custom-markers with Apache License 2.0 | 5 votes |
@Override public BitmapDescriptor getBitmapDescriptor() { return BitmapDescriptorFactory.fromResource( selectedIcon > 0 && isSelected() ? selectedIcon : defaultIcon ); }
Example 6
Source File: MainActivity.java From ExamplesAndroid with Apache License 2.0 | 5 votes |
@Override protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) { BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.mipmap.davidhackro); markerOptions.icon(icon); markerOptions.snippet(item.getTitle()); markerOptions.title(item.getSubtitle()); markerOptions.position(item.getPosition()); super.onBeforeClusterItemRendered(item, markerOptions); }
Example 7
Source File: PolylineDemoActivity.java From android-samples with Apache License 2.0 | 5 votes |
private Cap getSelectedCap(int pos) { switch (CAP_TYPE_NAME_RESOURCE_IDS[pos]) { case R.string.cap_butt: return new ButtCap(); case R.string.cap_square: return new SquareCap(); case R.string.cap_round: return new RoundCap(); case R.string.cap_image: return new CustomCap( BitmapDescriptorFactory.fromResource(R.drawable.chevron), CUSTOM_CAP_IMAGE_REF_WIDTH_PX); } return null; }
Example 8
Source File: RMBTMapFragment.java From open-rmbt with Apache License 2.0 | 5 votes |
@Override public void onMyLocationChange(Location location) { if (myLocationMarker != null) myLocationMarker.remove(); if (markerIconBitmapDescriptor == null) markerIconBitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.bg_trans_light); myLocationMarker = gMap.addMarker(new MarkerOptions() .position(new LatLng(location.getLatitude(), location.getLongitude())) .icon(markerIconBitmapDescriptor)); }
Example 9
Source File: ToastedMarkerOptionsChooser.java From clusterkraf with Apache License 2.0 | 5 votes |
@Override public void choose(MarkerOptions markerOptions, ClusterPoint clusterPoint) { Context context = contextRef.get(); if (context != null) { Resources res = context.getResources(); boolean isCluster = clusterPoint.size() > 1; boolean hasTwoToasters = clusterPoint.containsInputPoint(twoToasters); BitmapDescriptor icon; String title; if (isCluster) { title = res.getQuantityString(R.plurals.count_points, clusterPoint.size(), clusterPoint.size()); int clusterSize = clusterPoint.size(); if (hasTwoToasters) { icon = BitmapDescriptorFactory.fromBitmap(getClusterBitmap(res, R.drawable.ic_map_pin_cluster_toaster, clusterSize)); title = res.getString(R.string.including_two_toasters, title); } else { icon = BitmapDescriptorFactory.fromBitmap(getClusterBitmap(res, R.drawable.ic_map_pin_cluster, clusterSize)); title = res.getQuantityString(R.plurals.count_points, clusterSize, clusterSize); } } else { MarkerData data = (MarkerData)clusterPoint.getPointAtOffset(0).getTag(); if (hasTwoToasters) { icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_pin_toaster); title = data.getLabel(); } else { icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_pin); title = res.getString(R.string.point_number_x, data.getLabel()); } } markerOptions.icon(icon); markerOptions.title(title); markerOptions.anchor(0.5f, 1.0f); } }
Example 10
Source File: GglMapCustomMarkerView.java From FimiX8-RE with MIT License | 4 votes |
public BitmapDescriptor createCustomMarkerView(Context context, int res) { return BitmapDescriptorFactory.fromResource(res); }
Example 11
Source File: DefaultIconGenerator.java From google-maps-clustering with Apache License 2.0 | 4 votes |
@NonNull private BitmapDescriptor createClusterItemIcon() { return BitmapDescriptorFactory.fromResource(mIconStyle.getClusterIconResId()); }
Example 12
Source File: MovingMarkerActivity.java From Airbnb-Android-Google-Map-View with MIT License | 4 votes |
private void setupCameraPositionForMovement(LatLng markerPos, LatLng secondPos) { float bearing = bearingBetweenLatLngs(markerPos, secondPos); BitmapDescriptor icon = BitmapDescriptorFactory.fromResource(R.drawable.car_small); trackingMarker = mGoogleMap.addMarker(new MarkerOptions().position(markerPos) .icon(icon) .title("Car") .snippet("Yo")); CameraPosition cameraPosition = new CameraPosition.Builder() .target(markerPos) .bearing(bearing + BEARING_OFFSET) .tilt(90) .zoom(mGoogleMap.getCameraPosition().zoom >= 16 ? mGoogleMap.getCameraPosition().zoom : 16) .build(); mGoogleMap.animateCamera( CameraUpdateFactory.newCameraPosition(cameraPosition), ANIMATE_SPEEED_TURN, new GoogleMap.CancelableCallback() { @Override public void onFinish() { System.out.println("finished camera"); animator.reset(); Handler handler = new Handler(); handler.post(animator); } @Override public void onCancel() { System.out.println("cancelling camera"); } } ); }