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 a7e93a3f6c..9333c579b4 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 @@ -59,6 +59,8 @@ class LocationSharingFragment @Inject constructor( views.mapView.initialize(urlMapProvider.getMapUrl()) } + // TODO change the options dynamically depending on the current chosen location + views.shareLocationContainer.setOptions(LocationSharingOption.PINNED) views.shareLocationContainer.debouncedClicks { viewModel.handle(LocationSharingAction.OnShareLocation) } diff --git a/vector/src/main/java/im/vector/app/features/location/view/LocationSharingOptionPickerView.kt b/vector/src/main/java/im/vector/app/features/location/view/LocationSharingOptionPickerView.kt index 896edb5558..aa72bb17f2 100644 --- a/vector/src/main/java/im/vector/app/features/location/view/LocationSharingOptionPickerView.kt +++ b/vector/src/main/java/im/vector/app/features/location/view/LocationSharingOptionPickerView.kt @@ -20,7 +20,9 @@ import android.content.Context import android.util.AttributeSet import android.view.LayoutInflater import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.view.isVisible import im.vector.app.databinding.ViewLocationSharingOptionPickerBinding +import im.vector.app.features.location.LocationSharingOption /** * Custom view to display the location sharing option picker. @@ -29,15 +31,12 @@ class LocationSharingOptionPickerView @JvmOverloads constructor( context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 ) : ConstraintLayout(context, attrs, defStyleAttr) { - /*private val binding = */ - init { - ViewLocationSharingOptionPickerBinding.inflate( - LayoutInflater.from(context), - this - ) - } + private val binding = ViewLocationSharingOptionPickerBinding.inflate( + LayoutInflater.from(context), + this + ) - /*fun setOptions(vararg options: LocationSharingOption) { - // TODO show only the options passed in argument - }*/ + fun setOptions(vararg options: LocationSharingOption) { + binding.locationSharingOptionPinned.isVisible = options.contains(LocationSharingOption.PINNED) + } }