Use dynamic height to calculate the position of the copyright attributes.

This commit is contained in:
Onuray Sahin 2022-06-07 18:22:09 +03:00
parent 4b50058917
commit 68c6e524d2

View file

@ -25,6 +25,7 @@ import androidx.core.graphics.drawable.toBitmap
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import com.airbnb.mvrx.fragmentViewModel import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.geometry.LatLngBounds import com.mapbox.mapboxsdk.geometry.LatLngBounds
import com.mapbox.mapboxsdk.maps.MapView import com.mapbox.mapboxsdk.maps.MapView
@ -96,10 +97,11 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
private fun setupMap() { private fun setupMap() {
val mapFragment = getOrCreateSupportMapFragment() val mapFragment = getOrCreateSupportMapFragment()
mapFragment.getMapAsync { mapboxMap -> mapFragment.getMapAsync { mapboxMap ->
val bottomSheetHeight = BottomSheetBehavior.from(views.bottomSheet).peekHeight
mapboxMap.uiSettings.apply { mapboxMap.uiSettings.apply {
// Place copyright above the user list bottom sheet // Place copyright above the user list bottom sheet
setLogoMargins(dimensionConverter.dpToPx(8), 0, 0, dimensionConverter.dpToPx(208)) setLogoMargins(dimensionConverter.dpToPx(8), 0, 0, bottomSheetHeight + dimensionConverter.dpToPx(8))
setAttributionMargins(dimensionConverter.dpToPx(96), 0, 0, dimensionConverter.dpToPx(208)) setAttributionMargins(dimensionConverter.dpToPx(96), 0, 0, bottomSheetHeight + dimensionConverter.dpToPx(8))
} }
lifecycleScope.launch { lifecycleScope.launch {