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


Java IconGenerator.makeIcon方法代码示例

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


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

示例1: onFinish

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
@Override
public void onFinish() {
    if (currentPt < listPoint.size()) {
        Log.i("current", "" + currentPt);
        Log.i("listpointSize", "" + listPoint.size());

        //set number of station inside of marker
        IconGenerator tc = new IconGenerator(Map.this);
        Bitmap bmp = tc.makeIcon("" + (currentPt + 1));

        Marker marker = mMap.addMarker(new MarkerOptions()
                .position(listPoint.get(currentPt))
                .title(titles.get(currentPt))
                .icon(BitmapDescriptorFactory.fromBitmap(bmp)));
        marker.showInfoWindow();

        mMap.animateCamera(CameraUpdateFactory.newLatLng(listPoint.get(currentPt)), 4000, MyCancelableCallback);
        currentPt++;

    } else {
        Toast.makeText(getApplicationContext(), getResources().getString(R.string.end_route), Toast.LENGTH_LONG).show();
    }

}
 
开发者ID:kikitsa,项目名称:csd-Thesis,代码行数:25,代码来源:Map.java

示例2: attachMarkersToMap

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
public void attachMarkersToMap() {
    //add building markers
    for (Map.Entry<String, LatLng> entry : CONSTANTS.buildings.entrySet()) {
        String key = entry.getKey();
        LatLng value = entry.getValue();
        IconGenerator mIconGen = new IconGenerator(passedActivity);
        Bitmap iconBitmap = mIconGen.makeIcon(key);
        buildingMarkers.add(mMap.addMarker(new MarkerOptions().position(value)
                .icon(BitmapDescriptorFactory.fromBitmap(iconBitmap)).title(key)));
    }
}
 
开发者ID:derekriley,项目名称:UWP-navigation,代码行数:12,代码来源:MapTransform.java

示例3: buildAvatarIcon

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
public static Bitmap buildAvatarIcon(Context context,
                                     User user,
                                     ImageView imageView,
                                     IconGenerator iconGenerator) {
    Bitmap avatarIcon = null;
    Bitmap scaledBitmap;

    try {
        Bitmap fetchedAvatar;

        if (user.getAvatar() != null) {
            byte[] bytes = user.getAvatar().getData();
            fetchedAvatar= BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
        } else {
            fetchedAvatar = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_avatar);
        }

        scaledBitmap = Bitmap.createScaledBitmap(
                fetchedAvatar,
                100, 100,
                true);

        imageView.setImageBitmap(scaledBitmap);

        setIconStyle(user, iconGenerator);

        avatarIcon = iconGenerator.makeIcon();
    } catch (ParseException e) {
        e.printStackTrace();
    }

    return avatarIcon;
}
 
开发者ID:tl-nguyen,项目名称:RadarApp,代码行数:34,代码来源:BitmapHelper.java

示例4: onMarkerClick

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
/**
 * clicking the marker go to
 * the corresponding station-page
 *
 * @param marker
 *
 * @return
 */
@Override
public boolean onMarkerClick(Marker marker) {

    int viewNumber = 0;

    for (int i = 0; i < titles.size(); i++) {
        if (marker.getTitle().equals(titles.get(i))) {
            viewNumber = i;
        }
    }

    //change the color of pressed marker
    IconGenerator tc = new IconGenerator(Map.this);
    tc.setTextAppearance(R.style.pressedMarker);
    Bitmap bmp = tc.makeIcon("" + (viewNumber + 1));
    marker.setIcon(BitmapDescriptorFactory.fromBitmap(bmp));

    //if panel is down then slide panel up
    if(!panelVisibility){
        //animation for station's panel in order to slide up
        mPager.startAnimation(animationSlideUp);
        mPager.setVisibility(View.VISIBLE);

        //change the background of upDown button
        upDown.setBackgroundResource(R.mipmap.down_arrow);
        panelVisibility = true;
    }

    //set the viewPager to the right station
    mPager.setCurrentItem(viewNumber, true);

    return false;
}
 
开发者ID:kikitsa,项目名称:csd-Thesis,代码行数:42,代码来源:Map.java

示例5: getIcon

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
public Bitmap getIcon(RoomMetaData room, String title) {
    IconGenerator iconGenerator = new IconGenerator(context);
    iconGenerator.setTextAppearance(R.style.MapLabel);
    iconGenerator.setContentPadding(3,3,3,3);
    iconGenerator.setBackground(new ColorDrawable(room.color));
    return iconGenerator.makeIcon(title);

}
 
开发者ID:secondsun,项目名称:devnexus-android,代码行数:9,代码来源:GWCCMapIconGenerator.java

示例6: drawMarkers

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
private void drawMarkers(ArrayList<Event> events) {
    map.clear();
    for (int i = 0; i < events.size(); i++) {
        Event currentEvent = events.get(i);
        LatLng latLng = new LatLng(currentEvent.getCoordinates().getLatitude(), events.get(i).getCoordinates().getLongitude());
        String category = currentEvent.getCategory();
        String snippet = currentEvent.getMessage();
        IconGenerator iconGenerator = new IconGenerator(this);
        if (currentUser.getHash().compareTo(currentEvent.getAuthorHash()) == 0) {
            iconGenerator.setStyle(IconGenerator.STYLE_GREEN);
        }
        else if (currentEvent.getRespondentsHash().indexOf(currentUser.getHash()) != -1) {
            iconGenerator.setStyle(IconGenerator.STYLE_ORANGE);
        }
        else {
            iconGenerator.setStyle(IconGenerator.STYLE_BLUE);
        }
        ImageView imageView = new ImageView(this);
        Bitmap categoryIcon = DataExchange.categories.get(category);
        Bitmap bmp;
        if (categoryIcon != null) {
            iconGenerator.setContentView(imageView);
            imageView.setImageBitmap(categoryIcon);
            imageView.setPadding(10, 10, 10, 10);
            bmp = iconGenerator.makeIcon();
        }
        else {
            bmp = iconGenerator.makeIcon(category);
        }
        currentEvent.setMarkerId(map.addMarker(new MarkerOptions()
                .position(latLng)
                .title(getString(R.string.attenders_text, currentEvent.getRespondentsHash().size()))
                .snippet(snippet)
                .icon(BitmapDescriptorFactory.fromBitmap(bmp))
            ).getId());
    }
}
 
开发者ID:chechulinYuri,项目名称:stepout,代码行数:38,代码来源:MapsActivity.java

示例7: onMyLocationChange

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
@Override
public void onMyLocationChange(Location newLocation) {
	map.animateCamera(CameraUpdateFactory.newLatLngZoom(
			new LatLng(newLocation.getLatitude(), newLocation.getLongitude()), 15));
	try {
		IconGenerator iconGenerator = new IconGenerator(getActivity());
		Bitmap bitmap = iconGenerator.makeIcon("You");
		map.clear();
		map.addMarker(new MarkerOptions().position(
				new LatLng(newLocation.getLatitude(), newLocation.getLongitude())).icon(
				BitmapDescriptorFactory.fromBitmap(bitmap)));
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:rachitmishra,项目名称:ceeq,代码行数:16,代码来源:SecurityFragment.java

示例8: onMapReady

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
/**
 * Manipulates the map once available.
 * This callback is triggered when the map is ready to be used.
 * If Google Play services is not installed on the device, the user will be prompted to install
 * it inside the SupportMapFragment. This method will only be triggered once the user has
 * installed Google Play services and returned to the app.
 */
@Override
public void onMapReady(GoogleMap googleMap) {
    map = googleMap;
    if (map == null) return;
    map.setMapStyle(MapStyleOptions.loadRawResourceStyle(getContext(), R.raw.map_style));
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(22.3964, 114.1095), 10));
    GoogleMapOptions options = new GoogleMapOptions();
    options.mapToolbarEnabled(false);
    options.compassEnabled(true);
    options.rotateGesturesEnabled(true);
    options.scrollGesturesEnabled(false);
    options.tiltGesturesEnabled(true);
    options.zoomControlsEnabled(false);
    options.zoomGesturesEnabled(true);
    map.setBuildingsEnabled(false);
    map.setIndoorEnabled(false);
    map.setTrafficEnabled(false);
    map.setOnMarkerClickListener(this);
    if (ActivityCompat.checkSelfPermission(getContext(),
            Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED ||
            ActivityCompat.checkSelfPermission(getContext(),
                    Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
        map.setMyLocationEnabled(true);
    }
    if (busRouteStops != null && busRouteStops.size() > 0) {
        PolylineOptions line = new PolylineOptions().width(20).zIndex(1)
                .color(ContextCompat.getColor(getContext(), R.color.colorAccent));
        for (BusRouteStop stop: busRouteStops) {
            LatLng latLng = new LatLng(Double.parseDouble(stop.latitude), Double.parseDouble(stop.longitude));
            line.add(latLng);
            IconGenerator iconFactory = new IconGenerator(getContext());
            Bitmap bmp = iconFactory.makeIcon(stop.sequence + ": " + stop.name);
            map.addMarker(new MarkerOptions().position(latLng)
                    .icon(BitmapDescriptorFactory.fromBitmap(bmp))).setTag(stop);
        }
        line.startCap(new RoundCap());
        line.endCap(new RoundCap());
        map.addPolyline(line);
        if (busRouteStops.size() < goToStopPos) {
            goToStopPos = 0;
        }
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(
                new LatLng(Double.parseDouble(busRouteStops.get(goToStopPos).latitude),
                        Double.parseDouble(busRouteStops.get(goToStopPos).longitude)), 16));
    }
}
 
开发者ID:alvinhkh,项目名称:buseta,代码行数:54,代码来源:LwbStopListFragment.java


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