forked from extern/Unexpected-Keyboard
Allow multiple custom layouts
This merges the "Layouts" option with the "Custom layout" option. A custom layout becomes an item in the "Layouts" list among the other layouts. It's possible to add several custom layouts. Selecting the "Custom layout" item in the list opens a second dialog for entering the layout description. Layouts are serialized as JSON object and are decoded solely in the LayoutsPreference class.
This commit is contained in:
parent
8611dbcfa0
commit
500f4e41d3
@ -54,9 +54,9 @@ def generate_arrays(out, layouts):
|
||||
item.text = s
|
||||
elem.append(item)
|
||||
return elem
|
||||
none_item = [ ("system", "@string/pref_layout_e_system") ]
|
||||
system_item = [ ("system", "@string/pref_layout_e_system") ]
|
||||
custom_item = [ ("custom", "@string/pref_layout_e_custom") ]
|
||||
values_items, entries_items = zip(*(none_item + layouts + custom_item)) # unzip
|
||||
values_items, entries_items = zip(*(system_item + layouts + custom_item)) # unzip
|
||||
ids_items = map(lambda s: "@xml/%s" % s if s not in ["system", "custom"] else "-1", values_items)
|
||||
root = XML.Element("resources")
|
||||
root.append(XML.Comment(text="DO NOT EDIT. This file is generated, see gen_layouts.py."))
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Vlastní rozvržení</string>
|
||||
<string name="pref_layouts_add">Přidat alternativní rozložení</string>
|
||||
<string name="pref_layouts_item">Rozložení %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Vlastní rozvržení</string>
|
||||
<string name="pref_show_numpad_title">Zobrazit NumPad</string>
|
||||
<string name="pref_show_numpad_never">Nikdy</string>
|
||||
<string name="pref_show_numpad_landscape">Pouze v režimu na šířku</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Velmi dlouhá</string>
|
||||
<string name="pref_key_horizontal_space">Horizontální mezery mezi klávesami</string>
|
||||
<string name="pref_key_vertical_space">Vertikální mezery mezi klávesami</string>
|
||||
<string name="pref_category_advanced">Pokročilé</string>
|
||||
<string name="pref_custom_layout_title">Vlastní rozvržení</string>
|
||||
<string name="pref_custom_layout_summary">Více informací naleznete ve zdrojovém kódu. Tato možnost není určena pro běžné užití.</string>
|
||||
<string name="pref_vibration_e_disabled">Deaktivovány</string>
|
||||
<string name="pref_vibration_e_system">Dle systému</string>
|
||||
<string name="pref_vibration_e_strong">Silné</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<string name="key_descr_º">Indikátor řadové číslovky</string>
|
||||
<string name="key_descr_superscript">Horní index</string>
|
||||
<string name="key_descr_subscript">Dolní index</string>
|
||||
<string name="pref_category_advanced">Pokročilé</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Eigenes Layout</string>
|
||||
<string name="pref_layouts_add">Alternatives Layout hinzufügen</string>
|
||||
<string name="pref_layouts_item">Layout %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Eigenes Layout</string>
|
||||
<string name="pref_show_numpad_title">Ziffernblock anzeigen</string>
|
||||
<string name="pref_show_numpad_never">Nie</string>
|
||||
<string name="pref_show_numpad_landscape">Nur im Querformat</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Sehr weit</string>
|
||||
<string name="pref_key_horizontal_space">Horizontaler Abstand zwischen den Tasten</string>
|
||||
<string name="pref_key_vertical_space">Vertikaler Abstand zwischen den Tasten</string>
|
||||
<string name="pref_category_advanced">Erweitert</string>
|
||||
<string name="pref_custom_layout_title">Eigenes Layout</string>
|
||||
<string name="pref_custom_layout_summary">Bitte Sourcecode ansehen. Diese Option ist nicht zur Verwendung vorgesehen.</string>
|
||||
<string name="pref_vibration_e_disabled">Deaktiviert</string>
|
||||
<string name="pref_vibration_e_system">System</string>
|
||||
<string name="pref_vibration_e_strong">Stark</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<string name="key_descr_º">Ordinalzeichen</string>
|
||||
<string name="key_descr_superscript">Hochgestellt</string>
|
||||
<string name="key_descr_subscript">Tiefgestellt</string>
|
||||
<string name="pref_category_advanced">Erweitert</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Formato personalizado</string>
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<string name="pref_custom_layout_title">Formato personalizado</string>
|
||||
<string name="pref_show_numpad_title">Mostrar pad numérico</string>
|
||||
<string name="pref_show_numpad_never">Nunca</string>
|
||||
<string name="pref_show_numpad_landscape">Solo en modo paisaje</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Muy lejana</string>
|
||||
<string name="pref_key_horizontal_space">Espaciado horizontal entre las teclas</string>
|
||||
<string name="pref_key_vertical_space">Espaciado vertical entre las teclas</string>
|
||||
<string name="pref_category_advanced">Avanzado</string>
|
||||
<string name="pref_custom_layout_title">Formato personalizado</string>
|
||||
<string name="pref_custom_layout_summary">Revisar el código fuente. Esta opción no está pensada para ser usada.</string>
|
||||
<string name="pref_vibration_e_disabled">Deshabilitada</string>
|
||||
<string name="pref_vibration_e_system">Sistema</string>
|
||||
<string name="pref_vibration_e_strong">Fuerte</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">Avanzado</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">طرح صفارشی</string>
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<string name="pref_custom_layout_title">طرح شخصی</string>
|
||||
<string name="pref_show_numpad_title">نمایش پد شمارهها</string>
|
||||
<string name="pref_show_numpad_never">هرگز</string>
|
||||
<string name="pref_show_numpad_landscape">فقط در حالت افقی</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">بسیار دور</string>
|
||||
<string name="pref_key_horizontal_space">فاصله افقی بین کلیدها</string>
|
||||
<string name="pref_key_vertical_space">فاصله عمودی بین کلیدها</string>
|
||||
<string name="pref_category_advanced">پیشرفته</string>
|
||||
<string name="pref_custom_layout_title">طرح شخصی</string>
|
||||
<string name="pref_custom_layout_summary">کد منبع را ببینید. این گزینه قرار نیست استفاده شود.</string>
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">پیشرفته</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Disposition personnalisée</string>
|
||||
<string name="pref_layouts_add">Ajouter un clavier alternatif</string>
|
||||
<string name="pref_layouts_item">Disposition %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Disposition personnalisée</string>
|
||||
<string name="pref_show_numpad_title">Afficher le pavé numérique</string>
|
||||
<string name="pref_show_numpad_never">Jamais</string>
|
||||
<string name="pref_show_numpad_landscape">Seulement en mode paysage</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Très longue</string>
|
||||
<string name="pref_key_horizontal_space">Espacement horizontal entre les touches</string>
|
||||
<string name="pref_key_vertical_space">Espacement vertical entre les touches</string>
|
||||
<string name="pref_category_advanced">Avancé</string>
|
||||
<string name="pref_custom_layout_title">Disposition personnalisée</string>
|
||||
<string name="pref_custom_layout_summary">Cette option n\'est pas faite pour être utilisée.</string>
|
||||
<string name="pref_vibration_e_disabled">Désactivé</string>
|
||||
<string name="pref_vibration_e_system">Système</string>
|
||||
<string name="pref_vibration_e_strong">Fort</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">Avancé</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<!-- <string name="pref_layout_e_custom">Custom layout</string> -->
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
|
||||
<!-- <string name="pref_show_numpad_title">Show NumPad</string> -->
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Molto distante</string>
|
||||
<string name="pref_key_horizontal_space">Spazio orizzontale tra i tasti</string>
|
||||
<string name="pref_key_vertical_space">Spazio verticale tra i tasti</string>
|
||||
<!-- <string name="pref_category_advanced">Advanced</string> -->
|
||||
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
|
||||
<!-- <string name="pref_custom_layout_summary">See the source code. This option is not meant to be used.</string> -->
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<!-- <string name="pref_category_advanced">Advanced</string> -->
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<!-- <string name="pref_layout_e_custom">Custom layout</string> -->
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
|
||||
<!-- <string name="pref_show_numpad_title">Show NumPad</string> -->
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">매우 넓음</string>
|
||||
<string name="pref_key_horizontal_space">키보드 양 옆 간격</string>
|
||||
<string name="pref_key_vertical_space">키보드 세로 간격</string>
|
||||
<!-- <string name="pref_category_advanced">Advanced</string> -->
|
||||
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
|
||||
<!-- <string name="pref_custom_layout_summary">See the source code. This option is not meant to be used.</string> -->
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<!-- <string name="pref_category_advanced">Advanced</string> -->
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Pielāgots izkārtojums</string>
|
||||
<string name="pref_layouts_add">Pievienot aizstājējizkārtojumu</string>
|
||||
<string name="pref_layouts_item">Izkārtojums %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Pielāgots izkārtojums</string>
|
||||
<string name="pref_show_numpad_title">Rādīt ciparnīcu</string>
|
||||
<string name="pref_show_numpad_never">Nekad</string>
|
||||
<string name="pref_show_numpad_landscape">Tikai guleniskajā skatā</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Ļoti tāls</string>
|
||||
<string name="pref_key_horizontal_space">Līmeniskais attālums starp taustiņiem</string>
|
||||
<string name="pref_key_vertical_space">Stateniskais attālums starp taustiņiem</string>
|
||||
<string name="pref_category_advanced">Papildu</string>
|
||||
<string name="pref_custom_layout_title">Pielāgots izkārtojums</string>
|
||||
<string name="pref_custom_layout_summary">Skatīt pirmkodu. Šī iespēja nav paredzēta izmantošanai.</string>
|
||||
<string name="pref_vibration_e_disabled">Atspējota</string>
|
||||
<string name="pref_vibration_e_system">Sistēmas</string>
|
||||
<string name="pref_vibration_e_strong">Spēcīga</string>
|
||||
@ -103,4 +101,5 @@
|
||||
<string name="key_descr_º">Kārtas rādītājs</string>
|
||||
<string name="key_descr_superscript">Augšraksts</string>
|
||||
<string name="key_descr_subscript">Apakšraksts</string>
|
||||
<string name="pref_category_advanced">Papildu</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Własny układ</string>
|
||||
<string name="pref_layouts_add">Dodaj dodatkowy układ</string>
|
||||
<string name="pref_layouts_item">Układ %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Własny układ</string>
|
||||
<string name="pref_show_numpad_title">Pokaż klawiaturę numeryczną</string>
|
||||
<string name="pref_show_numpad_never">Nigdy</string>
|
||||
<string name="pref_show_numpad_landscape">Tylko w orientacji poziomej</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Bardzo duża</string>
|
||||
<string name="pref_key_horizontal_space">Odległość pomiędzy klawiszami w poziomie</string>
|
||||
<string name="pref_key_vertical_space">Odległość pomiędzy klawiszami w pionie</string>
|
||||
<string name="pref_category_advanced">Zaawansowane</string>
|
||||
<string name="pref_custom_layout_title">Własny układ</string>
|
||||
<string name="pref_custom_layout_summary">Zobacz kod źródłowy. Ta opcja nie jest przeznaczona do użycia.</string>
|
||||
<string name="pref_vibration_e_disabled">Wyłączone</string>
|
||||
<string name="pref_vibration_e_system">Systemowe</string>
|
||||
<string name="pref_vibration_e_strong">Silne</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<string name="key_descr_º">Wskaźnik porządkowy (męski)</string>
|
||||
<string name="key_descr_superscript">Indeks górny</string>
|
||||
<string name="key_descr_subscript">Indeks dolny</string>
|
||||
<string name="pref_category_advanced">Zaawansowane</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Layout personalizado</string>
|
||||
<string name="pref_layouts_add">Adicione um layout alternativo</string>
|
||||
<string name="pref_layouts_item">Layout %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Layout personalizado</string>
|
||||
<string name="pref_show_numpad_title">Mostrar Teclado Numérico</string>
|
||||
<string name="pref_show_numpad_never">Nunca</string>
|
||||
<string name="pref_show_numpad_landscape">Somente no modo paisagem</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Muito longo</string>
|
||||
<string name="pref_key_horizontal_space">Distância horizontal entre teclas</string>
|
||||
<string name="pref_key_vertical_space">Distância vertical entre teclas</string>
|
||||
<string name="pref_category_advanced">Avançado</string>
|
||||
<string name="pref_custom_layout_title">Layout personalizado</string>
|
||||
<string name="pref_custom_layout_summary">Veja o código-fonte. Esta opção não deve ser usada.</string>
|
||||
<string name="pref_vibration_e_disabled">Desabilitado</string>
|
||||
<string name="pref_vibration_e_system">Sistema</string>
|
||||
<string name="pref_vibration_e_strong">Intenso</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<string name="key_descr_º">Indicador Ordinal</string>
|
||||
<string name="key_descr_superscript">Sobrescrito</string>
|
||||
<string name="key_descr_subscript">Subscrito</string>
|
||||
<string name="pref_category_advanced">Avançado</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Aranjament personalizat</string>
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<string name="pref_custom_layout_title">Aranjament personalizat</string>
|
||||
<string name="pref_show_numpad_title">Arată NumPad</string>
|
||||
<string name="pref_show_numpad_never">Niciodată</string>
|
||||
<string name="pref_show_numpad_landscape">Doar în mod panoramă</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Foarte depărtată</string>
|
||||
<string name="pref_key_horizontal_space">Distanța orizontală dintre taste</string>
|
||||
<string name="pref_key_vertical_space">Distanța verticală dintre taste</string>
|
||||
<string name="pref_category_advanced">Setări avansate</string>
|
||||
<string name="pref_custom_layout_title">Aranjament personalizat</string>
|
||||
<string name="pref_custom_layout_summary">Deschide codul sursă. Această opțiune nu e destinată spre folosință.</string>
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">Setări avansate</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Пользовательская раскладка</string>
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<string name="pref_custom_layout_title">Пользовательская раскладка</string>
|
||||
<string name="pref_show_numpad_title">Показывать NumPad</string>
|
||||
<string name="pref_show_numpad_never">Никогда</string>
|
||||
<string name="pref_show_numpad_landscape">Только в ландшафтном режиме</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Очень далеко</string>
|
||||
<string name="pref_key_horizontal_space">Горизонтальное расстояние между клавишами</string>
|
||||
<string name="pref_key_vertical_space">Расстояние по вертикали между клавишами</string>
|
||||
<string name="pref_category_advanced">Расширенные настройки</string>
|
||||
<string name="pref_custom_layout_title">Пользовательская раскладка</string>
|
||||
<string name="pref_custom_layout_summary">Откройте исходный код. Эта параметр не предназначен для использования.</string>
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">Расширенные настройки</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<!-- <string name="pref_layout_e_custom">Custom layout</string> -->
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
|
||||
<!-- <string name="pref_show_numpad_title">Show NumPad</string> -->
|
||||
<!-- <string name="pref_show_numpad_never">Never</string> -->
|
||||
<!-- <string name="pref_show_numpad_landscape">Only in landscape mode</string> -->
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Çok uzun</string>
|
||||
<string name="pref_key_horizontal_space">Tuşlar arasındaki yatay boşluk</string>
|
||||
<string name="pref_key_vertical_space">Tuşlar arasındaki dikey boşluk</string>
|
||||
<!-- <string name="pref_category_advanced">Advanced</string> -->
|
||||
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
|
||||
<!-- <string name="pref_custom_layout_summary">See the source code. This option is not meant to be used.</string> -->
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<!-- <string name="pref_category_advanced">Advanced</string> -->
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Tùy chỉnh bố cục</string>
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<string name="pref_custom_layout_title">Tùy chỉnh bố cục</string>
|
||||
<string name="pref_show_numpad_title">Hiện NumPad</string>
|
||||
<string name="pref_show_numpad_never">Không bao giờ</string>
|
||||
<string name="pref_show_numpad_landscape">Chỉ trong chế độ phong cảnh</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Rất xa</string>
|
||||
<string name="pref_key_horizontal_space">Khoảng cách giữa các phím theo chiều ngang</string>
|
||||
<string name="pref_key_vertical_space">Khoảng cách giữa các phím theo chiều dọc</string>
|
||||
<string name="pref_category_advanced">Nâng cao</string>
|
||||
<string name="pref_custom_layout_title">Tùy chỉnh bố cục</string>
|
||||
<string name="pref_custom_layout_summary">Hãy xem mã nguồn. Lựa chọn này không có mục đích sử dụng.</string>
|
||||
<!-- <string name="pref_vibration_e_disabled">Disabled</string> -->
|
||||
<!-- <string name="pref_vibration_e_system">System</string> -->
|
||||
<!-- <string name="pref_vibration_e_strong">Strong</string> -->
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">Nâng cao</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">自定义布局</string>
|
||||
<!-- <string name="pref_layouts_add">Add an alternate layout</string> -->
|
||||
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
|
||||
<string name="pref_custom_layout_title">自定义布局</string>
|
||||
<string name="pref_show_numpad_title">显示数字小键盘</string>
|
||||
<string name="pref_show_numpad_never">从不</string>
|
||||
<string name="pref_show_numpad_landscape">只在横屏显示</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">非常长</string>
|
||||
<string name="pref_key_horizontal_space">按键的左右边距</string>
|
||||
<string name="pref_key_vertical_space">按键的上下边距</string>
|
||||
<string name="pref_category_advanced">高级设置</string>
|
||||
<string name="pref_custom_layout_title">自定义布局</string>
|
||||
<string name="pref_custom_layout_summary">请查看源代码。这个选项不应该在正常情况下使用。</string>
|
||||
<string name="pref_vibration_e_disabled">禁用</string>
|
||||
<string name="pref_vibration_e_system">使用系统振动强度</string>
|
||||
<string name="pref_vibration_e_strong">强</string>
|
||||
@ -101,4 +99,5 @@
|
||||
<!-- <string name="key_descr_º">Ordinal Indicator</string> -->
|
||||
<!-- <string name="key_descr_superscript">Superscript</string> -->
|
||||
<!-- <string name="key_descr_subscript">Subscript</string> -->
|
||||
<string name="pref_category_advanced">高级设置</string>
|
||||
</resources>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="pref_layout_e_custom">Custom layout</string>
|
||||
<string name="pref_layouts_add">Add an alternate layout</string>
|
||||
<string name="pref_layouts_item">Layout %1$d: %2$s</string>
|
||||
<string name="pref_custom_layout_title">Custom layout</string>
|
||||
<string name="pref_show_numpad_title">Show NumPad</string>
|
||||
<string name="pref_show_numpad_never">Never</string>
|
||||
<string name="pref_show_numpad_landscape">Only in landscape mode</string>
|
||||
@ -65,9 +66,6 @@
|
||||
<string name="pref_swipe_dist_e_very_far">Very far</string>
|
||||
<string name="pref_key_horizontal_space">Horizontal spacing between the keys</string>
|
||||
<string name="pref_key_vertical_space">Vertical spacing between the keys</string>
|
||||
<string name="pref_category_advanced">Advanced</string>
|
||||
<string name="pref_custom_layout_title">Custom layout</string>
|
||||
<string name="pref_custom_layout_summary">See the source code. This option is not meant to be used.</string>
|
||||
<string name="pref_vibration_e_disabled">Disabled</string>
|
||||
<string name="pref_vibration_e_system">System</string>
|
||||
<string name="pref_vibration_e_strong">Strong</string>
|
||||
@ -101,4 +99,6 @@
|
||||
<string name="key_descr_º">Ordinal Indicator</string>
|
||||
<string name="key_descr_superscript">Superscript</string>
|
||||
<string name="key_descr_subscript">Subscript</string>
|
||||
<!-- Unused -->
|
||||
<string name="pref_category_advanced">Advanced</string>
|
||||
</resources>
|
||||
|
@ -46,7 +46,4 @@
|
||||
<juloo.common.IntSlideBarPreference android:key="key_vertical_space" android:title="@string/pref_key_vertical_space" android:summary="%sdp" android:defaultValue="2" min="0" max="8"/>
|
||||
<juloo.common.IntSlideBarPreference android:key="key_horizontal_space" android:title="@string/pref_key_horizontal_space" android:summary="%sdp" android:defaultValue="2" min="0" max="8"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_category_advanced">
|
||||
<EditTextPreference android:key="custom_layout" android:title="@string/pref_custom_layout_title" android:summary="@string/pref_custom_layout_summary" android:inputType="text|textMultiLine|textLongMessage"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
@ -3,7 +3,6 @@ package juloo.keyboard2;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
@ -28,7 +27,6 @@ final class Config
|
||||
// From preferences
|
||||
/** [null] represent the [system] layout. */
|
||||
public List<KeyboardData> layouts;
|
||||
public KeyboardData custom_layout; // Might be 'null'
|
||||
public boolean show_numpad = false;
|
||||
// From the 'numpad_layout' option, also apply to the numeric pane.
|
||||
public boolean inverse_numpad = false;
|
||||
@ -114,11 +112,7 @@ final class Config
|
||||
{
|
||||
keyboardHeightPercent = _prefs.getInt("keyboard_height", 35);
|
||||
}
|
||||
List<String> layout_names = LayoutsPreference.load_from_preferences(_prefs);
|
||||
layouts = new ArrayList<KeyboardData>();
|
||||
for (String l : layout_names)
|
||||
layouts.add(layout_of_string(res, l));
|
||||
custom_layout = KeyboardData.load_string(_prefs.getString("custom_layout", ""));
|
||||
layouts = LayoutsPreference.load_from_preferences(res, _prefs);
|
||||
inverse_numpad = _prefs.getString("numpad_layout", "default").equals("low_first");
|
||||
number_row = _prefs.getBoolean("number_row", false);
|
||||
// The baseline for the swipe distance correspond to approximately the
|
||||
@ -335,36 +329,6 @@ final class Config
|
||||
}
|
||||
}
|
||||
|
||||
/** Obtained from XML. */
|
||||
static List<String> layout_ids_str = null;
|
||||
static TypedArray layout_ids_res = null;
|
||||
|
||||
/** Might return [null] if the selected layout is "system", "custom" or if
|
||||
the name is not recognized. */
|
||||
public KeyboardData layout_of_string(Resources res, String name)
|
||||
{
|
||||
if (layout_ids_str == null)
|
||||
{
|
||||
layout_ids_str = Arrays.asList(res.getStringArray(R.array.pref_layout_values));
|
||||
layout_ids_res = res.obtainTypedArray(R.array.layout_ids);
|
||||
}
|
||||
int i = layout_ids_str.indexOf(name);
|
||||
if (i >= 0)
|
||||
{
|
||||
int id = layout_ids_res.getResourceId(i, 0);
|
||||
if (id > 0)
|
||||
return KeyboardData.load(res, id);
|
||||
// Fallthrough
|
||||
}
|
||||
switch (name)
|
||||
{
|
||||
case "custom": return custom_layout;
|
||||
case "system":
|
||||
case "none":
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
char inverse_numpad_char(char c)
|
||||
{
|
||||
switch (c)
|
||||
|
@ -155,7 +155,7 @@ public class Keyboard2 extends InputMethodService
|
||||
{
|
||||
String s = subtype.getExtraValueOf("default_layout");
|
||||
if (s != null)
|
||||
default_layout = _config.layout_of_string(getResources(), s);
|
||||
default_layout = LayoutsPreference.layout_of_string(getResources(), s);
|
||||
refreshAccentsOption(imm, subtype);
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
@ -12,16 +13,17 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class LayoutsPreference extends ListGroupPreference<String>
|
||||
public class LayoutsPreference extends ListGroupPreference<LayoutsPreference.Layout>
|
||||
{
|
||||
static final String KEY = "layouts";
|
||||
static final List<String> DEFAULT = Collections.singletonList("system");
|
||||
static final ListGroupPreference.Serializer<String> SERIALIZER =
|
||||
new ListGroupPreference.StringSerializer();
|
||||
static final List<Layout> DEFAULT =
|
||||
Collections.singletonList((Layout)new SystemLayout());
|
||||
static final ListGroupPreference.Serializer<Layout> SERIALIZER =
|
||||
new Serializer();
|
||||
|
||||
/** Layout names as stored in the preferences. */
|
||||
List<String> _layout_names;
|
||||
/** Text displayed for each layout in the dialog list. */
|
||||
String[] _layout_display_names;
|
||||
|
||||
@ -30,13 +32,56 @@ public class LayoutsPreference extends ListGroupPreference<String>
|
||||
super(ctx, attrs);
|
||||
setKey(KEY);
|
||||
Resources res = ctx.getResources();
|
||||
_layout_names = Arrays.asList(res.getStringArray(R.array.pref_layout_values));
|
||||
_layout_display_names = res.getStringArray(R.array.pref_layout_entries);
|
||||
}
|
||||
|
||||
public static List<String> load_from_preferences(SharedPreferences prefs)
|
||||
/** Obtained from [res/values/layouts.xml]. */
|
||||
static List<String> _unsafe_layout_ids_str = null;
|
||||
static TypedArray _unsafe_layout_ids_res = null;
|
||||
|
||||
/** Layout internal names. Contains "system" and "custom". */
|
||||
public static List<String> get_layout_names(Resources res)
|
||||
{
|
||||
return load_from_preferences(KEY, prefs, DEFAULT, SERIALIZER);
|
||||
if (_unsafe_layout_ids_str == null)
|
||||
_unsafe_layout_ids_str = Arrays.asList(
|
||||
res.getStringArray(R.array.pref_layout_values));
|
||||
return _unsafe_layout_ids_str;
|
||||
}
|
||||
|
||||
/** Layout resource id for a layout name. [-1] if not found. */
|
||||
public static int layout_id_of_name(Resources res, String name)
|
||||
{
|
||||
if (_unsafe_layout_ids_res == null)
|
||||
_unsafe_layout_ids_res = res.obtainTypedArray(R.array.layout_ids);
|
||||
int i = get_layout_names(res).indexOf(name);
|
||||
if (i >= 0)
|
||||
return _unsafe_layout_ids_res.getResourceId(i, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/** [null] for the "system" layout. */
|
||||
public static List<KeyboardData> load_from_preferences(Resources res, SharedPreferences prefs)
|
||||
{
|
||||
List<KeyboardData> layouts = new ArrayList<KeyboardData>();
|
||||
for (Layout l : load_from_preferences(KEY, prefs, DEFAULT, SERIALIZER))
|
||||
{
|
||||
if (l instanceof NamedLayout)
|
||||
layouts.add(layout_of_string(res, ((NamedLayout)l).name));
|
||||
else if (l instanceof CustomLayout)
|
||||
layouts.add(KeyboardData.load_string(((CustomLayout)l).xml));
|
||||
else // instanceof SystemLayout
|
||||
layouts.add(null);
|
||||
}
|
||||
return layouts;
|
||||
}
|
||||
|
||||
public static KeyboardData layout_of_string(Resources res, String name)
|
||||
{
|
||||
int id = layout_id_of_name(res, name);
|
||||
if (id > 0)
|
||||
return KeyboardData.load(res, id);
|
||||
// Might happen when the app is downgraded, return the system layout.
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,15 +89,28 @@ public class LayoutsPreference extends ListGroupPreference<String>
|
||||
{
|
||||
super.onSetInitialValue(restoreValue, defaultValue);
|
||||
if (_values.size() == 0)
|
||||
set_values(new ArrayList<String>(DEFAULT), false);
|
||||
set_values(new ArrayList<Layout>(DEFAULT), false);
|
||||
}
|
||||
|
||||
String label_of_layout(Layout l)
|
||||
{
|
||||
if (l instanceof NamedLayout)
|
||||
{
|
||||
String lname = ((NamedLayout)l).name;
|
||||
int value_i = get_layout_names(getContext().getResources()).indexOf(lname);
|
||||
return value_i < 0 ? lname : _layout_display_names[value_i];
|
||||
}
|
||||
else if (l instanceof CustomLayout)
|
||||
return getContext().getString(R.string.pref_layout_e_custom);
|
||||
else // instanceof SystemLayout
|
||||
return getContext().getString(R.string.pref_layout_e_system);
|
||||
}
|
||||
|
||||
@Override
|
||||
String label_of_value(String value, int i)
|
||||
String label_of_value(Layout value, int i)
|
||||
{
|
||||
int value_i = _layout_names.indexOf(value);
|
||||
String lname = value_i < 0 ? value : _layout_display_names[value_i];
|
||||
return getContext().getString(R.string.pref_layouts_item, i + 1, lname);
|
||||
return getContext().getString(R.string.pref_layouts_item, i + 1,
|
||||
label_of_layout(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +128,7 @@ public class LayoutsPreference extends ListGroupPreference<String>
|
||||
}
|
||||
|
||||
@Override
|
||||
Serializer<String> get_serializer() { return SERIALIZER; }
|
||||
ListGroupPreference.Serializer<Layout> get_serializer() { return SERIALIZER; }
|
||||
|
||||
@Override
|
||||
void select(final SelectionCallback callback)
|
||||
@ -81,12 +139,40 @@ public class LayoutsPreference extends ListGroupPreference<String>
|
||||
.setAdapter(layouts, new DialogInterface.OnClickListener(){
|
||||
public void onClick(DialogInterface _dialog, int which)
|
||||
{
|
||||
callback.select(_layout_names.get(which));
|
||||
String name = get_layout_names(getContext().getResources()).get(which);
|
||||
switch (name)
|
||||
{
|
||||
case "system":
|
||||
callback.select(new SystemLayout());
|
||||
break;
|
||||
case "custom":
|
||||
select_custom(callback);
|
||||
break;
|
||||
default:
|
||||
callback.select(new NamedLayout(name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
void select_custom(final SelectionCallback callback)
|
||||
{
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setView(R.layout.dialog_edit_text)
|
||||
.setTitle(R.string.pref_custom_layout_title)
|
||||
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener(){
|
||||
public void onClick(DialogInterface dialog, int _which)
|
||||
{
|
||||
EditText input = (EditText)((AlertDialog)dialog).findViewById(R.id.text);
|
||||
callback.select(new CustomLayout(input.getText().toString()));
|
||||
}
|
||||
})
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
class LayoutsAddButton extends AddButton
|
||||
{
|
||||
public LayoutsAddButton(Context ctx)
|
||||
@ -95,4 +181,59 @@ public class LayoutsPreference extends ListGroupPreference<String>
|
||||
setLayoutResource(R.layout.pref_layouts_add_btn);
|
||||
}
|
||||
}
|
||||
|
||||
/** A layout selected by the user. The only implementations are
|
||||
[NamedLayout], [SystemLayout] and [CustomLayout]. */
|
||||
interface Layout {}
|
||||
|
||||
static final class SystemLayout implements Layout
|
||||
{
|
||||
public SystemLayout() {}
|
||||
}
|
||||
|
||||
/** The name of a layout defined in [res/xml]. */
|
||||
static final class NamedLayout implements Layout
|
||||
{
|
||||
public final String name;
|
||||
public NamedLayout(String n) { name = n; }
|
||||
}
|
||||
|
||||
/** The XML description of a custom layout. */
|
||||
static final class CustomLayout implements Layout
|
||||
{
|
||||
public final String xml;
|
||||
public CustomLayout(String c) { xml = c; }
|
||||
}
|
||||
|
||||
/** Named layouts are serialized to strings and custom layouts to JSON
|
||||
objects with a [kind] field. */
|
||||
static class Serializer implements ListGroupPreference.Serializer<Layout>
|
||||
{
|
||||
public Layout load_item(Object obj) throws JSONException
|
||||
{
|
||||
if (obj instanceof String)
|
||||
{
|
||||
String name = (String)obj;
|
||||
if (name.equals("system"))
|
||||
return new SystemLayout();
|
||||
return new NamedLayout(name);
|
||||
}
|
||||
JSONObject obj_ = (JSONObject)obj;
|
||||
switch (obj_.getString("kind"))
|
||||
{
|
||||
case "custom": return new CustomLayout(obj_.getString("xml"));
|
||||
case "system": default: return new SystemLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public Object save_item(Layout v) throws JSONException
|
||||
{
|
||||
if (v instanceof NamedLayout)
|
||||
return ((NamedLayout)v).name;
|
||||
if (v instanceof CustomLayout)
|
||||
return new JSONObject().put("kind", "custom")
|
||||
.put("xml", ((CustomLayout)v).xml);
|
||||
return new JSONObject().put("kind", "system");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user