Fix: Cannot control ime_switcher and menu after resetting.
mButtonDispatchers contains ButtonDispatcher for ime_switcher and menu;
however, in #inflateButton, we tried to find ButtonDispatcher for
menu_ime, which is a FrameLayout containing ime_switcher and menu.
Therefore, after #clearViews and #inflateLayout, ime_switcher and menu
KeyButtonView are not in the corresponding ButtonDispatchers.
It means NavigationBarView#getImeSwitchButton and
NavigationBarView#getMenuButton returns empty ButtonDispatcher.
As a result, we can't control ime switch button and menu button via
NavigationBarView after then. e.g. We can't control ime switch button
visibility.
This CL fixes that issue by calling #addToDispatchers recursively for
ViewGroup children if corresponding ButtonDispatcher is not found. This
behavior is aligned with #addAll.
Bug: 28580774
Change-Id: Ibe724753390b7bbb395a6d53d00bc6d06d00aa9a
1 file changed