Renaming "btn" into "button"

This commit is contained in:
Maxime Naturel 2022-03-15 15:08:32 +01:00
parent 9ecf12a7ba
commit b72c87da44
4 changed files with 23 additions and 23 deletions

View File

@ -64,7 +64,7 @@
<!-- Location sharing -->
<dimen name="location_sharing_option_default_padding">10dp</dimen>
<dimen name="location_sharing_locate_btn_margin_vertical">16dp</dimen>
<dimen name="location_sharing_locate_btn_margin_horizontal">12dp</dimen>
<dimen name="location_sharing_compass_btn_margin_horizontal">8dp</dimen>
<dimen name="location_sharing_locate_button_margin_vertical">16dp</dimen>
<dimen name="location_sharing_locate_button_margin_horizontal">12dp</dimen>
<dimen name="location_sharing_compass_button_margin_horizontal">8dp</dimen>
</resources>

View File

@ -144,7 +144,7 @@ class LocationSharingFragment @Inject constructor(
}
private fun initLocateButton() {
views.mapView.locateBtn.setOnClickListener {
views.mapView.locateButton.setOnClickListener {
viewModel.handle(LocationSharingAction.ZoomToUserLocation)
}
}

View File

@ -53,10 +53,10 @@ class MapTilerMapView @JvmOverloads constructor(
private val userLocationDrawable by lazy {
ContextCompat.getDrawable(context, R.drawable.ic_location_user)
}
val locateBtn by lazy { createLocateBtn() }
val locateButton by lazy { createLocateButton() }
private var mapRefs: MapRefs? = null
private var initZoomDone = false
private var showLocationBtn = false
private var showLocationButton = false
init {
context.theme.obtainStyledAttributes(
@ -66,15 +66,15 @@ class MapTilerMapView @JvmOverloads constructor(
0
).run {
try {
setLocateBtnVisibility(this)
setLocateButtonVisibility(this)
} finally {
recycle()
}
}
}
private fun setLocateBtnVisibility(typedArray: TypedArray) {
showLocationBtn = typedArray.getBoolean(R.styleable.MapTilerMapView_showLocateButton, false)
private fun setLocateButtonVisibility(typedArray: TypedArray) {
showLocationButton = typedArray.getBoolean(R.styleable.MapTilerMapView_showLocateButton, false)
}
/**
@ -87,7 +87,7 @@ class MapTilerMapView @JvmOverloads constructor(
Timber.d("## Location: initialize")
getMapAsync { map ->
initMapStyle(map, url)
initLocateBtn(map)
initLocateButton(map)
notifyLocationOfMapCenter(locationTargetChangeListener)
listenCameraMove(map, locationTargetChangeListener)
}
@ -105,21 +105,21 @@ class MapTilerMapView @JvmOverloads constructor(
}
}
private fun initLocateBtn(map: MapboxMap) {
if (showLocationBtn) {
addView(locateBtn)
adjustCompassBtn(map)
private fun initLocateButton(map: MapboxMap) {
if (showLocationButton) {
addView(locateButton)
adjustCompassButton(map)
}
}
private fun createLocateBtn(): ImageView =
private fun createLocateButton(): ImageView =
ImageView(context).apply {
setImageDrawable(ContextCompat.getDrawable(context, R.drawable.btn_locate))
contentDescription = context.getString(R.string.a11y_location_share_locate_btn)
contentDescription = context.getString(R.string.a11y_location_share_locate_button)
layoutParams = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
updateLayoutParams<MarginLayoutParams> {
val marginHorizontal = context.resources.getDimensionPixelOffset(R.dimen.location_sharing_locate_btn_margin_horizontal)
val marginVertical = context.resources.getDimensionPixelOffset(R.dimen.location_sharing_locate_btn_margin_vertical)
val marginHorizontal = context.resources.getDimensionPixelOffset(R.dimen.location_sharing_locate_button_margin_horizontal)
val marginVertical = context.resources.getDimensionPixelOffset(R.dimen.location_sharing_locate_button_margin_vertical)
setMargins(marginHorizontal, marginVertical, marginHorizontal, marginVertical)
}
updateLayoutParams<LayoutParams> {
@ -127,10 +127,10 @@ class MapTilerMapView @JvmOverloads constructor(
}
}
private fun adjustCompassBtn(map: MapboxMap) {
locateBtn.post {
val marginTop = locateBtn.height + locateBtn.marginTop + locateBtn.marginBottom
val marginRight = context.resources.getDimensionPixelOffset(R.dimen.location_sharing_compass_btn_margin_horizontal)
private fun adjustCompassButton(map: MapboxMap) {
locateButton.post {
val marginTop = locateButton.height + locateButton.marginTop + locateButton.marginBottom
val marginRight = context.resources.getDimensionPixelOffset(R.dimen.location_sharing_compass_button_margin_horizontal)
map.uiSettings.setCompassMargins(0, marginTop, marginRight, 0)
}
}

View File

@ -2930,7 +2930,7 @@
<!-- TODO delete -->
<string name="location_share" tools:ignore="UnusedResources">Share location</string>
<string name="a11y_location_share_pin_on_map">Pin of selected location on map</string>
<string name="a11y_location_share_locate_btn">Zoom to current location</string>
<string name="a11y_location_share_locate_button">Zoom to current location</string>
<string name="location_share_option_user_current">Share my current location</string>
<string name="a11y_location_share_option_user_current_icon">Share my current location</string>
<string name="location_share_option_user_live">Share live location</string>