Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soft keyboard not detected when toggling the emoji-popup #60

Closed
audax opened this issue Oct 20, 2016 · 7 comments
Closed

Soft keyboard not detected when toggling the emoji-popup #60

audax opened this issue Oct 20, 2016 · 7 comments
Labels

Comments

@audax
Copy link

audax commented Oct 20, 2016

  • Version of the library: 0.3.0
  • Affected devices: Nexus X with 7.0 and Xperia Z5 Compact with 6.01
  • Affected versions: Reproduced in 0.3.0 and 46dcd01

The problem appears in the Qabel-android client in versionn 0.12.0 and 0.12.1: https://github.com/Qabel/qabel-android/releases/tag/0.12.1-beta.3

To reproduce:

  1. Open the chat fragment with this layout
  2. Open the soft keyboard by clicking into the edit text field
  3. Click the emoji-button

Expected behavior:
The soft keyboard hides and the emoji popup appears
Actual behavior:
The emoji-button changes the drawable to the keyboard drawable and the emoji popup does not appear, the keyboard stays visible. Clicking the emoji button again has no effect.

When I close the keyboard with the hardware button and then press the emoji button again, the emoji popup opens and everything works fine.


I also tried to bind the emoji popup on the root of the activities layout, but that had no effect.

@rubengees
Copy link
Collaborator

I just had the same issue and was able to solve it.
Basically what you have to do is calling rootView.getViewTreeObserver().dispatchOnGlobalLayout() after calling emojiPopup.toggle().

Background

Internally, EmojiPopup relies on a ViewTreeObserver.OnGlobalLayoutListener to get notified when the keyboard comes into view. For some reason this does not work for all layouts and the listener never gets called. By calling rootView.getViewTreeObserver().dispatchOnGlobalLayout() we signalize the listener that the keyboard is now out ourself.

@audax
Copy link
Author

audax commented Oct 26, 2016

We found out that the 0.2 version does not have this problem.
I think this commit broke it:
0f0b727
The listener is only attached if if (!popupWindow.isShowing()) { and before that commit the listener was attached in the constructor.

I'll bisect this bug and find out if this is indeed the commit that broke it.

@vanniktech
Copy link
Owner

Thanks for the detailed bug report. Yeah i also got some other issues that version 0.3.0 broke toggling. In all applications that I'm using the library everything still worked.

Did the workaround from @rubengees fix the issue?

@vanniktech vanniktech added the bug label Nov 5, 2016
@audax
Copy link
Author

audax commented Nov 5, 2016

It did indeed fix the issue. We are currently looking if there are still issues on some devices. So far it looks like the workaround is doing it's job.
Qabel/qabel-android@1cecf3f

@vanniktech
Copy link
Owner

Alright thanks, good to know. I'll also try to investigate further. I'm trying to once and for all try to fix this issue with 0.4.0.

@vanniktech
Copy link
Owner

@audax thanks again I just merged #64 which contains your fix. You can try 0.4.0-SNAPSHOT out. I'll cut a release soon.

@audax
Copy link
Author

audax commented Nov 19, 2016

Thx for the fix @vanniktech! Android really is a never ending nightmare of workarounds…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants