-
Notifications
You must be signed in to change notification settings - Fork 493
Create PropertyIconDeterminationActivity.kt #1392
base: master
Are you sure you want to change the base?
Conversation
Translated PropertyIconDeterminationActivity.java into Kotlin
added import R. Other than that, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid using !!
(with updating remark above, this won't be needed anymore)
Translated PropertyIconDeterminationActivity.java into Kotlin