From b72c87da444908da7c6c14ca5acfd5a3f5bfbf87 Mon Sep 17 00:00:00 2001 From: Maxime Naturel Date: Tue, 15 Mar 2022 15:08:32 +0100 Subject: [PATCH] Renaming "btn" into "button" --- .../ui-styles/src/main/res/values/dimens.xml | 6 ++-- .../location/LocationSharingFragment.kt | 2 +- .../app/features/location/MapTilerMapView.kt | 36 +++++++++---------- vector/src/main/res/values/strings.xml | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/library/ui-styles/src/main/res/values/dimens.xml b/library/ui-styles/src/main/res/values/dimens.xml index 08fe557f7c..600c73c878 100644 --- a/library/ui-styles/src/main/res/values/dimens.xml +++ b/library/ui-styles/src/main/res/values/dimens.xml @@ -64,7 +64,7 @@ 10dp - 16dp - 12dp - 8dp + 16dp + 12dp + 8dp diff --git a/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt b/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt index cdffc95d95..e9e96e676c 100644 --- a/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt +++ b/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt @@ -144,7 +144,7 @@ class LocationSharingFragment @Inject constructor( } private fun initLocateButton() { - views.mapView.locateBtn.setOnClickListener { + views.mapView.locateButton.setOnClickListener { viewModel.handle(LocationSharingAction.ZoomToUserLocation) } } diff --git a/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt b/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt index b4638d6793..e3206e231d 100644 --- a/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt +++ b/vector/src/main/java/im/vector/app/features/location/MapTilerMapView.kt @@ -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 { - 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 { @@ -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) } } diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index bbb2bc7740..162ab3e119 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -2930,7 +2930,7 @@ Share location Pin of selected location on map - Zoom to current location + Zoom to current location Share my current location Share my current location Share live location