Creating BottomSheet to choose the live duration

This commit is contained in:
Maxime NATUREL 2022-03-30 14:34:56 +02:00
parent f34225506a
commit d0a255819a
3 changed files with 71 additions and 2 deletions

View file

@ -39,6 +39,7 @@ import im.vector.app.databinding.FragmentLocationSharingBinding
import im.vector.app.features.VectorFeatures
import im.vector.app.features.home.AvatarRenderer
import im.vector.app.features.home.room.detail.timeline.helper.MatrixItemColorProvider
import im.vector.app.features.location.live.duration.ChooseLiveDurationBottomSheet
import im.vector.app.features.location.option.LocationSharingOption
import org.matrix.android.sdk.api.util.MatrixItem
import java.lang.ref.WeakReference
@ -236,8 +237,10 @@ class LocationSharingFragment @Inject constructor(
private fun startLiveLocationSharing() {
// TODO. Get duration from user
val duration = 30 * 1000L
viewModel.handle(LocationSharingAction.StartLiveLocationSharing(duration))
ChooseLiveDurationBottomSheet.newInstance()
.show(requireActivity().supportFragmentManager, "DISPLAY_CHOOSE_DURATION_OPTIONS")
//val duration = 30 * 1000L
//viewModel.handle(LocationSharingAction.StartLiveLocationSharing(duration))
}
private fun updateMap(state: LocationSharingViewState) {

View file

@ -0,0 +1,48 @@
/*
* Copyright 2019 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.location.live.duration
import android.view.LayoutInflater
import android.view.ViewGroup
import dagger.hilt.android.AndroidEntryPoint
import im.vector.app.core.platform.VectorBaseBottomSheetDialogFragment
import im.vector.app.databinding.BottomSheetChooseLiveLocationShareDurationBinding
import im.vector.app.features.home.room.detail.timeline.action.MessageSharedActionViewModel
/**
* Bottom sheet displaying list of options to choose the duration of the live sharing.
*/
@AndroidEntryPoint
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
override fun getBinding(inflater: LayoutInflater, container: ViewGroup?): BottomSheetChooseLiveLocationShareDurationBinding {
return BottomSheetChooseLiveLocationShareDurationBinding.inflate(inflater, container, false)
}
// 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()
}
}
}

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurface"
android:orientation="vertical">
<TextView
android:id="@+id/bottomSheetLiveLocShareChooseDurationTitle"
style="@style/Widget.Vector.TextView.Subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="8dp"
android:textColor="?vctr_content_primary"
android:text="@string/location_share_live_select_duration_title" />
</LinearLayout>