Callback interface for the choice of the duration
This commit is contained in:
parent
4da11bbdc0
commit
5abc196536
|
@ -53,7 +53,9 @@ class LocationSharingFragment @Inject constructor(
|
|||
private val avatarRenderer: AvatarRenderer,
|
||||
private val matrixItemColorProvider: MatrixItemColorProvider,
|
||||
private val vectorFeatures: VectorFeatures,
|
||||
) : VectorBaseFragment<FragmentLocationSharingBinding>(), LocationTargetChangeListener {
|
||||
) : VectorBaseFragment<FragmentLocationSharingBinding>(),
|
||||
LocationTargetChangeListener,
|
||||
ChooseLiveDurationBottomSheet.DurationChoiceListener {
|
||||
|
||||
private val viewModel: LocationSharingViewModel by fragmentViewModel()
|
||||
|
||||
|
@ -236,11 +238,12 @@ class LocationSharingFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun startLiveLocationSharing() {
|
||||
// TODO. Get duration from user
|
||||
ChooseLiveDurationBottomSheet.newInstance()
|
||||
ChooseLiveDurationBottomSheet.newInstance(this)
|
||||
.show(requireActivity().supportFragmentManager, "DISPLAY_CHOOSE_DURATION_OPTIONS")
|
||||
//val duration = 30 * 1000L
|
||||
//viewModel.handle(LocationSharingAction.StartLiveLocationSharing(duration))
|
||||
}
|
||||
|
||||
override fun onDurationChoice(durationMillis: Long) {
|
||||
viewModel.handle(LocationSharingAction.StartLiveLocationSharing(durationMillis))
|
||||
}
|
||||
|
||||
private fun updateMap(state: LocationSharingViewState) {
|
||||
|
|
|
@ -30,19 +30,31 @@ import im.vector.app.features.home.room.detail.timeline.action.MessageSharedActi
|
|||
class ChooseLiveDurationBottomSheet :
|
||||
VectorBaseBottomSheetDialogFragment<BottomSheetChooseLiveLocationShareDurationBinding>() {
|
||||
|
||||
// TODO create interface callback to set the chosen duration
|
||||
// TODO show same UI as in Figma
|
||||
// TODO handle choice of user
|
||||
|
||||
var durationChoiceListener: DurationChoiceListener? = null
|
||||
|
||||
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): BottomSheetChooseLiveLocationShareDurationBinding {
|
||||
return BottomSheetChooseLiveLocationShareDurationBinding.inflate(inflater, container, false)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
durationChoiceListener = null
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
// we are not using state for this one as it's static, so no need to override invalidate()
|
||||
|
||||
companion object {
|
||||
fun newInstance(): ChooseLiveDurationBottomSheet {
|
||||
return ChooseLiveDurationBottomSheet()
|
||||
fun newInstance(durationChoiceListener: DurationChoiceListener): ChooseLiveDurationBottomSheet {
|
||||
val bottomSheet = ChooseLiveDurationBottomSheet()
|
||||
bottomSheet.durationChoiceListener = durationChoiceListener
|
||||
return bottomSheet
|
||||
}
|
||||
}
|
||||
|
||||
interface DurationChoiceListener {
|
||||
fun onDurationChoice(durationMillis: Long)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue