Skip to content

Commit a00baf4

Browse files
longvantruongpandeymanggmattinanntgithub-advanced-security[bot]
authored
fix keyboard android 10 (#34)
* chore: custom sdk tcb * chore: custom sdk tcb * chore: custom sdk tcb * chore: custom sdk tcb * chore: custom sdk tcb * fix: blackduck issues (#22) * fixes blackduck issues * fix: dokka version * fix: Workflow does not contain permissions (#20) Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> * chore: handle back press survey * chore: handle back press survey * fix: fixes the pixel fold issue (#24) * fixes the pixel fold issue * adds errors * fixes log * add hidden field * handle back press survey * fixes responses stuck error (#25) * feat(api): add cancel support for ongoing retrofit calls * fix: blocks http requests (#27) * fix: blocks http requests * fix: fixes network sec config * fix: retrofit * feat(network): enforce TLS 1.2 1.3 support odder Android version * fix: branding text (#30) * fix: branding text * fix: test * chore: update isBrandingEnabled * fix show survey when app is not resumed * fix safeDismiss * fix launchWhenResumed * add try catch cancel call api * fix(android): adjust WebView height manually on Android 10 when keyboard is visible --------- Co-authored-by: Anshuman Pandey <54475686+pandeymangg@users.noreply.github.com> Co-authored-by: Matti Nannt <mail@matti.sh> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 4415d6f commit a00baf4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

android/src/main/java/com/formbricks/android/webview/FormbricksFragment.kt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import android.app.Activity.RESULT_OK
55
import android.app.Dialog
66
import android.content.Intent
77
import android.graphics.Color
8+
import android.graphics.Rect
89
import android.net.Uri
10+
import android.os.Build
911
import android.os.Bundle
1012
import android.os.Handler
1113
import android.os.Looper
@@ -178,6 +180,25 @@ class FormbricksFragment(val hiddenFields: Map<String, Any>? = null) : BottomShe
178180
return
179181
}
180182

183+
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q) {
184+
val rootView = dialog?.window?.decorView?.findViewById<View>(android.R.id.content)
185+
rootView?.viewTreeObserver?.addOnGlobalLayoutListener {
186+
val r = Rect()
187+
rootView.getWindowVisibleDisplayFrame(r)
188+
val screenHeight = rootView.rootView.height
189+
val keyboardHeight = screenHeight - r.bottom
190+
if (keyboardHeight > screenHeight * 0.15) {
191+
// Keyboard is open – minimize WebView
192+
binding.formbricksWebview.layoutParams.height = r.bottom - binding.formbricksWebview.top
193+
binding.formbricksWebview.requestLayout()
194+
} else {
195+
// Keyboard closed
196+
binding.formbricksWebview.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT
197+
binding.formbricksWebview.requestLayout()
198+
}
199+
}
200+
}
201+
181202
dialog?.window?.setDimAmount(0.0f)
182203
binding.formbricksWebview.setBackgroundColor(Color.TRANSPARENT)
183204
binding.formbricksWebview.let {

0 commit comments

Comments
 (0)