У меня есть bottomSheetDialogFragment, который открывается из HomeFragment (часть navigationcontroller).Я хочу открыть другое назначение при нажатии кнопки внутри bottomSheetDialogFragment, но при этом оно дает мне «назначение, неизвестное этому NavigationController»
HomeFragment.kt
override fun onClick(view: View?) {
when (view) {
binding.ivBacktrack -> {
val upgradePremBottomSheet =
UpgradePremiumMembershipBottomSheetDialogFragment.newInstance()
upgradePremBottomSheet.show(childFragmentManager, null)
}
binding.ivInterested -> displayToast()
binding.ivNotInterested -> displayToast()
binding.ivMessage -> {
val directMessageBottomSheet = DirectMessageBottomDialogFragment.newInstance()
directMessageBottomSheet.show(childFragmentManager, "Direct Message Bottom Sheet")
}
}
}
DirectMessageBottomDialogFragment.kt
class DirectMessageBottomDialogFragment : BottomSheetDialogFragment(), View.OnClickListener {
lateinit var binding: LayoutDirectMessageLimitReachedBottomSheetBinding
companion object{
fun newInstance(): DirectMessageBottomDialogFragment{
return DirectMessageBottomDialogFragment()
}
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
binding = LayoutDirectMessageLimitReachedBottomSheetBinding.inflate(inflater,container,false)
binding.clDmLimitReachedBottomSheet.setBackgroundColor(ContextCompat.getColor(
context!!, R.color.background_black
))
return binding.root
}
override fun onStart() {
super.onStart()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.tvGetPremiumMembership.setOnClickListener(this)
binding.tvPurchaseDmPacks.setOnClickListener(this)
binding.ivClose.setOnClickListener(this)
}
override fun onClick(v: View?) {
when(v){
binding.tvGetPremiumMembership -> findNavController().navigate(R.id.action_directMessageBottomDialogFragment_to_paymentFragment)
binding.tvPurchaseDmPacks -> findNavController().navigate(R.id.action_directMessageBottomDialogFragment_to_dmPackFragment)
binding.ivClose -> dismiss()
}
}
}
Любая помощь приветствуется