use of com.google.android.gms.maps.GoogleMap.OnCircleClickListener in project android-samples by googlemaps.
the class CircleDemoActivity method onMapReady.
@Override
public void onMapReady(GoogleMap map) {
// Override the default content description on the view, for accessibility mode.
map.setContentDescription(getString(R.string.map_circle_description));
mMap = map;
mMap.setOnMarkerDragListener(this);
mMap.setOnMapLongClickListener(this);
mFillColorArgb = Color.HSVToColor(mFillAlphaBar.getProgress(), new float[] { mFillHueBar.getProgress(), 1, 1 });
mStrokeColorArgb = Color.HSVToColor(mStrokeAlphaBar.getProgress(), new float[] { mStrokeHueBar.getProgress(), 1, 1 });
mFillHueBar.setOnSeekBarChangeListener(this);
mFillAlphaBar.setOnSeekBarChangeListener(this);
mStrokeWidthBar.setOnSeekBarChangeListener(this);
mStrokeHueBar.setOnSeekBarChangeListener(this);
mStrokeAlphaBar.setOnSeekBarChangeListener(this);
mStrokePatternSpinner.setOnItemSelectedListener(this);
DraggableCircle circle = new DraggableCircle(SYDNEY, DEFAULT_RADIUS_METERS);
mCircles.add(circle);
// Move the map so that it is centered on the initial circle
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(SYDNEY, 4.0f));
// Set up the click listener for the circle.
map.setOnCircleClickListener(new OnCircleClickListener() {
@Override
public void onCircleClick(Circle circle) {
// Flip the red, green and blue components of the circle's stroke color.
circle.setStrokeColor(circle.getStrokeColor() ^ 0x00ffffff);
}
});
List<PatternItem> pattern = getSelectedPattern(mStrokePatternSpinner.getSelectedItemPosition());
for (DraggableCircle draggableCircle : mCircles) {
draggableCircle.setStrokePattern(pattern);
}
}
Aggregations