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


Java IconGenerator类代码示例

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


IconGenerator类属于com.google.maps.android.ui包,在下文中一共展示了IconGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onCreate

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

    /* [ANALYTICS:SCREEN]
     * TRIGGER:   View the Map screen.
     * LABEL:     'Map'
     * [/ANALYTICS]
     */
    AnalyticsManager.sendScreenView(SCREEN_LABEL);

    // get DPI
    mDPI = getActivity().getResources().getDisplayMetrics().densityDpi / 160f;

    // setup the query handler to populate info windows
    mQueryHandler = createInfowindowHandler(getActivity().getContentResolver());

    mIconGenerator = new IconGenerator(getActivity());

}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:21,代码来源:MapFragment.java

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

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

示例6: addIcon

import com.google.maps.android.ui.IconGenerator; //导入依赖的package包/类
private void addIcon(IconGenerator iconFactory, String text, LatLng position) {
  TextView mmTextMapView = new TextView(this);
  mmTextMapView.setTypeface(font);
  ViewGroup.LayoutParams layoutParams =
      new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
          ViewGroup.LayoutParams.WRAP_CONTENT);
  mmTextMapView.setLayoutParams(layoutParams);
  mmTextMapView.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL);
  mmTextMapView.setTextColor(getResources().getColor(R.color.text_color));
  mmTextMapView.setText(text);
  iconFactory.setContentView(mmTextMapView);

  MarkerOptions markerOptions = new MarkerOptions().
      icon(BitmapDescriptorFactory.fromBitmap(
          iconFactory.makeIcon(mmTextMapView.getText().toString()))).
      position(position).
      anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());
  map.getMap().addMarker(markerOptions);
}
 
开发者ID:MMAUG,项目名称:BF101,代码行数:20,代码来源:DetailActivity.java

示例7: CustomRenderer

import com.google.maps.android.ui.IconGenerator; //导入依赖的package包/类
public CustomRenderer(Activity activity, GoogleMap map, ClusterManager<CustomMarker> clusterManager) {
    super(activity, map, clusterManager);
    mActivity = activity;
    mMap = map;

    // Define Custom icon
    mIconGenerator = new IconGenerator(activity);
    mIconGenerator.setBackground(activity.getResources().getDrawable(R.drawable.ic_waypt));
}
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:10,代码来源:CustomRenderer.java

示例8: getLabelIconGenerator

import com.google.maps.android.ui.IconGenerator; //导入依赖的package包/类
/**
 * Creates a new IconGenerator for labels on the map.
 */
public static IconGenerator getLabelIconGenerator(Context c) {
    IconGenerator iconFactory = new IconGenerator(c);
    iconFactory.setTextAppearance(R.style.MapLabel);
    iconFactory.setBackground(null);

    return iconFactory;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:11,代码来源:MapUtils.java

示例9: createLabelMarker

import com.google.maps.android.ui.IconGenerator; //导入依赖的package包/类
/**
 * Creates a marker for a label.
 *
 * @param iconFactory Reusable IconFactory
 * @param id          Id to be embedded as the title
 * @param label       Text to be shown on the label
 */
public static MarkerOptions createLabelMarker(IconGenerator iconFactory, String id,
        LatLng position, String label) {
    final BitmapDescriptor icon =
            BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(label));

    return new MarkerOptions().position(position).title(id).icon(icon)
            .anchor(0.5f, 0.5f)
            .visible(false);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:17,代码来源:MapUtils.java

示例10: NodeClusterRenderer

import com.google.maps.android.ui.IconGenerator; //导入依赖的package包/类
public NodeClusterRenderer(Context context, GoogleMap map, NodeClusterManager<T> clusterManager) {
    mMap = map;
    mDensity = context.getResources().getDisplayMetrics().density;
    mIconGenerator = new IconGenerator(context);
    mIconGenerator.setContentView(makeSquareTextView(context));
    mIconGenerator.setTextAppearance(com.google.maps.android.R.style.ClusterIcon_TextAppearance);
    mIconGenerator.setBackground(makeClusterBackground());
    mClusterManager = clusterManager;
    shouldAnimate = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB;
}
 
开发者ID:JohannesRudolph,项目名称:Freifunk-App,代码行数:11,代码来源:NodeClusterRenderer.java

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

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

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

示例14: createLabelMarker

import com.google.maps.android.ui.IconGenerator; //导入依赖的package包/类
/**
 * Creates a marker for a label.
 *
 * @param iconFactory Reusable IconFactory
 * @param id          Id to be embedded as the title
 * @param position
 * @param label       Text to be shown on the label
 * @return
 */
public static MarkerOptions createLabelMarker(IconGenerator iconFactory, String id, LatLng position, String label) {
    final String snippet = MapFragment.TYPE_LABEL;

    iconFactory.setTextAppearance(com.saarang.samples.apps.iosched.R.style.MapLabel);
    iconFactory.setBackground(null);

    final BitmapDescriptor icon =
            BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon(label));

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

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


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