Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9622684b authored by Cosmin Băieș's avatar Cosmin Băieș
Browse files

Handle edge-to-edge for SimpleInputMethodService

As the SimpleIME is targetting the current SDK, we have to handle the
bottom insets so that the SimpleKeyboardView does not overlap with the
navigation bar area.

Flag: EXEMPT testfix
Bug: 394328311
Test: atest InputMethodServiceTest
Change-Id: Ica92b730a93bc18438c0ca7cde2af0b338b57113
parent db4d9093
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.Log;
import android.util.SparseArray;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import android.widget.TextView;

@@ -107,6 +108,15 @@ final class SimpleKeyboardView extends FrameLayout {
        mapSoftKeys();
    }

    @Override
    public WindowInsets onApplyWindowInsets(WindowInsets insets) {
        // Handle edge to edge for navigationBars insets (system nav bar)
        // and captionBars insets (IME navigation bar).
        final int insetBottom = insets.getInsets(WindowInsets.Type.systemBars()).bottom;
        setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(), insetBottom);
        return insets.inset(0, 0, 0, insetBottom);
    }

    /**
     * Sets the key press listener.
     *