mirror of
https://github.com/googlemaps/android-samples.git
synced 2025-12-08 18:02:20 +00:00
ran lint on marker demo. Also changed one markerOptions to use apply
Change-Id: Ibd6795c9c74c6bd2a45819ffabc3d47002264ae0
This commit is contained in:
parent
9da2267721
commit
54770fc0d7
@ -121,7 +121,7 @@ class MarkerDemoActivity :
|
||||
/** Demonstrates customizing the info window and/or its contents. */
|
||||
internal inner class CustomInfoWindowAdapter : InfoWindowAdapter {
|
||||
|
||||
// These are both viewgroups containing an ImageView with id "badge" and two
|
||||
// These are both view groups containing an ImageView with id "badge" and two
|
||||
// TextViews with id "title" and "snippet".
|
||||
private val window: View = layoutInflater.inflate(R.layout.custom_info_window, null)
|
||||
private val contents: View = layoutInflater.inflate(R.layout.custom_info_contents, null)
|
||||
@ -327,12 +327,12 @@ class MarkerDemoActivity :
|
||||
// add 4 markers on top of each other in Darwin with varying z-indexes
|
||||
(0 until 4).map {
|
||||
placeDetailsMap.put(
|
||||
"DARWIN ${it + 1}", PlaceDetails(
|
||||
position = places.getValue("DARWIN"),
|
||||
title = "Darwin Marker ${it + 1}",
|
||||
snippet = "z-index initially ${it + 1}",
|
||||
zIndex = it.toFloat()
|
||||
)
|
||||
"DARWIN ${it + 1}", PlaceDetails(
|
||||
position = places.getValue("DARWIN"),
|
||||
title = "Darwin Marker ${it + 1}",
|
||||
snippet = "z-index initially ${it + 1}",
|
||||
zIndex = it.toFloat()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -347,6 +347,7 @@ class MarkerDemoActivity :
|
||||
.infoWindowAnchor(infoWindowAnchorX, infoWindowAnchorY)
|
||||
.draggable(draggable)
|
||||
.zIndex(zIndex))
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -354,15 +355,16 @@ class MarkerDemoActivity :
|
||||
// hues (colors).
|
||||
val numMarkersInRainbow = 12
|
||||
(0 until numMarkersInRainbow).mapTo(markerRainbow) {
|
||||
map.addMarker(MarkerOptions()
|
||||
.position(LatLng(
|
||||
-30 + 10 * Math.sin(it * Math.PI / (numMarkersInRainbow - 1)),
|
||||
135 - 10 * Math.cos(it * Math.PI / (numMarkersInRainbow - 1))))
|
||||
.title("Marker $it")
|
||||
.icon(BitmapDescriptorFactory.defaultMarker((it * 360 / numMarkersInRainbow)
|
||||
.toFloat()))
|
||||
.flat(flatBox.isChecked)
|
||||
.rotation(rotationBar.progress.toFloat()))
|
||||
map.addMarker(MarkerOptions().apply{
|
||||
position(LatLng(
|
||||
-30 + 10 * Math.sin(it * Math.PI / (numMarkersInRainbow - 1)),
|
||||
135 - 10 * Math.cos(it * Math.PI / (numMarkersInRainbow - 1))))
|
||||
title("Marker $it")
|
||||
icon(BitmapDescriptorFactory.defaultMarker((it * 360 / numMarkersInRainbow)
|
||||
.toFloat()))
|
||||
flat(flatBox.isChecked)
|
||||
rotation(rotationBar.progress.toFloat())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +388,7 @@ class MarkerDemoActivity :
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the map is ready, the executes the provided lamdba function
|
||||
* Checks if the map is ready, the executes the provided lambda function
|
||||
*
|
||||
* @param stuffToDo the code to be executed if the map is ready
|
||||
*/
|
||||
@ -487,6 +489,6 @@ class MarkerDemoActivity :
|
||||
}
|
||||
|
||||
override fun onMarkerDrag(marker : Marker) {
|
||||
topText.text = "onMarkerDrag. Current Position: ${marker.position}"
|
||||
topText.text = getString(R.string.on_marker_drag, marker.position.latitude, marker.position.longitude)
|
||||
}
|
||||
}
|
||||
@ -20,10 +20,12 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/badge"
|
||||
android:contentDescription="@string/state_badge_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:adjustViewBounds="true"></ImageView>
|
||||
android:layout_marginEnd="5dp"
|
||||
android:adjustViewBounds="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@ -38,7 +40,7 @@
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ff000000"
|
||||
android:textSize="14dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
@ -48,6 +50,6 @@
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ff7f7f7f"
|
||||
android:textSize="14dp" />
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -16,15 +16,17 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/custom_info_bubble"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:background="@drawable/custom_info_bubble">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/badge"
|
||||
android:contentDescription="@string/state_badge_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:adjustViewBounds="true"></ImageView>
|
||||
android:layout_marginEnd="5dp"
|
||||
android:adjustViewBounds="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
@ -39,7 +41,7 @@
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ff000000"
|
||||
android:textSize="14dp"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
@ -49,6 +51,6 @@
|
||||
android:ellipsize="end"
|
||||
android:singleLine="true"
|
||||
android:textColor="#ff7f7f7f"
|
||||
android:textSize="14dp" />
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/rotation" />
|
||||
@ -63,12 +64,13 @@
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|left"
|
||||
android:layout_gravity="bottom|start"
|
||||
android:background="@color/white"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<LinearLayout
|
||||
style="?android:attr/buttonBarButtonStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@ -77,14 +79,16 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:onClick="onClearMap"
|
||||
android:text="@string/clear_map" />
|
||||
android:text="@string/clear_map"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.5"
|
||||
android:onClick="onResetMap"
|
||||
android:text="@string/reset_map" />
|
||||
android:text="@string/reset_map"
|
||||
style="?android:attr/borderlessButtonStyle"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RadioGroup
|
||||
@ -95,14 +99,20 @@
|
||||
<RadioButton
|
||||
android:id="@+id/default_info_window"
|
||||
android:checked="true"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/default_info_window" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/custom_info_contents"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/custom_info_contents" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/custom_info_window"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:text="@string/custom_info_window" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
@ -69,7 +69,9 @@
|
||||
<string name="map_not_ready">Map is not ready</string>
|
||||
<string name="markers_demo_description">Demonstrates how to add Markers to a map.</string>
|
||||
<string name="markers_demo_label">Markers</string>
|
||||
<string name="on_marker_drag">onMarkerDrag. Current Position: (%1$f, %2$f)</string>
|
||||
<string name="on_marker_drag_start">Started dragging marker</string>
|
||||
<string name="on_marker_drag_end">Marker stopped dragging</string>
|
||||
<string name="rotation">Rotation</string>
|
||||
<string name="state_badge_label">State badge</string>
|
||||
</resources>
|
||||
Loading…
x
Reference in New Issue
Block a user