fix crash in bottom sheet dialogs
This commit is contained in:
parent
2b05f7cf4e
commit
873b69266d
|
@ -29,7 +29,6 @@ import at.connyduck.pixelcat.components.login.LoginActivity
|
|||
import at.connyduck.pixelcat.components.main.MainActivity
|
||||
import at.connyduck.pixelcat.databinding.BottomsheetAccountsBinding
|
||||
import at.connyduck.pixelcat.db.AccountManager
|
||||
import at.connyduck.pixelcat.util.viewBinding
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
@ -37,9 +36,17 @@ class AccountSelectionBottomSheet(
|
|||
private val accountManager: AccountManager
|
||||
) : BottomSheetDialogFragment() {
|
||||
|
||||
private val binding by viewBinding(BottomsheetAccountsBinding::bind)
|
||||
private var _binding: BottomsheetAccountsBinding? = null
|
||||
private val binding
|
||||
get() = _binding!!
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?) = binding.root
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?) : View {
|
||||
_binding = BottomsheetAccountsBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
lifecycleScope.launch {
|
||||
|
@ -66,4 +73,9 @@ class AccountSelectionBottomSheet(
|
|||
private fun onNewAccount() {
|
||||
startActivity(LoginActivity.newIntent(requireContext()))
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
_binding = null
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,18 +26,21 @@ import android.view.ViewGroup
|
|||
import at.connyduck.pixelcat.components.about.AboutActivity
|
||||
import at.connyduck.pixelcat.components.settings.SettingsActivity
|
||||
import at.connyduck.pixelcat.databinding.BottomsheetMenuBinding
|
||||
import at.connyduck.pixelcat.util.viewBinding
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
|
||||
class MenuBottomSheet : BottomSheetDialogFragment() {
|
||||
|
||||
private val binding by viewBinding(BottomsheetMenuBinding::bind)
|
||||
private var _binding: BottomsheetMenuBinding? = null
|
||||
private val binding
|
||||
get() = _binding!!
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
) = binding.root
|
||||
savedInstanceState: Bundle?) : View {
|
||||
_binding = BottomsheetMenuBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue