Closed kherink closed 3 years ago
Hello @kherink !
Thank you for reaching out and suggesting a solution! Appreciate it!
I've tested your solution and it doesn't seem to work on emulator and on S9 Android 9. So I am a bit cautious to apply your fix without understanding reasons behind it. Tried 4 different attachment methods mentioned in linked stackoverflow question in the PR:
1. (ViewGroup) activity.getWindow().getDecorView().findViewById(android.R.id.content)
2. (ViewGroup) activity.getWindow().getDecorView().getRootView()
3. (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0)
4. ((ViewGroup) ((ViewGroup) activity.getWindow().findViewById(android.R.id.content)).getChildAt(0))
1st is currently used approach 2nd indeed renders ChatWindowView behind OS status bar and Navigation Bar 3rd and 4th seem to be the same and don't work on Emulator nor Galaxy S9 device.
Also current solution works OK in the example on all devices I tested (emulator API levels 21, 30, Google Pixel 3a API 30 and Galaxy S10 API 29 and 30). This makes me think that maybe your activity flag settings could be a differentiator here. Any special Window features or flags you're using in your activity? Could you also provide your LiveChat licence ID to s.jarosz@livechat.com . This will allow me to see you settings for your ChatWindow.
I will keep investigating this and try find better solution. In the meantime, you could attach ChatWindowView manually instead of using ChatWindowView.createAndAttachChatWindowInstance(this)
convenience method, simply by inflating and adding view to your activity or using one the suggested ways to find root activity.
For example:
chatWindow = (ChatWindowView) LayoutInflater.from(this).inflate(R.layout.view_chat_window, (ViewGroup) this.findViewById(R.id.some_id), false);
((ViewGroup) this.findViewById(R.id.your_root_view_group)).addView(chatWindow);
chatWindow.setUpWindow(ChatWindowConfiguration());
chatWindow.setUpListener(this);
chatWindow.initialize();
Thanks!
Hi @nomyzs, thank you for following up. The 2 physical devices I was able to repro the issue are the listed S8, and a Google Pixel with Android 10. also a S9 (free test device provided by Sauce Labs on a test plan for their remote device farm) also on Android 10. I am not aware of any special activity flag settings in the activity containing the chat view. I've done exactly what you suggest and attached the ChatWindowView manually which worked fine for us. Please let me know if you find anything based on the emailed info, or if i can be of futher help in investigating this. Best regards, Karel
Hey @kherink .
You might want to try v2.1.6
version of this library.
Turns out your issues was reproducible when configuring parenting Activity in Full Screen Mode. PLease refer to #62 for more details :)
Thanks for your input on this! Hopefully this solves your problems and simplifies your integration :)
on some devices (many samsung phones including galaxy S8 and S9) the ChatWindowView is obscured by activity bar and keyboard after it is attached to existing activity and shown
Top and input obscured (Samsung Galaxy S8, Android Version 9, Baseband Version G950FXXUCDUD1, One UI version 1)
Top of the screen obscured (Pixel device)