Skip to content

Commit 70fe842

Browse files
committed
fix: recreate input view when exiting floating mode to prevent nav bar overlaps
1 parent 1c5c4c4 commit 70fe842

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

app/src/main/java/helium314/keyboard/latin/FloatingKeyboardManager.kt

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -220,23 +220,8 @@ class FloatingKeyboardManager(private val context: Context, private val latinIME
220220

221221
val mainKeyboardFrame = overlayRoot?.findViewById<View>(R.id.main_keyboard_frame)
222222
if (mainKeyboardFrame != null) {
223-
// Remove from overlay content container
223+
// Remove from overlay content container so it can be safely GC'd
224224
(mainKeyboardFrame.parent as? ViewGroup)?.removeView(mainKeyboardFrame)
225-
226-
// Restore to original parent
227-
val parent = savedParent
228-
if (parent != null) {
229-
mainKeyboardFrame.layoutParams = savedLayoutParams ?: LinearLayout.LayoutParams(
230-
LinearLayout.LayoutParams.MATCH_PARENT,
231-
LinearLayout.LayoutParams.WRAP_CONTENT
232-
).apply { gravity = Gravity.BOTTOM }
233-
234-
if (savedParentIndex >= 0 && savedParentIndex <= parent.childCount) {
235-
parent.addView(mainKeyboardFrame, savedParentIndex)
236-
} else {
237-
parent.addView(mainKeyboardFrame)
238-
}
239-
}
240225
}
241226

242227
// Remove overlay window

app/src/main/java/helium314/keyboard/latin/LatinIME.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,10 @@ public void onFloatingKeyboardShown() {
805805
* Restores the IME input view and re-shows the IME window.
806806
*/
807807
public void onFloatingKeyboardHidden() {
808-
if (mInputView != null) {
809-
mInputView.setVisibility(View.VISIBLE);
810-
}
808+
// Recreate the entire input view to fix bottom navigation/chin overlaps
809+
setInputView(onCreateInputView());
810+
updateInputViewShown();
811+
811812
// Re-show the IME window
812813
startShowingInputView(true);
813814
}

0 commit comments

Comments
 (0)