Allow more than 2 layouts

The two layout selection options are replaced by a ListGroupPreference
that allow to enter an arbitrary amount of layouts.

The "switch_second" and "switch_second_back" keys are replaced by
"switch_forward" and "switch_backward", which allow to cycle through the
selected layouts in two directions.

Layouts are changed to place these two key on the space bar.
The backward key is not shown if there's only two layouts.
This commit is contained in:
Jules Aguillon
2023-07-29 18:37:06 +02:00
parent 818aa4c7d5
commit dad5f57a03
28 changed files with 172 additions and 85 deletions

View File

@ -54,10 +54,10 @@ def generate_arrays(out, layouts):
item.text = s
elem.append(item)
return elem
none_item = [ ("none", "None") ]
none_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
ids_items = map(lambda s: "@xml/%s" % s if s not in ["none", "custom"] else "-1", values_items)
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."))
root.append(mk_array("string-array", "pref_layout_values", values_items))