Touchscreen support + small improvements
* Soft-Keyboard numpad * no more SoftKeyHandler, the main view is in its own package * settings are no longer passed unnecessarilly here and there * fixed numeric mode not working in some cases * simplified suggestion handling * fixed crashing when changing the phone orientation
This commit is contained in:
parent
7f6cd6110d
commit
4e5416f6b4
36 changed files with 1142 additions and 368 deletions
231
res/layout/main_numpad.xml
Normal file
231
res/layout/main_numpad.xml
Normal file
|
|
@ -0,0 +1,231 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_numpad"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/numpad_candidate_height">
|
||||
|
||||
<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:fadingEdge="horizontal"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:scrollbars="none" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/main_soft_keys"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/numpad_padding_top"
|
||||
android:paddingBottom="@dimen/numpad_padding_bottom">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/numpad_key_height"
|
||||
tools:ignore="HardcodedText,KeyboardInaccessibleWidget">
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="1"
|
||||
android:text="⚙"
|
||||
android:textSize="@dimen/soft_key_icon_size" />
|
||||
|
||||
<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" />
|
||||
|
||||
<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="1"
|
||||
android:text="⌫"
|
||||
android:textSize="@dimen/soft_key_icon_size"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/numpad_key_height"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="1"
|
||||
android:text="+WORD" />
|
||||
|
||||
<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:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/numpad_key_height"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="1"
|
||||
android:text="MODE" />
|
||||
|
||||
<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:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/numpad_key_height"
|
||||
tools:ignore="HardcodedText">
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="1"
|
||||
android:text="🌐"
|
||||
android:textSize="@dimen/soft_key_icon_size"
|
||||
tools:ignore="HardcodedText" />
|
||||
|
||||
<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" />
|
||||
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="1"
|
||||
android:text="@android:string/ok"
|
||||
tools:ignore="ButtonOrder" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/main_small"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/candidate_list_height">
|
||||
android:layout_height="@dimen/candidate_height">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/status_bar"
|
||||
|
|
@ -34,55 +35,47 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/soft_key_height"
|
||||
android:baselineAligned="true"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="HardcodedText,KeyboardInaccessibleWidget">
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_left"
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="3"
|
||||
android:clickable="true"
|
||||
android:focusable="false"
|
||||
android:longClickable="true"
|
||||
android:text="⚙"
|
||||
android:textSize="@dimen/soft_key_icon_size"
|
||||
tools:ignore="HardcodedText,KeyboardInaccessibleWidget" />
|
||||
android:textSize="@dimen/soft_key_icon_size" />
|
||||
|
||||
<View
|
||||
android:id="@+id/main_separator_left"
|
||||
style="@style/hSeparator"
|
||||
android:background="@drawable/button_separator_dark" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_mid"
|
||||
<io.github.sspanak.tt9.ui.main.keys.SoftKey
|
||||
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="5"
|
||||
android:clickable="true"
|
||||
android:focusable="false"
|
||||
android:longClickable="true"
|
||||
android:text="@android:string/ok"
|
||||
tools:ignore="ButtonOrder,KeyboardInaccessibleWidget" />
|
||||
android:text="@android:string/ok" />
|
||||
|
||||
<View
|
||||
android:id="@+id/main_separator_right"
|
||||
android:background="@drawable/button_separator_dark"
|
||||
style="@style/hSeparator" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/main_right"
|
||||
<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="3"
|
||||
android:clickable="true"
|
||||
android:focusable="false"
|
||||
android:longClickable="true"
|
||||
android:text="⌫"
|
||||
android:textSize="@dimen/soft_key_icon_size"
|
||||
tools:ignore="HardcodedText,KeyboardInaccessibleWidget" />
|
||||
android:textSize="@dimen/soft_key_icon_size" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -2,15 +2,14 @@
|
|||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/suggestion_list_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suggestion_list_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:paddingHorizontal="@dimen/candidate_padding_horizontal"
|
||||
android:paddingVertical="@dimen/candidate_padding_vertical"
|
||||
android:text=""
|
||||
android:textSize="@dimen/candidate_font_size" />
|
||||
</LinearLayout>
|
||||
16
res/layout/suggestion_list_numpad.xml
Normal file
16
res/layout/suggestion_list_numpad.xml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/suggestion_list_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/suggestion_list_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:minWidth="@dimen/numpad_candidate_min_width"
|
||||
android:paddingHorizontal="@dimen/candidate_padding_horizontal"
|
||||
android:textSize="@dimen/numpad_candidate_font_size" />
|
||||
</LinearLayout>
|
||||
|
|
@ -59,4 +59,5 @@
|
|||
<string name="pref_upside_down_keys_summary">Включете настройката, ако на първият ред са 7–8–9, вместо 1–2–3.</string>
|
||||
<string name="dictionary_truncate_unselected">Изтрий неизбраните</string>
|
||||
<string name="pref_category_setup">Начална настройка</string>
|
||||
<string name="pref_show_soft_numpad">Цифрова клавиатура на екрана</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -35,4 +35,5 @@
|
|||
<string name="pref_upside_down_keys">Orden de teclas inverso</string>
|
||||
<string name="pref_upside_down_keys_summary">Habilite la configuración si hay 7–8–9 en la primera fila, en lugar de 1–2–3.</string>
|
||||
<string name="pref_category_setup">Configuración inicial</string>
|
||||
<string name="pref_show_soft_numpad">Teclado numérico en pantalla</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -50,4 +50,5 @@
|
|||
<string name="pref_upside_down_keys_summary">Activez le paramètre s\'il y a 7–8–9 sur le premier rang, au lieu de 1–2–3.</string>
|
||||
<string name="dictionary_truncate_unselected">Vider les non sélectionnés</string>
|
||||
<string name="pref_category_setup">Configuration initiale</string>
|
||||
<string name="pref_show_soft_numpad">Pavé numérique à l\'écran</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -59,4 +59,5 @@
|
|||
<string name="pref_upside_down_keys_summary">Используйте настройку, если в первом ряду 7–8–9 вместо 1–2–3.</string>
|
||||
<string name="dictionary_truncate_unselected">Очистить невыбранные</string>
|
||||
<string name="pref_category_setup">Начальная настройка</string>
|
||||
<string name="pref_show_soft_numpad">Экранная цифровая клавиатура</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -59,4 +59,5 @@
|
|||
<string name="pref_upside_down_keys_summary">Використовуйте налаштування, якщо 7–8–9 у першому рядку замість 1–2–3.</string>
|
||||
<string name="dictionary_truncate_unselected">Очистіть невибрані</string>
|
||||
<string name="pref_category_setup">Початкове налаштування</string>
|
||||
<string name="pref_show_soft_numpad">Екранна цифрова клавіатура</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@
|
|||
<color name="candidate_selected">#AAAAAA</color>
|
||||
<color name="candidate_separator">#888888</color>
|
||||
|
||||
<color name="numpad_background">#E7F0E7</color>
|
||||
|
||||
<!-- Dark theme -->
|
||||
<color name="dark_button_text">#C0C0C0</color>
|
||||
|
||||
<color name="dark_candidate_background">#333333</color>
|
||||
<color name="dark_candidate_background">#2C2C2C</color>
|
||||
<color name="dark_candidate_color">#CCCCCC</color>
|
||||
<color name="dark_candidate_selected">#555555</color>
|
||||
|
||||
<color name="dark_numpad_background">#353835</color>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="candidate_list_height">26sp</dimen>
|
||||
<dimen name="candidate_font_size">18sp</dimen>
|
||||
<dimen name="candidate_height">26sp</dimen>
|
||||
<dimen name="candidate_padding_horizontal">6sp</dimen>
|
||||
<dimen name="candidate_padding_vertical">1sp</dimen>
|
||||
|
||||
<dimen name="soft_key_height">44dp</dimen>
|
||||
<dimen name="soft_key_icon_size">24sp</dimen>
|
||||
|
|
@ -14,4 +13,13 @@
|
|||
<dimen name="pref_padding_vertical">18dp</dimen>
|
||||
<dimen name="pref_text_size">22sp</dimen>
|
||||
<dimen name="pref_summary_size">19sp</dimen>
|
||||
|
||||
<!-- Numpad -->
|
||||
<dimen name="numpad_padding_top">5dp</dimen>
|
||||
<dimen name="numpad_padding_bottom">15dp</dimen>
|
||||
<dimen name="numpad_key_height">56dp</dimen>
|
||||
|
||||
<dimen name="numpad_candidate_font_size">17sp</dimen>
|
||||
<dimen name="numpad_candidate_height">32dp</dimen>
|
||||
<dimen name="numpad_candidate_min_width">36dp</dimen>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
<string name="pref_dark_theme">Dark Theme</string>
|
||||
<string name="pref_double_zero_char">Character for Double 0-key Press</string>
|
||||
<string name="pref_show_soft_function_keys">Show On-Screen Keys</string>
|
||||
<string name="pref_show_soft_numpad">Show On-Screen Numpad</string>
|
||||
<string name="pref_show_soft_numpad_summary" translatable="false">(BETA)</string>
|
||||
<string name="pref_help">Help</string>
|
||||
<string name="pref_upside_down_keys">Reverse Key Order</string>
|
||||
<string name="pref_upside_down_keys_summary">Use this if you have 7–8–9 on the first row, instead of 1–2–3.</string>
|
||||
|
|
|
|||
|
|
@ -13,4 +13,12 @@
|
|||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_show_soft_function_keys" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
app:defaultValue="false"
|
||||
app:key="pref_show_soft_numpad"
|
||||
app:layout="@layout/pref_switch"
|
||||
app:title="@string/pref_show_soft_numpad"
|
||||
app:summary="@string/pref_show_soft_numpad_summary"
|
||||
app:dependency="pref_show_soft_keys" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue