Compare commits

..
12 Commits
Author SHA1 Message Date
Jules Aguillon a7d73ebd8a Release 1.31.1 (48)
Check layouts / Generated files (push) Has been cancelled
Check layouts / check_layout.output (push) Has been cancelled
Check translations / check-translations (push) Has been cancelled
Make Apk CI / Build-Apk (push) Has been cancelled
2025-03-29 15:09:38 +01:00
Jules Aguillon 0acf66d455 Restore previous swipe sensibility
The distance at which a swipe was considered successful was reduced in
188c682 to allow making circle gestures on a key that also had a slider.
It was also useful in reducing accidental sliding.

This is impractical for normal typing so it is reverted. The reduced
range continues to be used for sliders.
2025-03-29 12:04:36 +01:00
Jules Aguillon 85c73d9f62 CONTRIBUTING.md: Update section on srcs/compose 2025-03-29 11:21:50 +01:00
Jules Aguillon 58dabfaa07 Fix emoji flag group missing
Off by one error when parsing the emoji groups.
2025-03-28 00:27:44 +01:00
Haley Halcyon 3d7925340b Update latn_qwerty_jp.xml (#962)
Add macron, used in rōmaji for long vowels
2025-03-28 00:04:31 +01:00
Jules Aguillon e746ccd5d0 Place editing keys on the bottom-right of Z/X/C/V
The code is changed to ensure that extra keys all use a consistent
location.
2025-03-27 23:49:49 +01:00
Jules AguillonandJoey Schaff 6541054cce Remove symbols from the number row by default (#964)
The number row option is changed into a ListPreference and controls whether the number row contains symbols or not.

Co-authored-by: Joey Schaff <j@jaoh.xyz>
2025-03-27 23:25:32 +01:00
Spike 3971f6243c Possible-key-values.md—Note syntax change for slider (#958)
The non-backward-compatible change to the XML should be mentioned as users must revise their layouts.
2025-03-27 22:50:34 +01:00
Jules Aguillon 6c40e0604a Add a preferred position for selectAll 2025-03-23 14:58:11 +01:00
Jules Aguillon 1d6a115ce4 Add link to Weblate on the README 2025-03-22 16:32:57 +01:00
Jules Aguillon 6717613b5e Fix label brightness not being applied
This is due to Paint.setColor overriding any alpha value set with
Paint.setAlpha. Bug was added in 653c598.
2025-03-22 12:25:59 +01:00
Joey Schaff 35219a458a Swapping the default placement of ! and | on the Colemak layout (#949)
Swapped placement of ! and | to make it more reasonable.
2025-03-22 11:46:52 +01:00
38 changed files with 229 additions and 115 deletions
+39 -11
View File
@@ -190,18 +190,46 @@ As translations need to be updated regularly, you can subscribe to this issue
to receive a notification when an update is needed:
https://github.com/Julow/Unexpected-Keyboard/issues/373
### Adding Compose key sequences
### Adding symbols to Shift, Fn, Compose and other modifiers
New Compose sequences can be added into `srcs/compose/compose/extra.json`.
If a entirely new family of sequences were to be added, a new `.json` file can
be created in the same directory to host them.
New key combinations can be added to builtin modifiers in the following files:
### Adding key combinations
- Shift in `srcs/compose/shift.json`.
- Fn in `srcs/compose/fn.json`.
- Compose in `srcs/compose/compose/extra.json`.
- Other modifiers are defined in the `accent_*.json` files in `srcs/compose`.
Key combinations are defined in `srcs/juloo.keyboard2/KeyModifier.java`.
For example, keys modified by the `Fn` key are defined in method
`apply_fn_char`.
Generated code must then be updated by running:
Keys with special meaning are defined in `KeyValue.java` in method
`getKeyByName`. Their special action are defined in `KeyEventHandler.java` in
method `key_up`
```
./gradlew compileComposeSequences
```
These files describe each symbols that get transformed when a given modifier is
activated, in JSON format. For example:
Example from `fn.json`, when `Fn` is activated, `<` becomes `«`:
```json
{
"<": "«",
}
```
The result of a sequence can be a key name. See the list of key names in
[doc/Possible-key-values.md](doc/Possible-key-values.md). For example from
`fn.json`, when `Fn` is activated, space becomes `nbsp`:
```json
{
" ": "nbsp",
}
```
Compose sequences are made of several steps. For example, the sequence
`Compose V s = Š` is defined as:
```json
{
"V": {
"s": "Š"
}
}
```
+8 -1
View File
@@ -1,4 +1,4 @@
# Unexpected Keyboard
# Unexpected Keyboard [<img src="https://hosted.weblate.org/widget/unexpected-keyboard/svg-badge.svg" alt="État de la traduction" />](https://hosted.weblate.org/engage/unexpected-keyboard/)
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
@@ -24,7 +24,14 @@ Usage: to apply the symbols located in the corners of each key, slide your finge
| --- | --- | --- |
| <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" alt="Screenshot-4" /> | <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" alt="Screenshot-5" /> | <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png" alt="Screenshot-6" /> |
## Help translate the application
Improve the application translations [using Weblate](https://hosted.weblate.org/engage/unexpected-keyboard/).
[<img src="https://hosted.weblate.org/widget/unexpected-keyboard/multi-auto.svg" alt="État de la traduction" />](https://hosted.weblate.org/engage/unexpected-keyboard/)
## Similar apps
* [Calculator++](https://git.bubu1.eu/Bubu/android-calculatorpp) - Calculator with a similar UX, swipe to corners for advanced math symbols and operators.
## Contributing
+2 -2
View File
@@ -14,8 +14,8 @@ android {
applicationId "juloo.keyboard2"
minSdk 21
targetSdkVersion 35
versionCode 47
versionName "1.31.0"
versionCode 48
versionName "1.31.1"
}
sourceSets {
+2
View File
@@ -95,6 +95,8 @@ Value | Meaning
`delete_word` | Delete the word to the left of the cursor.
`forward_delete_word` | Delete the word to the right of the cursor.
The values with `cursor_` are new in v1.31.0. Previous custom layouts specified the slider with `slider="true"`, which should be removed.
## Whitespace
Value | Meaning
:------ | :------
@@ -4,3 +4,5 @@ Improved space bar slider and added selection mode.
Lock shift with a circle gesture.
Improvements to layouts.
Various bug fixes and improvements to themes.
Huge thanks to the contributors: @0skar2 @chuckwagoncomputing @dzaima @eandersons Lokesh Kumar @lrvideckis @ms-jagadeeshan @quantenzitrone @Sestowner @solokot @Spike-from-NH @srikanban @tenextractor
@@ -0,0 +1,9 @@
Bug fixes
Delete a word with a circle gesture on the delete key.
Compose key can be unselected.
Improved space bar slider and added selection mode.
Lock shift with a circle gesture.
Various bug fixes and improvements to themes and layouts.
Many thanks to the contributors: @HaleyHalcyon @Jaoheah @Spike-from-NH
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Rozložení %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Odebrat rozložení</string>
<string name="pref_custom_layout_title">Vlastní rozložení</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Layout %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Layout entfernen</string>
<string name="pref_custom_layout_title">Eigenes Layout</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Diseño %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Quitar diseño</string>
<string name="pref_custom_layout_title">Diseño personalizado</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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">Solo en modo horizontal</string>
+3
View File
@@ -18,6 +18,9 @@
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
<!-- <string name="pref_layouts_remove_custom">Remove layout</string> -->
<string name="pref_custom_layout_title">طرح شخصی</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">نمایش پد شماره‌ها</string>
<string name="pref_show_numpad_never">هرگز</string>
<string name="pref_show_numpad_landscape">فقط در حالت افقی</string>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Disposition %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Supprimer</string>
<string name="pref_custom_layout_title">Disposition personnalisée</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
<!-- <string name="pref_layouts_remove_custom">Remove layout</string> -->
<!-- <string name="pref_custom_layout_title">Custom layout</string> -->
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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> -->
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">レイアウト %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">レイアウトを削除</string>
<string name="pref_custom_layout_title">カスタムレイアウト</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">テンキーを表示</string>
<string name="pref_show_numpad_never">表示しない</string>
<string name="pref_show_numpad_landscape">横向きの時は表示</string>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">레이아웃 %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">레이아웃 제거</string>
<string name="pref_custom_layout_title">사용자 정의 레이아웃</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">NumPad 표시</string>
<string name="pref_show_numpad_never">안 함</string>
<string name="pref_show_numpad_landscape">가로 모드에서만</string>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Izkārtojums %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Noņemt izkārtojumu</string>
<string name="pref_custom_layout_title">Pielāgots izkārtojums</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Układ %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Usuń układ</string>
<string name="pref_custom_layout_title">Własny układ</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Layout %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Remover layout</string>
<string name="pref_custom_layout_title">Layout personalizado</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
<!-- <string name="pref_layouts_remove_custom">Remove layout</string> -->
<string name="pref_custom_layout_title">Aranjament personalizat</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Раскладка %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Удалить раскладку</string>
<string name="pref_custom_layout_title">Пользовательская раскладка</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">Показывать цифровой блок</string>
<string name="pref_show_numpad_never">Никогда</string>
<string name="pref_show_numpad_landscape">Только в ландшафтном режиме</string>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Tuş düzeni %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Tuş düzenini kaldır</string>
<string name="pref_custom_layout_title">Özel tuş düzeni</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">NumPadi göster</string>
<string name="pref_show_numpad_never">Asla</string>
<string name="pref_show_numpad_landscape">Sadece manzara modunda</string>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Макет %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Видалити макет</string>
<string name="pref_custom_layout_title">Власний макет</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">Показувати числову клавіатуру</string>
<string name="pref_show_numpad_never">Ніколи</string>
<string name="pref_show_numpad_landscape">Тільки в альбомному режимі</string>
+3
View File
@@ -18,6 +18,9 @@
<!-- <string name="pref_layouts_item">Layout %1$d: %2$s</string> -->
<!-- <string name="pref_layouts_remove_custom">Remove layout</string> -->
<string name="pref_custom_layout_title">Tùy chỉnh bố cục</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</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>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">布局 %1$d:%2$s</string>
<string name="pref_layouts_remove_custom">移除布局</string>
<string name="pref_custom_layout_title">自定义布局</string>
<!-- <string name="pref_show_number_row_no_number_row">No number row</string> -->
<!-- <string name="pref_show_number_row_no_symbols">Number row without symbols</string> -->
<!-- <string name="pref_show_number_row_symbols">Number row with symbols</string> -->
<string name="pref_show_numpad_title">显示数字小键盘</string>
<string name="pref_show_numpad_never">从不</string>
<string name="pref_show_numpad_landscape">只在横屏显示</string>
+10
View File
@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="pref_show_number_row_values">
<item>no_number_row</item>
<item>no_symbols</item>
<item>symbols</item>
</string-array>
<string-array name="pref_show_number_row_entries">
<item>@string/pref_show_number_row_no_number_row</item>
<item>@string/pref_show_number_row_no_symbols</item>
<item>@string/pref_show_number_row_symbols</item>
</string-array>
<string-array name="pref_show_numpad_values">
<item>never</item>
<item>landscape</item>
+3
View File
@@ -18,6 +18,9 @@
<string name="pref_layouts_item">Layout %1$d: %2$s</string>
<string name="pref_layouts_remove_custom">Remove layout</string>
<string name="pref_custom_layout_title">Custom layout</string>
<string name="pref_show_number_row_no_number_row">No number row</string>
<string name="pref_show_number_row_no_symbols">Number row without symbols</string>
<string name="pref_show_number_row_symbols">Number row with symbols</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>
+11 -10
View File
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- See [number_row_no_symbols.xml] for the number row with no symbols. -->
<row height="0.75">
<key key0="1" se="!"/>
<key key0="2" se="@"/>
<key key0="3" se="#"/>
<key key0="4" se="$"/>
<key key0="5" se="%"/>
<key key0="6" sw="^"/>
<key key0="7" sw="&amp;"/>
<key key0="8" sw="*"/>
<key key0="9" sw="("/>
<key key0="0" sw=")"/>
<key key0="1" se="!"/>
<key key0="2" se="@"/>
<key key0="3" se="#"/>
<key key0="4" se="$"/>
<key key0="5" se="%"/>
<key key0="6" sw="^"/>
<key key0="7" sw="&amp;"/>
<key key0="8" sw="*"/>
<key key0="9" sw="("/>
<key key0="0" sw=")"/>
</row>
+13
View File
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<row height="0.75">
<key key0="1"/>
<key key0="2"/>
<key key0="3"/>
<key key0="4"/>
<key key0="5"/>
<key key0="6"/>
<key key0="7"/>
<key key0="8"/>
<key key0="9"/>
<key key0="0"/>
</row>
+1 -1
View File
@@ -8,7 +8,7 @@
</PreferenceCategory>
<juloo.keyboard2.prefs.ExtraKeysPreference android:title="@string/pref_extra_keys_internal"/>
</PreferenceScreen>
<CheckBoxPreference android:key="number_row" android:title="@string/pref_number_row_title" android:summary="@string/pref_number_row_summary" android:defaultValue="false"/>
<ListPreference android:key="number_row" android:title="@string/pref_number_row_title" android:summary="%s" android:defaultValue="no_number_row" android:entries="@array/pref_show_number_row_entries" android:entryValues="@array/pref_show_number_row_values"/>
<ListPreference android:key="show_numpad" android:title="@string/pref_show_numpad_title" android:summary="%s" android:defaultValue="1" android:entries="@array/pref_show_numpad_entries" android:entryValues="@array/pref_show_numpad_values"/>
<ListPreference android:key="numpad_layout" android:title="@string/pref_numpad_layout" android:summary="%s" android:defaultValue="high_first" android:entries="@array/pref_numpad_layout_entries" android:entryValues="@array/pref_numpad_layout_values"/>
</PreferenceCategory>
+11 -3
View File
@@ -30,6 +30,7 @@ public final class Config
// From the 'numpad_layout' option, also apply to the numeric pane.
public boolean inverse_numpad = false;
public boolean add_number_row;
public boolean number_row_symbols;
public float swipe_dist_px;
public float slide_step_px;
// Let the system handle vibration when false.
@@ -122,7 +123,9 @@ public final class Config
}
layouts = LayoutsPreference.load_from_preferences(res, _prefs);
inverse_numpad = _prefs.getString("numpad_layout", "default").equals("low_first");
add_number_row = _prefs.getBoolean("number_row", false);
String number_row = _prefs.getString("number_row", "no_number_row");
add_number_row = !number_row.equals("no_number_row");
number_row_symbols = number_row.equals("symbols");
// The baseline for the swipe distance correspond to approximately the
// width of a key in portrait mode, as most layouts have 10 columns.
// Multipled by the DPI ratio because most swipes are made in the diagonals.
@@ -272,7 +275,7 @@ public final class Config
/** Config migrations. */
private static int CONFIG_VERSION = 1;
private static int CONFIG_VERSION = 2;
public static void migrate(SharedPreferences prefs)
{
@@ -284,7 +287,7 @@ public final class Config
e.putInt("version", CONFIG_VERSION);
// Migrations might run on an empty [prefs] for new installs, in this case
// they set the default values of complex options.
switch (saved_version) // Fallback switch
switch (saved_version)
{
case 0:
// Primary, secondary and custom layout options are merged into the new
@@ -298,7 +301,12 @@ public final class Config
if (custom_layout != null && !custom_layout.equals(""))
l.add(LayoutsPreference.CustomLayout.parse(custom_layout));
LayoutsPreference.save_to_preferences(e, l);
// Fallthrough
case 1:
boolean add_number_row = prefs.getBoolean("number_row", false);
e.putString("number_row", add_number_row ? "no_symbols" : "no_number_row");
// Fallthrough
case 2:
default: break;
}
e.apply();
+8 -2
View File
@@ -51,8 +51,14 @@ public class Emoji
if ((line = reader.readLine()) != null)
{
String[] tokens = line.split(" ");
for (int i = 0; i < tokens.length-1; i++)
_groups.add(_all.subList(Integer.parseInt(tokens[i]), Integer.parseInt(tokens[i+1])));
int last = 0;
for (int i = 1; i < tokens.length; i++)
{
int next = Integer.parseInt(tokens[i]);
_groups.add(_all.subList(last, next));
last = next;
}
_groups.add(_all.subList(last, _all.size()));
}
}
catch (IOException e) { Logs.exn("Emoji.init() failed", e); }
+2 -4
View File
@@ -441,8 +441,7 @@ public class Keyboard2View extends View
if (kv == null)
return;
float textSize = scaleTextSize(kv, _config.labelTextSize, keyH);
Paint p = tc.label_paint(kv.hasFlagsAny(KeyValue.FLAG_KEY_FONT), textSize);
p.setColor(labelColor(kv, isKeyDown, false));
Paint p = tc.label_paint(kv.hasFlagsAny(KeyValue.FLAG_KEY_FONT), labelColor(kv, isKeyDown, false), textSize);
canvas.drawText(kv.getString(), x, (keyH - p.ascent() - p.descent()) / 2f + y, p);
}
@@ -456,8 +455,7 @@ public class Keyboard2View extends View
if (kv == null)
return;
float textSize = scaleTextSize(kv, _config.sublabelTextSize, keyH);
Paint p = tc.sublabel_paint(kv.hasFlagsAny(KeyValue.FLAG_KEY_FONT), textSize, a);
p.setColor(labelColor(kv, isKeyDown, true));
Paint p = tc.sublabel_paint(kv.hasFlagsAny(KeyValue.FLAG_KEY_FONT), labelColor(kv, isKeyDown, true), textSize, a);
float subPadding = _config.keyPadding;
if (v == Vertical.CENTER)
y += (keyH - p.ascent() - p.descent()) / 2f;
+2 -7
View File
@@ -177,14 +177,9 @@ public final class KeyboardData
private static Map<Integer, KeyboardData> _layoutCache = new HashMap<Integer, KeyboardData>();
public static Row load_bottom_row(Resources res) throws Exception
public static Row load_row(Resources res, int res_id) throws Exception
{
return parse_row(res.getXml(R.xml.bottom_row));
}
public static Row load_number_row(Resources res) throws Exception
{
return parse_row(res.getXml(R.xml.number_row));
return parse_row(res.getXml(res_id));
}
public static KeyboardData load_num_pad(Resources res) throws Exception
+6 -4
View File
@@ -11,7 +11,8 @@ public final class LayoutModifier
{
static Config globalConfig;
static KeyboardData.Row bottom_row;
static KeyboardData.Row number_row;
static KeyboardData.Row number_row_no_symbols;
static KeyboardData.Row number_row_symbols;
static KeyboardData num_pad;
/** Update the layout according to the configuration.
@@ -44,7 +45,7 @@ public final class LayoutModifier
}
else if (globalConfig.add_number_row && !kw.embedded_number_row) // The numpad removes the number row
{
added_number_row = modify_number_row(number_row, kw);
added_number_row = modify_number_row(globalConfig.number_row_symbols ? number_row_symbols : number_row_no_symbols, kw);
remove_keys.addAll(added_number_row.getKeys(0).keySet());
}
// Add the bottom row before computing the extra keys
@@ -204,8 +205,9 @@ public final class LayoutModifier
globalConfig = globalConfig_;
try
{
number_row = KeyboardData.load_number_row(res);
bottom_row = KeyboardData.load_bottom_row(res);
number_row_no_symbols = KeyboardData.load_row(res, R.xml.number_row_no_symbols);
number_row_symbols = KeyboardData.load_row(res, R.xml.number_row);
bottom_row = KeyboardData.load_row(res, R.xml.bottom_row);
num_pad = KeyboardData.load_num_pad(res);
}
catch (Exception e)
+12 -4
View File
@@ -219,7 +219,7 @@ public final class Pointers implements Handler.Callback
* [direction] is an int between [0] and [15] that represent 16 sections of a
* circle, clockwise, starting at the top.
*/
KeyValue getKeyAtDirection(KeyboardData.Key k, int direction)
static KeyValue getKeyAtDirection(KeyboardData.Key k, int direction)
{
return k.keys[DIRECTION_TO_INDEX[direction]];
}
@@ -234,16 +234,24 @@ public final class Pointers implements Handler.Callback
private KeyValue getNearestKeyAtDirection(Pointer ptr, int direction)
{
KeyValue k;
// [i] is [0, -1, 1, -2, 2], scanning a 1/4 of the circle's area, centered
// on the initial direction.
for (int i = 0; i > -2; i = (~i>>31) - i)
// [i] is [0, -1, +1, ..., -3, +3], scanning 43% of the circle's area,
// centered on the initial swipe direction.
for (int i = 0; i > -4; i = (~i>>31) - i)
{
int d = (direction + i + 16) % 16;
// Don't make the difference between a key that doesn't exist and a key
// that is removed by [_handler]. Triggers side effects.
k = _handler.modifyKey(getKeyAtDirection(ptr.key, d), ptr.modifiers);
if (k != null)
{
// When the nearest key is a slider, it is only selected if it's placed
// within 18% of the original swipe direction.
// This reduces accidental swipes on the slider and allow typing circle
// gestures without being interrupted by the slider.
if (k.getKind() == KeyValue.Kind.Slider && Math.abs(i) >= 2)
continue;
return k;
}
}
return null;
}
+6 -3
View File
@@ -126,6 +126,7 @@ public class Theme
final Paint _special_label_paint;
final Paint _sublabel_paint;
final Paint _special_sublabel_paint;
final int _label_alpha_bits;
public Key(Theme theme, Config config, float keyWidth, boolean activated)
{
@@ -149,18 +150,21 @@ public class Theme
_special_label_paint = init_label_paint(config, _key_font);
_sublabel_paint = init_label_paint(config, null);
_special_sublabel_paint = init_label_paint(config, _key_font);
_label_alpha_bits = (config.labelBrightness & 0xFF) << 24;
}
public Paint label_paint(boolean special_font, float text_size)
public Paint label_paint(boolean special_font, int color, float text_size)
{
Paint p = special_font ? _special_label_paint : _label_paint;
p.setColor((color & 0x00FFFFFF) | _label_alpha_bits);
p.setTextSize(text_size);
return p;
}
public Paint sublabel_paint(boolean special_font, float text_size, Paint.Align align)
public Paint sublabel_paint(boolean special_font, int color, float text_size, Paint.Align align)
{
Paint p = special_font ? _special_sublabel_paint : _sublabel_paint;
p.setColor((color & 0x00FFFFFF) | _label_alpha_bits);
p.setTextSize(text_size);
p.setTextAlign(align);
return p;
@@ -181,7 +185,6 @@ public class Theme
{
Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
p.setTextAlign(Paint.Align.CENTER);
p.setAlpha(config.labelBrightness);
if (font != null)
p.setTypeface(font);
return p;
@@ -306,70 +306,38 @@ public class ExtraKeysPreference extends PreferenceCategory
+ KeyValue.getKeyByName(key_name).getString();
}
/** Place an extra key next to the key specified by the first argument, on
bottom-right preferably or on the bottom-left. If the specified key is not
on the layout, place on the specified row and column. */
static KeyboardData.PreferredPos mk_preferred_pos(String next_to_key, int row, int col, boolean prefer_bottom_right)
{
KeyValue next_to = (next_to_key == null) ? null : KeyValue.getKeyByName(next_to_key);
int d1, d2; // Preferred direction and fallback direction
if (prefer_bottom_right) { d1 = 4; d2 = 3; } else { d1 = 3; d2 = 4; }
return new KeyboardData.PreferredPos(next_to,
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(row, col, d1),
new KeyboardData.KeyPos(row, col, d2),
new KeyboardData.KeyPos(row, -1, d1),
new KeyboardData.KeyPos(row, -1, d2),
new KeyboardData.KeyPos(-1, -1, -1),
});
}
static KeyboardData.PreferredPos key_preferred_pos(String key_name)
{
switch (key_name)
{
case "cut":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("x"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(2, 2, 8),
new KeyboardData.KeyPos(2, -1, 8),
new KeyboardData.KeyPos(-1, -1, 8),
});
case "copy":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("c"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(2, 3, 8),
new KeyboardData.KeyPos(2, -1, 8),
new KeyboardData.KeyPos(-1, -1, 8),
});
case "paste":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("v"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(2, 4, 8),
new KeyboardData.KeyPos(2, -1, 8),
new KeyboardData.KeyPos(-1, -1, 8),
});
case "undo":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("z"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(2, 1, 8),
new KeyboardData.KeyPos(2, -1, 8),
new KeyboardData.KeyPos(-1, -1, 8),
});
case "redo":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("y"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(0, -1, 8),
new KeyboardData.KeyPos(-1, -1, 8),
});
case "f11_placeholder":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("9"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(0, 8, 3),
new KeyboardData.KeyPos(0, 8, 4),
new KeyboardData.KeyPos(0, -1, 3),
new KeyboardData.KeyPos(0, -1, 4),
});
case "f12_placeholder":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("0"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(0, 9, 3),
new KeyboardData.KeyPos(0, 9, 4),
new KeyboardData.KeyPos(0, -1, 3),
new KeyboardData.KeyPos(0, -1, 4),
});
case "delete_word":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("backspace"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(-1, -1, 3),
});
case "forward_delete_word":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("backspace"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(-1, -1, 4),
});
case "cut": return mk_preferred_pos("x", 2, 2, true);
case "copy": return mk_preferred_pos("c", 2, 3, true);
case "paste": return mk_preferred_pos("v", 2, 4, true);
case "undo": return mk_preferred_pos("z", 2, 1, true);
case "selectAll": return mk_preferred_pos("a", 1, 0, true);
case "redo": return mk_preferred_pos("y", 0, 5, true);
case "f11_placeholder": return mk_preferred_pos("9", 0, 8, false);
case "f12_placeholder": return mk_preferred_pos("0", 0, 9, false);
case "delete_word": return mk_preferred_pos("backspace", -1, -1, false);
case "forward_delete_word": return mk_preferred_pos("backspace", -1, -1, true);
}
return KeyboardData.PreferredPos.DEFAULT;
}
+2 -2
View File
@@ -6,7 +6,7 @@
<key key0="w" key1="loc accent_grave" key2=" ́" key3="~" />
<key key0="f" key1="`" key2="-" key3="+" />
<key key0="p" key2="=" key3="%"/>
<key key0="g" key1="!" key2="/" key3="\\"/>
<key key0="g" key1="|" key2="/" key3="\\"/>
<key key0="j" key1="loc accent_caron" key2="loc accent_trema" />
<key key0="l"/>
<key key0="u" key1="loc accent_double_aigu" key2="loc accent_ring" />
@@ -34,7 +34,7 @@
<key key0="v" key1="[" key2="]"/>
<key key0="b" key1="(" key2=")"/>
<key key0="k" key1=";" key2=":"/>
<key key0="m" key1="|" key2="\?" />
<key key0="m" key1="!" key2="\?" />
<key key0="backspace" key1="delete" shift="0.25" width="1.25"/>
</row>
+1 -1
View File
@@ -9,7 +9,7 @@
<key key0="y" key2="6" key3="&amp;"/>
<key key0="u" key2="7" key3="'"/>
<key key0="i" key2="8" key3="(" key4=")"/>
<key key0="o" key1="=" key2="9" key3="-"/>
<key key0="o" key1="=" key2="9" key3="-" key4="accent-macron"/>
<key key0="p" key1="~" key2="0" key3="^"/>
</row>
<row>