Compare commits

...

15 Commits

Author SHA1 Message Date
Jules Aguillon
167c63ee25 Release 1.18.0 2022-10-16 22:42:14 +02:00
Jules Aguillon
f56b926857 Autocapitalisation: Avoid trigerring when Ctrl+Del
Autocapitalisation could trigger while repeatedly typing Ctrl+Del to
remove several words.
2022-10-16 22:34:21 +02:00
Jules Aguillon
75df3afda6 Allow to disable Alt and Meta keys
The keys are marked "loc" in the layouts and are handled like the other
extra keys.
The only difference is that they are enabled by default (for now).
2022-10-16 01:07:24 +02:00
Rapha
7fb5c992b6 Rename resulting CI artifact (#180)
* Rename resulting CI artifact
Add details to the name of the artifact, to distiguish downloads of it between multiple branches while testing

* Update CI to nodejs16 and improve artifact naming
2022-10-16 00:53:04 +02:00
Jules Aguillon
158a3577be Disable fullscreen mode
This mode is annoying to some users and is disabled in most text views.

The keyboard has a fixed sized relative to the height of the screen in
landscape mode. The keyboard can't take more space than expected,
currently.

This might cause problems in the future and might be hidden behind an
option if one is found. Every text views so far seemed to behave fine.
2022-10-16 00:42:28 +02:00
Jules Aguillon
138e59f13a Fix literal tab key
Broken since 31d6a70d.
2022-10-16 00:04:06 +02:00
Jules Aguillon
db347c665c Add the breve diacritic 2022-10-15 23:28:36 +02:00
lpv
8be80eecd4 Basic greek layout. (#207)
* Basic greek layout.
2022-10-15 23:22:19 +02:00
Jules Aguillon
d9a8688237 Fix crash due to auto capitalisation
It is unclear how _autocap.started is not called first but nothing is
preventing to initialize things earlier.
2022-10-15 16:19:27 +02:00
Jules Aguillon
7f51cf001a Mention long press in lockable modifiers option
More documentation about this feature would be appropriate.
2022-10-15 15:55:48 +02:00
Raj9039852537
1909f2fcb4 Added Hindi language layout (#211)
* Hindi Keyboard Layout

Hindi keyboard layout added
Basic symbols like brackets, colons etc are useful. This includes ( ) { } [ ] \ / ÷ - + = ! % : ; . , ?
2022-10-11 22:13:40 +02:00
Jules Aguillon
fc8bb3a539 Allow to type İ on the Turkish layout
In Turkish, upper case of 'iı' is 'İI' but Java's toUpperCase will
return 'II'.
To make 'İ' accessible, make it the shift of 'ı'. This has the
inconvenient of swapping i and ı on the keyboard.
2022-10-04 10:12:22 +02:00
Jules Aguillon
dda8f0314d Contributing: clarify layouts 2022-10-04 10:12:22 +02:00
polyctena
5873b7315d German translation (#208)
Co-authored-by: Benjamin <f.weiss@stud.uni-goettingen.de>
2022-10-04 09:56:15 +02:00
Jules Aguillon
64e263a1af Fix an unexplained crash encountered in the wild
For some reason, 'subtype' can be null. Perhaps because the keyboard is
started before the IMM is ready.
2022-09-24 23:34:50 +02:00
22 changed files with 256 additions and 80 deletions

View File

@@ -9,14 +9,14 @@ jobs:
Build-Apk:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Cache debug certificate
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _build/debug.keystore
key: debug-keystore
@@ -35,8 +35,13 @@ jobs:
fi
- name: Build
run: make
- name: Artifact naming
run: |
artifact="${{github.repository_owner}} ${{github.ref_name}}"
artifact="${artifact//\//-}" # replace slashes
echo "artifact=${artifact}" >> $GITHUB_ENV
- name: Save debug apk
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: debug apk
name: "${{env.artifact}} debug_apk"
path: _build/*.apk

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="25" android:versionName="1.17.0" android:hardwareAccelerated="false">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="26" android:versionName="1.18.0" 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

@@ -78,17 +78,22 @@ make installd
## Guidelines
### Adding a programming layout
### Adding a layout
A programming layout must contains every ASCII characters.
The current programming layouts are: QWERTY, Dvorak.
Layouts are defined in XML, see `res/xml/qwerty.xml`.
An entry must be added to the layout option in `res/values/arrays.xml`, to both
`pref_layout_values` (correspond to the file name) and `pref_layout_entries`
(display name).
Layouts are defined in XML, see `res/xml/qwerty.xml`. An entry must be added to
the layout option in `res/values/arrays.xml`, to both `pref_layout_values`
(correspond to the file name) and `pref_layout_entries` (display name).
The layout must also be referenced in `srcs/juloo.keyboard2/Config.java` in
`layoutId_of_string`.
#### Adding a programming layout
A programming layout must contains every ASCII characters.
The current programming layouts are: QWERTY, Dvorak and Colemak.
Keys with a name starting in `loc ` are hidden unless they are configured for
the user's installed languages in `res/xml/method.xml`. These keys are optional
and will be added automatically when necessary.
@@ -97,7 +102,7 @@ Some users cannot easily type the characters close the the edges of the screen
due to a bulky phone case. It is best to avoid placing important characters
there (such as the digits or punctuation).
### Adding a localized layout
#### Adding a localized layout
Localized layouts (a layout specific to a language) are gladly accepted.
See for example: 4333575 (Bulgarian), 88e2175 (Latvian), 133b6ec (German).

View File

@@ -0,0 +1,7 @@
New supported languages: Hindi, Greek
Disable fullscreen mode.
Improvements to layouts and translations.
Various fixes and improvements.
Thanks to the contributors: @sdrapha, @lpv11, @Raj9039852537, @polyctena

View File

@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" product="debug">Unexpected Keyboard (Debug)</string>
<string name="app_name" product="default">Unexpected Keyboard</string>
<string name="settings_activity_label">Unexpected Keyboard - Einstellungen</string>
<string name="pref_category_layout">Layout</string>
<string name="pref_layout_title">Tastaturlayout ändern</string>
@@ -8,6 +10,9 @@
<string name="pref_accents_e_all_installed">Akzente für alle installierten Sprachen anzeigen</string>
<string name="pref_accents_e_selected">Akzente nur für die gewählte Sprache anzeigen</string>
<string name="pref_accents_e_none">Akzente verbergen</string>
<string name="pref_autocapitalisation_title">Automatische Großschreibung</string>
<string name="pref_autocapitalisation_summary">Umschalttaste am Satzanfang aktivieren</string>
<string name="pref_extra_keys_title">Tasten hinzufügen</string>
<string name="pref_programming_layout_title">Tastaturlayout zum Programmieren</string>
<string name="pref_programming_layout_none">Keines</string>
<string name="pref_category_typing">Tippen</string>
@@ -19,9 +24,14 @@
<string name="pref_vibrate_summary">Vibration bei Tastendruck ein-/ausschalten</string>
<string name="pref_precise_repeat_title">Präzise Cursorsteuerung</string>
<string name="pref_precise_repeat_summary">Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen</string>
<string name="pref_lockable_keys_title">Veraltet: Sperrbare Hilfstasten</string>
<string name="pref_lockable_keys_summary">Wird entfernt. (Hilfstasten, die durch zweimaliges Tippen gesperrt (eingerastet) werden können)</string>
<string name="pref_lock_double_tap_title">Umschalttaste mit Doppeltippen einrasten</string>
<string name="pref_lock_double_tap_summary">Anstatt Taste längere Zeit gedrückt zu halten</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>
<string name="pref_keyboard_height_landscape_title">Höhe der Tastatur im Querformat</string>
<string name="pref_horizontal_margin_title">Horizontaler Abstand</string>
<string name="pref_character_size_title">Größe der Beschriftung</string>
<string name="pref_character_size_summary">Größe der Buchstaben auf den Tasten (%.2fx)</string>
@@ -30,6 +40,7 @@
<string name="pref_theme_e_dark">Dunkel</string>
<string name="pref_theme_e_light">Hell</string>
<string name="pref_theme_e_black">Schwarz</string>
<string name="pref_theme_e_white">Weiß</string>
<string name="pref_swipe_dist_e_very_short">Sehr kurz</string>
<string name="pref_swipe_dist_e_short">Kurz</string>
<string name="pref_swipe_dist_e_default">Normal</string>

View File

@@ -6,6 +6,7 @@
<item>qwerty</item>
<item>qwerty_pt</item>
<item>qwerty_es</item>
<item>qwerty_el</item>
<item>qwerty_ko</item>
<item>qwerty_lv</item>
<item>qwerty_no</item>
@@ -22,6 +23,7 @@
<item>bone</item>
<item>jcuken_ua</item>
<item>bangla</item>
<item>hindi</item>
</string-array>
<string-array name="pref_layout_entries">
<item>@string/pref_layout_e_system</item>
@@ -29,6 +31,7 @@
<item>QWERTY</item>
<item>QWERTY (Brasileiro)</item>
<item>QWERTY (Español)</item>
<item>QWERTY (Greek)</item>
<item>QWERTY (Korean)</item>
<item>QWERTY (Latvian)</item>
<item>QWERTY (Norwegian)</item>
@@ -45,6 +48,7 @@
<item>Bone</item>
<item>ЙЦУКЕН (Українська)</item>
<item>বাংলা</item>
<item>हिन्दी</item>
</string-array>
<string-array name="pref_programming_layout_values">
<item>none</item>

View File

@@ -25,7 +25,7 @@
<string name="pref_precise_repeat_title">Precise cursor movements</string>
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
<string name="pref_lockable_keys_title">Deprecated: Lockable modifiers</string>
<string name="pref_lockable_keys_summary">This option will be removed</string>
<string name="pref_lockable_keys_summary">Every modifiers can be locked with a long press</string>
<string name="pref_lock_double_tap_title">Double tap on shift for caps lock</string>
<string name="pref_lock_double_tap_summary">Instead of holding modifiers for a time</string>
<string name="pref_category_style">Style</string>

View File

@@ -36,8 +36,8 @@
<key width="1.5" key0="backspace" key1="delete" key3=";"/>
</row>
<row height="0.95">
<key width="1.8" key0="ctrl" key2="meta" key4="switch_numeric"/>
<key width="1.2" key0="fn" key1="alt" key2="change_method" key3="switch_emoji" key4="config"/>
<key width="1.8" key0="ctrl" key2="loc meta" key4="switch_numeric"/>
<key width="1.2" key0="fn" key1="loc alt" key2="change_method" key3="switch_emoji" key4="config"/>
<key width="4.0" key0="space" key1="switch_programming" key2="0" edgekeys="true"/>
<key width="1.2" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
<key width="1.8" key0="enter" key3="action"/>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<row height="0.95">
<key width="1.8" key0="ctrl" key1="loc switch_greekmath" key2="meta" key4="switch_numeric"/>
<key width="1.2" key0="fn" key1="alt" key2="change_method" key3="switch_emoji" key4="config"/>
<key width="1.8" key0="ctrl" key1="loc switch_greekmath" key2="loc meta" key4="switch_numeric"/>
<key width="1.2" key0="fn" key1="loc alt" key2="change_method" key3="switch_emoji" key4="config"/>
<key width="4.0" key0="space" key1="switch_programming" edgekeys="true"/>
<key width="1.2" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
<key width="1.8" key0="enter" key2="action"/>

37
res/xml/hindi.xml Normal file
View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="ौ" key1="औ" key2="₨" key3="esc" key4="१"/>
<key key0="ै" key1="ऐ" key2="ऍ" key3="¶" key4="२"/>
<key key0="ा" key1="आ" key2="ॅ" key3="ग़" key4="३"/>
<key key0="ी" key1="ई" key2="ज्ञ" key3="ज़" key4="४"/>
<key key0="ू" key1="ऊ" key2="त्र" key3="ऩ" key4="५"/>
<key key0="ब" key1="भ" key2="क्ष" key3="÷" key4="६"/>
<key key0="ह" key1="ङ" key2="श्र" key3="×" key4="७"/>
<key key0="ग" key1="घ" key2="" key3="=" key4="८"/>
<key key0="द" key1="ध" key2="ऋ" key3="+" key4="९"/>
<key key0="ज" key1="झ" key2="ृ" key3="-" key4=""/>
</row>
<row>
<key shift="0.5" key0="ो" key1="ओ" key2="ॉ" key3="tab" key4="ऑ"/>
<key key0="े" key1="ए" key2="ञ" key3="~" key4="॰"/>
<key key0="्" key1="अ" key2="़" key3="ऽ" key4="ऺ"/>
<key key0="ि" key1="इ" key2="ढ" key3="॥" key4="ॄ"/>
<key key0="ु" key1="उ" key2="ड" key3="\\" key4="/"/>
<key key0="प" key1="फ" key2="छ" key3="&lt;" key4="&gt;"/>
<key key0="र" key1="ऱ" key2="च" key3="[" key4="]"/>
<key key0="क" key1="ख" key2="क़" key3="{" key4="}"/>
<key key0="त" key1="थ" key2="ख़" key3="(" key4=")"/>
</row>
<row>
<key width="1.4" key0="shift"/>
<key shift="0.1" key0="ट" key1="ठ" key2="ड़" key3="\#" key4="*"/>
<key key0="ं" key1="ँ" key2="।" key3="ॐ" key4="\@"/>
<key key0="म" key1="ण" key2="य" key3="य़" key4="%"/>
<key key0="न" key1="" key2="।" key3=":" key4="&amp;"/>
<key key0="व" key1="" key2="ढ़" key3=";" key4="."/>
<key key0="ल" key1="ळ" key2="फ़" key3="!" key4=","/>
<key key0="स" key1="श" key2="ष" key3="\?" key4="।"/>
<key shift="0.1" width="1.4" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@@ -2,6 +2,7 @@
<input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true">
<subtype android:label="%s" android:languageTag="bg" android:imeSubtypeLocale="bg_BG" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=bgph1,extra_keys=€"/>
<subtype android:label="%s" android:languageTag="bn" android:imeSubtypeLocale="bn_BD" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=৳"/>
<subtype android:label="%s" android:languageTag="hi" android:imeSubtypeLocale="hi_IN" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=hindi,extra_keys=₹"/>
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=accent_trema|ß|€"/>
<subtype android:label="%s" android:languageTag="en-GB" android:imeSubtypeLocale="en_GB" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=£|€"/>
<subtype android:label="%s" android:languageTag="en-US" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/>
@@ -21,4 +22,5 @@
<subtype android:label="%s" android:languageTag="tr" android:imeSubtypeLocale="tr_TR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_tr,extra_keys=accent_cedille|accent_trema|₺|ı|ğ"/>
<subtype android:label="%s" android:languageTag="uk" android:imeSubtypeLocale="uk_UA" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=jcuken_ua"/>
<subtype android:label="%s" android:languageTag="cs" android:imeSubtypeLocale="cs_CZ" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz_cs,extra_keys=a|accent_cedille|accent_circonflexe"/>
<subtype android:label="%s" android:languageTag="el" android:imeSubtypeLocale="el" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_el,extra_keys=£|€"/>
</input-method>

View File

@@ -39,8 +39,8 @@
<key width="1.5" key0="backspace" key2="delete"/>
</row>
<row height="0.95">
<key width="1.8" key0="ctrl" key2="meta" key4="switch_numeric"/>
<key width="1.2" key0="fn" key1="alt" key2="change_method" key3="switch_emoji" key4="config"/>
<key width="1.8" key0="ctrl" key2="loc meta" key4="switch_numeric"/>
<key width="1.2" key0="fn" key1="loc alt" key2="change_method" key3="switch_emoji" key4="config"/>
<key width="4.0" key0="space" key1="switch_programming" edgekeys="true"/>
<key width="1.2" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
<key key0="j" key4=";"/>

View File

@@ -20,7 +20,7 @@
</row>
<row>
<key width="0.75" key0="switch_greekmath"/>
<key width="0.75" key0="shift" key2="fn" key4="alt"/>
<key width="0.75" key0="shift" key2="fn" key4="loc alt"/>
<key key0="1" key1="superscript" key2="ordinal" key3="subscript"/>
<key key0="2"/>
<key key0="3"/>

37
res/xml/qwerty_el.xml Normal file
View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0=";" key2="1" key4="esc"/>
<key key0="ς" key1="~" key2="2" key3="\@"/>
<key key0="ε" key1="!" key2="3" key3="\#" key4="loc €"/>
<key key0="ρ" key2="4" key3="$"/>
<key key0="τ" key2="5" key3="%"/>
<key key0="υ" key2="6" key3="^"/>
<key key0="θ" key2="7" key3="&amp;"/>
<key key0="ι" key1="accent_trema" key2="8" key3="*"/>
<key key0="ο" key2="9" key3="(" key4=")"/>
<key key0="π" key2="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="α" key1="tab" key2="`"/>
<key key0="σ"/>
<key key0="δ" key2="loc £"/>
<key key0="φ"/>
<key key0="γ" key2="-" key3="_"/>
<key key0="η" key2="=" key3="+"/>
<key key0="ξ" key2="accent_aigu" key3="{" key4="}"/>
<key key0="κ" key2="accent_grave" key3="[" key4="]"/>
<key key0="λ" key2="|" key3="\\"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="ζ"/>
<key key0="χ"/>
<key key0="ψ" key2="&lt;" key3="."/>
<key key0="ω" key2="&gt;" key3=","/>
<key key0="β" key2="\?" key3="/"/>
<key key0="ν" key2=":" key3=";"/>
<key key0="μ" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@@ -27,25 +27,10 @@ final class Autocapitalisation
InputType.TYPE_TEXT_FLAG_CAP_SENTENCES |
InputType.TYPE_TEXT_FLAG_CAP_WORDS;
Runnable delayed_callback = new Runnable()
public Autocapitalisation(Looper looper, Callback cb)
{
public void run()
{
if (_should_update_caps_mode)
{
_should_enable_shift = _enabled && (_ic.getCursorCapsMode(_caps_mode) != 0);
_should_update_caps_mode = false;
}
_callback.update_shift_state(_should_enable_shift, _should_disable_shift);
}
};
void callback(final boolean might_disable)
{
_should_disable_shift = might_disable;
// The callback must be delayed because [getCursorCapsMode] would sometimes
// be called before the editor finished handling the previous event.
_handler.postDelayed(delayed_callback, 1);
_handler = new Handler(looper);
_callback = cb;
}
/**
@@ -53,11 +38,9 @@ final class Autocapitalisation
* [started] does initialisation work and must be called before any other
* event.
*/
public void started(Looper looper, Callback cb, EditorInfo info, InputConnection ic)
public void started(EditorInfo info, InputConnection ic)
{
_handler = new Handler(looper);
_ic = ic;
_callback = cb;
_caps_mode = info.inputType & TextUtils.CAP_MODE_SENTENCES;
if (!Config.globalConfig().autocapitalisation || _caps_mode == 0)
{
@@ -82,17 +65,14 @@ final class Autocapitalisation
callback(false);
}
void type_one_char(char c)
public void event_sent(int code, int meta)
{
_cursor++;
if (is_trigger_character(c))
_should_update_caps_mode = true;
else
if (meta != 0)
{
_should_enable_shift = false;
}
public void event_sent(int code)
{
_should_update_caps_mode = false;
return;
}
switch (code)
{
case KeyEvent.KEYCODE_DEL:
@@ -103,12 +83,17 @@ final class Autocapitalisation
callback(true);
}
public static interface Callback
{
public void update_shift_state(boolean should_enable, boolean should_disable);
}
/** Returns [true] if shift might be disabled. */
public void selection_updated(int old_cursor, int new_cursor)
{
if (new_cursor == _cursor) // Just typing
return;
if (new_cursor == 0)
if (new_cursor == 0 && _ic != null)
{
// Detect whether the input box has been cleared
CharSequence t = _ic.getTextAfterCursor(1, 0);
@@ -120,6 +105,36 @@ final class Autocapitalisation
callback(true);
}
Runnable delayed_callback = new Runnable()
{
public void run()
{
if (_should_update_caps_mode && _ic != null)
{
_should_enable_shift = _enabled && (_ic.getCursorCapsMode(_caps_mode) != 0);
_should_update_caps_mode = false;
}
_callback.update_shift_state(_should_enable_shift, _should_disable_shift);
}
};
void callback(final boolean might_disable)
{
_should_disable_shift = might_disable;
// The callback must be delayed because [getCursorCapsMode] would sometimes
// be called before the editor finished handling the previous event.
_handler.postDelayed(delayed_callback, 1);
}
void type_one_char(char c)
{
_cursor++;
if (is_trigger_character(c))
_should_update_caps_mode = true;
else
_should_enable_shift = false;
}
boolean is_trigger_character(char c)
{
switch (c)
@@ -130,9 +145,4 @@ final class Autocapitalisation
return false;
}
}
public static interface Callback
{
public void update_shift_state(boolean should_enable, boolean should_disable);
}
}

View File

@@ -247,12 +247,14 @@ final class Config
{
case "azerty": return R.xml.azerty;
case "bangla": return R.xml.bangla;
case "hindi": return R.xml.hindi;
case "bgph1": return R.xml.local_bgph1;
case "bone": return R.xml.bone;
case "colemak": return R.xml.colemak;
case "dvorak": return R.xml.dvorak;
case "neo2": return R.xml.neo2;
case "qwerty_es": return R.xml.qwerty_es;
case "qwerty_el": return R.xml.qwerty_el;
case "qwerty_hu": return R.xml.qwerty_hu;
case "qwerty_ko": return R.xml.qwerty_ko;
case "qwerty_lv": return R.xml.qwerty_lv;

View File

@@ -14,6 +14,8 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
{
public static String[] extra_keys = new String[]
{
"alt",
"meta",
"accent_aigu",
"accent_grave",
"accent_double_aigu",
@@ -26,12 +28,25 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
"accent_caron",
"accent_macron",
"accent_ogonek",
"accent_breve",
"",
"ß",
"£",
"switch_greekmath",
};
public static boolean default_checked(String name)
{
switch (name)
{
case "alt":
case "meta":
return true;
default:
return false;
}
}
boolean _key_font;
public ExtraKeyCheckBoxPreference(Context context, AttributeSet attrs)
@@ -42,6 +57,7 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
a.recycle();
String key_name = extra_keys[index];
setKey(pref_key_of_key_name(key_name));
setDefaultValue(default_checked(key_name));
KeyValue kv = KeyValue.getKeyByName(key_name);
setTitle(kv.getString());
_key_font = kv.hasFlags(KeyValue.FLAG_KEY_FONT);
@@ -65,7 +81,7 @@ public class ExtraKeyCheckBoxPreference extends CheckBoxPreference
HashSet<KeyValue> ks = new HashSet<KeyValue>();
for (String key_name : extra_keys)
{
if (prefs.getBoolean(pref_key_of_key_name(key_name), false))
if (prefs.getBoolean(pref_key_of_key_name(key_name), default_checked(key_name)))
ks.add(KeyValue.getKeyByName(key_name));
}
return ks;

View File

@@ -50,6 +50,7 @@ class KeyModifier
case MACRON: return apply_dead_char(k, '\u00AF');
case OGONEK: return apply_dead_char(k, '\u02DB');
case DOT_ABOVE: return apply_dead_char(k, '\u02D9');
case BREVE: return apply_dead_char(k, '\u02D8');
case DOUBLE_AIGU: return apply_map_char(k, map_char_double_aigu);
case ORDINAL: return apply_map_char(k, map_char_ordinal);
case SUPERSCRIPT: return apply_map_char(k, map_char_superscript);
@@ -144,6 +145,7 @@ class KeyModifier
case KeyEvent.KEYCODE_DPAD_LEFT: return "home";
case KeyEvent.KEYCODE_DPAD_RIGHT: return "end";
case KeyEvent.KEYCODE_ESCAPE: return "insert";
case KeyEvent.KEYCODE_TAB: return "\\t";
default: return null;
}
}
@@ -241,7 +243,6 @@ class KeyModifier
case '⊃': return "";
case '±': return "";
// other
case '\t': return "\\t";
case ' ': return "nbsp";
default: return null;
}
@@ -354,6 +355,10 @@ class KeyModifier
case '─': return '═';
case '│': return '║';
case 'ß': return 'ẞ';
/* In Turkish, upper case of 'iı' is 'İI' but Java's toUpperCase will
return 'II'. To make 'İ' accessible, make it the shift of 'ı'. This
has the inconvenient of swapping i and ı on the keyboard. */
case 'ı': return 'İ';
default: return c;
}
}

View File

@@ -45,7 +45,8 @@ final class KeyValue
BOX,
OGONEK,
SLASH,
ARROW_RIGHT
ARROW_RIGHT,
BREVE
}
// Behavior flags.
@@ -223,6 +224,11 @@ final class KeyValue
FLAG_LATCH | FLAG_SPECIAL | extra_flags);
}
private static void addDiacritic(String name, int special_font_symbol, Modifier m)
{
addModifierKey(name, String.valueOf((char)special_font_symbol), m, FLAG_KEY_FONT);
}
private static void addEventKey(String name, String symbol, Event e, int flags)
{
addKey(name, symbol, KIND_EVENT, e.ordinal(), flags | FLAG_SPECIAL);
@@ -249,21 +255,21 @@ final class KeyValue
Modifier.SHIFT, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addModifierKey("ctrl", "Ctrl", Modifier.CTRL, FLAG_SMALLER_FONT);
addModifierKey("alt", "Alt", Modifier.ALT, FLAG_SMALLER_FONT);
addModifierKey("accent_aigu", "\u0050", Modifier.AIGU, FLAG_KEY_FONT);
addModifierKey("accent_caron", "\u0051", Modifier.CARON, FLAG_KEY_FONT);
addModifierKey("accent_cedille", "\u0052", Modifier.CEDILLE, FLAG_KEY_FONT);
addModifierKey("accent_circonflexe", "\u0053", Modifier.CIRCONFLEXE, FLAG_KEY_FONT);
addModifierKey("accent_grave", "\u0054", Modifier.GRAVE, FLAG_KEY_FONT);
addModifierKey("accent_macron", "\u0055", Modifier.MACRON, FLAG_KEY_FONT);
addModifierKey("accent_ring", "\u0056", Modifier.RING, FLAG_KEY_FONT);
addModifierKey("accent_tilde", "\u0057", Modifier.TILDE, FLAG_KEY_FONT);
addModifierKey("accent_trema", "\u0058", Modifier.TREMA, FLAG_KEY_FONT);
addModifierKey("accent_ogonek", "\u0059", Modifier.OGONEK, FLAG_KEY_FONT);
addModifierKey("accent_dot_above", "\u005a", Modifier.DOT_ABOVE, FLAG_KEY_FONT);
addModifierKey("accent_double_aigu", "\u005b", Modifier.DOUBLE_AIGU, FLAG_KEY_FONT);
addModifierKey("accent_slash", "\134", // Can't write u005c
Modifier.SLASH, FLAG_KEY_FONT);
addModifierKey("accent_arrow_right", "\u005d", Modifier.ARROW_RIGHT, FLAG_KEY_FONT);
addDiacritic("accent_aigu", 0x50, Modifier.AIGU);
addDiacritic("accent_caron", 0x51, Modifier.CARON);
addDiacritic("accent_cedille", 0x52, Modifier.CEDILLE);
addDiacritic("accent_circonflexe", 0x53, Modifier.CIRCONFLEXE);
addDiacritic("accent_grave", 0x54, Modifier.GRAVE);
addDiacritic("accent_macron", 0x55, Modifier.MACRON);
addDiacritic("accent_ring", 0x56, Modifier.RING);
addDiacritic("accent_tilde", 0x57, Modifier.TILDE);
addDiacritic("accent_trema", 0x58, Modifier.TREMA);
addDiacritic("accent_ogonek", 0x59, Modifier.OGONEK);
addDiacritic("accent_dot_above", 0x5A, Modifier.DOT_ABOVE);
addDiacritic("accent_double_aigu", 0x5B, Modifier.DOUBLE_AIGU);
addDiacritic("accent_slash", 0x5C, Modifier.SLASH);
addDiacritic("accent_arrow_right", 0x5D, Modifier.ARROW_RIGHT);
addDiacritic("accent_breve", 0x5E, Modifier.BREVE);
addModifierKey("superscript", "Sup", Modifier.SUPERSCRIPT, FLAG_SMALLER_FONT);
addModifierKey("subscript", "Sub", Modifier.SUBSCRIPT, FLAG_SMALLER_FONT);
addModifierKey("ordinal", "Ord", Modifier.ORDINAL, FLAG_SMALLER_FONT);

View File

@@ -36,7 +36,7 @@ public class Keyboard2 extends InputMethodService
private ViewGroup _emojiPane = null;
private Config _config;
private Autocapitalisation _autocap = new Autocapitalisation();
private Autocapitalisation _autocap;
private boolean _debug_logs = false;
@@ -57,6 +57,7 @@ public class Keyboard2 extends InputMethodService
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
_keyboardView.reset();
_debug_logs = getResources().getBoolean(R.bool.debug_logs);
_autocap = new Autocapitalisation(getMainLooper(), this);
}
public void update_shift_state(boolean should_enable, boolean should_disable)
@@ -147,8 +148,16 @@ public class Keyboard2 extends InputMethodService
else
{
InputMethodSubtype subtype = imm.getCurrentInputMethodSubtype();
refreshSubtypeLayout(subtype);
refreshAccentsOption(imm, subtype);
if (subtype == null)
{
// On some rare cases, [subtype] is null.
refreshSubtypeLegacyFallback();
}
else
{
refreshSubtypeLayout(subtype);
refreshAccentsOption(imm, subtype);
}
}
_config.shouldOfferSwitchingToProgramming =
_config.programming_layout != -1 &&
@@ -225,7 +234,7 @@ public class Keyboard2 extends InputMethodService
_keyboardView.setKeyboard(getLayout(R.xml.numeric));
else
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
_autocap.started(getMainLooper(), this, info, getCurrentInputConnection());
_autocap.started(info, getCurrentInputConnection());
setInputView(_keyboardView);
if (_debug_logs)
log_editor_info(info);
@@ -267,6 +276,13 @@ public class Keyboard2 extends InputMethodService
refreshConfig();
}
@Override
public boolean onEvaluateFullscreenMode()
{
/* Entirely disable fullscreen mode. */
return false;
}
/** Not static */
public class Receiver implements KeyEventHandler.IReceiver
{
@@ -337,7 +353,7 @@ public class Keyboard2 extends InputMethodService
return;
conn.sendKeyEvent(new KeyEvent(1, 1, eventAction, eventCode, 0, meta));
if (eventAction == KeyEvent.ACTION_UP)
_autocap.event_sent(eventCode);
_autocap.event_sent(eventCode, meta);
}
public void showKeyboardConfig()

13
srcs/special_font/5E.svg Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-20 0 1168 2048">
<g transform="matrix(1 0 0 -1 0 1536)">
<path fill="currentColor"
d="M931.256 1002.78l-69.3145 -69.3145q-112.472 86.3154 -249.792 98.0859v99.3945q176.555 -11.7715 319.106 -128.166v0zM516.679 1031.55q-133.396 -10.4619 -249.792 -100.701q0 1.30859 -71.9297 74.5449l2.61523 -2.61523q142.554 116.396 319.106 128.166v-99.3945
v0zM197.572 860.229q-90.2393 -103.316 -107.24 -245.867h-99.3936q17.001 181.786 137.32 319.104l-6.53906 5.23145l3.92285 -2.61523l41.8506 -43.1582q30.0791 -31.3867 30.0791 -32.6953v0zM1137.89 614.361h-99.3936q-17.001 141.242 -107.239 248.483
l69.3135 70.6211q120.318 -137.319 137.319 -319.104v0zM1137.89 517.583q-14.3857 -189.633 -129.474 -326.953l-69.3135 70.6221q86.3154 111.164 99.3936 256.331h99.3936v0zM189.726 263.867h0.000976562q-86.3154 107.239 -99.3936 253.716h-99.3945
q13.0781 -189.633 128.165 -326.953l-3.92285 -3.92383q-1.30762 0 74.5449 77.1611zM939.103 121.315q-146.476 -124.242 -326.952 -136.014v99.3945q139.935 11.7705 257.639 105.934zM516.679 -14.6973q-180.478 11.7715 -326.953 136.013l69.3145 69.3145
q117.703 -90.2383 257.64 -105.933v-99.3945h-0.000976562zM881 1496q0 -121 -82.5 -194.5t-216.5 -73.5t-217 74t-83 194h151q0 -70 38 -109.5t111 -39.5q70 0 109.5 39t39.5 110h150z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.