Status Update
Comments
jz...@tigerconnect.com <jz...@tigerconnect.com> #2
When you call navController.setGraph(R.navigation.navigation_graph), it stores that ID and will restore that ID automatically.
If you were to instead use:
NavInflater navInflater = new NavInflater(this, navController.getNavigatorProvider());
navController.setGraph(navInflater.inflate(R.navigation.navigation_graph));
Then NavController would not restore the graph itself and the call to restoreState() you point out would only restore the back stack state, etc. but would wait for you to call setGraph again.
You're right that the inconsistency between the two setGraph methods is concerning. We'll take a look.
wa...@google.com <wa...@google.com>
gi...@gmail.com <gi...@gmail.com> #3
it...@gmail.com <it...@gmail.com> #4
it...@gmail.com <it...@gmail.com> #5
Actually it seems as though the EmojiPicker only takes forever to inflate when in a Composable with that verticalScroll()
modifier. When I remove this modifier, the view inflates right away (it's just not scrollable). So there's definitely some work to be done to detect the appropriate constraints for this embedded recycler view (again, why isn't this just a composable to begin with?!).
st...@gmail.com <st...@gmail.com> #6
gi...@gmail.com <gi...@gmail.com> #7
Any news on this?
sa...@nextdoor.com <sa...@nextdoor.com> #8
jz...@tigerconnect.com <jz...@tigerconnect.com> #9
val bottomSheetDialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
bottomSheetDialog.setOnShowListener {
val bottomSheet = bottomSheetDialog
.findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
if (bottomSheet != null) {
val behavior: BottomSheetBehavior<*> = BottomSheetBehavior.from(bottomSheet)
behavior.isDraggable = false
}
}
return bottomSheetDialog
}
sa...@nextdoor.com <sa...@nextdoor.com> #10
fa...@gmail.com <fa...@gmail.com> #11
A working workaround for XMLs & View:
You need to turn nestedScrollingEnabled
flag false on the RecyclerView
with the id of R.id.emoji_picker_header
BottomSheetBehavior
looks for the very first nested scrolling view within the findScrollingChild
RecyclerView
for the Header on the EmojiPickerView
.
After you turn the flag off, BottomSheetBehavior
will pick the second RecyclerView
for the Body with the id of R.id.emoji_picker_body
The problem is BottomSheetBehavior
has already picked the wrong one during the layout process.
For this reason you need to reinitialize BottomSheetBehavior.nestedScrollingChildRef
property right after you turned the flag off.
It is only possible with the public onLayoutChild
nestedScrollingChildRef
doesn't has a setter.
emojiPickerView.doOnNextLayout {
it.findViewById<RecyclerView>(androidx.emoji2.emojipicker.R.id.emoji_picker_header)
?.isNestedScrollingEnabled = false
val coordinatorLayout = findViewById<CoordinatorLayout>(com.google.android.material.R.id.coordinator)
val bottomSheet = findViewById<FrameLayout>(com.google.android.material.R.id.design_bottom_sheet)
if (coordinatorLayout != null && bottomSheet != null) {
behavior.onLayoutChild(coordinatorLayout, bottomSheet, bottomSheet.layoutDirection)
}
}
Important, you need to wait for EmojiPickerView
's layout end with emojiPickerView.doOnNextLayout { ... }
extension function or the emojiPickerView.viewTreeObserver.addOnGlobalLayoutListener()
method
VoilĂ
Description