mirror of
https://github.com/NiciDieNase/chaosflix
synced 2024-11-22 20:33:05 +00:00
In FilterBottomSheet, share viewmodel with parent fragment so filters get synced
This commit is contained in:
parent
706aaa236e
commit
6eef4c921b
1 changed files with 2 additions and 2 deletions
|
@ -6,6 +6,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.contains
|
import androidx.core.view.contains
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
import com.google.android.material.chip.Chip
|
import com.google.android.material.chip.Chip
|
||||||
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.Conference
|
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.Conference
|
||||||
|
@ -15,13 +16,12 @@ import org.koin.android.viewmodel.ext.android.viewModel
|
||||||
|
|
||||||
class FilterBottomSheet : BottomSheetDialogFragment() {
|
class FilterBottomSheet : BottomSheetDialogFragment() {
|
||||||
|
|
||||||
private val viewModel: BrowseViewModel by viewModel()
|
|
||||||
|
|
||||||
private val filterTagChips: MutableMap<String, Chip> = mutableMapOf()
|
private val filterTagChips: MutableMap<String, Chip> = mutableMapOf()
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
val conference = arguments?.getParcelable<Conference>("conference")
|
val conference = arguments?.getParcelable<Conference>("conference")
|
||||||
|
|
||||||
|
val viewModel: BrowseViewModel = ViewModelProvider(requireParentFragment())[BrowseViewModel::class.java]
|
||||||
val binding = FragmentFilterSheetBinding.inflate(inflater, container, false)
|
val binding = FragmentFilterSheetBinding.inflate(inflater, container, false)
|
||||||
binding.viewModel = viewModel
|
binding.viewModel = viewModel
|
||||||
binding.lifecycleOwner = viewLifecycleOwner
|
binding.lifecycleOwner = viewLifecycleOwner
|
||||||
|
|
Loading…
Reference in a new issue