Set options method

This commit is contained in:
Maxime Naturel 2022-03-01 17:43:34 +01:00
parent 1c6b31001f
commit 55c6383074
2 changed files with 11 additions and 10 deletions

View File

@ -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)
}

View File

@ -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)
}
}