Closed AlmutawaEssam closed 3 years ago
For me I can confirm that this is working properly
adjustResizeOnGlobalLayout(chatWindow?.findViewById<WebView>(R.id.chat_window_web_view))
fun adjustResizeOnGlobalLayout(webView: WebView?) {
if (webView != null)
{
val decorView = window.decorView
val viewGroup = getWindow().getDecorView().findViewById(android.R.id.content) as ViewGroup
decorView.viewTreeObserver.addOnGlobalLayoutListener {
val displayMetrics = resources.displayMetrics
val rect = Rect()
decorView.getWindowVisibleDisplayFrame(rect)
val paddingBottom: Int = displayMetrics.heightPixels - rect.bottom
if (viewGroup.paddingBottom != paddingBottom) {
// showing/hiding the soft keyboard
viewGroup.setPadding(
viewGroup.paddingLeft,
viewGroup.paddingTop,
viewGroup.paddingRight,
paddingBottom
)
} else {
// soft keyboard shown/hidden and padding changed
if (paddingBottom != 0) {
// soft keyboard shown, scroll active element into view in case it is blocked by the soft keyboard
webView.evaluateJavascript(
"if (document.activeElement) { document.activeElement.scrollIntoView({behavior: \"smooth\", block: \"center\", inline: \"nearest\"}); }",
null
)
}
}
}
}
}
Hey @AlmutawaEssam !
Thank you for your suggestion! Based on this we were able to come up with solution to keyboard overlapping input box.
Turns out issue was happening on Android SDK version lower than 30 when ChatWindow was added to activity configured as full screen activity
Latest release - v2.1.6
should hopefully solve your issue!
Looking forward to know if that actually helps in your case :)
I hope above helped. Closing this due to inactivity on this and solution already available in latest release :)
this is related to this issue: #33
I found this solution https://stackoverflow.com/a/56269190/9278341 I believe it should do it