From 51b330c6168a8b0e0c16482254d4674fbe5476c7 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 13 Nov 2022 00:24:23 +0100 Subject: Allow switching quickly between two layouts A new option allow to choose a secondary layout, the switching key is placed on the top edge of the space bar. The "Programming layout" option was basically doing that but it was possible to choose from a few layouts only. It is improved and renamed. The 'LayoutListPreference' allows setting the string for the first entry but otherwise share the rest of the array. Add nice icons from materialdesignicons. --- srcs/juloo.keyboard2/Keyboard2.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'srcs/juloo.keyboard2/Keyboard2.java') diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 7bf9812..d2fdb2c 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -157,9 +157,9 @@ public class Keyboard2 extends InputMethodService refreshAccentsOption(imm, subtype); } } - _config.shouldOfferSwitchingToProgramming = - _config.programming_layout != -1 && - _currentTextLayout != _config.programming_layout; + _config.shouldOfferSwitchingToSecond = + _config.second_layout != -1 && + _currentTextLayout != _config.second_layout; } private String actionLabel_of_imeAction(int action) @@ -343,17 +343,17 @@ public class Keyboard2 extends InputMethodService _keyboardView.setKeyboard(getLayout(R.xml.greekmath)); } - public void switchProgramming() + public void switchSecond() { - if (_config.programming_layout == -1) + if (_config.second_layout == -1) return; KeyboardData layout = - getLayout(_config.programming_layout).mapKeys(new KeyboardData.MapKeyValues() { + getLayout(_config.second_layout).mapKeys(new KeyboardData.MapKeyValues() { public KeyValue apply(KeyValue key, boolean localized) { if (key.getKind() == KeyValue.Kind.Event - && key.getEvent() == KeyValue.Event.SWITCH_PROGRAMMING) - return KeyValue.getKeyByName("switch_text"); + && key.getEvent() == KeyValue.Event.SWITCH_SECOND) + return KeyValue.getKeyByName("switch_second_back"); return key; } }); -- cgit v1.2.3