Add option to disable pin entry layout

The pin entry layout might be inferior for some usecases and people
might be more used to the numeric layout.
This commit is contained in:
Jules Aguillon 2023-07-29 17:29:45 +02:00
parent d1f0d5a7bf
commit fce8ff7ce2
19 changed files with 51 additions and 9 deletions

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Jak bude klávesa pro přepnutí klávesnice reagovat</string>
<string name="pref_vibrate_title">Vibrace</string>
<string name="pref_vibrate_summary">Preference intenzity vibrací při stisku klávesy</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Styl</string>
<string name="pref_margin_bottom_title">Spodní odsazení</string>
<string name="pref_keyboard_height_title">Výška klávesnice</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Verhalten der Tastaturumschalttaste</string>
<string name="pref_vibrate_title">Vibration</string>
<string name="pref_vibrate_summary">Vibration bei Tastendruck ein-/ausschalten</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Design</string>
<string name="pref_margin_bottom_title">Unterer Abstand</string>
<string name="pref_keyboard_height_title">Höhe der Tastatur</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Comportamiento de la tecla para cambiar formatos</string>
<string name="pref_vibrate_title">Vibración</string>
<string name="pref_vibrate_summary">Habilitar/deshabilitar vibración al presionar una tecla</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Estilo</string>
<string name="pref_margin_bottom_title">Margen del pie</string>
<string name="pref_keyboard_height_title">Altura del teclado</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">رفتار کلید تغییردهنده صفحه کلید</string>
<string name="pref_vibrate_title">لرزش</string>
<string name="pref_vibrate_summary">فعال/غیرفعال کردن لرزش در زمان فشار دادن کلیدها</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">سبک</string>
<string name="pref_margin_bottom_title">حاشیه پایین</string>
<string name="pref_keyboard_height_title">ارتفاع صفحه کلید</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Comportement de la touche de changement de clavier</string>
<string name="pref_vibrate_title">Vibreur</string>
<string name="pref_vibrate_summary">Vibration a chaque touche</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Style</string>
<string name="pref_margin_bottom_title">Marge du bas</string>
<string name="pref_keyboard_height_title">Hauteur du clavier</string>

View File

@ -45,6 +45,8 @@
<!-- <string name="pref_switch_input_immediate_summary">Behavior of the keyboard-switching key</string> -->
<string name="pref_vibrate_title">Vibrazione</string>
<string name="pref_vibrate_summary">Abilita/Disabilita Vibrazione alla pressione dei tasti</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Stile</string>
<string name="pref_margin_bottom_title">Margine inferiore</string>
<string name="pref_keyboard_height_title">Altezza tastiera</string>

View File

@ -45,6 +45,8 @@
<!-- <string name="pref_switch_input_immediate_summary">Behavior of the keyboard-switching key</string> -->
<string name="pref_vibrate_title">진동</string>
<string name="pref_vibrate_summary">키 누를 때 진동 키거/끄기</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">스타일</string>
<string name="pref_margin_bottom_title">아래 넓이</string>
<string name="pref_keyboard_height_title">키보드 높이</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Tastatūras pārslēgšanas taustiņa uzvedība</string>
<string name="pref_vibrate_title">Trīcēšana</string>
<string name="pref_vibrate_summary">Iespējot/atspējot taustiņa piespiešanas trīcēšanu</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Izskata pielāgojumi</string>
<string name="pref_margin_bottom_title">Apakšējā apmale</string>
<string name="pref_keyboard_height_title">Tastatūras augstums</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Działanie klawisza przełączającego klawiaturę</string>
<string name="pref_vibrate_title">Wibracje</string>
<string name="pref_vibrate_summary">Wł./wył. wibrację przy naciśnięciu klawisza</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Styl</string>
<string name="pref_margin_bottom_title">Margines dolny</string>
<string name="pref_keyboard_height_title">Wysokość klawiatury</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Comportamento da tecla de troca de teclado</string>
<string name="pref_vibrate_title">Vibração</string>
<string name="pref_vibrate_summary">Ativar/desativar vibração ao digitar</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Estilo</string>
<string name="pref_margin_bottom_title">Margem inferior</string>
<string name="pref_keyboard_height_title">Altura do teclado</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Comportamentul tastei pentru schimbarea tastaturii</string>
<string name="pref_vibrate_title">Vibrație</string>
<string name="pref_vibrate_summary">Activați/dezactivați vibrația la apăsarea tastelor</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Stil</string>
<string name="pref_margin_bottom_title">Marginea de jos</string>
<string name="pref_keyboard_height_title">Înălțimea tastaturii</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Поведение клавиши переключения клавиатуры</string>
<string name="pref_vibrate_title">Вибрация</string>
<string name="pref_vibrate_summary">Включение/выключение вибрации при нажатии клавиши</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Стиль</string>
<string name="pref_margin_bottom_title">Нижняя граница поля</string>
<string name="pref_keyboard_height_title">Высота клавиатуры</string>

View File

@ -45,6 +45,8 @@
<!-- <string name="pref_switch_input_immediate_summary">Behavior of the keyboard-switching key</string> -->
<string name="pref_vibrate_title">Titreşim</string>
<string name="pref_vibrate_summary">Tuşa basıldığında titreşimi etkinleştir</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Stil</string>
<string name="pref_margin_bottom_title">Alt boşluk</string>
<string name="pref_keyboard_height_title">Klavye yüksekliği</string>

View File

@ -47,6 +47,8 @@
<!-- <string name="pref_switch_input_immediate_summary">Behavior of the keyboard-switching key</string> -->
<string name="pref_vibrate_title">Sự rung</string>
<string name="pref_vibrate_summary">Bật/tắt rung khi nhấn</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">Kiểu cách</string>
<string name="pref_margin_bottom_title">Căn lề dưới</string>
<string name="pref_keyboard_height_title">Chiều cao bàn phím</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">切换键盘按钮的行为</string>
<string name="pref_vibrate_title">振动</string>
<string name="pref_vibrate_summary">启用或者禁用按下按键时振动</string>
<!-- <string name="pref_pin_entry_enabled_title">Pin entry layout</string> -->
<!-- <string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string> -->
<string name="pref_category_style">样式</string>
<string name="pref_margin_bottom_title">键盘下边距</string>
<string name="pref_keyboard_height_title">键盘高度</string>

View File

@ -45,6 +45,8 @@
<string name="pref_switch_input_immediate_summary">Behavior of the keyboard-switching key</string>
<string name="pref_vibrate_title">Vibration</string>
<string name="pref_vibrate_summary">Enable/disable vibration on keypress</string>
<string name="pref_pin_entry_enabled_title">Pin entry layout</string>
<string name="pref_pin_entry_enabled_summary">When typing numbers, dates and phone numbers</string>
<string name="pref_category_style">Style</string>
<string name="pref_margin_bottom_title">Margin bottom</string>
<string name="pref_keyboard_height_title">Keyboard height</string>

View File

@ -22,6 +22,7 @@
<CheckBoxPreference android:key="autocapitalisation" android:title="@string/pref_autocapitalisation_title" android:summary="@string/pref_autocapitalisation_summary" android:defaultValue="true"/>
<CheckBoxPreference android:key="switch_input_immediate" android:title="@string/pref_switch_input_immediate_title" android:summary="@string/pref_switch_input_immediate_summary" android:defaultValue="false"/>
<ListPreference android:key="vibration_behavior" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="system" android:entries="@array/pref_vibration_entries" android:entryValues="@array/pref_vibration_values"/>
<CheckBoxPreference android:key="pin_entry_enabled" android:title="@string/pref_pin_entry_enabled_title" android:summary="@string/pref_pin_entry_enabled_summary" android:defaultValue="true"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_style">
<ListPreference android:key="theme" android:title="@string/pref_theme" android:summary="%s" android:defaultValue="system" android:entries="@array/pref_theme_entries" android:entryValues="@array/pref_theme_values"/>

View File

@ -52,6 +52,7 @@ final class Config
public int theme; // Values are R.style.*
public boolean autocapitalisation;
public boolean switch_input_immediate;
public boolean pin_entry_enabled;
// Dynamically set
public boolean shouldOfferSwitchingToNextInputMethod;
@ -157,6 +158,7 @@ final class Config
switch_input_immediate = _prefs.getBoolean("switch_input_immediate", false);
extra_keys_param = ExtraKeysPreference.get_extra_keys(_prefs);
extra_keys_custom = CustomExtraKeysPreference.get(_prefs);
pin_entry_enabled = _prefs.getBoolean("pin_entry_enabled", true);
}
KeyValue action_key()

View File

@ -71,6 +71,12 @@ public class Keyboard2 extends InputMethodService
return KeyboardData.load(getResources(), layout_id);
}
/** Load a layout that contains a numpad (eg. the pin entry). */
KeyboardData loadNumpad(int layout_id)
{
return _config.modify_numpad(KeyboardData.load(getResources(), layout_id));
}
@Override
public void onCreate()
{
@ -154,7 +160,7 @@ public class Keyboard2 extends InputMethodService
}
}
if (default_layout == null)
default_layout = KeyboardData.load(getResources(), R.xml.latn_qwerty_us);
default_layout = loadLayout(R.xml.latn_qwerty_us);
_localeTextLayout = default_layout;
if (_config.second_layout == null)
{
@ -235,20 +241,21 @@ public class Keyboard2 extends InputMethodService
return null;
}
private void refresh_special_layout(EditorInfo info)
private KeyboardData refresh_special_layout(EditorInfo info)
{
switch (info.inputType & InputType.TYPE_MASK_CLASS)
{
case InputType.TYPE_CLASS_NUMBER:
case InputType.TYPE_CLASS_PHONE:
case InputType.TYPE_CLASS_DATETIME:
_currentSpecialLayout =
_config.modify_numpad(KeyboardData.load(getResources(), R.xml.pin));
break;
if (_config.pin_entry_enabled)
return loadNumpad(R.xml.pin);
else
return loadNumpad(R.xml.numeric);
default:
_currentSpecialLayout = null;
break;
}
return null;
}
@Override
@ -256,7 +263,7 @@ public class Keyboard2 extends InputMethodService
{
refresh_config();
refresh_action_label(info);
refresh_special_layout(info);
_currentSpecialLayout = refresh_special_layout(info);
_keyboardView.setKeyboard(current_layout());
_keyeventhandler.started(info);
setInputView(_keyboardView);
@ -382,7 +389,7 @@ public class Keyboard2 extends InputMethodService
break;
case SWITCH_NUMERIC:
setSpecialLayout(_config.modify_numpad(loadLayout(R.xml.numeric)));
setSpecialLayout(loadNumpad(R.xml.numeric));
break;
case SWITCH_EMOJI:
@ -422,7 +429,7 @@ public class Keyboard2 extends InputMethodService
break;
case SWITCH_GREEKMATH:
setSpecialLayout(_config.modify_numpad(loadLayout(R.xml.greekmath)));
setSpecialLayout(loadNumpad(R.xml.greekmath));
break;
case CAPS_LOCK: