1
0
Fork 0

added width constraints in landscape mode to prevent too much stretching on tablets and other large devices

This commit is contained in:
sspanak 2024-06-27 20:32:24 +03:00 committed by Dimo Karaivanov
parent d917054d0a
commit 9f4c04d286
4 changed files with 318 additions and 293 deletions

View file

@ -126,4 +126,5 @@ android {
dependencies {
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
}

View file

@ -1,314 +1,333 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
android:gravity="center_horizontal">
<View
android:id="@+id/separator_top"
style="@style/numRowSeparator" />
<LinearLayout
android:id="@+id/status_bar_container"
android:layout_width="fill_parent"
android:layout_height="@dimen/numpad_candidate_height"
android:layoutDirection="ltr">
<io.github.sspanak.tt9.ui.main.keys.SoftKeyArrow
android:id="@+id/soft_key_left_arrow"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="@dimen/numpad_arrow_key_width"
android:layout_height="fill_parent"
android:text="@string/key_dpad_left"
android:textSize="@dimen/soft_key_icon_size" />
<View
android:id="@+id/separator_candidates_1"
style="@style/numSeparator" />
<FrameLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textStyle="italic"
tools:text="@tools:sample/lorem" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/suggestions_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layoutDirection="locale"
android:orientation="horizontal"
android:scrollbars="none" />
</FrameLayout>
<View
android:id="@+id/separator_candidates_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftKeyArrow
android:id="@+id/soft_key_right_arrow"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="@dimen/numpad_arrow_key_width"
android:layout_height="fill_parent"
android:text="@string/key_dpad_right"
android:textSize="@dimen/soft_key_icon_size" />
</LinearLayout>
<View
android:id="@+id/separator_candidates_bottom"
style="@style/numRowSeparator" />
<!-- Keypad Wrapper -->
<LinearLayout
android:id="@+id/main_soft_keys"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/numpad_padding_bottom">
android:maxWidth="@dimen/numpad_max_width"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<!-- Row 1 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText,KeyboardInaccessibleWidget">
<io.github.sspanak.tt9.ui.main.keys.SoftKeySettings
android:id="@+id/soft_key_settings"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="⚙"
android:textSize="@dimen/soft_key_icon_size" />
android:id="@+id/linearLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<View
android:id="@+id/separator_1_1"
style="@style/numSeparator" />
android:id="@+id/separator_top"
style="@style/numRowSeparator" />
<!-- Digits 1-3 -->
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_1"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<LinearLayout
android:id="@+id/status_bar_container"
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_candidate_height"
android:layoutDirection="ltr">
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_2"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftKeyArrow
android:id="@+id/soft_key_left_arrow"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="@dimen/numpad_arrow_key_width"
android:layout_height="match_parent"
android:text="@string/key_dpad_left"
android:textSize="@dimen/soft_key_icon_size" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_3"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_candidates_1"
style="@style/numSeparator" />
<FrameLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<TextView
android:id="@+id/status_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textStyle="italic"
tools:text="@tools:sample/lorem" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/suggestions_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:layoutDirection="locale"
android:orientation="horizontal"
android:scrollbars="none" />
</FrameLayout>
<View
android:id="@+id/separator_candidates_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftKeyArrow
android:id="@+id/soft_key_right_arrow"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="@dimen/numpad_arrow_key_width"
android:layout_height="match_parent"
android:text="@string/key_dpad_right"
android:textSize="@dimen/soft_key_icon_size" />
</LinearLayout>
<View
android:id="@+id/separator_1_2"
style="@style/numSeparator" />
android:id="@+id/separator_candidates_bottom"
style="@style/numRowSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftBackspaceKey
android:id="@+id/soft_key_backspace"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:textSize="@dimen/soft_key_icon_size" />
<!-- Keypad Wrapper -->
<LinearLayout
android:id="@+id/main_soft_keys"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/numpad_padding_bottom">
<!-- Row 1 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText,KeyboardInaccessibleWidget">
<io.github.sspanak.tt9.ui.main.keys.SoftKeySettings
android:id="@+id/soft_key_settings"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="⚙"
android:textSize="@dimen/soft_key_icon_size" />
<View
android:id="@+id/separator_1_1"
style="@style/numSeparator" />
<!-- Digits 1-3 -->
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_1"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_2"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_3"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_1_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftBackspaceKey
android:id="@+id/soft_key_backspace"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:textSize="@dimen/soft_key_icon_size" />
</LinearLayout>
<!-- Row 2 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText">
<io.github.sspanak.tt9.ui.main.keys.SoftKeyAddWord
android:id="@+id/soft_key_add_word"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text=""
android:textStyle="bold" />
<View
android:id="@+id/separator_2_1"
style="@style/numSeparator" />
<!-- Digits 4-6 -->
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_4"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_5"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_6"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_2_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftFilterKey
android:id="@+id/soft_key_filter_suggestions"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight" />
</LinearLayout>
<!-- Row 3 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText">
<io.github.sspanak.tt9.ui.main.keys.SoftInputModeKey
android:id="@+id/soft_key_input_mode"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="⌨"
android:textSize="@dimen/soft_key_icon_size" />
<View
android:id="@+id/separator_3_1"
style="@style/numSeparator" />
<!-- Digits 7-9 -->
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_7"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_8"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_9"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_3_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftVoiceInputKey
android:id="@+id/soft_key_voice_input"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight" />
</LinearLayout>
<!-- Row 4 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText">
<io.github.sspanak.tt9.ui.main.keys.SoftKeyNextLanguage
android:id="@+id/soft_key_language"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="🌐" />
<View
android:id="@+id/separator_4_1"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftPunctuationKey
android:id="@+id/soft_key_punctuation_1"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_0"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftPunctuationKey
android:id="@+id/soft_key_punctuation_2"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_4_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftOkKey
android:id="@+id/soft_key_ok"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="OK"
tools:ignore="ButtonOrder" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- Row 2 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText">
<io.github.sspanak.tt9.ui.main.keys.SoftKeyAddWord
android:id="@+id/soft_key_add_word"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text=""
android:textStyle="bold" />
<View
android:id="@+id/separator_2_1"
style="@style/numSeparator" />
<!-- Digits 4-6 -->
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_4"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_5"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_6"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_2_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftFilterKey
android:id="@+id/soft_key_filter_suggestions"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"/>
</LinearLayout>
<!-- Row 3 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText">
<io.github.sspanak.tt9.ui.main.keys.SoftInputModeKey
android:id="@+id/soft_key_input_mode"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="⌨"
android:textSize="@dimen/soft_key_icon_size" />
<View
android:id="@+id/separator_3_1"
style="@style/numSeparator" />
<!-- Digits 7-9 -->
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_7"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_8"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_9"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_3_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftVoiceInputKey
android:id="@+id/soft_key_voice_input"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight" />
</LinearLayout>
<!-- Row 4 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/numpad_key_height"
android:layoutDirection="ltr"
tools:ignore="HardcodedText">
<io.github.sspanak.tt9.ui.main.keys.SoftKeyNextLanguage
android:id="@+id/soft_key_language"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="🌐" />
<View
android:id="@+id/separator_4_1"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftPunctuationKey
android:id="@+id/soft_key_punctuation_1"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftNumberKey
android:id="@+id/soft_key_0"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<io.github.sspanak.tt9.ui.main.keys.SoftPunctuationKey
android:id="@+id/soft_key_punctuation_2"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:textAppearance="@style/TextAppearance.AppCompat.Large" />
<View
android:id="@+id/separator_4_2"
style="@style/numSeparator" />
<io.github.sspanak.tt9.ui.main.keys.SoftOkKey
android:id="@+id/soft_key_ok"
style="@android:style/Widget.Holo.Button.Borderless"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="@dimen/numpad_control_key_layout_weight"
android:text="OK"
tools:ignore="ButtonOrder" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="numpad_max_width">720dp</dimen>
</resources>

View file

@ -21,6 +21,7 @@
<dimen name="pref_padding_vertical">12dp</dimen>
<!-- Numpad -->
<dimen name="numpad_max_width">10000dp</dimen>
<dimen name="numpad_padding_bottom">2dp</dimen>
<dimen name="numpad_row_separator_margin">0dp</dimen>