DialogFragment use
kassim opened this issue · 0 comments
Point 1
Kotterknife behaves in a way that if DialogFragment.getDialog() != null
, it will use getDialog().findViewById()
or if a getDialog() == null
it will attempt getView().findViewById()
The FragmentManager calls getLayoutInflater
before onCreateView
, and in a DialogFragment onCreateDialog
is called as part of getLayoutInflater
, therefore there is no point at which a View will exist when a Dialog doesn't.
So I recommend perhaps removing the fallback as to not confuse developers looking at the source.
Point 2
The view created in onCreateView
is not set to the dialog until onActivityCreated
. Therefore if a behaviour of initialising the view state in onViewCreated
is taken then a crash is guaranteed.
There doesn't seem to be a great way of knowing if Dialog.setContentView
or FragmentonActivityCreated
was called so perhaps this detail should be added to documentation?
--
I'll make a PR later, but wanted to see if this was agreeable or I'm misunderstanding why I was running into issues.