Hiding bottom sheet when no more lives

This commit is contained in:
Maxime NATUREL 2022-07-25 09:46:41 +02:00
parent d1c631b55c
commit 46684702a1
1 changed files with 9 additions and 2 deletions

View File

@ -22,6 +22,8 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.graphics.drawable.toBitmap import androidx.core.graphics.drawable.toBitmap
import androidx.core.view.isGone
import androidx.core.view.isVisible
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
@ -57,7 +59,6 @@ import javax.inject.Inject
/** /**
* Screen showing a map with all the current users sharing their live location in a room. * Screen showing a map with all the current users sharing their live location in a room.
*/ */
@AndroidEntryPoint @AndroidEntryPoint
class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<FragmentLocationLiveMapViewBinding>() { class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<FragmentLocationLiveMapViewBinding>() {
@ -173,7 +174,13 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
} }
private fun updateUserListBottomSheet(userLocations: List<UserLiveLocationViewState>) { private fun updateUserListBottomSheet(userLocations: List<UserLiveLocationViewState>) {
bottomSheetController.setData(userLocations) if (userLocations.isEmpty()) {
views.bottomSheet.isGone = true
// TODO show Live location ended view
} else {
views.bottomSheet.isVisible = true
bottomSheetController.setData(userLocations)
}
} }
private fun updateMap(userLiveLocations: List<UserLiveLocationViewState>) { private fun updateMap(userLiveLocations: List<UserLiveLocationViewState>) {