Compare commits

..

4 Commits

Author SHA1 Message Date
Jules Aguillon
65cc0c736e Release 1.14.2 (21) 2022-04-16 23:43:25 +02:00
Jules Aguillon
2cce0fed67 Makefile: Pass -r to adb install
Fails to update on some versions of Android without it.
2022-04-16 23:38:16 +02:00
Jules Aguillon
9a8c4f291d Fix compatibility with Android 6
Android 6 uses Java 1.7, the only incompatible feature in use was
lambdas.
2022-04-16 23:36:54 +02:00
marciozomb13
14cc318a0e Update PT strings (#121)
Tiny fixes and improvements.
2022-04-16 23:17:17 +02:00
7 changed files with 58 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="20" android:versionName="1.14.1" android:hardwareAccelerated="false">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="21" android:versionName="1.14.2" android:hardwareAccelerated="false">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="30"/>
<application android:label="@string/app_name" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:hardwareAccelerated="false">
<service android:name="juloo.keyboard2.Keyboard2" android:label="@string/app_name" android:permission="android.permission.BIND_INPUT_METHOD">

View File

@@ -3,7 +3,7 @@
PACKAGE_NAME = juloo.keyboard2
ANDROID_PLATFORM_VERSION = android-30
JAVA_VERSION = 1.8
JAVA_VERSION = 1.7
SRC_DIR = srcs
RES_DIR = res
@@ -16,7 +16,7 @@ debug: _build/$(PACKAGE_NAME).debug.apk
release: _build/$(PACKAGE_NAME).apk
installd: _build/$(PACKAGE_NAME).debug.apk
adb install "$<"
adb install -r "$<"
clean:
rm -rf _build/*.dex _build/class _build/gen _build/*.apk _build/*.unsigned-apk \

View File

@@ -0,0 +1,4 @@
Fix compatibility with Android 6.
Translation improvements.
Huge thanks to the contributors: @marciozomb13

View File

@@ -1,29 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" product="debug">Unexpected Keyboard</string>
<string name="app_name" product="default">Unexpected Keyboard</string>
<string name="settings_activity_label">Configurações Unexpected Keyboard</string>
<string name="pref_category_layout">Layout</string>
<string name="pref_layout_title">Mudar layout do teclado</string>
<string name="pref_layout_e_system">Mesmo do sistema</string>
<string name="pref_accents_title">Acentos</string>
<string name="pref_accents_e_all_installed">Mostrar acentos para todos idiomas instalados</string>
<string name="pref_accents_e_all_installed">Mostrar acentos para todos os idiomas instalados</string>
<string name="pref_accents_e_selected">Mostrar acentos só para o idioma selecionado</string>
<string name="pref_accents_e_all">Mostrar todos acentos</string>
<string name="pref_accents_e_none">Esconder acentos</string>
<string name="pref_accents_e_none">Ocultar acentos</string>
<string name="pref_programming_layout_title">Layout do teclado para programação</string>
<string name="pref_programming_layout_none">Nenhum</string>
<string name="pref_category_typing">Digitação</string>
<string name="pref_swipe_dist_title">Distância a deslizar</string>
<string name="pref_swipe_dist_summary">Distância até acionar os cantos das teclas (%s)</string>
<string name="pref_long_timeout_title">Tempo até repetir tecla</string>
<string name="pref_long_interval_title">Intervalo para repetir tecla</string>
<string name="pref_long_interval_title">Intervalo de repetição de tecla</string>
<string name="pref_category_vibrate">Vibração</string>
<string name="pref_vibrate_title">Vibração</string>
<string name="pref_vibrate_summary">Ativar/desativar vibração ao digitar</string>
<string name="pref_vibrate_duration_title">Duração</string>
<string name="pref_precise_repeat_title">Precisão nos movimentos do cursor</string>
<string name="pref_precise_repeat_summary">Varia a velocidade de repetição ao depender de quanto deslizar</string>
<string name="pref_lockable_keys_title">Segurar teclas</string>
<string name="pref_precise_repeat_summary">Varia a velocidade de repetição a depender do quanto deslizar</string>
<string name="pref_lockable_keys_title">Teclas traváveis</string>
<string name="pref_lockable_keys_summary">Teclas que podem ficar seguradas ao teclar duas vezes</string>
<string name="pref_category_style">Estilo</string>
<string name="pref_margin_bottom_title">Margem de baixo</string>
<string name="pref_margin_bottom_title">Margem inferior</string>
<string name="pref_keyboard_height_title">Altura do teclado</string>
<string name="pref_horizontal_margin_title">Margem horizontal</string>
<string name="pref_character_size_title">Tamanho dos indicadores</string>

View File

@@ -149,34 +149,38 @@ final class Config
public KeyboardData modify_layout(KeyboardData kw)
{
// Update the name to avoid caching in KeyModifier
KeyValue action_key = (actionLabel == null) ? null :
final KeyValue action_key = (actionLabel == null) ? null :
KeyValue.getKeyByName("action").withNameAndSymbol(actionLabel, actionLabel);
return kw.replaceKeys(key -> {
if (key == null)
return null;
switch (key.eventCode)
return kw.replaceKeys(new KeyboardData.MapKeys() {
public KeyValue apply(KeyValue key)
{
case KeyValue.EVENT_CHANGE_METHOD:
return shouldOfferSwitchingToNextInputMethod ? key : null;
case KeyEvent.KEYCODE_ENTER:
return (swapEnterActionKey && action_key != null) ? action_key : key;
case KeyValue.EVENT_ACTION:
return (swapEnterActionKey && action_key != null) ?
KeyValue.getKeyByName("enter") : action_key;
case KeyValue.EVENT_SWITCH_PROGRAMMING:
return shouldOfferSwitchingToProgramming ? key : null;
default:
if (key.flags != 0)
{
if ((key.flags & KeyValue.FLAG_LOCALIZED) != 0 &&
extra_keys != null &&
!extra_keys.contains(key.name))
return null;
if ((key.flags & lockable_modifiers) != 0)
return key.withFlags(key.flags | KeyValue.FLAG_LOCK);
}
return key;
}});
if (key == null)
return null;
switch (key.eventCode)
{
case KeyValue.EVENT_CHANGE_METHOD:
return shouldOfferSwitchingToNextInputMethod ? key : null;
case KeyEvent.KEYCODE_ENTER:
return (swapEnterActionKey && action_key != null) ? action_key : key;
case KeyValue.EVENT_ACTION:
return (swapEnterActionKey && action_key != null) ?
KeyValue.getKeyByName("enter") : action_key;
case KeyValue.EVENT_SWITCH_PROGRAMMING:
return shouldOfferSwitchingToProgramming ? key : null;
default:
if (key.flags != 0)
{
if ((key.flags & KeyValue.FLAG_LOCALIZED) != 0 &&
extra_keys != null &&
!extra_keys.contains(key.name))
return null;
if ((key.flags & lockable_modifiers) != 0)
return key.withFlags(key.flags | KeyValue.FLAG_LOCK);
}
return key;
}
}
});
}
private float getDipPref(DisplayMetrics dm, SharedPreferences prefs, String pref_name, float def)

View File

@@ -294,10 +294,13 @@ public class Keyboard2 extends InputMethodService
if (_config.programming_layout == -1)
return;
KeyboardData layout =
getLayout(_config.programming_layout).replaceKeys(key -> {
if (key != null && key.eventCode == KeyValue.EVENT_SWITCH_PROGRAMMING)
return KeyValue.getKeyByName("switch_text");
return key;
getLayout(_config.programming_layout).replaceKeys(new KeyboardData.MapKeys() {
public KeyValue apply(KeyValue key)
{
if (key != null && key.eventCode == KeyValue.EVENT_SWITCH_PROGRAMMING)
return KeyValue.getKeyByName("switch_text");
return key;
}
});
_keyboardView.setKeyboard(layout);
}

View File

@@ -208,7 +208,10 @@ class KeyboardData
}
}
public static abstract interface MapKeys extends Function<KeyValue, KeyValue> { }
// Not using Function<KeyValue, KeyValue> to keep compatibility with Android 6.
public static abstract interface MapKeys {
public KeyValue apply(KeyValue kv);
}
/** Parsing utils */