File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
ApiDemos/kotlin/app/src/main/java/com/example/kotlindemos Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -139,6 +139,7 @@ class CircleDemoActivity :
139
139
}
140
140
141
141
fun onStyleChange () {
142
+ // [circle] is treated as implicit this inside the with block
142
143
with (circle) {
143
144
strokeWidth = strokeWidthBar.progress.toFloat()
144
145
strokeColor = strokeColorArgb
@@ -208,7 +209,8 @@ class CircleDemoActivity :
208
209
setContentDescription(getString(R .string.circle_demo_details))
209
210
setOnMapLongClickListener { point ->
210
211
// We know the center, let's place the outline at a point 3/4 along the view.
211
- val view: View = supportFragmentManager.findFragmentById(R .id.map).view as View
212
+ val view: View = supportFragmentManager.findFragmentById(R .id.map).view
213
+ ? : return @setOnMapLongClickListener
212
214
val radiusLatLng = map.projection.fromScreenLocation(
213
215
Point (view.height * 3 / 4 , view.width * 3 / 4 ))
214
216
// Create the circle.
@@ -292,6 +294,7 @@ class CircleDemoActivity :
292
294
else -> strokeColorArgb
293
295
}
294
296
297
+ // Apply the style change to all the circles.
295
298
circles.map { it.onStyleChange() }
296
299
}
297
300
You can’t perform that action at this time.
0 commit comments