Skip to content

Commit c7342bd

Browse files
committed
Fix bottom spacer not applying to key previews
1 parent 3c84290 commit c7342bd

File tree

2 files changed

+59
-51
lines changed

2 files changed

+59
-51
lines changed

app/src/main/java/io/github/yawnoc/strokeinput/InputContainer.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,25 @@
1616
import android.view.ViewGroup;
1717
import android.view.ViewTreeObserver;
1818
import android.view.WindowInsets;
19-
import android.widget.FrameLayout;
19+
import android.widget.LinearLayout;
2020

2121
import androidx.core.view.WindowInsetsCompat;
2222

2323
import java.util.List;
2424

2525
/*
2626
A container that holds:
27-
1. Main input plane:
28-
- Popup recess
29-
- Stroke sequence bar
30-
- Candidates view
31-
- Keyboard view
32-
- Bottom spacer (needed in API level 35+ due to edge-to-edge)
33-
2. Key preview plane (overlaid)
27+
1. Main input block:
28+
(a) Main input plane:
29+
- Popup recess
30+
- Stroke sequence bar
31+
- Candidates view
32+
- Keyboard view
33+
(b) Key preview plane (overlaid)
34+
2. Bottom spacer (needed in API level 35+ due to edge-to-edge)
3435
*/
3536
public class InputContainer
36-
extends FrameLayout
37+
extends LinearLayout
3738
{
3839
// Container properties
3940
private View popupRecess;

app/src/main/res/layout/input_container.xml

Lines changed: 49 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,59 +10,66 @@
1010
xmlns:tools="http://schemas.android.com/tools"
1111
android:layout_width="match_parent"
1212
android:layout_height="wrap_content"
13+
android:layout_gravity="bottom"
1314
android:orientation="vertical"
1415
>
15-
<LinearLayout
16-
android:id="@+id/main_input_plane"
16+
<FrameLayout
1717
android:layout_width="match_parent"
1818
android:layout_height="wrap_content"
19-
android:layout_gravity="bottom"
2019
android:orientation="vertical"
2120
>
22-
<View
23-
android:id="@+id/popup_recess"
21+
<LinearLayout
22+
android:id="@+id/main_input_plane"
2423
android:layout_width="match_parent"
25-
android:layout_height="@dimen/height__popup_recess"
26-
/>
27-
<io.github.yawnoc.strokeinput.StrokeSequenceBar
28-
android:id="@+id/stroke_sequence_bar"
29-
android:layout_width="wrap_content"
3024
android:layout_height="wrap_content"
31-
android:visibility="invisible"
32-
android:textColor="@color/stroke_sequence_bar_text"
33-
android:textSize="@dimen/font_size__stroke_sequence_bar"
34-
android:ellipsize="start"
35-
android:singleLine="true"
36-
android:background="@color/stroke_sequence_bar_fill"
37-
android:paddingTop="@dimen/padding_top__stroke_sequence_bar"
38-
android:paddingLeft="@dimen/padding_left__stroke_sequence_bar"
39-
android:paddingRight="@dimen/padding_right__stroke_sequence_bar"
40-
android:paddingBottom="@dimen/padding_bottom__stroke_sequence_bar"
41-
android:theme="@style/Theme.AppCompat"
42-
tools:ignore="RtlHardcoded"
43-
/>
44-
<io.github.yawnoc.strokeinput.CandidatesView
45-
android:id="@+id/candidates_view"
25+
android:layout_gravity="bottom"
26+
android:orientation="vertical"
27+
>
28+
<View
29+
android:id="@+id/popup_recess"
30+
android:layout_width="match_parent"
31+
android:layout_height="@dimen/height__popup_recess"
32+
/>
33+
<io.github.yawnoc.strokeinput.StrokeSequenceBar
34+
android:id="@+id/stroke_sequence_bar"
35+
android:layout_width="wrap_content"
36+
android:layout_height="wrap_content"
37+
android:visibility="invisible"
38+
android:textColor="@color/stroke_sequence_bar_text"
39+
android:textSize="@dimen/font_size__stroke_sequence_bar"
40+
android:ellipsize="start"
41+
android:singleLine="true"
42+
android:background="@color/stroke_sequence_bar_fill"
43+
android:paddingTop="@dimen/padding_top__stroke_sequence_bar"
44+
android:paddingLeft="@dimen/padding_left__stroke_sequence_bar"
45+
android:paddingRight="@dimen/padding_right__stroke_sequence_bar"
46+
android:paddingBottom="@dimen/padding_bottom__stroke_sequence_bar"
47+
android:theme="@style/Theme.AppCompat"
48+
tools:ignore="RtlHardcoded"
49+
/>
50+
<io.github.yawnoc.strokeinput.CandidatesView
51+
android:id="@+id/candidates_view"
52+
android:layout_width="match_parent"
53+
android:layout_height="@dimen/height__candidate_button"
54+
android:background="@color/candidate_button_fill_unpressed"
55+
/>
56+
<io.github.yawnoc.strokeinput.KeyboardView
57+
android:id="@+id/keyboard_view"
58+
android:layout_width="wrap_content"
59+
android:layout_height="wrap_content"
60+
/>
61+
</LinearLayout>
62+
<io.github.yawnoc.strokeinput.KeyPreviewPlane
63+
android:id="@+id/key_preview_plane"
4664
android:layout_width="match_parent"
47-
android:layout_height="@dimen/height__candidate_button"
48-
android:background="@color/candidate_button_fill_unpressed"
49-
/>
50-
<io.github.yawnoc.strokeinput.KeyboardView
51-
android:id="@+id/keyboard_view"
52-
android:layout_width="wrap_content"
5365
android:layout_height="wrap_content"
66+
android:layout_gravity="bottom"
5467
/>
55-
<View
56-
android:id="@+id/bottom_spacer"
57-
android:layout_width="match_parent"
58-
android:layout_height="0dp"
59-
android:background="@android:color/black"
60-
/>
61-
</LinearLayout>
62-
<io.github.yawnoc.strokeinput.KeyPreviewPlane
63-
android:id="@+id/key_preview_plane"
68+
</FrameLayout>
69+
<View
70+
android:id="@+id/bottom_spacer"
6471
android:layout_width="match_parent"
65-
android:layout_height="wrap_content"
66-
android:layout_gravity="bottom"
72+
android:layout_height="0dp"
73+
android:background="@android:color/black"
6774
/>
6875
</io.github.yawnoc.strokeinput.InputContainer>

0 commit comments

Comments
 (0)