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


Java IconGenerator.setStyle方法代码示例

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


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

示例1: onCreate

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // TODO: 20-Nov-16 inject this into presenter
    generator = new IconGenerator(this);
    generator.setContentRotation(270);
    generator.setStyle(IconGenerator.STYLE_BLUE);

    mapFragment = ((MapFragment) getFragmentManager().findFragmentById(R.id.map_fragment));
    mapFragment.getMapAsync(googleMap -> {
        map = googleMap;
        presenter.onMapReady();
        map.setMyLocationEnabled(true);
    });

    presenter.onAttach();
}
 
开发者ID:bellol,项目名称:NSW-Petrol-Prices,代码行数:19,代码来源:DashboardActivity.java

示例2: addMarker

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
private void addMarker() {
    MarkerOptions options = new MarkerOptions();

    // following four lines requires 'Google Maps Android API Utility Library'
    // https://developers.google.com/maps/documentation/android/utility/
    // I have used this to display the time as title for location markers
    // you can safely comment the following four lines but for this info
    IconGenerator iconFactory = new IconGenerator(this);
    iconFactory.setStyle(IconGenerator.STYLE_PURPLE);
    options.icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(mLastUpdateTime)));
    options.anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());

    LatLng currentLatLng = new LatLng(mCurrentLocation.getLatitude(), mCurrentLocation.getLongitude());
    options.position(currentLatLng);
    Marker mapMarker = mMap.addMarker(options);
    long atTime = mCurrentLocation.getTime();
    mLastUpdateTime = DateFormat.getTimeInstance().format(new Date(atTime));
    mapMarker.setTitle(mLastUpdateTime);
    Log.d(TAG, "Marker added.............................");
    mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng,
            13));
    Log.d(TAG, "Zoom done.............................");
}
 
开发者ID:yokmama,项目名称:honki_android,代码行数:24,代码来源:MapsActivity.java

示例3: start

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
@Override @UiThread
protected void start() {
  // All your normal criteria setup
  // let Android select the right location provider for you
  getSupportActionBar().setTitle(getResources().getString(R.string.title_activity_call));

  String myProvider = mLocationManager.getBestProvider(mCriteria, true);
  mLocationManager.requestLocationUpdates(myProvider, 0, 0, mLocationListener);
  MapMarkerListener mMarkerListener = new MapMarkerListener(this);
  IconGenerator iconFactory = new IconGenerator(this);
  getMap().setMyLocationEnabled(true);
  Location mLocation = mLocationManager.getLastKnownLocation(myProvider);

  if (mLocation != null) {
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(
        new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), 19));
    iconFactory.setStyle(IconGenerator.STYLE_GREEN);
    addIcon(iconFactory, "3/W", new LatLng(mLocation.getLatitude(), mLocation.getLongitude()));
    addIcon(iconFactory, "9/C",
        new LatLng(mLocation.getLatitude() + 0.00002, mLocation.getLongitude() + 0.0005));
    getMap().setOnMarkerClickListener(mMarkerListener);
  } else {
    // TODO request user location and find near by taxi here
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(16, 96), 19));
  }
}
 
开发者ID:indexer,项目名称:popa,代码行数:27,代码来源:MainActivity.java

示例4: setIconStyle

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
private static void setIconStyle(User user, IconGenerator iconGenerator) {
    String provider = user.getUserDetail().getProvider();
    boolean isActive = user.getUserDetail().getActive();

    if (isActive) {
        if (provider.equals(LocationManager.GPS_PROVIDER)) {
            iconGenerator.setStyle(IconGenerator.STYLE_GREEN);
        } else if (provider.equals(LocationManager.NETWORK_PROVIDER)) {
            iconGenerator.setStyle(IconGenerator.STYLE_ORANGE);
        }
    } else {
        iconGenerator.setStyle(IconGenerator.STYLE_RED);
    }
}
 
开发者ID:tl-nguyen,项目名称:RadarApp,代码行数:15,代码来源:BitmapHelper.java

示例5: createMosconeMarker

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
/**
 * Creates a marker for Moscone Center.
 *
 * @param iconFactory Reusable IconFactory
 * @param position
 * @param c
 * @return
 */
public static MarkerOptions createMosconeMarker(IconGenerator iconFactory, LatLng position, Context c) {
    final String snippet = MapFragment.TYPE_MOSCONE;
    iconFactory.setStyle(IconGenerator.STYLE_DEFAULT);

    final BitmapDescriptor icon =
            BitmapDescriptorFactory.fromResource(com.saarang.samples.apps.iosched.R.drawable.moscone_marker);

    return new MarkerOptions().position(position).title(snippet)
            .snippet(snippet).icon(icon)
            .anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV())
            .visible(true);
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:21,代码来源:MapUtils.java

示例6: createMosconeMarker

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
/**
 * Creates a marker for Moscone Center.
 *
 * @param iconFactory Reusable IconFactory
 * @param position
 * @param c
 * @return
 */
public static MarkerOptions createMosconeMarker(IconGenerator iconFactory, LatLng position, Context c) {
    final String snippet = MapFragment.TYPE_MOSCONE;
    iconFactory.setStyle(IconGenerator.STYLE_DEFAULT);

    final BitmapDescriptor icon =
            BitmapDescriptorFactory.fromResource(R.drawable.moscone_marker);

    return new MarkerOptions().position(position).title(snippet)
            .snippet(snippet).icon(icon)
            .anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV())
            .visible(false);
}
 
开发者ID:gdg-bh,项目名称:AppDevFestSudeste2015,代码行数:21,代码来源:MapUtils.java

示例7: 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

示例8: startDemo

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
@Override
protected void startDemo() {
    getMap().moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(-33.8696, 151.2094), 10));

    IconGenerator iconFactory = new IconGenerator(this);
    addIcon(iconFactory, "Default", new LatLng(-33.8696, 151.2094));

    iconFactory.setColor(Color.CYAN);
    addIcon(iconFactory, "Custom color", new LatLng(-33.9360, 151.2070));

    iconFactory.setRotation(90);
    iconFactory.setStyle(IconGenerator.STYLE_RED);
    addIcon(iconFactory, "Rotated 90 degrees", new LatLng(-33.8858, 151.096));

    iconFactory.setContentRotation(-90);
    iconFactory.setStyle(IconGenerator.STYLE_PURPLE);
    addIcon(iconFactory, "Rotate=90, ContentRotate=-90", new LatLng(-33.9992, 151.098));

    iconFactory.setRotation(0);
    iconFactory.setContentRotation(90);
    iconFactory.setStyle(IconGenerator.STYLE_GREEN);
    addIcon(iconFactory, "ContentRotate=90", new LatLng(-33.7677, 151.244));

    iconFactory.setRotation(0);
    iconFactory.setContentRotation(0);
    iconFactory.setStyle(IconGenerator.STYLE_ORANGE);
    addIcon(iconFactory, makeCharSequence(), new LatLng(-33.77720, 151.12412));
}
 
开发者ID:googlemaps,项目名称:android-maps-utils,代码行数:29,代码来源:IconGeneratorDemoActivity.java

示例9: resetMap

import com.google.maps.android.ui.IconGenerator; //导入方法依赖的package包/类
private void resetMap() {
    if (map == null) {
        // Map not loaded yet. resetMap() will automatically be called once the map is loaded.
        return;
    }

    map.clear();

    RouteModel route = getArguments().getParcelable(ExtraData.EXTRA_ROUTE);

    LatLng start = route.getStart().getLatLng();

    LatLng cameraLocation = start;
    WaypointModel waypoint = getArguments().getParcelable(ExtraData.EXTRA_CENTER_ON_WAYPOINT);
    if (waypoint != null) {
        cameraLocation = waypoint.getLatLng();
    }
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(cameraLocation, 14));

    IconGenerator iconFactory = new IconGenerator(getActivity());
    iconFactory.setStyle(IconGenerator.STYLE_GREEN);
    map.addMarker(new MarkerOptions()
            .position(start)
            .icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon("1"))));

    iconFactory.setStyle(IconGenerator.STYLE_ORANGE);
    List<WaypointModel> waypoints = route.getWaypoints();
    int numberOfWaypoints = waypoints.size();
    for (int i = 0; i < numberOfWaypoints; i++) {
        map.addMarker(new MarkerOptions()
                .position(waypoints.get(i).getLatLng())
                .icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(String.valueOf(i + 2)))));
    }

    // TODO: Should we show a marker if the end is the same as start?
    if (!route.isRoundTrip()) {
        iconFactory.setStyle(IconGenerator.STYLE_RED);
        map.addMarker(new MarkerOptions()
                .position(route.getEnd().getLatLng())
                .icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(String.valueOf(numberOfWaypoints + 2)))));
    }
}
 
开发者ID:SenAndAaron,项目名称:voyager2-android,代码行数:43,代码来源:VoyagerMapFragment.java


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