88package io .github .yawnoc .strokeinput ;
99
1010import android .content .Context ;
11+ import android .graphics .Insets ;
1112import android .graphics .Typeface ;
13+ import android .os .Build ;
1214import android .util .AttributeSet ;
1315import android .view .View ;
16+ import android .view .ViewGroup ;
1417import android .view .ViewTreeObserver ;
18+ import android .view .WindowInsets ;
1519import android .widget .FrameLayout ;
1620
21+ import androidx .core .view .WindowInsetsCompat ;
22+
1723import java .util .List ;
1824
1925/*
2329 - Stroke sequence bar
2430 - Candidates view
2531 - Keyboard view
32+ - Bottom spacer (needed in API level 35+ due to edge-to-edge)
2633 2. Key preview plane (overlaid)
2734*/
2835public class InputContainer
@@ -34,6 +41,23 @@ public class InputContainer
3441 private CandidatesView candidatesView ;
3542 private CandidatesViewAdapter candidatesViewAdapter ;
3643 private KeyboardView keyboardView ;
44+ private View bottomSpacer ;
45+
46+ @ Override
47+ public WindowInsets onApplyWindowInsets (WindowInsets insets )
48+ {
49+ super .onApplyWindowInsets (insets );
50+
51+ if (Build .VERSION .SDK_INT >= 35 ) // bottom spacing for edge-to-edge
52+ {
53+ final Insets systemBars = insets .getInsets (WindowInsetsCompat .Type .systemBars ());
54+ ViewGroup .LayoutParams layoutParameters = bottomSpacer .getLayoutParams ();
55+ layoutParameters .height = systemBars .bottom ;
56+ bottomSpacer .setLayoutParams (layoutParameters );
57+ }
58+
59+ return insets ;
60+ }
3761
3862 public InputContainer (final Context context , final AttributeSet attributes )
3963 {
@@ -70,6 +94,11 @@ public void initialiseKeyboardView(
7094 keyboardView .setKeyboard (keyboard );
7195 }
7296
97+ public void initialiseBottomSpacer ()
98+ {
99+ bottomSpacer = findViewById (R .id .bottom_spacer );
100+ }
101+
73102 public void setPopupRecessLayout (final boolean isFullscreen )
74103 {
75104 if (isFullscreen )
0 commit comments