Status Update
Comments
wa...@google.com <wa...@google.com>
li...@google.com <li...@google.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.
ad...@gmail.com <ad...@gmail.com> #3
ap...@google.com <ap...@google.com> #4
li...@google.com <li...@google.com> #5
Hi Adrien, the fix will be in the androidx.emoji2 (1.4.0-beta03) which will be released in May 10th. Thanks for reporting the issue.
ad...@gmail.com <ad...@gmail.com> #6
Thanks a lot :)
ad...@gmail.com <ad...@gmail.com> #7
Just tried beta3. The crash is now fixed ! Thanks.
However, the Popup always appears at the top of the screen instead of at the proper location. I'll try to put together a small project on github to demonstrate/reproduce the issue.
pn...@gmail.com <pn...@gmail.com> #8
Unfortunately, this fix seems to cause EmojiPicker to crash when embedded into an IME:
android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:931)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:387)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
at android.widget.PopupWindow.invokePopup(PopupWindow.java:1577)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1343)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:1309)
at androidx.emoji2.emojipicker.EmojiViewHolder.showPopupWindow(EmojiViewHolder.kt:114)
at androidx.emoji2.emojipicker.EmojiViewHolder.onEmojiLongClickListener$lambda$0(EmojiViewHolder.kt:41)
at androidx.emoji2.emojipicker.EmojiViewHolder.$r8$lambda$4L5z_x3hpOEoRlrrYk9cvuxGptg(Unknown Source:0)
at androidx.emoji2.emojipicker.EmojiViewHolder$$ExternalSyntheticLambda0.onLongClick(Unknown Source:4)
at android.view.View.performLongClickInternal(View.java:7339)
at android.view.View.performLongClick(View.java:7297)
at android.view.View.performLongClick(View.java:7315)
at android.view.View$CheckForLongPress.run(View.java:27850)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Here's a super simple demo:
li...@google.com <li...@google.com> #9
li...@google.com <li...@google.com> #10
li...@google.com <li...@google.com> #11
To summarize the issue. Previously, we use emojiView as the parent of the popup view, this works fine with the sample app and embedding into an IME, however, this doesn't work with the nested popup view (embedding emoji picker into a popup view). After we use the inflated popupview as the parent of the popup view, this works fine with the sample app and embedding into a popup view, however, this doesn't work with embedding into an IME.
Logically, we should use the emojiView as the parent of the popup view, so we can anchor the popup view to the correct position. However, when we embed the emoji picker in the popup view, calling the #showAtLocation() with emojiView throws the WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN which is returned in
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit 1e86716f0b8c73378c977e12d5c20d09fa44caad
Author: Lin Guo <linguo@google.com>
Date: Fri Jul 14 00:54:48 2023
Catch the WindowManager.BadTokenException when using EmojiPickerView
inside a popup
Test: manual
Bug: 278306916
Change-Id: I0a1443025e80328fc33f8172612689b3d9017296
M emoji2/emoji2-emojipicker/src/main/java/androidx/emoji2/emojipicker/EmojiViewHolder.kt
ad...@gmail.com <ad...@gmail.com> #13
Hi, With rc1 the feature is broken and displays 'Don't use EmojiPickerView inside a Popup'.
However using EmojiPickerView inside a popup is (in my opinion) the major and most valuable use-case for EmojiPickerView.
Docking EmojiPickerView at the bottom of the screen as a 'fake soft keyboard' leads to a bad user experience, especially on larger screens (tablets, foldables, laptops etc): When adding reactions to content, it forces the user to look away from the content.
Note that on larger screens, competing reaction-system usually allow to pick a emoji from a popup that opens near the content that is being reacted-to.
I attached a few examples of Apple implementation.
It would be awesome if Google could provide an equivalent for Android, and EmojiPickerView is almost it :) So please consider supporting EmojiPickerView in a popup, or provide guidance for a similar feature.
wa...@google.com <wa...@google.com> #14
Could you please put the picker view into a popup style view but not a Android popup widget?
The variant selection is using popup so if the picker view is in a popup then the nested popup will cause issues.
BTW, usually the picker view is a full screen or half screen UI on mobile phones. Are you building it on tablet which a popup style is understandably more suitable?
ad...@gmail.com <ad...@gmail.com> #15
Thanks for the answer :)
I put together a small project to reproduce the issue:
This small project also try to show that:
- When placed in a PopupWindow, the EmojiPickerView is gorgeous, fun and super useful !
- The native Android PopupWindow is very useful and implements a lot of logic that would be hard to get right if done by hand.
- Showing a Popup inside a popup with correct positioning in Android is possible and simple on API 26+.
The project shows that it would be easily possible for EmojiPickerView to support nested popups, at least for API 26+. Also, maybe it would make sense for the androidx support library, or at least for the EmojiPickerView, to support a nested popup fallback for API < 26 ?
Many thanks
li...@google.com <li...@google.com> #16
We will add this request to our planning.
Description
Component used: androidx.emoji2:emoji2-emojipicker Version used: androidx.emoji2:emoji2-emojipicker:1.4.0-beta01 Devices/Android versions reproduced on: 10,13
The following crash happens when using EmojiPickerView that is inside a Popup (in order to add an emoji reaction to content). The crash occurs when long-clicking on an emoji with a skin color selector available.