abouttreesummaryrefslogcommitdiff
path: root/res
diff options
context:
space:
mode:
authorJules Aguillon2023-07-09 18:06:12 +0200
committerJules Aguillon2023-07-09 18:14:43 +0200
commit4669192a01cacba288b5fdd3671ad7c8db9df7d8 (patch)
tree6f9bcdee2e5a75642c003e06610a69f602a2b841 /res
parenta2957a43d68f51e10c84be07b8725ea241dc8580 (diff)
downloadunexpected-keyboard-4669192a01cacba288b5fdd3671ad7c8db9df7d8.tar.gz
unexpected-keyboard-4669192a01cacba288b5fdd3671ad7c8db9df7d8.zip
Refactor: Don't define extra keys in xml
The current approach is hard to maintain, for example the last key "autofill" was not displayed. This implements a PreferenceGroup that contains the check boxes for every extra keys without involving listing the preferences in settings.xml. A custom layout is used to remove the 'title' text view. The list of extra keys is moved into the new class. 'ExtraKeyCheckBoxPreference' becomes a nested class.
Diffstat (limited to 'res')
-rw-r--r--res/layout/extra_keys_preference.xml5
-rw-r--r--res/xml/settings.xml37
2 files changed, 6 insertions, 36 deletions
diff --git a/res/layout/extra_keys_preference.xml b/res/layout/extra_keys_preference.xml
new file mode 100644
index 0000000..40bbfbe
--- /dev/null
+++ b/res/layout/extra_keys_preference.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingEnd="?android:attr/scrollbarSize" android:background="?android:attr/selectableItemBackground">
+ <!-- Preference layout that do not define the text view with id 'title'. -->
+ <LinearLayout android:id="@android:id/widget_frame" android:layout_width="wrap_content" android:layout_height="match_parent" android:gravity="center_vertical" android:orientation="vertical"/>
+</LinearLayout>
diff --git a/res/xml/settings.xml b/res/xml/settings.xml
index 322bf4d..f57d58a 100644
--- a/res/xml/settings.xml
+++ b/res/xml/settings.xml
@@ -7,42 +7,7 @@
<ListPreference android:key="show_numpad" android:title="@string/pref_show_numpad_title" android:summary="%s" android:defaultValue="1" android:entries="@array/pref_show_numpad_entries" android:entryValues="@array/pref_show_numpad_values"/>
<CheckBoxPreference android:key="number_row" android:title="@string/pref_number_row_title" android:summary="@string/pref_number_row_summary" android:defaultValue="false"/>
<PreferenceScreen android:title="@string/pref_extra_keys_title">
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="0"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="1"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="2"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="3"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="4"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="5"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="6"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="7"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="8"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="9"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="10"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="11"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="12"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="13"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="14"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="15"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="16"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="17"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="18"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="19"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="20"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="21"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="22"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="23"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="24"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="25"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="26"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="27"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="28"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="29"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="30"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="31"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="32"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="33"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="34"/>
- <juloo.keyboard2.ExtraKeyCheckBoxPreference app:index="35"/>
+ <juloo.keyboard2.ExtraKeysPreference/>
</PreferenceScreen>
<ListPreference android:key="numpad_layout" android:title="@string/pref_numpad_layout" android:summary="%s" android:defaultValue="high_first" android:entries="@array/pref_numpad_layout_entries" android:entryValues="@array/pref_numpad_layout_values"/>
</PreferenceCategory>