Create PropertyIconDeterminationActivity.kt#1392
Conversation
Translated PropertyIconDeterminationActivity.java into Kotlin
added import R. Other than that, LGTM!
ZiZasaurus
left a comment
There was a problem hiding this comment.
just added import R. Other than that looks great!
| import com.mapbox.mapboxsdk.style.sources.GeoJsonSource | ||
|
|
||
|
|
||
| class PropertyIconDeterminationActivity : AppCompatActivity(), MapboxMap.OnMapClickListener { |
There was a problem hiding this comment.
add class level documentation that explains what this example is doing
| private val SOURCE_ID = "SOURCE_ID" | ||
| private val RED_ICON_ID = "RED_ICON_ID" | ||
| private val YELLOW_ICON_ID = "YELLOW_ICON_ID" | ||
| private val LAYER_ID = "LAYER_ID" | ||
| private val ICON_PROPERTY = "ICON_PROPERTY" |
There was a problem hiding this comment.
constants should be put into the companion object
| private val YELLOW_ICON_ID = "YELLOW_ICON_ID" | ||
| private val LAYER_ID = "LAYER_ID" | ||
| private val ICON_PROPERTY = "ICON_PROPERTY" | ||
| private var mapView: MapView? = null |
There was a problem hiding this comment.
You don';t need to rely on nullable views and using findViewById is you use android-kotlin-extensions: https://antonioleiva.com/kotlin-android-extensions/
There was a problem hiding this comment.
kotlinx.android.synthetic is no longer a recommended practice. It is deprecated.
- https://android-developers.googleblog.com/2020/11/the-future-of-kotlin-android-extensions.html
- https://proandroiddev.com/migrating-the-deprecated-kotlin-android-extensions-compiler-plugin-to-viewbinding-d234c691dec7
Do you have a plan to use it in Mapbox?
|
|
||
| override fun onResume() { | ||
| super.onResume() | ||
| mapView!!.onResume() |
There was a problem hiding this comment.
avoid using !! (with updating remark above, this won't be needed anymore)
Translated PropertyIconDeterminationActivity.java into Kotlin