Compare commits
57 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
93b4cc2e7b | ||
|
7a451d5a36 | ||
|
2d2f0dd51d | ||
|
8631dfb723 | ||
|
c9f7f2cfc8 | ||
|
f2893437d2 | ||
|
2f47d2400b | ||
|
348c278eae | ||
|
7af579a1bc | ||
|
4333575bb9 | ||
|
e0217c650d | ||
|
1723288f5d | ||
|
88e21758bc | ||
|
e031de6b57 | ||
|
baf867a9f9 | ||
|
04f15fbfee | ||
|
cb95e99f50 | ||
|
28f98cc129 | ||
|
3ab2228065 | ||
|
eda171d57a | ||
|
0bf7ff5f34 | ||
|
aa12466767 | ||
|
100e0b270d | ||
|
38adf7d7b9 | ||
|
9485770372 | ||
|
c489b5aba7 | ||
|
96c4b165ac | ||
|
40897f2c26 | ||
|
133b6ec2c1 | ||
|
833dfa31bb | ||
|
fa9250a89e | ||
|
854eb431f3 | ||
|
d4eef00a8a | ||
|
f22d040eda | ||
|
dfec26a93b | ||
|
53113cadd9 | ||
|
4b43645c4b | ||
|
93e84ba7e9 | ||
|
23e59c6b09 | ||
|
2764e96eb1 | ||
|
9c82c9cfdc | ||
|
8bef0728ae | ||
|
b05f6e8447 | ||
|
f69a0605a8 | ||
|
29367f127d | ||
|
093a00c572 | ||
|
40b1ec63a9 | ||
|
93704cca0a | ||
|
15ce200ce3 | ||
|
0190cfc29a | ||
|
dd24ad323b | ||
|
86655d4959 | ||
|
3e332dbf54 | ||
|
d721cc86d1 | ||
|
1cfecbdf48 | ||
|
988d8db7e8 | ||
|
e5fa23e1f7 |
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
*.keystore
|
*.keystore
|
||||||
_build
|
_build
|
||||||
|
/*-keystore.conf
|
||||||
|
@@ -1,38 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="16" android:versionName="1.12.0" android:hardwareAccelerated="false">
|
||||||
package="juloo.keyboard2"
|
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="30"/>
|
||||||
android:versionCode="13"
|
<application android:label="@string/app_name" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:hardwareAccelerated="false">
|
||||||
android:versionName="1.10.0"
|
<service android:name="juloo.keyboard2.Keyboard2" android:label="@string/app_name" android:permission="android.permission.BIND_INPUT_METHOD">
|
||||||
android:hardwareAccelerated="false">
|
<intent-filter>
|
||||||
|
<action android:name="android.view.InputMethod"/>
|
||||||
<uses-sdk android:minSdkVersion="4"
|
</intent-filter>
|
||||||
android:targetSdkVersion="29" />
|
<meta-data android:name="android.view.im" android:resource="@xml/method"/>
|
||||||
|
</service>
|
||||||
<application android:label="@string/app_name"
|
<activity android:name="juloo.keyboard2.SettingsActivity" android:icon="@drawable/ic_launcher" android:label="@string/settings_activity_label">
|
||||||
android:allowBackup="true"
|
<intent-filter>
|
||||||
android:icon="@drawable/ic_launcher"
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
android:hardwareAccelerated="false">
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
<service android:name="juloo.keyboard2.Keyboard2"
|
</application>
|
||||||
android:label="@string/app_name"
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
android:permission="android.permission.BIND_INPUT_METHOD">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.view.InputMethod" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data android:name="android.view.im"
|
|
||||||
android:resource="@xml/method" />
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<activity android:name="juloo.keyboard2.SettingsActivity"
|
|
||||||
android:icon="@drawable/ic_launcher"
|
|
||||||
android:label="@string/settings_activity_label">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
85
CONTRIBUTING.md
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
Thanks for contributing :)
|
||||||
|
|
||||||
|
## Building the app
|
||||||
|
|
||||||
|
The application doesn't use Gradle and it might be hard to use some features of
|
||||||
|
Android Studio.
|
||||||
|
|
||||||
|
Fortunately, there's not many dependencies:
|
||||||
|
- OpenJDK 8
|
||||||
|
- Android SDK: build tools `30.0.3`, platform `30`
|
||||||
|
- Make sure to have the `$ANDROID_HOME` environment variable set.
|
||||||
|
|
||||||
|
For Nix users, there's a `shell.nix` for setting-up the right environment.
|
||||||
|
|
||||||
|
Building the debug apk:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
If the build succeed, the debug apk is located in
|
||||||
|
`_build/juloo.keyboard2.debug.apk`.
|
||||||
|
|
||||||
|
## Debugging on your phone
|
||||||
|
|
||||||
|
First [Enable adb debugging on your device](https://developer.android.com/studio/command-line/adb#Enabling).
|
||||||
|
Then connect your phone to your computer using an USB cable or wireless
|
||||||
|
debugging.
|
||||||
|
|
||||||
|
And finally, install the application with:
|
||||||
|
```sh
|
||||||
|
make installd
|
||||||
|
```
|
||||||
|
|
||||||
|
The debug version of the application won't be removed, both versions will stay
|
||||||
|
installed at the same time.
|
||||||
|
|
||||||
|
The application must be enabled in the settings:
|
||||||
|
System > Languages & input > On-screen keyboard > Manage on-screen keyboards.
|
||||||
|
|
||||||
|
## Debugging the application: INSTALL_FAILED_UPDATE_INCOMPATIBLE
|
||||||
|
|
||||||
|
`make installd` can fail with the following error message:
|
||||||
|
|
||||||
|
```
|
||||||
|
adb: failed to install _build/juloo.keyboard2.debug.apk: Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package juloo.keyboard2.debug signatures do not match previously installed version; ignoring!]
|
||||||
|
make: *** [Makefile:20: installd] Error 1
|
||||||
|
```
|
||||||
|
|
||||||
|
The application can't be "updated" because the temporary certificate has been
|
||||||
|
lost. The solution is to uninstall and install again.
|
||||||
|
The application must be enabled again in the settings.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
adb uninstall juloo.keyboard2.debug
|
||||||
|
make installd
|
||||||
|
```
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
### Add a localized layout
|
||||||
|
|
||||||
|
Localized layouts (a layout specific to a language) are generally accepted.
|
||||||
|
See for example: 4333575 (Bulgarian), 88e2175 (Latvian), 133b6ec (German).
|
||||||
|
|
||||||
|
This keyboard is intended for programmers. If your language uses the Latin script, make sure it is possible to type every letters on the QWERTY keyboard.
|
||||||
|
This is generally done using dead-keys, for example: 0bf7ff5 (Latvian), 573c13f (Swedish).
|
||||||
|
It is also possible to add some characters that are hidden in other languages, for example 93e84ba (ß), though the space is limited.
|
||||||
|
|
||||||
|
### Add a programming layout
|
||||||
|
|
||||||
|
A programming layout must contains every ASCII characters as well as every dead-keys.
|
||||||
|
Currently, the only example is QWERTY.
|
||||||
|
|
||||||
|
### Translations
|
||||||
|
|
||||||
|
Translations are always welcome ! See for example: 1723288 (Latvian), baf867a (French).
|
||||||
|
The app can be translated by writing `res/values-<language code>/strings.xml` (for example `values-fr`, `values-lv`), based on the default: `res/values/strings.xml` (English).
|
||||||
|
|
||||||
|
The store description is found in `metadata/android/<locale>/`, `short_description.txt` and `full_description.txt`.
|
||||||
|
The full description changes very infrequently (it was changed once in 6 years). But if it changes too much, outdated translation might be removed.
|
||||||
|
|
||||||
|
Translating changelogs is not useful because they evolve too fast. Changelogs are generally written entirely just before a release, translating them would delay releases too much. Old changelogs are not shown to anyone currently.
|
27
Makefile
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
PACKAGE_NAME = juloo.keyboard2
|
PACKAGE_NAME = juloo.keyboard2
|
||||||
|
|
||||||
ANDROID_PLATFORM_VERSION = android-29
|
ANDROID_PLATFORM_VERSION = android-30
|
||||||
JAVA_VERSION = 1.7
|
JAVA_VERSION = 1.7
|
||||||
|
|
||||||
SRC_DIR = srcs
|
SRC_DIR = srcs
|
||||||
@@ -44,11 +44,6 @@ JAVA_FILES = $(shell find $(SRC_DIR) -name '*.java')
|
|||||||
RES_FILES = $(shell find $(RES_DIR) -type f)
|
RES_FILES = $(shell find $(RES_DIR) -type f)
|
||||||
ASSETS_FILES = $(shell find $(ASSETS_DIR) -type f 2>/dev/null)
|
ASSETS_FILES = $(shell find $(ASSETS_DIR) -type f 2>/dev/null)
|
||||||
|
|
||||||
# Align
|
|
||||||
|
|
||||||
_build/%.apk: _build/%.signed-apk
|
|
||||||
$(ANDROID_BUILD_TOOLS)/zipalign -fp 4 "$<" "$@"
|
|
||||||
|
|
||||||
# Debug signing
|
# Debug signing
|
||||||
|
|
||||||
DEBUG_KEYSTORE = _build/debug.keystore
|
DEBUG_KEYSTORE = _build/debug.keystore
|
||||||
@@ -59,10 +54,9 @@ $(DEBUG_KEYSTORE):
|
|||||||
-alias debug -keypass $(DEBUG_PASSWD) -keystore "$@" \
|
-alias debug -keypass $(DEBUG_PASSWD) -keystore "$@" \
|
||||||
-keyalg rsa -storepass $(DEBUG_PASSWD) -validity 10000
|
-keyalg rsa -storepass $(DEBUG_PASSWD) -validity 10000
|
||||||
|
|
||||||
_build/%.debug.signed-apk: _build/%.debug.unsigned-apk $(DEBUG_KEYSTORE)
|
_build/%.debug.apk: _build/%.debug.unsigned-apk $(DEBUG_KEYSTORE)
|
||||||
jarsigner -keystore $(DEBUG_KEYSTORE) \
|
apksigner sign --in "$<" --out "$@" \
|
||||||
-storepass $(DEBUG_PASSWD) -keypass $(DEBUG_PASSWD) \
|
--ks $(DEBUG_KEYSTORE) --ks-key-alias debug --ks-pass "pass:$(DEBUG_PASSWD)"
|
||||||
-signedjar "$@" "$<" debug
|
|
||||||
|
|
||||||
# Debug apk
|
# Debug apk
|
||||||
|
|
||||||
@@ -70,16 +64,19 @@ _build/$(PACKAGE_NAME).debug.unsigned-apk: AAPT_PACKAGE_FLAGS+=--rename-manifest
|
|||||||
|
|
||||||
# Release signing
|
# Release signing
|
||||||
|
|
||||||
# %-keystore.conf should declare KEYSTORE, KEYNAME and OPTS
|
# %-keystore.conf should declare KEYSTORE, KEYNAME and KEYSTOREPASS
|
||||||
# it is interpreted as a shell script
|
# it is interpreted as a shell script
|
||||||
# OPTS can be used to pass -storepass or -keypass options to jarsigner
|
_build/%.apk: _build/%.unsigned-apk %-keystore.conf
|
||||||
_build/%.signed-apk: _build/%.unsigned-apk %-keystore.conf
|
|
||||||
eval `cat $(word 2,$^)` && \
|
eval `cat $(word 2,$^)` && \
|
||||||
jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore "$$KEYSTORE" $$OPTS -signedjar "$@" "$<" "$$KEYNAME"
|
apksigner sign --in "$<" --out "$@" \
|
||||||
|
--ks "$$KEYSTORE" --ks-key-alias "$$KEYNAME" --ks-pass "pass:$$KEYSTOREPASS"
|
||||||
|
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
_build/%.unsigned-apk: _build/classes.dex $(MANIFEST_FILE) $(ASSETS_FILES)
|
_build/%.unsigned-apk: _build/%.unaligned-apk
|
||||||
|
$(ANDROID_BUILD_TOOLS)/zipalign -fp 4 "$<" "$@"
|
||||||
|
|
||||||
|
_build/%.unaligned-apk: _build/classes.dex $(MANIFEST_FILE) $(ASSETS_FILES)
|
||||||
$(ANDROID_BUILD_TOOLS)/aapt package -f -M $(MANIFEST_FILE) -S $(RES_DIR) \
|
$(ANDROID_BUILD_TOOLS)/aapt package -f -M $(MANIFEST_FILE) -S $(RES_DIR) \
|
||||||
-I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS)
|
-I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS)
|
||||||
[ -z "$(ASSETS_FILES)" ] || $(ANDROID_BUILD_TOOLS)/aapt add "$@" $(ASSETS_FILES)
|
[ -z "$(ASSETS_FILES)" ] || $(ANDROID_BUILD_TOOLS)/aapt add "$@" $(ASSETS_FILES)
|
||||||
|
30
README.md
@@ -2,15 +2,35 @@
|
|||||||
|
|
||||||
A lightweight virtual keyboard for developers.
|
A lightweight virtual keyboard for developers.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
All the characters you might need are available on a single screen, as well as control, alt, escape and many others.
|
This app is a virtual keyboard for Android. The main features are easy typing of every ASCII character using the swipe gesture, dead keys for accents and modifier keys and the presence of special keys (tab, esc, arrows, etc..).
|
||||||
|
|
||||||
Several characters are displayed on each key. Get the one in the middle with a press and the ones in the corners by sliding your finger.
|
The keyboard shows up to 4 extra characters in the corners of each key. These extra characters are hit by swiping the finger on the key.
|
||||||
|
|
||||||
Like any other keyboard app, you will need to activate it in the system settings to be able to use it.
|
Highlight of some of the features:
|
||||||
This can be found in the System Settings > System > Languages & Input > Virtual keyboard > Manage keyboards.
|
|
||||||
|
- Every character and special keys that are also available on a PC keyboard. This is perfect for using applications like Termux.
|
||||||
|
|
||||||
|
- This includes Tab, Esc, the arrows and function keys, but also Ctrl and Alt !
|
||||||
|
|
||||||
|
- Accented keys are accessible using dead keys. First activate the accent, then type the accented letter.
|
||||||
|
|
||||||
|
- Very light and fast. Use 500x times less space than Google's keyboard and 15x times less than the default keyboard. No ad, no tracking.
|
||||||
|
|
||||||
|
- Multiple layouts: QWERTY, QWERTZ, AZERTY. Themes: White, Dark, OLED Black. And many other options.
|
||||||
|
|
||||||
|
Like any other virtual keyboards, it must be enabled in the system settings. Open the System Settings and go to:
|
||||||
|
System > Languages & input > On-screen keyboard > Manage on-screen keyboards.
|
||||||
|
|
||||||
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
|
||||||
alt="Get it on F-Droid"
|
alt="Get it on F-Droid"
|
||||||
height="80">](https://f-droid.org/packages/juloo.keyboard2/)
|
height="80">](https://f-droid.org/packages/juloo.keyboard2/)
|
||||||
|
[<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png"
|
||||||
|
alt="Get it on Google Play"
|
||||||
|
height="80">](https://play.google.com/store/apps/details?id=juloo.keyboard2)
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
For instructions on building the application, see
|
||||||
|
[Contributing](CONTRIBUTING.md).
|
||||||
|
1
metadata/android/de-DE/short_description.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Eine schlanke Bildschirmtastatur für Entwickler
|
1
metadata/android/de-DE/title.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Unexpected Keyboard
|
@@ -1 +1 @@
|
|||||||
First open-source release !
|
First open-source release!
|
||||||
|
8
metadata/android/en-US/changelogs/14.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
New languages: German
|
||||||
|
|
||||||
|
New keyboard layouts: QWERTZ
|
||||||
|
|
||||||
|
Added themes: White, Dark and OLED Black
|
||||||
|
|
||||||
|
Added the Action key near the Enter key, required for some app.
|
||||||
|
Improved some options and fixed a few bugs.
|
8
metadata/android/en-US/changelogs/15.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
New languages: German
|
||||||
|
|
||||||
|
New keyboard layouts: QWERTZ
|
||||||
|
|
||||||
|
Added themes: White, Dark and OLED Black
|
||||||
|
|
||||||
|
Added the Action key near the Enter key, required for some app.
|
||||||
|
Improved some options and fixed a few bugs.
|
13
metadata/android/en-US/changelogs/16.txt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
New languages: Latvian (thanks @eandersons), Bulgarian (thanks Zdravko Iskrenov)
|
||||||
|
New layouts: Bulgarian traditional, Latvian
|
||||||
|
|
||||||
|
The application can now be translated.
|
||||||
|
Translations: French, Latvian (thanks @eandersons)
|
||||||
|
|
||||||
|
Improve the behavior of the Action key.
|
||||||
|
The globe key now opens the keyboard switching dialog.
|
||||||
|
The literal tab character can be typed with Fn+Tab.
|
||||||
|
Add options to control the spacing between the keys.
|
||||||
|
Better integration with the system theme.
|
||||||
|
|
||||||
|
Thanks to all the contributors: @Moini, @sdrapha, @eandersons, @Poussinou, Zdravko Iskrenov
|
@@ -1,6 +1,18 @@
|
|||||||
All the characters you might need are available on a single screen, as well as control, alt, escape and many others.
|
This app is a virtual keyboard for Android. The main features are easy typing of every ASCII character using the swipe gesture, dead keys for accents and modifier keys and the presence of special keys (tab, esc, arrows, etc..).
|
||||||
|
|
||||||
Several characters are displayed on each key. Get the one in the middle with a press and the ones in the corners by sliding your finger.
|
The keyboard shows up to 4 extra characters in the corners of each key. These extra characters are hit by swiping the finger on the key.
|
||||||
|
|
||||||
Like any other keyboard app, you will need to activate it in the system settings to be able to use it.
|
Highlight of some of the features:
|
||||||
This can be found in the System Settings > System > Languages & Input > Virtual keyboard > Manage keyboards.
|
|
||||||
|
- Every character and special keys that are also available on a PC keyboard. This is perfect for using applications like Termux.
|
||||||
|
|
||||||
|
- This includes Tab, Esc, the arrows and function keys, but also Ctrl and Alt !
|
||||||
|
|
||||||
|
- Accented keys are accessible using dead keys. First activate the accent, then type the accented letter.
|
||||||
|
|
||||||
|
- Very light and fast. Use 500x times less space than Google's keyboard and 15x times less than the default keyboard. No ad, no tracking.
|
||||||
|
|
||||||
|
- Multiple layouts: QWERTY, QWERTZ, AZERTY. Themes: White, Dark, OLED Black. And many other options.
|
||||||
|
|
||||||
|
Like any other virtual keyboards, it must be enabled in the system settings. Open the System Settings and go to:
|
||||||
|
System > Languages & input > On-screen keyboard > Manage on-screen keyboards.
|
||||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 58 KiB |
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 64 KiB |
BIN
metadata/android/en-US/images/phoneScreenshots/6.png
Normal file
After Width: | Height: | Size: 46 KiB |
8
metadata/android/fr-FR/changelogs/14.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Nouvelle langue : Allemand
|
||||||
|
|
||||||
|
Nouvelle configuration du clavier : QWERTZ
|
||||||
|
|
||||||
|
Thèmes : Clair, Sombre et Noir OLED
|
||||||
|
|
||||||
|
Ajout de la touche Action, à côté de la touche Entrer, nécessaire pour certaines applications.
|
||||||
|
Amélioration des options et résolution de bugs.
|
8
metadata/android/fr-FR/changelogs/15.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
Nouvelle langue : Allemand
|
||||||
|
|
||||||
|
Nouvelle configuration du clavier : QWERTZ
|
||||||
|
|
||||||
|
Thèmes : Clair, Sombre et Noir OLED
|
||||||
|
|
||||||
|
Ajout de la touche Action, à côté de la touche Entrer, nécessaire pour certaines applications.
|
||||||
|
Amélioration des options et résolution de bugs.
|
12
metadata/android/fr-FR/changelogs/16.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
Nouvelles langues: Letton (merci @eandersons), Bulgare (merci Zdravko Iskrenov)
|
||||||
|
Nouvelles dispositions: Bulgare, Letton
|
||||||
|
|
||||||
|
L'application est traduite en Français et Letton.
|
||||||
|
|
||||||
|
Amélioration de la touche Action.
|
||||||
|
La touche globe ouvre le menu de sélection des claviers.
|
||||||
|
Fn+Tab pour écrire le charactère Tab littérallement.
|
||||||
|
Nouvelles options pour contrôler l'espacement entre les touches.
|
||||||
|
Meilleure intégration avec le thème système.
|
||||||
|
|
||||||
|
Merci à tous les contributeurs: @Moini, @sdrapha, @eandersons, @Poussinou, Zdravko Iskrenov
|
@@ -1,3 +1,18 @@
|
|||||||
Tous les caractères dont vous pourriez avoir besoin sont disponibles sur un seul écran, ainsi que les touches control, alt, escape et bien d'autres.
|
Cette application est un clavier virtuel pour Android. Les fonctionnalités principales sont l'accès rapide à tous les caractères ASCII en glissant le doigt, les touches mortes pour les accents et la présence des touches spéciales (Tab, Esc, les flèches, etc..).
|
||||||
|
|
||||||
Plusieurs caractères sont affichés sur chaque touche. Tapez celui du milieu par une simple pression et ceux des coins en faisant glisser votre doigt.
|
Il peut y avoir un caractère supplémentaire dans chaque coin de chaque touche. Ces caractères sont tapés en glissant le doigt sur la touche.
|
||||||
|
|
||||||
|
Quelques fonctionnalités:
|
||||||
|
|
||||||
|
- Tous les caractères et toutes les touches spéciales d'un clavier PC. Idéal pour utiliser une application comme Termux.
|
||||||
|
|
||||||
|
- Cela comprend les touches Tab, Esc, les flèches et les touches fonctions mais aussi Ctrl et Alt !
|
||||||
|
|
||||||
|
- Les accents sont des touches mortes. Activez d'abord l'accent et tapez ensuite la lettre accentuée.
|
||||||
|
|
||||||
|
- Léger et rapide. Utilise 500x fois moins d'espace que le clavier de Google et 15x fois moins que le clavier de base. Pas de pub, pas de traqueur.
|
||||||
|
|
||||||
|
- Plusieurs configurations: QWERTY, QWERTZ, AZERTY. Thèmes: Clair, Sombre, Noir OLED. Et beaucoup d'autres options.
|
||||||
|
|
||||||
|
Comme tous les claviers virtuels, il doit être activé dans les paramètres systèmes. Ouvrez les paramètres et allez dans:
|
||||||
|
Système > Langue & saisie > Clavier à l'écran > Gérer les claviers à l'écran.
|
||||||
|
18
metadata/android/lv-LV/full_description.txt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
Šī lietotne ir tastatūra Android tālruņiem. Galvenās iespējas ir ērta ASCII rakstzīmju ievadīšana ar pavilkšanas kustību, taustiņi piekļūšanai uzsvara zīmēm un pārveidošanas taustiņiem un īpašo taustiņu esamība (Tab, Esc, bultas utt.).
|
||||||
|
|
||||||
|
Tastatūrā ir redzamas līdz 4 papildus rakstzīmēm katra taustiņa stūros. Tām var piekļūt ar pirksta pavilkšanu uz taustiņa attiecīgajā virzienā.
|
||||||
|
|
||||||
|
Izceltās iespējas:
|
||||||
|
|
||||||
|
- Visas rakstzīmes un īpašie taustiņi, kas ir atrodami arī datora tastatūrā. Tas lieliski noder tādās lietotnēs kā, piemēram, Termux.
|
||||||
|
|
||||||
|
- Ir iekļauti Tab, Esc, bultas un darbību taustiņi, kā arī Ctrl un Alt.
|
||||||
|
|
||||||
|
- Uzsvara zīmju taustiņi ir pieejami ar īpašām pogām. Vispirms jāizvēlas uzsvara zīmes veids, tad jāievada vēlamais burts.
|
||||||
|
|
||||||
|
- Ļoti viegla un ātra. Izmanto 500 reižu mazāk vietas kā Google tastatūra un 15 reižu mazāk kā noklusējuma tastatūra. Bez reklāmām un izsekošanas.
|
||||||
|
|
||||||
|
- Dažādi izkārtojumi: QWERTY, QWERTZ, AZERTY. Izskats: Gaišs, Tumšs, OLED melns. Kā arī daudzas citas papildiespējas.
|
||||||
|
|
||||||
|
Kā jebkura cita tālruņa tastatūra, tā ir jāiespējo ierīces iestatījumos. Jāatver Iestatījumi un tad:
|
||||||
|
Sistēma > Valodas un ievade > Virtuālā tastatūra > Pārvaldīt tastatūras.
|
1
metadata/android/lv-LV/short_description.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Viegla un ātra tālruņa tastatūra izstrādātājiem.
|
@@ -1,38 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:hardwareAccelerated="false">
|
||||||
android:orientation="vertical"
|
<juloo.keyboard2.EmojiGroupButtonsBar android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
|
||||||
android:hardwareAccelerated="false">
|
<juloo.keyboard2.EmojiGridView android:id="@+id/emoji_grid" android:background="?attr/colorKeyboard" android:layout_width="fill_parent" android:layout_height="@dimen/emoji_grid_height"/>
|
||||||
<juloo.keyboard2.EmojiGroupButtonsBar
|
<LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
|
||||||
android:orientation="horizontal"
|
<juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" key="switch_back_emoji"/>
|
||||||
android:layout_width="fill_parent"
|
<juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" android:layout_weight="4" key="space"/>
|
||||||
android:layout_height="wrap_content" />
|
<juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" key="backspace"/>
|
||||||
<juloo.keyboard2.EmojiGridView
|
<juloo.keyboard2.EmojiKeyButton style="@style/emojiKeyButton" key="enter"/>
|
||||||
android:id="@+id/emoji_grid"
|
</LinearLayout>
|
||||||
android:background="@color/bg"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="@dimen/emoji_grid_height"
|
|
||||||
/>
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
>
|
|
||||||
<juloo.keyboard2.EmojiKeyButton
|
|
||||||
style="@style/emojiKeyButton"
|
|
||||||
key="switch_back_emoji"
|
|
||||||
/>
|
|
||||||
<juloo.keyboard2.EmojiKeyButton
|
|
||||||
style="@style/emojiKeyButton"
|
|
||||||
android:layout_weight="4"
|
|
||||||
key="space"
|
|
||||||
/>
|
|
||||||
<juloo.keyboard2.EmojiKeyButton
|
|
||||||
style="@style/emojiKeyButton"
|
|
||||||
key="backspace"
|
|
||||||
/>
|
|
||||||
<juloo.keyboard2.EmojiKeyButton
|
|
||||||
style="@style/emojiKeyButton"
|
|
||||||
key="enter"
|
|
||||||
/>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@@ -1,5 +1,2 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android"
|
<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android" android:hardwareAccelerated="false" android:background="?attr/colorKeyboard"/>
|
||||||
android:background="@color/bg"
|
|
||||||
android:hardwareAccelerated="false"
|
|
||||||
/>
|
|
||||||
|
48
res/values-fr/strings.xml
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Unexpected Keyboard</string>
|
||||||
|
<string name="settings_activity_label">Unexpected Keyboard Paramètres</string>
|
||||||
|
<string name="pref_category_layout">Disposition</string>
|
||||||
|
<string name="pref_layout_title">Disposition des touches</string>
|
||||||
|
<string name="pref_layout_e_system">Paramètre système</string>
|
||||||
|
<string name="pref_accents_title">Accents</string>
|
||||||
|
<string name="pref_accents_e_all_installed">Afficher les accents pour les langues installées</string>
|
||||||
|
<string name="pref_accents_e_selected">Afficher les accents pour la langue sélectionnée</string>
|
||||||
|
<string name="pref_accents_e_all">Afficher tous les accents</string>
|
||||||
|
<string name="pref_accents_e_none">Cacher les accents</string>
|
||||||
|
<string name="pref_category_typing">Saisie</string>
|
||||||
|
<string name="pref_swipe_dist_title">Distance de swipe</string>
|
||||||
|
<string name="pref_swipe_dist_summary">La distance des caractères dans les coins (%s)</string>
|
||||||
|
<string name="pref_long_timeout_title">Délai avant répétition</string>
|
||||||
|
<string name="pref_long_interval_title">Écart entre répétitions</string>
|
||||||
|
<string name="pref_category_vibrate">Vibration</string>
|
||||||
|
<string name="pref_vibrate_title">Vibreur</string>
|
||||||
|
<string name="pref_vibrate_summary">Vibration a chaque touche</string>
|
||||||
|
<string name="pref_vibrate_duration_title">Durée</string>
|
||||||
|
<string name="pref_precise_repeat_title">Mouvement précis du curseur</string>
|
||||||
|
<string name="pref_precise_repeat_summary">Modifier la vitesse de répétition en bougeant le doigt</string>
|
||||||
|
<string name="pref_category_style">Style</string>
|
||||||
|
<string name="pref_margin_bottom_title">Marge du bas</string>
|
||||||
|
<string name="pref_key_height_title">Hauteur des touches</string>
|
||||||
|
<string name="pref_horizontal_margin_title">Marge des côtés</string>
|
||||||
|
<string name="pref_character_size_title">Taille des labels</string>
|
||||||
|
<string name="pref_character_size_summary">Taille des caractères affichés sur les touches (%.2fx)</string>
|
||||||
|
<string name="pref_theme">Thème</string>
|
||||||
|
<string name="pref_theme_e_system">Paramètre système</string>
|
||||||
|
<string name="pref_theme_e_dark">Sombre</string>
|
||||||
|
<string name="pref_theme_e_light">Clair</string>
|
||||||
|
<string name="pref_theme_e_black">Noir</string>
|
||||||
|
<string name="pref_swipe_dist_e_very_short">Très courte</string>
|
||||||
|
<string name="pref_swipe_dist_e_short">Courte</string>
|
||||||
|
<string name="pref_swipe_dist_e_default">Normale</string>
|
||||||
|
<string name="pref_swipe_dist_e_far">Longue</string>
|
||||||
|
<string name="pref_swipe_dist_e_very_far">Très longue</string>
|
||||||
|
<string name="pref_key_horizontal_space">Espacement horizontal entre les touches</string>
|
||||||
|
<string name="pref_key_vertical_space">Espacement vertical entre les touches</string>
|
||||||
|
<string name="key_action_next">Suiv.</string>
|
||||||
|
<string name="key_action_done">Fin</string>
|
||||||
|
<string name="key_action_go">Aller</string>
|
||||||
|
<string name="key_action_prev">Prec.</string>
|
||||||
|
<string name="key_action_search">Chercher</string>
|
||||||
|
<string name="key_action_send">Envoyer</string>
|
||||||
|
</resources>
|
@@ -1,10 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="horizontal_margin">12dp</dimen>
|
<dimen name="horizontal_margin">12dp</dimen>
|
||||||
<dimen name="margin_bottom">3dp</dimen>
|
<dimen name="margin_bottom">3dp</dimen>
|
||||||
<dimen name="key_padding">3dp</dimen>
|
<dimen name="key_padding">3dp</dimen>
|
||||||
<dimen name="key_height">36dp</dimen>
|
<dimen name="key_height">36dp</dimen>
|
||||||
<dimen name="label_text_size">18dp</dimen>
|
<dimen name="label_text_size">18dp</dimen>
|
||||||
<dimen name="sublabel_text_size">11dp</dimen>
|
<dimen name="sublabel_text_size">11dp</dimen>
|
||||||
<dimen name="emoji_type_button_height">48dp</dimen>
|
<dimen name="emoji_type_button_height">48dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
46
res/values-lv/strings.xml
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Unexpected Keyboard</string>
|
||||||
|
<string name="settings_activity_label">Unexpected Keyboard iestatījumi</string>
|
||||||
|
<string name="pref_category_layout">Izkārtojums</string>
|
||||||
|
<string name="pref_layout_title">Mainīt tastatūras izkārtojumu</string>
|
||||||
|
<string name="pref_layout_e_system">Ierīces iestatījumi</string>
|
||||||
|
<string name="pref_accents_title">Uzsvara zīmes</string>
|
||||||
|
<string name="pref_accents_e_all_installed">Rādīt uzsvara zīmes visām uzstādītajām valodām</string>
|
||||||
|
<string name="pref_accents_e_selected">Rādīt uzsvara zīmes tikai atlasītajām valodām</string>
|
||||||
|
<string name="pref_accents_e_all">Rādīt visas uzsvara zīmes</string>
|
||||||
|
<string name="pref_accents_e_none">Paslēpt uzsvara zīmes</string>
|
||||||
|
<string name="pref_category_typing">Rakstīšana</string>
|
||||||
|
<string name="pref_swipe_dist_title">Pavilkšanas attālums</string>
|
||||||
|
<string name="pref_swipe_dist_summary">Taustiņu stūros esošo rakstzīmju attālums (%s)</string>
|
||||||
|
<string name="pref_long_timeout_title">Taustiņa atkārtošanās ātrums</string>
|
||||||
|
<string name="pref_long_interval_title">Taustiņa atkārtošanās aizture</string>
|
||||||
|
<string name="pref_category_vibrate">Trīcēšana</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_vibrate_duration_title">Ilgums</string>
|
||||||
|
<string name="pref_precise_repeat_title">Pielāgojama kursora kustība</string>
|
||||||
|
<string name="pref_precise_repeat_summary">Mainīt taustiņa atkārtošanās ātrumu ar pavilkšanas attālumu</string>
|
||||||
|
<string name="pref_category_style">Izskata pielāgojumi</string>
|
||||||
|
<string name="pref_margin_bottom_title">Apakšējā apmale</string>
|
||||||
|
<string name="pref_key_height_title">Taustiņa augstums</string>
|
||||||
|
<string name="pref_horizontal_margin_title">Līmeniskā apmale</string>
|
||||||
|
<string name="pref_character_size_title">Iezīmes izmērs</string>
|
||||||
|
<string name="pref_character_size_summary">Tastatūrā attēloto rakstzīmju izmērs (%.2fx)</string>
|
||||||
|
<string name="pref_theme">Izskats</string>
|
||||||
|
<string name="pref_theme_e_system">Ierīces iestatījumi</string>
|
||||||
|
<string name="pref_theme_e_dark">Tumšs</string>
|
||||||
|
<string name="pref_theme_e_light">Gaišs</string>
|
||||||
|
<string name="pref_theme_e_black">Melns</string>
|
||||||
|
<string name="pref_swipe_dist_e_very_short">Ļoti tuvs</string>
|
||||||
|
<string name="pref_swipe_dist_e_short">Tuvs</string>
|
||||||
|
<string name="pref_swipe_dist_e_default">Vidējs</string>
|
||||||
|
<string name="pref_swipe_dist_e_far">Tāls</string>
|
||||||
|
<string name="pref_swipe_dist_e_very_far">Ļoti tāls</string>
|
||||||
|
<string name="key_action_next">Nākamais</string>
|
||||||
|
<string name="key_action_done">Darīts</string>
|
||||||
|
<string name="key_action_go">Aiziet</string>
|
||||||
|
<string name="key_action_prev">Iepriekšējais</string>
|
||||||
|
<string name="key_action_search">Meklēt</string>
|
||||||
|
<string name="key_action_send">Sūtīt</string>
|
||||||
|
</resources>
|
@@ -4,10 +4,18 @@
|
|||||||
<item>system</item>
|
<item>system</item>
|
||||||
<item>azerty</item>
|
<item>azerty</item>
|
||||||
<item>qwerty</item>
|
<item>qwerty</item>
|
||||||
|
<item>qwerty_lv</item>
|
||||||
|
<item>qwertz</item>
|
||||||
|
<item>bgph1</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_layout_entries">
|
||||||
|
<item>@string/pref_layout_e_system</item>
|
||||||
|
<item>AZERTY</item>
|
||||||
|
<item>QWERTY</item>
|
||||||
|
<item>QWERTY (Latvian)</item>
|
||||||
|
<item>QWERTZ</item>
|
||||||
|
<item>Bulgarian (Phonetic Traditional)</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string name="pref_accents_default">1</string>
|
|
||||||
|
|
||||||
<string-array name="pref_accents_entries">
|
<string-array name="pref_accents_entries">
|
||||||
<item>@string/pref_accents_e_all_installed</item>
|
<item>@string/pref_accents_e_all_installed</item>
|
||||||
<item>@string/pref_accents_e_selected</item>
|
<item>@string/pref_accents_e_selected</item>
|
||||||
@@ -20,4 +28,30 @@
|
|||||||
<item>3</item>
|
<item>3</item>
|
||||||
<item>4</item>
|
<item>4</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="pref_theme_entries">
|
||||||
|
<item>@string/pref_theme_e_system</item>
|
||||||
|
<item>@string/pref_theme_e_dark</item>
|
||||||
|
<item>@string/pref_theme_e_light</item>
|
||||||
|
<item>@string/pref_theme_e_black</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_theme_values">
|
||||||
|
<item>system</item>
|
||||||
|
<item>dark</item>
|
||||||
|
<item>light</item>
|
||||||
|
<item>black</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_swipe_dist_entries">
|
||||||
|
<item>@string/pref_swipe_dist_e_very_short</item>
|
||||||
|
<item>@string/pref_swipe_dist_e_short</item>
|
||||||
|
<item>@string/pref_swipe_dist_e_default</item>
|
||||||
|
<item>@string/pref_swipe_dist_e_far</item>
|
||||||
|
<item>@string/pref_swipe_dist_e_very_far</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_swipe_dist_values">
|
||||||
|
<item>5</item>
|
||||||
|
<item>7.5</item>
|
||||||
|
<item>15</item>
|
||||||
|
<item>25</item>
|
||||||
|
<item>35</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<item name="bg" type="color">#1B1B1B</item>
|
|
||||||
<item name="key_bg" type="color">#303030</item>
|
|
||||||
<item name="key_down_bg" type="color">#1B1B1B</item>
|
|
||||||
<item name="key_label" type="color">#FFFFFF</item>
|
|
||||||
<item name="key_label_locked" type="color">#229933</item>
|
|
||||||
<item name="key_label_activated" type="color">#226b99</item>
|
|
||||||
<item name="key_sub_label" type="color">#A0A0A0</item>
|
|
||||||
<item name="emoji_button_bg" type="color">#202020</item>
|
|
||||||
<item name="emoji_color" type="color">#FFFFFF</item>
|
|
||||||
<item name="emoji_key_bg" type="color">@color/emoji_button_bg</item>
|
|
||||||
<item name="emoji_key_text" type="color">@color/key_label</item>
|
|
||||||
</resources>
|
|
@@ -1,15 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="horizontal_margin">3dp</dimen>
|
<dimen name="horizontal_margin">3dp</dimen>
|
||||||
<dimen name="margin_top">3dp</dimen>
|
<dimen name="margin_top">3dp</dimen>
|
||||||
<dimen name="margin_bottom">7dp</dimen>
|
<dimen name="margin_bottom">7dp</dimen>
|
||||||
<dimen name="key_padding">2dp</dimen>
|
<dimen name="key_padding">2dp</dimen>
|
||||||
<dimen name="key_vertical_interval">2dp</dimen>
|
<dimen name="key_vertical_interval">2dp</dimen>
|
||||||
<dimen name="key_horizontal_interval">2dp</dimen>
|
<dimen name="key_horizontal_interval">2dp</dimen>
|
||||||
<dimen name="key_height">51dp</dimen>
|
<dimen name="key_height">51dp</dimen>
|
||||||
<dimen name="key_round">5dp</dimen>
|
<dimen name="label_text_size">18dp</dimen>
|
||||||
<dimen name="label_text_size">18dp</dimen>
|
<dimen name="sublabel_text_size">12dp</dimen>
|
||||||
<dimen name="sublabel_text_size">12dp</dimen>
|
<dimen name="emoji_type_button_height">56dp</dimen>
|
||||||
<dimen name="emoji_type_button_height">56dp</dimen>
|
<dimen name="emoji_grid_height">250dp</dimen>
|
||||||
<dimen name="emoji_grid_height">250dp</dimen>
|
<dimen name="emoji_text_size">28dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -1,51 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="app_name">Unexpected Keyboard</string>
|
||||||
<string name="app_name">Unexpected Keyboard</string>
|
<string name="settings_activity_label">Unexpected Keyboard Settings</string>
|
||||||
|
<string name="pref_category_layout">Layout</string>
|
||||||
<string name="settings_activity_label">Unexpected Keyboard Settings</string>
|
|
||||||
|
|
||||||
<string name="subtype_label">%s</string>
|
|
||||||
|
|
||||||
<string name="pref_category_layout">Layout</string>
|
|
||||||
<string name="pref_layout_title">Change keyboard layout</string>
|
<string name="pref_layout_title">Change keyboard layout</string>
|
||||||
<string name="pref_layout_summary">%s</string>
|
<string name="pref_layout_e_system">System settings</string>
|
||||||
<string-array name="pref_layout_entries">
|
|
||||||
<item>System settings</item>
|
|
||||||
<item>Azerty</item>
|
|
||||||
<item>Qwerty</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string name="pref_accents_title">Accents</string>
|
<string name="pref_accents_title">Accents</string>
|
||||||
<string name="pref_accents_summary">%s</string>
|
<string name="pref_accents_e_all_installed">Show accents for all installed languages</string>
|
||||||
<string name="pref_accents_e_all_installed">Show accents for all the installed languages</string>
|
<string name="pref_accents_e_selected">Only show accents for the selected language</string>
|
||||||
<string name="pref_accents_e_selected">Show accents for the selected language</string>
|
<string name="pref_accents_e_all">Show all accents</string>
|
||||||
<string name="pref_accents_e_all">Show every accents</string>
|
|
||||||
<string name="pref_accents_e_none">Hide accents</string>
|
<string name="pref_accents_e_none">Hide accents</string>
|
||||||
|
<string name="pref_category_typing">Typing</string>
|
||||||
<string name="pref_category_typing">Typing</string>
|
<string name="pref_swipe_dist_title">Swiping distance</string>
|
||||||
<string name="pref_preci_title">Precision</string>
|
<string name="pref_swipe_dist_summary">Distance of characters in the corners of the keys (%s)</string>
|
||||||
<string name="pref_preci_summary">Distance of corner values (%spx)</string>
|
<string name="pref_long_timeout_title">Key repeat timeout</string>
|
||||||
<string name="pref_long_timeout_title">Long press timeout</string>
|
<string name="pref_long_interval_title">Key repeat interval</string>
|
||||||
<string name="pref_long_timeout_summary">%sms</string>
|
<string name="pref_category_vibrate">Vibration</string>
|
||||||
<string name="pref_long_interval_title">Long press interval</string>
|
<string name="pref_vibrate_title">Vibration</string>
|
||||||
<string name="pref_long_interval_summary">%sms</string>
|
<string name="pref_vibrate_summary">Enable/disable vibration on keypress</string>
|
||||||
|
<string name="pref_vibrate_duration_title">Duration</string>
|
||||||
<string name="pref_category_vibrate">Vibration</string>
|
|
||||||
<string name="pref_vibrate_title">Vibration</string>
|
|
||||||
<string name="pref_vibrate_summary">Enable/Disable vibrations on key down</string>
|
|
||||||
<string name="pref_vibrate_duration_title">Duration</string>
|
|
||||||
<string name="pref_vibrate_duration_summary">%sms</string>
|
|
||||||
<string name="pref_precise_repeat_title">Precise cursor movements</string>
|
<string name="pref_precise_repeat_title">Precise cursor movements</string>
|
||||||
<string name="pref_precise_repeat_summary">Modulate the speed of movements by swiping more or less</string>
|
<string name="pref_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
|
||||||
|
<string name="pref_category_style">Style</string>
|
||||||
<string name="pref_category_style">Style</string>
|
<string name="pref_margin_bottom_title">Margin bottom</string>
|
||||||
<string name="pref_margin_bottom_title">Margin bottom</string>
|
<string name="pref_key_height_title">Key height</string>
|
||||||
<string name="pref_margin_bottom_summary">%sdp</string>
|
<string name="pref_horizontal_margin_title">Horizontal margin</string>
|
||||||
<string name="pref_key_height_title">Key height</string>
|
|
||||||
<string name="pref_key_height_summary">%sdp</string>
|
|
||||||
<string name="pref_horizontal_margin_title">Horizontal margin</string>
|
|
||||||
<string name="pref_horizontal_margin_summary">%sdp</string>
|
|
||||||
<string name="pref_character_size_title">Label size</string>
|
<string name="pref_character_size_title">Label size</string>
|
||||||
<string name="pref_character_size_summary">Size of characters displayed on the keyboard (%.2fx)</string>
|
<string name="pref_character_size_summary">Size of characters displayed on the keyboard (%.2fx)</string>
|
||||||
|
<string name="pref_theme">Theme</string>
|
||||||
|
<string name="pref_theme_e_system">System settings</string>
|
||||||
|
<string name="pref_theme_e_dark">Dark</string>
|
||||||
|
<string name="pref_theme_e_light">Light</string>
|
||||||
|
<string name="pref_theme_e_black">Black</string>
|
||||||
|
<string name="pref_swipe_dist_e_very_short">Very short</string>
|
||||||
|
<string name="pref_swipe_dist_e_short">Short</string>
|
||||||
|
<string name="pref_swipe_dist_e_default">Normal</string>
|
||||||
|
<string name="pref_swipe_dist_e_far">Far</string>
|
||||||
|
<string name="pref_swipe_dist_e_very_far">Very far</string>
|
||||||
|
<string name="pref_key_horizontal_space">Horizontal spacing between the keys</string>
|
||||||
|
<string name="pref_key_vertical_space">Vertical spacing between the keys</string>
|
||||||
|
<string name="key_action_next">Next</string>
|
||||||
|
<string name="key_action_done">Done</string>
|
||||||
|
<string name="key_action_go">Go</string>
|
||||||
|
<string name="key_action_prev">Prev</string>
|
||||||
|
<string name="key_action_search">Search</string>
|
||||||
|
<string name="key_action_send">Send</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -1,20 +1,25 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<style name="emojiTypeButton">
|
<style name="emojiTypeButton">
|
||||||
<item name="android:padding">1px</item>
|
<item name="android:padding">1px</item>
|
||||||
<item name="android:gravity">center</item>
|
<item name="android:gravity">center</item>
|
||||||
<item name="android:minHeight">@dimen/label_text_size</item>
|
<item name="android:minHeight">@dimen/label_text_size</item>
|
||||||
<item name="android:background">@color/emoji_button_bg</item>
|
<item name="android:background">?attr/emoji_button_bg</item>
|
||||||
<item name="android:textColor">@color/emoji_key_text</item>
|
<item name="android:textColor">?attr/emoji_key_text</item>
|
||||||
<item name="android:textSize">@dimen/label_text_size</item>
|
<item name="android:textSize">@dimen/label_text_size</item>
|
||||||
</style>
|
</style>
|
||||||
<style name="emojiKeyButton">
|
<style name="emojiKeyButton">
|
||||||
<item name="android:layout_width">0px</item>
|
<item name="android:layout_width">0px</item>
|
||||||
<item name="android:layout_height">wrap_content</item>
|
<item name="android:layout_height">wrap_content</item>
|
||||||
<item name="android:layout_weight">1</item>
|
<item name="android:layout_weight">1</item>
|
||||||
<item name="android:padding">0px</item>
|
<item name="android:padding">0px</item>
|
||||||
<item name="android:background">@color/emoji_key_bg</item>
|
<item name="android:background">?attr/emoji_key_bg</item>
|
||||||
<item name="android:textColor">@color/emoji_key_text</item>
|
<item name="android:textColor">?attr/emoji_key_text</item>
|
||||||
<item name="android:textSize">@dimen/label_text_size</item>
|
<item name="android:textSize">@dimen/label_text_size</item>
|
||||||
</style>
|
</style>
|
||||||
|
<!-- Passed to TextView.setTextAppearance -->
|
||||||
|
<style name="emojiGridButton">
|
||||||
|
<item name="android:textSize">@dimen/emoji_text_size</item>
|
||||||
|
<item name="android:textColor">?attr/emoji_color</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
70
res/values/themes.xml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<declare-styleable name="keyboard">
|
||||||
|
<!-- The background of the keyboard -->
|
||||||
|
<attr name="colorKeyboard" format="color"/>
|
||||||
|
<!-- Background of the keys -->
|
||||||
|
<attr name="colorKey" format="color"/>
|
||||||
|
<!-- Background of the keys when pressed -->
|
||||||
|
<attr name="colorKeyActivated" format="color"/>
|
||||||
|
<!-- Label colors -->
|
||||||
|
<attr name="colorLabel" format="color"/>
|
||||||
|
<attr name="colorLabelActivated" format="color"/>
|
||||||
|
<attr name="colorLabelLocked" format="color"/>
|
||||||
|
<!-- Corner labels -->
|
||||||
|
<attr name="colorSubLabel" format="color"/>
|
||||||
|
<!-- Dimens -->
|
||||||
|
<attr name="keyBorderRadius" format="dimension"/>
|
||||||
|
<!-- Emoji panel -->
|
||||||
|
<attr name="emoji_button_bg" type="color" format="color"/>
|
||||||
|
<attr name="emoji_color" type="color" format="color"/>
|
||||||
|
<attr name="emoji_key_bg" type="color" format="color"/>
|
||||||
|
<attr name="emoji_key_text" type="color" format="color"/>
|
||||||
|
</declare-styleable>
|
||||||
|
<style name="Dark">
|
||||||
|
<item name="android:isLightTheme">false</item>
|
||||||
|
<item name="colorKeyboard">#1B1B1B</item>
|
||||||
|
<item name="colorKey">#303030</item>
|
||||||
|
<item name="colorKeyActivated">#1B1B1B</item>
|
||||||
|
<item name="colorLabel">#FFFFFF</item>
|
||||||
|
<item name="colorLabelActivated">#226b99</item>
|
||||||
|
<item name="colorLabelLocked">#229933</item>
|
||||||
|
<item name="colorSubLabel">#A0A0A0</item>
|
||||||
|
<item name="keyBorderRadius">5dp</item>
|
||||||
|
<item name="emoji_button_bg" type="color">#202020</item>
|
||||||
|
<item name="emoji_color" type="color">#FFFFFF</item>
|
||||||
|
<item name="emoji_key_bg" type="color">?attr/emoji_button_bg</item>
|
||||||
|
<item name="emoji_key_text" type="color">?attr/colorLabel</item>
|
||||||
|
</style>
|
||||||
|
<style name="Light">
|
||||||
|
<item name="android:isLightTheme">true</item>
|
||||||
|
<item name="android:forceDarkAllowed">false</item>
|
||||||
|
<item name="colorKeyboard">#e3e3e3</item>
|
||||||
|
<item name="colorKey">#cfcfcf</item>
|
||||||
|
<item name="colorKeyActivated">#e3e3e3</item>
|
||||||
|
<item name="colorLabel">#000000</item>
|
||||||
|
<item name="colorLabelActivated">#64afdd</item>
|
||||||
|
<item name="colorLabelLocked">#64dd76</item>
|
||||||
|
<item name="colorSubLabel">#5e5e5e</item>
|
||||||
|
<item name="keyBorderRadius">5dp</item>
|
||||||
|
<item name="emoji_button_bg" type="color">#dedede</item>
|
||||||
|
<item name="emoji_color" type="color">#000000</item>
|
||||||
|
<item name="emoji_key_bg" type="color">?attr/emoji_button_bg</item>
|
||||||
|
<item name="emoji_key_text" type="color">?attr/colorLabel</item>
|
||||||
|
</style>
|
||||||
|
<style name="Black">
|
||||||
|
<item name="android:isLightTheme">false</item>
|
||||||
|
<item name="colorKeyboard">#000000</item>
|
||||||
|
<item name="colorKey">#000000</item>
|
||||||
|
<item name="colorKeyActivated">#333333</item>
|
||||||
|
<item name="colorLabel">#eeeeee</item>
|
||||||
|
<item name="colorLabelActivated">#009dff</item>
|
||||||
|
<item name="colorLabelLocked">#00ff26</item>
|
||||||
|
<item name="colorSubLabel">#bbbbbb</item>
|
||||||
|
<item name="keyBorderRadius">1dp</item>
|
||||||
|
<item name="emoji_button_bg" type="color">#000000</item>
|
||||||
|
<item name="emoji_color" type="color">#ffffff</item>
|
||||||
|
<item name="emoji_key_bg" type="color">?attr/emoji_button_bg</item>
|
||||||
|
<item name="emoji_key_text" type="color">?attr/colorLabel</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
@@ -1,44 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<keyboard>
|
<keyboard>
|
||||||
<row>
|
<row>
|
||||||
<key key0="a" key1="esc" key2="1" key3="&" />
|
<key key0="a" key1="esc" key2="1" key3="&"/>
|
||||||
<key key0="z" key2="2" key4="~" />
|
<key key0="z" key2="2" key4="~"/>
|
||||||
<key key0="e" key2="3" key3=""" key4="\#" />
|
<key key0="e" key2="3" key3=""" key4="\#"/>
|
||||||
<key key0="r" key2="4" key3="'" />
|
<key key0="r" key2="4" key3="'"/>
|
||||||
<key key0="t" key2="5" key3="(" key4=")" />
|
<key key0="t" key2="5" key3="(" key4=")"/>
|
||||||
<key key0="y" key2="6" key3="-" key4="|" />
|
<key key0="y" key2="6" key3="-" key4="|"/>
|
||||||
<key key0="u" key2="7" key4="`" />
|
<key key0="u" key2="7" key4="`"/>
|
||||||
<key key0="i" key2="8" key3="_" key4="\\" />
|
<key key0="i" key2="8" key3="_" key4="\\"/>
|
||||||
<key key0="o" key2="9" />
|
<key key0="o" key2="9"/>
|
||||||
<key key0="p" key2="0" key4="\@" />
|
<key key0="p" key2="0" key4="\@"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<key key0="q" key1="tab" />
|
<key key0="q" key1="tab"/>
|
||||||
<key key0="s" key1="accent_ring" />
|
<key key0="s" key1="accent_ring" key3="ß"/>
|
||||||
<key key0="d" key1="accent_grave" key3="accent_aigu" />
|
<key key0="d" key1="accent_grave" key3="accent_aigu"/>
|
||||||
<key key0="f" key3="{" key4="}" />
|
<key key0="f" key3="{" key4="}"/>
|
||||||
<key key0="g" key3="[" key4="]" />
|
<key key0="g" key3="[" key4="]"/>
|
||||||
<key key0="h" key3="=" key4="+" />
|
<key key0="h" key3="=" key4="+"/>
|
||||||
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key3="^" />
|
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key3="^"/>
|
||||||
<key key0="k" key2="€" key3="$" key4="£" />
|
<key key0="k" key2="€" key3="$" key4="£"/>
|
||||||
<key key0="l" key2="%" />
|
<key key0="l" key2="%"/>
|
||||||
<key key0="m" key4="*" />
|
<key key0="m" key4="*"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<key width="2.0" key0="shift" />
|
<key width="2.0" key0="shift"/>
|
||||||
<key key0="w" key3="<" key4=">" />
|
<key key0="w" key3="<" key4=">"/>
|
||||||
<key key0="x" />
|
<key key0="x"/>
|
||||||
<key key0="c" key1="accent_cedille" key3="," key4="\?" />
|
<key key0="c" key1="accent_cedille" key3="," key4="\?"/>
|
||||||
<key key0="v" key3=";" key4="." />
|
<key key0="v" key3=";" key4="."/>
|
||||||
<key key0="b" key3=":" key4="/" />
|
<key key0="b" key3=":" key4="/"/>
|
||||||
<key key0="n" key1="accent_tilde" key2="§" key4="!" />
|
<key key0="n" key1="accent_tilde" key2="§" key4="!"/>
|
||||||
<key width="2.0" key0="backspace" key2="delete" />
|
<key width="2.0" key0="backspace" key2="delete"/>
|
||||||
</row>
|
</row>
|
||||||
<row height="0.95">
|
<row height="0.95">
|
||||||
<key width="1.8" key0="ctrl" key3="switch_numeric" />
|
<key width="1.8" key0="ctrl" key3="switch_numeric"/>
|
||||||
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config" />
|
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||||
<key width="4.0" key0="space" />
|
<key width="4.0" key0="space"/>
|
||||||
<key width="1.2" key1="up" key2="right" key3="left" key4="down" />
|
<key width="1.2" key1="up" key2="right" key3="left" key4="down"/>
|
||||||
<key width="1.8" key0="enter" />
|
<key width="1.8" key0="enter" key2="action"/>
|
||||||
</row>
|
</row>
|
||||||
</keyboard>
|
</keyboard>
|
||||||
|
44
res/xml/local_bgph1.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<keyboard>
|
||||||
|
<row>
|
||||||
|
<key key0="я" key1="esc" key2="1" key3="ч" key4="!"/>
|
||||||
|
<key key0="в" key2="2" key3="\@"/>
|
||||||
|
<key key0="е" key2="3" key3="\#" key4="№"/>
|
||||||
|
<key key0="р" key2="4" key3="$"/>
|
||||||
|
<key key0="т" key2="5" key3="%"/>
|
||||||
|
<key key0="ъ" key2="6" key3="^" key4="€"/>
|
||||||
|
<key key0="у" key2="7" key3="&" key4="§"/>
|
||||||
|
<key key0="и" key2="8" key3="*"/>
|
||||||
|
<key key0="о" key1="accent_macron" key2="9" key3="(" key4=")"/>
|
||||||
|
<key key0="п" key2="0" key3="ш" key4="щ"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<key shift="0.5" key0="а" key1="tab" key2="`"/>
|
||||||
|
<key key0="с"/>
|
||||||
|
<key key0="д" key1="accent_grave" key3="accent_aigu"/>
|
||||||
|
<key key0="ф"/>
|
||||||
|
<key key0="г" key1="accent_caron" key2="-" key3="_"/>
|
||||||
|
<key key0="х" key2="=" key3="+"/>
|
||||||
|
<key key0="й" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
|
||||||
|
<key key0="к" key3="[" key4="]"/>
|
||||||
|
<key key0="л" key2="|" key3="\\"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<key width="1.5" key0="shift"/>
|
||||||
|
<key key0="з"/>
|
||||||
|
<key key0="ь" key1="accent_ring" key3="ѝ"/>
|
||||||
|
<key key0="ц" key1="accent_cedille" key2="<" key3="."/>
|
||||||
|
<key key0="ж" key2=">" key3=","/>
|
||||||
|
<key key0="б" key2="\?" key3="/"/>
|
||||||
|
<key key0="н" key1="accent_tilde" key2=":" key3=";"/>
|
||||||
|
<key key0="м" key2=""" key3="'"/>
|
||||||
|
<key width="1.5" key0="backspace" key2="delete"/>
|
||||||
|
</row>
|
||||||
|
<row height="0.95">
|
||||||
|
<key width="1.8" key0="ctrl" key3="switch_numeric"/>
|
||||||
|
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||||
|
<key width="4.0" key0="space"/>
|
||||||
|
<key width="1.2" key1="up" key2="right" key3="left" key4="down"/>
|
||||||
|
<key width="1.8" key0="enter" key2="action"/>
|
||||||
|
</row>
|
||||||
|
</keyboard>
|
@@ -1,40 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
|
<input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true">
|
||||||
android:settingsActivity="juloo.keyboard2.SettingsActivity"
|
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=trema|szlig"/>
|
||||||
android:supportsSwitchingToNextInputMethod="true">
|
<subtype android:label="%s" android:languageTag="en" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/>
|
||||||
<subtype android:label="@string/subtype_label"
|
<subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|tilde|trema"/>
|
||||||
android:languageTag="en"
|
<subtype android:label="%s" android:languageTag="fr" android:imeSubtypeLocale="fr_FR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=azerty,extra_keys=grave|aigu|circonflexe|cedille|trema"/>
|
||||||
android:imeSubtypeLocale="en_US"
|
<subtype android:label="%s" android:languageTag="it" android:imeSubtypeLocale="it_IT" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=grave|aigu"/>
|
||||||
android:imeSubtypeMode="keyboard"
|
<subtype android:label="%s" android:languageTag="lv" android:imeSubtypeLocale="lv_LV" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_lv,extra_keys=caron|cedille|macron"/>
|
||||||
android:isAsciiCapable="true"
|
<subtype android:label="%s" android:languageTag="sv" android:imeSubtypeLocale="sv_SE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=aigu|trema|ring"/>
|
||||||
android:imeSubtypeExtraValue="default_layout=qwerty"
|
<subtype android:label="%s" android:languageTag="bg" android:imeSubtypeLocale="bg_BG" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=bgph1"/>
|
||||||
/>
|
|
||||||
<subtype android:label="@string/subtype_label"
|
|
||||||
android:languageTag="fr"
|
|
||||||
android:imeSubtypeLocale="fr_FR"
|
|
||||||
android:imeSubtypeMode="keyboard"
|
|
||||||
android:isAsciiCapable="true"
|
|
||||||
android:imeSubtypeExtraValue="default_layout=azerty,accents=grave|aigu|circonflexe|cedille|trema"
|
|
||||||
/>
|
|
||||||
<subtype android:label="@string/subtype_label"
|
|
||||||
android:languageTag="es"
|
|
||||||
android:imeSubtypeLocale="es_ES"
|
|
||||||
android:imeSubtypeMode="keyboard"
|
|
||||||
android:isAsciiCapable="true"
|
|
||||||
android:imeSubtypeExtraValue="default_layout=qwerty,accents=aigu|tilde|trema"
|
|
||||||
/>
|
|
||||||
<subtype android:label="@string/subtype_label"
|
|
||||||
android:languageTag="it"
|
|
||||||
android:imeSubtypeLocale="it_IT"
|
|
||||||
android:imeSubtypeMode="keyboard"
|
|
||||||
android:isAsciiCapable="true"
|
|
||||||
android:imeSubtypeExtraValue="default_layout=qwerty,accents=grave|aigu"
|
|
||||||
/>
|
|
||||||
<subtype android:label="@string/subtype_label"
|
|
||||||
android:languageTag="sv"
|
|
||||||
android:imeSubtypeLocale="sv_SE"
|
|
||||||
android:imeSubtypeMode="keyboard"
|
|
||||||
android:isAsciiCapable="true"
|
|
||||||
android:imeSubtypeExtraValue="default_layout=qwerty,accents=aigu|trema|ring"
|
|
||||||
/>
|
|
||||||
</input-method>
|
</input-method>
|
||||||
|
@@ -1,35 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<keyboard>
|
<keyboard>
|
||||||
<row>
|
<row>
|
||||||
<key width="0.75" key0="esc" key2="~" key4="!" />
|
<key width="0.75" key0="esc" key2="~" key4="!"/>
|
||||||
<key width="0.75" key0="(" key2="[" key4="{" />
|
<key width="0.75" key0="(" key2="[" key4="{"/>
|
||||||
<key key0="7" key3="<" key4=">" />
|
<key key0="7" key3="<" key4=">"/>
|
||||||
<key key0="8" key2="∞" />
|
<key key0="8" key2="∞"/>
|
||||||
<key key0="9" key2="π" />
|
<key key0="9" key2="π"/>
|
||||||
<key width="0.75" key0="*" key1="√" key2="×" />
|
<key width="0.75" key0="*" key1="√" key2="×"/>
|
||||||
<key width="0.75" key0="/" key1="%" key3="÷" />
|
<key width="0.75" key0="/" key1="%" key3="÷"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<key width="0.75" key0="tab" key1=";" key2="|" key4="\\" />
|
<key width="0.75" key0="tab" key1=";" key2="|" key4="\\"/>
|
||||||
<key width="0.75" key0=")" key2="]" key4="}" />
|
<key width="0.75" key0=")" key2="]" key4="}"/>
|
||||||
<key key0="4" />
|
<key key0="4"/>
|
||||||
<key key0="5" key1="up" key2="right" key3="left" key4="down" />
|
<key key0="5" key1="up" key2="right" key3="left" key4="down"/>
|
||||||
<key key0="6" />
|
<key key0="6"/>
|
||||||
<key width="0.75" key0="+" key1="Σ" key2="$" />
|
<key width="0.75" key0="+" key1="Σ" key2="$"/>
|
||||||
<key width="0.75" key0="-" key2="^" />
|
<key width="0.75" key0="-" key2="^"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<key shift="0.35" width="1.15" key0="shift" key2="fn" key4="alt" />
|
<key shift="0.35" width="1.15" key0="shift" key2="fn" key4="alt"/>
|
||||||
<key key0="1" key1="superscript" key3="subscript" />
|
<key key0="1" key1="superscript" key3="subscript"/>
|
||||||
<key key0="2" />
|
<key key0="2"/>
|
||||||
<key key0="3" />
|
<key key0="3"/>
|
||||||
<key width="1.15" key0="backspace" key2="delete" />
|
<key width="1.15" key0="backspace" key2="delete"/>
|
||||||
</row>
|
</row>
|
||||||
<row height="0.95">
|
<row height="0.95">
|
||||||
<key width="1.5" key0="ctrl" key3="switch_text" />
|
<key width="1.5" key0="ctrl" key3="switch_text"/>
|
||||||
<key width="1.5" key0="0" />
|
<key width="1.5" key0="0"/>
|
||||||
<key width="0.75" key0="." key2="," />
|
<key width="0.75" key0="." key2=","/>
|
||||||
<key width="0.75" key0="space" key1=""" key2="'" key4="_" />
|
<key width="0.75" key0="space" key1=""" key2="'" key4="_"/>
|
||||||
<key width="1.5" key0="enter" key2="±" key3="=" />
|
<key width="1.5" key0="enter" key1="±" key2="action" key3="="/>
|
||||||
</row>
|
</row>
|
||||||
</keyboard>
|
</keyboard>
|
||||||
|
@@ -1,44 +1,44 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<keyboard>
|
<keyboard>
|
||||||
<row>
|
<row>
|
||||||
<key key0="q" key1="esc" key2="1" key3="~" key4="!" />
|
<key key0="q" key1="esc" key2="1" key3="~" key4="!"/>
|
||||||
<key key0="w" key2="2" key3="\@" />
|
<key key0="w" key2="2" key3="\@"/>
|
||||||
<key key0="e" key2="3" key3="\#" />
|
<key key0="e" key2="3" key3="\#"/>
|
||||||
<key key0="r" key2="4" key3="$" />
|
<key key0="r" key2="4" key3="$"/>
|
||||||
<key key0="t" key2="5" key3="%" />
|
<key key0="t" key2="5" key3="%"/>
|
||||||
<key key0="y" key2="6" key3="^" />
|
<key key0="y" key2="6" key3="^"/>
|
||||||
<key key0="u" key2="7" key3="&" />
|
<key key0="u" key2="7" key3="&"/>
|
||||||
<key key0="i" key2="8" key3="*" />
|
<key key0="i" key2="8" key3="*"/>
|
||||||
<key key0="o" key2="9" key3="(" key4=")" />
|
<key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
|
||||||
<key key0="p" key2="0" />
|
<key key0="p" key2="0"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<key shift="0.5" key0="a" key1="tab" key2="`" />
|
<key shift="0.5" key0="a" key1="tab" key2="`"/>
|
||||||
<key key0="s" key1="accent_ring" />
|
<key key0="s" key1="accent_ring" key3="ß"/>
|
||||||
<key key0="d" key1="accent_grave" key3="accent_aigu" />
|
<key key0="d" key1="accent_grave" key3="accent_aigu"/>
|
||||||
<key key0="f" />
|
<key key0="f"/>
|
||||||
<key key0="g" key2="-" key3="_" />
|
<key key0="g" key1="accent_caron" key2="-" key3="_"/>
|
||||||
<key key0="h" key2="=" key3="+" />
|
<key key0="h" key2="=" key3="+"/>
|
||||||
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{" />
|
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
|
||||||
<key key0="k" key4="]" key3="[" />
|
<key key0="k" key3="[" key4="]"/>
|
||||||
<key key0="l" key2="|" key3="\\" />
|
<key key0="l" key2="|" key3="\\"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<key width="1.5" key0="shift" />
|
<key width="1.5" key0="shift"/>
|
||||||
<key key0="z" />
|
<key key0="z"/>
|
||||||
<key key0="x" />
|
<key key0="x"/>
|
||||||
<key key0="c" key1="accent_cedille" key2="<" key3="." />
|
<key key0="c" key1="accent_cedille" key2="<" key3="."/>
|
||||||
<key key0="v" key2=">" key3="," />
|
<key key0="v" key2=">" key3=","/>
|
||||||
<key key0="b" key2="\?" key3="/" />
|
<key key0="b" key2="\?" key3="/"/>
|
||||||
<key key0="n" key1="accent_tilde" key2=":" key3=";" />
|
<key key0="n" key1="accent_tilde" key2=":" key3=";"/>
|
||||||
<key key0="m" key2=""" key3="'" />
|
<key key0="m" key2=""" key3="'"/>
|
||||||
<key width="1.5" key0="backspace" key2="delete" />
|
<key width="1.5" key0="backspace" key2="delete"/>
|
||||||
</row>
|
</row>
|
||||||
<row height="0.95">
|
<row height="0.95">
|
||||||
<key width="1.8" key0="ctrl" key3="switch_numeric" />
|
<key width="1.8" key0="ctrl" key3="switch_numeric"/>
|
||||||
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config" />
|
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||||
<key width="4.0" key0="space" />
|
<key width="4.0" key0="space"/>
|
||||||
<key width="1.2" key1="up" key2="right" key3="left" key4="down" />
|
<key width="1.2" key1="up" key2="right" key3="left" key4="down"/>
|
||||||
<key width="1.8" key0="enter" />
|
<key width="1.8" key0="enter" key2="action"/>
|
||||||
</row>
|
</row>
|
||||||
</keyboard>
|
</keyboard>
|
||||||
|
44
res/xml/qwerty_lv.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<keyboard>
|
||||||
|
<row>
|
||||||
|
<key key0="q" key1="esc" key2="1" key3="~" key4="!" />
|
||||||
|
<key key0="w" key2="2" key3="\@" />
|
||||||
|
<key key0="e" key1="ē" key2="3" key3="\#" />
|
||||||
|
<key key0="r" key1="ŗ" key2="4" key3="$" />
|
||||||
|
<key key0="t" key2="5" key3="%" />
|
||||||
|
<key key0="y" key2="6" key3="^" />
|
||||||
|
<key key0="u" key1="ū" key2="7" key3="&" />
|
||||||
|
<key key0="i" key1="ī" key2="8" key3="*" />
|
||||||
|
<key key0="o" key1="ō" key2="9" key3="(" key4=")" />
|
||||||
|
<key key0="p" key2="0" key3="{" key4="}" />
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<key shift="0.5" key0="a" key1="ā" />
|
||||||
|
<key key0="s" key1="š" />
|
||||||
|
<key key0="d" />
|
||||||
|
<key key0="f" />
|
||||||
|
<key key0="g" key1="ģ" />
|
||||||
|
<key key0="h" key2="accent_macron" key3="accent_caron" key4="accent_cedille" />
|
||||||
|
<key key0="j" key1="+" key2="=" key3="-" key4="_" />
|
||||||
|
<key key0="k" key1="ķ" key3="[" key4="]" />
|
||||||
|
<key key0="l" key1="ļ" key2="|" key3="/" key4="\\" />
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<key width="1.5" key0="shift" key1="tab" />
|
||||||
|
<key key0="z" key1="ž" />
|
||||||
|
<key key0="x" />
|
||||||
|
<key key0="c" key1="č" />
|
||||||
|
<key key0="v" />
|
||||||
|
<key key0="b" key3="<" key4=">" />
|
||||||
|
<key key0="n" key1="ņ" key2="`" key3=":" key4=";" />
|
||||||
|
<key key0="m" key1="'" key2=""" key3="," key4="\?" />
|
||||||
|
<key width="1.5" key0="backspace" key2="delete" />
|
||||||
|
</row>
|
||||||
|
<row height="0.95">
|
||||||
|
<key width="1.8" key0="ctrl" key3="switch_numeric" />
|
||||||
|
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config" />
|
||||||
|
<key width="4.0" key0="space" />
|
||||||
|
<key width="1.2" key0="." key1="up" key2="right" key3="left" key4="down" />
|
||||||
|
<key width="1.8" key0="enter" key2="action" />
|
||||||
|
</row>
|
||||||
|
</keyboard>
|
44
res/xml/qwertz.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<keyboard>
|
||||||
|
<row>
|
||||||
|
<key key0="q" key1="esc" key2="1" key3="\@" key4="!"/>
|
||||||
|
<key key0="w" key1="^" key2="2" key3="""/>
|
||||||
|
<key key0="e" key1="§" key2="3" key4="€"/>
|
||||||
|
<key key0="r" key2="4" key3="$"/>
|
||||||
|
<key key0="t" key2="5" key3="%"/>
|
||||||
|
<key key0="z" key2="6" key3="&" key4="{"/>
|
||||||
|
<key key0="u" key2="7" key4="}"/>
|
||||||
|
<key key0="i" key1="(" key2="8" key4="["/>
|
||||||
|
<key key0="o" key1=")" key2="9" key4="]"/>
|
||||||
|
<key key0="p" key1="=" key2="0" key4="\?"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<key shift="0.5" key0="a" key1="tab" key2="`"/>
|
||||||
|
<key key0="s" key3="ß"/>
|
||||||
|
<key key0="d" key1="accent_grave" key2="accent_aigu" key3="accent_ring"/>
|
||||||
|
<key key0="f" key1="~"/>
|
||||||
|
<key key0="g" key3="-"/>
|
||||||
|
<key key0="h" key3="+"/>
|
||||||
|
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key3="*"/>
|
||||||
|
<key key0="k" key3="/" key4="\\"/>
|
||||||
|
<key key0="l" key1="'" key3="\#"/>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<key width="1.5" key0="shift"/>
|
||||||
|
<key key0="y" key1=">" key2="|" key3="<"/>
|
||||||
|
<key key0="x"/>
|
||||||
|
<key key0="c" key1="accent_cedille"/>
|
||||||
|
<key key0="v" />
|
||||||
|
<key key0="b" key1=";" key3=","/>
|
||||||
|
<key key0="n" key1=":" key3="." key4="accent_tilde"/>
|
||||||
|
<key key0="m" key1="_" />
|
||||||
|
<key width="1.5" key0="backspace" key2="delete"/>
|
||||||
|
</row>
|
||||||
|
<row height="0.95">
|
||||||
|
<key width="1.8" key0="ctrl" key3="switch_numeric"/>
|
||||||
|
<key width="1.2" key0="alt" key1="fn" key2="change_method" key3="switch_emoji" key4="config"/>
|
||||||
|
<key width="4.0" key0="space"/>
|
||||||
|
<key width="1.2" key1="up" key2="right" key3="left" key4="down"/>
|
||||||
|
<key width="1.8" key0="enter" key2="action"/>
|
||||||
|
</row>
|
||||||
|
</keyboard>
|
@@ -1,102 +1,26 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<PreferenceCategory android:title="@string/pref_category_layout">
|
<PreferenceCategory android:title="@string/pref_category_layout">
|
||||||
<ListPreference
|
<ListPreference android:key="layout" android:title="@string/pref_layout_title" android:summary="%s" android:defaultValue="system" android:entries="@array/pref_layout_entries" android:entryValues="@array/pref_layout_values"/>
|
||||||
android:key="layout"
|
<ListPreference android:key="accents" android:title="@string/pref_accents_title" android:summary="%s" android:defaultValue="1" android:entries="@array/pref_accents_entries" android:entryValues="@array/pref_accents_values"/>
|
||||||
android:title="@string/pref_layout_title"
|
</PreferenceCategory>
|
||||||
android:summary="@string/pref_layout_summary"
|
<PreferenceCategory android:title="@string/pref_category_typing">
|
||||||
android:defaultValue="system"
|
<ListPreference android:key="swipe_dist" android:title="@string/pref_swipe_dist_title" android:summary="@string/pref_swipe_dist_summary" android:defaultValue="15" android:entries="@array/pref_swipe_dist_entries" android:entryValues="@array/pref_swipe_dist_values"/>
|
||||||
android:entries="@array/pref_layout_entries"
|
<juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
|
||||||
android:entryValues="@array/pref_layout_values" />
|
<juloo.common.IntSlideBarPreference android:key="longpress_interval" android:title="@string/pref_long_interval_title" android:summary="%sms" android:defaultValue="25" min="5" max="100"/>
|
||||||
/>
|
<CheckBoxPreference android:key="precise_repeat" android:title="@string/pref_precise_repeat_title" android:summary="@string/pref_precise_repeat_summary" android:defaultValue="true"/>
|
||||||
<ListPreference
|
</PreferenceCategory>
|
||||||
android:key="accents"
|
<PreferenceCategory android:title="@string/pref_category_vibrate">
|
||||||
android:title="@string/pref_accents_title"
|
<CheckBoxPreference android:key="vibrate_enabled" android:title="@string/pref_vibrate_title" android:summary="@string/pref_vibrate_summary" android:defaultValue="true"/>
|
||||||
android:summary="@string/pref_accents_summary"
|
<juloo.common.IntSlideBarPreference android:key="vibrate_duration" android:title="@string/pref_vibrate_duration_title" android:summary="%sms" android:defaultValue="20" min="5" max="50"/>
|
||||||
android:defaultValue="@string/pref_accents_default"
|
</PreferenceCategory>
|
||||||
android:entries="@array/pref_accents_entries"
|
<PreferenceCategory android:title="@string/pref_category_style">
|
||||||
android:entryValues="@array/pref_accents_values" />
|
<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"/>
|
||||||
</PreferenceCategory>
|
<juloo.common.IntSlideBarPreference android:key="margin_bottom" android:title="@string/pref_margin_bottom_title" android:summary="%sdp" android:defaultValue="5" min="0" max="100"/>
|
||||||
<PreferenceCategory android:title="@string/pref_category_typing">
|
<juloo.common.IntSlideBarPreference android:key="key_height" android:title="@string/pref_key_height_title" android:summary="%sdp" android:defaultValue="50" min="30" max="90"/>
|
||||||
<juloo.common.SlideBarPreference
|
<juloo.common.IntSlideBarPreference android:key="horizontal_margin" android:title="@string/pref_horizontal_margin_title" android:summary="%sdp" android:defaultValue="3" min="0" max="20"/>
|
||||||
android:key="sub_value_dist"
|
<juloo.common.SlideBarPreference android:key="character_size" android:title="@string/pref_character_size_title" android:summary="@string/pref_character_size_summary" android:defaultValue="1.0" min="0.8" max="1.2"/>
|
||||||
android:title="@string/pref_preci_title"
|
<juloo.common.IntSlideBarPreference android:key="key_vertical_space" android:title="@string/pref_key_vertical_space" android:summary="%sdp" android:defaultValue="2" min="0" max="8"/>
|
||||||
android:summary="@string/pref_preci_summary"
|
<juloo.common.IntSlideBarPreference android:key="key_horizontal_space" android:title="@string/pref_key_horizontal_space" android:summary="%sdp" android:defaultValue="2" min="0" max="8"/>
|
||||||
android:defaultValue="10.0"
|
</PreferenceCategory>
|
||||||
min="5.0"
|
|
||||||
max="25.0"
|
|
||||||
/>
|
|
||||||
<juloo.common.IntSlideBarPreference
|
|
||||||
android:key="longpress_timeout"
|
|
||||||
android:title="@string/pref_long_timeout_title"
|
|
||||||
android:summary="@string/pref_long_timeout_summary"
|
|
||||||
android:defaultValue="600"
|
|
||||||
min="50"
|
|
||||||
max="2000"
|
|
||||||
/>
|
|
||||||
<juloo.common.IntSlideBarPreference
|
|
||||||
android:key="longpress_interval"
|
|
||||||
android:title="@string/pref_long_interval_title"
|
|
||||||
android:summary="@string/pref_long_interval_summary"
|
|
||||||
android:defaultValue="25"
|
|
||||||
min="5"
|
|
||||||
max="100"
|
|
||||||
/>
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="precise_repeat"
|
|
||||||
android:title="@string/pref_precise_repeat_title"
|
|
||||||
android:summary="@string/pref_precise_repeat_summary"
|
|
||||||
android:defaultValue="true"
|
|
||||||
/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
<PreferenceCategory android:title="@string/pref_category_vibrate">
|
|
||||||
<CheckBoxPreference
|
|
||||||
android:key="vibrate_enabled"
|
|
||||||
android:title="@string/pref_vibrate_title"
|
|
||||||
android:summary="@string/pref_vibrate_summary"
|
|
||||||
android:defaultValue="true"
|
|
||||||
/>
|
|
||||||
<juloo.common.IntSlideBarPreference
|
|
||||||
android:key="vibrate_duration"
|
|
||||||
android:title="@string/pref_vibrate_duration_title"
|
|
||||||
android:summary="@string/pref_vibrate_duration_summary"
|
|
||||||
android:defaultValue="20"
|
|
||||||
min="5"
|
|
||||||
max="50"
|
|
||||||
/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
<PreferenceCategory android:title="@string/pref_category_style">
|
|
||||||
<juloo.common.IntSlideBarPreference
|
|
||||||
android:key="margin_bottom"
|
|
||||||
android:title="@string/pref_margin_bottom_title"
|
|
||||||
android:summary="@string/pref_margin_bottom_summary"
|
|
||||||
android:defaultValue="5"
|
|
||||||
min="0"
|
|
||||||
max="100"
|
|
||||||
/>
|
|
||||||
<juloo.common.IntSlideBarPreference
|
|
||||||
android:key="key_height"
|
|
||||||
android:title="@string/pref_key_height_title"
|
|
||||||
android:summary="@string/pref_key_height_summary"
|
|
||||||
android:defaultValue="50"
|
|
||||||
min="30"
|
|
||||||
max="90"
|
|
||||||
/>
|
|
||||||
<juloo.common.IntSlideBarPreference
|
|
||||||
android:key="horizontal_margin"
|
|
||||||
android:title="@string/pref_horizontal_margin_title"
|
|
||||||
android:summary="@string/pref_horizontal_margin_summary"
|
|
||||||
android:defaultValue="3"
|
|
||||||
min="0"
|
|
||||||
max="20"
|
|
||||||
/>
|
|
||||||
<juloo.common.SlideBarPreference
|
|
||||||
android:key="character_size"
|
|
||||||
android:title="@string/pref_character_size_title"
|
|
||||||
android:summary="@string/pref_character_size_summary"
|
|
||||||
android:defaultValue="1.0"
|
|
||||||
min="0.8"
|
|
||||||
max="1.2"
|
|
||||||
/>
|
|
||||||
</PreferenceCategory>
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
14
shell.nix
@@ -4,18 +4,20 @@
|
|||||||
} }:
|
} }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
jdk = pkgs.openjdk8;
|
||||||
|
|
||||||
android = pkgs.androidenv.composeAndroidPackages {
|
android = pkgs.androidenv.composeAndroidPackages {
|
||||||
buildToolsVersions = [ "30.0.3" ];
|
buildToolsVersions = [ "30.0.3" ];
|
||||||
platformVersions = [ "29" ];
|
platformVersions = [ "30" ];
|
||||||
abiVersions = [ "armeabi-v7a" ];
|
abiVersions = [ "armeabi-v7a" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
in
|
apksigner = pkgs.apksigner.override {
|
||||||
|
inherit (jdk) jre;
|
||||||
|
inherit (android) build-tools;
|
||||||
|
};
|
||||||
|
|
||||||
pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = [ pkgs.findutils jdk android.androidsdk apksigner ];
|
||||||
findutils openjdk8 android.androidsdk
|
|
||||||
];
|
|
||||||
ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
|
||||||
}
|
}
|
||||||
|
@@ -11,106 +11,106 @@ import android.widget.TextView;
|
|||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** IntSlideBarPreference
|
** IntSlideBarPreference
|
||||||
** -
|
** -
|
||||||
** Open a dialog showing a seekbar
|
** Open a dialog showing a seekbar
|
||||||
** -
|
** -
|
||||||
** xml attrs:
|
** xml attrs:
|
||||||
** android:defaultValue Default value (int)
|
** android:defaultValue Default value (int)
|
||||||
** min min value (int)
|
** min min value (int)
|
||||||
** max max value (int)
|
** max max value (int)
|
||||||
** -
|
** -
|
||||||
** Summary field allow to show the current value using %s flag
|
** Summary field allow to show the current value using %s flag
|
||||||
*/
|
*/
|
||||||
public class IntSlideBarPreference extends DialogPreference
|
public class IntSlideBarPreference extends DialogPreference
|
||||||
implements SeekBar.OnSeekBarChangeListener
|
implements SeekBar.OnSeekBarChangeListener
|
||||||
{
|
{
|
||||||
private LinearLayout _layout;
|
private LinearLayout _layout;
|
||||||
private TextView _textView;
|
private TextView _textView;
|
||||||
private SeekBar _seekBar;
|
private SeekBar _seekBar;
|
||||||
|
|
||||||
private int _min;
|
private int _min;
|
||||||
|
|
||||||
private String _initialSummary;
|
private String _initialSummary;
|
||||||
|
|
||||||
public IntSlideBarPreference(Context context, AttributeSet attrs)
|
public IntSlideBarPreference(Context context, AttributeSet attrs)
|
||||||
{
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
_initialSummary = getSummary().toString();
|
_initialSummary = getSummary().toString();
|
||||||
_textView = new TextView(context);
|
_textView = new TextView(context);
|
||||||
_textView.setPadding(48, 40, 48, 40);
|
_textView.setPadding(48, 40, 48, 40);
|
||||||
_seekBar = new SeekBar(context);
|
_seekBar = new SeekBar(context);
|
||||||
_seekBar.setOnSeekBarChangeListener(this);
|
_seekBar.setOnSeekBarChangeListener(this);
|
||||||
_min = attrs.getAttributeIntValue(null, "min", 0);
|
_min = attrs.getAttributeIntValue(null, "min", 0);
|
||||||
int max = attrs.getAttributeIntValue(null, "max", 0);
|
int max = attrs.getAttributeIntValue(null, "max", 0);
|
||||||
_seekBar.setMax(max - _min);
|
_seekBar.setMax(max - _min);
|
||||||
_layout = new LinearLayout(getContext());
|
_layout = new LinearLayout(getContext());
|
||||||
_layout.setOrientation(LinearLayout.VERTICAL);
|
_layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
_layout.addView(_textView);
|
_layout.addView(_textView);
|
||||||
_layout.addView(_seekBar);
|
_layout.addView(_seekBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
||||||
{
|
{
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartTrackingTouch(SeekBar seekBar)
|
public void onStartTrackingTouch(SeekBar seekBar)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopTrackingTouch(SeekBar seekBar)
|
public void onStopTrackingTouch(SeekBar seekBar)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
|
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (restorePersistedValue)
|
if (restorePersistedValue)
|
||||||
{
|
{
|
||||||
value = getPersistedInt(_min);
|
value = getPersistedInt(_min);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = (Integer)defaultValue;
|
value = (Integer)defaultValue;
|
||||||
persistInt(value);
|
persistInt(value);
|
||||||
}
|
}
|
||||||
_seekBar.setProgress(value - _min);
|
_seekBar.setProgress(value - _min);
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object onGetDefaultValue(TypedArray a, int index)
|
protected Object onGetDefaultValue(TypedArray a, int index)
|
||||||
{
|
{
|
||||||
return (a.getInt(index, _min));
|
return (a.getInt(index, _min));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDialogClosed(boolean positiveResult)
|
protected void onDialogClosed(boolean positiveResult)
|
||||||
{
|
{
|
||||||
if (positiveResult)
|
if (positiveResult)
|
||||||
persistInt(_seekBar.getProgress() + _min);
|
persistInt(_seekBar.getProgress() + _min);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected View onCreateDialogView()
|
protected View onCreateDialogView()
|
||||||
{
|
{
|
||||||
ViewGroup parent = (ViewGroup)_layout.getParent();
|
ViewGroup parent = (ViewGroup)_layout.getParent();
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
parent.removeView(_layout);
|
parent.removeView(_layout);
|
||||||
return (_layout);
|
return (_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateText()
|
private void updateText()
|
||||||
{
|
{
|
||||||
String f = String.format(_initialSummary, _seekBar.getProgress() + _min);
|
String f = String.format(_initialSummary, _seekBar.getProgress() + _min);
|
||||||
|
|
||||||
_textView.setText(f);
|
_textView.setText(f);
|
||||||
setSummary(f);
|
setSummary(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,117 +11,117 @@ import android.widget.TextView;
|
|||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** SideBarPreference
|
** SideBarPreference
|
||||||
** -
|
** -
|
||||||
** Open a dialog showing a seekbar
|
** Open a dialog showing a seekbar
|
||||||
** -
|
** -
|
||||||
** xml attrs:
|
** xml attrs:
|
||||||
** android:defaultValue Default value (float)
|
** android:defaultValue Default value (float)
|
||||||
** min min value (float)
|
** min min value (float)
|
||||||
** max max value (float)
|
** max max value (float)
|
||||||
** -
|
** -
|
||||||
** Summary field allow to show the current value using %f or %s flag
|
** Summary field allow to show the current value using %f or %s flag
|
||||||
*/
|
*/
|
||||||
public class SlideBarPreference extends DialogPreference
|
public class SlideBarPreference extends DialogPreference
|
||||||
implements SeekBar.OnSeekBarChangeListener
|
implements SeekBar.OnSeekBarChangeListener
|
||||||
{
|
{
|
||||||
private static final int STEPS = 100;
|
private static final int STEPS = 100;
|
||||||
|
|
||||||
private LinearLayout _layout;
|
private LinearLayout _layout;
|
||||||
private TextView _textView;
|
private TextView _textView;
|
||||||
private SeekBar _seekBar;
|
private SeekBar _seekBar;
|
||||||
|
|
||||||
private float _min;
|
private float _min;
|
||||||
private float _max;
|
private float _max;
|
||||||
private float _value;
|
private float _value;
|
||||||
|
|
||||||
private String _initialSummary;
|
private String _initialSummary;
|
||||||
|
|
||||||
public SlideBarPreference(Context context, AttributeSet attrs)
|
public SlideBarPreference(Context context, AttributeSet attrs)
|
||||||
{
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
_initialSummary = getSummary().toString();
|
_initialSummary = getSummary().toString();
|
||||||
_textView = new TextView(context);
|
_textView = new TextView(context);
|
||||||
_textView.setPadding(48, 40, 48, 40);
|
_textView.setPadding(48, 40, 48, 40);
|
||||||
_seekBar = new SeekBar(context);
|
_seekBar = new SeekBar(context);
|
||||||
_seekBar.setOnSeekBarChangeListener(this);
|
_seekBar.setOnSeekBarChangeListener(this);
|
||||||
_seekBar.setMax(STEPS);
|
_seekBar.setMax(STEPS);
|
||||||
_min = float_of_string(attrs.getAttributeValue(null, "min"));
|
_min = float_of_string(attrs.getAttributeValue(null, "min"));
|
||||||
_value = _min;
|
_value = _min;
|
||||||
_max = Math.max(1f, float_of_string(attrs.getAttributeValue(null, "max")));
|
_max = Math.max(1f, float_of_string(attrs.getAttributeValue(null, "max")));
|
||||||
_layout = new LinearLayout(getContext());
|
_layout = new LinearLayout(getContext());
|
||||||
_layout.setOrientation(LinearLayout.VERTICAL);
|
_layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
_layout.addView(_textView);
|
_layout.addView(_textView);
|
||||||
_layout.addView(_seekBar);
|
_layout.addView(_seekBar);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
||||||
{
|
{
|
||||||
_value = Math.round(progress * (_max - _min)) / (float)STEPS + _min;
|
_value = Math.round(progress * (_max - _min)) / (float)STEPS + _min;
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartTrackingTouch(SeekBar seekBar)
|
public void onStartTrackingTouch(SeekBar seekBar)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopTrackingTouch(SeekBar seekBar)
|
public void onStopTrackingTouch(SeekBar seekBar)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
|
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
|
||||||
{
|
{
|
||||||
if (restorePersistedValue)
|
if (restorePersistedValue)
|
||||||
{
|
{
|
||||||
_value = getPersistedFloat(_min);
|
_value = getPersistedFloat(_min);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_value = (Float)defaultValue;
|
_value = (Float)defaultValue;
|
||||||
persistFloat(_value);
|
persistFloat(_value);
|
||||||
}
|
}
|
||||||
_seekBar.setProgress((int)((_value - _min) * STEPS / (_max - _min)));
|
_seekBar.setProgress((int)((_value - _min) * STEPS / (_max - _min)));
|
||||||
updateText();
|
updateText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object onGetDefaultValue(TypedArray a, int index)
|
protected Object onGetDefaultValue(TypedArray a, int index)
|
||||||
{
|
{
|
||||||
return (a.getFloat(index, _min));
|
return (a.getFloat(index, _min));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDialogClosed(boolean positiveResult)
|
protected void onDialogClosed(boolean positiveResult)
|
||||||
{
|
{
|
||||||
if (positiveResult)
|
if (positiveResult)
|
||||||
persistFloat(_value);
|
persistFloat(_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected View onCreateDialogView()
|
protected View onCreateDialogView()
|
||||||
{
|
{
|
||||||
ViewGroup parent = (ViewGroup)_layout.getParent();
|
ViewGroup parent = (ViewGroup)_layout.getParent();
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
parent.removeView(_layout);
|
parent.removeView(_layout);
|
||||||
return (_layout);
|
return (_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateText()
|
private void updateText()
|
||||||
{
|
{
|
||||||
String f = String.format(_initialSummary, _value);
|
String f = String.format(_initialSummary, _value);
|
||||||
|
|
||||||
_textView.setText(f);
|
_textView.setText(f);
|
||||||
setSummary(f);
|
setSummary(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static float float_of_string(String str)
|
private static float float_of_string(String str)
|
||||||
{
|
{
|
||||||
if (str == null)
|
if (str == null)
|
||||||
return (0f);
|
return (0f);
|
||||||
return (Float.parseFloat(str));
|
return (Float.parseFloat(str));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,100 +1,134 @@
|
|||||||
package juloo.keyboard2;
|
package juloo.keyboard2;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.os.Build;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
|
||||||
class Config
|
final class Config
|
||||||
{
|
{
|
||||||
private Keyboard2 _context;
|
|
||||||
|
|
||||||
// From resources
|
// From resources
|
||||||
public final float marginTop;
|
public final float marginTop;
|
||||||
public final float keyPadding;
|
public final float keyPadding;
|
||||||
public final float keyVerticalInterval;
|
|
||||||
public final float keyHorizontalInterval;
|
|
||||||
public final float keyRound;
|
|
||||||
|
|
||||||
// From preferences
|
// From preferences
|
||||||
public int layout; // Or '-1' for the system defaults
|
public int layout; // Or '-1' for the system defaults
|
||||||
public float subValueDist;
|
private float swipe_dist_dp;
|
||||||
public boolean vibrateEnabled;
|
public float swipe_dist_px;
|
||||||
public long vibrateDuration;
|
public boolean vibrateEnabled;
|
||||||
public long longPressTimeout;
|
public long vibrateDuration;
|
||||||
public long longPressInterval;
|
public long longPressTimeout;
|
||||||
public float marginBottom;
|
public long longPressInterval;
|
||||||
public float keyHeight;
|
public float marginBottom;
|
||||||
public float horizontalMargin;
|
public float keyHeight;
|
||||||
|
public float horizontalMargin;
|
||||||
|
public float keyVerticalInterval;
|
||||||
|
public float keyHorizontalInterval;
|
||||||
public boolean preciseRepeat;
|
public boolean preciseRepeat;
|
||||||
public float characterSize; // Ratio
|
public float characterSize; // Ratio
|
||||||
public int accents; // Values are R.values.pref_accents_v_*
|
public int accents; // Values are R.values.pref_accents_v_*
|
||||||
|
public int theme; // Values are R.style.*
|
||||||
|
|
||||||
// Dynamically set
|
// Dynamically set
|
||||||
public boolean shouldOfferSwitchingToNextInputMethod;
|
public boolean shouldOfferSwitchingToNextInputMethod;
|
||||||
public int accent_flags_to_remove;
|
public int key_flags_to_remove;
|
||||||
|
public String actionLabel; // Might be 'null'
|
||||||
|
public int actionId; // Meaningful only when 'actionLabel' isn't 'null'
|
||||||
|
public boolean swapEnterActionKey; // Swap the "enter" and "action" keys
|
||||||
|
|
||||||
public Config(Keyboard2 context)
|
public final IKeyEventHandler handler;
|
||||||
{
|
|
||||||
Resources res = context.getResources();
|
|
||||||
|
|
||||||
_context = context;
|
private Config(Context context, IKeyEventHandler h)
|
||||||
// static values
|
{
|
||||||
marginTop = res.getDimension(R.dimen.margin_top);
|
Resources res = context.getResources();
|
||||||
keyPadding = res.getDimension(R.dimen.key_padding);
|
// static values
|
||||||
keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval);
|
marginTop = res.getDimension(R.dimen.margin_top);
|
||||||
keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval);
|
keyPadding = res.getDimension(R.dimen.key_padding);
|
||||||
keyRound = res.getDimension(R.dimen.key_round);
|
// default values
|
||||||
// default values
|
|
||||||
layout = -1;
|
layout = -1;
|
||||||
subValueDist = 10f;
|
vibrateEnabled = true;
|
||||||
vibrateEnabled = true;
|
vibrateDuration = 20;
|
||||||
vibrateDuration = 20;
|
longPressTimeout = 600;
|
||||||
longPressTimeout = 600;
|
longPressInterval = 65;
|
||||||
longPressInterval = 65;
|
marginBottom = res.getDimension(R.dimen.margin_bottom);
|
||||||
marginBottom = res.getDimension(R.dimen.margin_bottom);
|
keyHeight = res.getDimension(R.dimen.key_height);
|
||||||
keyHeight = res.getDimension(R.dimen.key_height);
|
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
|
||||||
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
|
keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval);
|
||||||
|
keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval);
|
||||||
preciseRepeat = true;
|
preciseRepeat = true;
|
||||||
characterSize = 1.f;
|
characterSize = 1.f;
|
||||||
accents = 1;
|
accents = 1;
|
||||||
// from prefs
|
// from prefs
|
||||||
refresh();
|
refresh(context);
|
||||||
// initialized later
|
// initialized later
|
||||||
shouldOfferSwitchingToNextInputMethod = false;
|
shouldOfferSwitchingToNextInputMethod = false;
|
||||||
accent_flags_to_remove = 0;
|
key_flags_to_remove = 0;
|
||||||
}
|
actionLabel = null;
|
||||||
|
actionId = 0;
|
||||||
|
swapEnterActionKey = false;
|
||||||
|
handler = h;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Reload prefs
|
** Reload prefs
|
||||||
*/
|
*/
|
||||||
public void refresh()
|
public void refresh(Context context)
|
||||||
{
|
{
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
|
Resources res = context.getResources();
|
||||||
layout = layoutId_of_string(prefs.getString("layout", "system"));
|
DisplayMetrics dm = res.getDisplayMetrics();
|
||||||
subValueDist = prefs.getFloat("sub_value_dist", subValueDist);
|
layout = layoutId_of_string(prefs.getString("layout", "system"));
|
||||||
vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
|
swipe_dist_dp = Float.valueOf(prefs.getString("swipe_dist", "15"));
|
||||||
vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
|
swipe_dist_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, swipe_dist_dp, dm);
|
||||||
longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
|
vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
|
||||||
longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
|
vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
|
||||||
marginBottom = getDipPref(prefs, "margin_bottom", marginBottom);
|
longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
|
||||||
keyHeight = getDipPref(prefs, "key_height", keyHeight);
|
longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
|
||||||
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
|
marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom);
|
||||||
|
keyVerticalInterval = getDipPref(dm, prefs, "key_vertical_space", keyVerticalInterval);
|
||||||
|
keyHorizontalInterval = getDipPref(dm, prefs, "key_horizontal_space", keyHorizontalInterval);
|
||||||
|
// Add keyVerticalInterval to keyHeight because the space between the keys
|
||||||
|
// is removed from the keys during rendering
|
||||||
|
keyHeight = getDipPref(dm, prefs, "key_height", keyHeight) + keyVerticalInterval;
|
||||||
|
horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin);
|
||||||
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
|
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
|
||||||
characterSize = prefs.getFloat("character_size", characterSize);
|
characterSize = prefs.getFloat("character_size", characterSize);
|
||||||
accents = Integer.valueOf(prefs.getString("accents", "1"));
|
accents = Integer.valueOf(prefs.getString("accents", "1"));
|
||||||
}
|
theme = getThemeId(res, prefs.getString("theme", ""));
|
||||||
|
}
|
||||||
|
|
||||||
private float getDipPref(SharedPreferences prefs, String pref_name, float def)
|
private float getDipPref(DisplayMetrics dm, SharedPreferences prefs, String pref_name, float def)
|
||||||
{
|
{
|
||||||
int value = prefs.getInt(pref_name, -1);
|
float value;
|
||||||
|
try { value = prefs.getInt(pref_name, -1); }
|
||||||
|
catch (Exception e) { value = prefs.getFloat(pref_name, -1f); }
|
||||||
|
if (value < 0f)
|
||||||
|
return (def);
|
||||||
|
return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value, dm));
|
||||||
|
}
|
||||||
|
|
||||||
if (value < 0)
|
private int getThemeId(Resources res, String theme_name)
|
||||||
return (def);
|
{
|
||||||
return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value,
|
switch (theme_name)
|
||||||
_context.getResources().getDisplayMetrics()));
|
{
|
||||||
}
|
case "light": return R.style.Light;
|
||||||
|
case "black": return R.style.Black;
|
||||||
|
case "dark": return R.style.Dark;
|
||||||
|
default:
|
||||||
|
case "system":
|
||||||
|
if (Build.VERSION.SDK_INT >= 8)
|
||||||
|
{
|
||||||
|
int night_mode = res.getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||||
|
if ((night_mode & Configuration.UI_MODE_NIGHT_NO) != 0)
|
||||||
|
return R.style.Light;
|
||||||
|
}
|
||||||
|
return R.style.Dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int layoutId_of_string(String name)
|
public static int layoutId_of_string(String name)
|
||||||
{
|
{
|
||||||
@@ -102,24 +136,56 @@ class Config
|
|||||||
{
|
{
|
||||||
case "azerty": return R.xml.azerty;
|
case "azerty": return R.xml.azerty;
|
||||||
case "qwerty": return R.xml.qwerty;
|
case "qwerty": return R.xml.qwerty;
|
||||||
case "system": return -1;
|
case "qwerty_lv": return R.xml.qwerty_lv;
|
||||||
default: throw new IllegalArgumentException();
|
case "qwertz": return R.xml.qwertz;
|
||||||
|
case "bgph1": return R.xml.local_bgph1;
|
||||||
|
case "system": default: return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Used for the accents option. */
|
/* Used for the accents option. */
|
||||||
public static int accentFlag_of_name(String name)
|
public static int extra_key_flag_of_name(String name)
|
||||||
{
|
{
|
||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "grave": return KeyValue.FLAG_ACCENT1;
|
|
||||||
case "aigu": return KeyValue.FLAG_ACCENT2;
|
case "aigu": return KeyValue.FLAG_ACCENT2;
|
||||||
case "circonflexe": return KeyValue.FLAG_ACCENT3;
|
case "caron": return KeyValue.FLAG_ACCENT_CARON;
|
||||||
case "tilde": return KeyValue.FLAG_ACCENT4;
|
|
||||||
case "cedille": return KeyValue.FLAG_ACCENT5;
|
case "cedille": return KeyValue.FLAG_ACCENT5;
|
||||||
case "trema": return KeyValue.FLAG_ACCENT6;
|
case "circonflexe": return KeyValue.FLAG_ACCENT3;
|
||||||
|
case "grave": return KeyValue.FLAG_ACCENT1;
|
||||||
|
case "macron": return KeyValue.FLAG_ACCENT_MACRON;
|
||||||
case "ring": return KeyValue.FLAG_ACCENT_RING;
|
case "ring": return KeyValue.FLAG_ACCENT_RING;
|
||||||
|
case "szlig": return KeyValue.FLAG_LANG_SZLIG;
|
||||||
|
case "tilde": return KeyValue.FLAG_ACCENT4;
|
||||||
|
case "trema": return KeyValue.FLAG_ACCENT6;
|
||||||
default: throw new RuntimeException(name);
|
default: throw new RuntimeException(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int themeId_of_string(String name)
|
||||||
|
{
|
||||||
|
switch (name)
|
||||||
|
{
|
||||||
|
case "light": return R.style.Light;
|
||||||
|
case "black": return R.style.Black;
|
||||||
|
default: case "dark": return R.style.Dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Config _globalConfig = null;
|
||||||
|
|
||||||
|
public static void initGlobalConfig(Context context, IKeyEventHandler handler)
|
||||||
|
{
|
||||||
|
_globalConfig = new Config(context, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Config globalConfig()
|
||||||
|
{
|
||||||
|
return _globalConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface IKeyEventHandler
|
||||||
|
{
|
||||||
|
public void handleKeyUp(KeyValue value, int flags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,35 +10,35 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
public class Emoji extends KeyValue
|
public class Emoji extends KeyValue
|
||||||
{
|
{
|
||||||
private final String _desc;
|
private final String _desc;
|
||||||
|
|
||||||
private static HashMap<String, Emoji> emojis_by_name = new HashMap<String, Emoji>();
|
private static HashMap<String, Emoji> emojis_by_name = new HashMap<String, Emoji>();
|
||||||
|
|
||||||
protected Emoji(String name, String bytecode, String desc)
|
protected Emoji(String name, String bytecode, String desc)
|
||||||
{
|
{
|
||||||
super(name, bytecode, CHAR_NONE, EVENT_NONE, 0);
|
super(name, bytecode, CHAR_NONE, EVENT_NONE, 0);
|
||||||
_desc = desc;
|
_desc = desc;
|
||||||
emojis_by_name.put(name, this);
|
emojis_by_name.put(name, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
{
|
{
|
||||||
return (_desc);
|
return (_desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int num_groups = 0;
|
public static int num_groups = 0;
|
||||||
|
|
||||||
private static Emoji[][] emojis_by_group = new Emoji[][]{};
|
private static Emoji[][] emojis_by_group = new Emoji[][]{};
|
||||||
|
|
||||||
public static Emoji getEmojiByName(String name)
|
public static Emoji getEmojiByName(String name)
|
||||||
{
|
{
|
||||||
return emojis_by_name.get(name);
|
return emojis_by_name.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Emoji[] getEmojisByGroup(int group_id)
|
public static Emoji[] getEmojisByGroup(int group_id)
|
||||||
{
|
{
|
||||||
return (emojis_by_group[group_id]);
|
return (emojis_by_group[group_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the list of emojis from a raw file. Will initialize only once. */
|
/* Read the list of emojis from a raw file. Will initialize only once. */
|
||||||
public static void init(Resources res)
|
public static void init(Resources res)
|
||||||
|
@@ -19,158 +19,154 @@ import java.util.Set;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
public class EmojiGridView extends GridView
|
public class EmojiGridView extends GridView
|
||||||
implements GridView.OnItemClickListener
|
implements GridView.OnItemClickListener
|
||||||
{
|
{
|
||||||
public static final int GROUP_LAST_USE = -1;
|
public static final int GROUP_LAST_USE = -1;
|
||||||
|
|
||||||
public static final int COLUMN_WIDTH = 192;
|
public static final int COLUMN_WIDTH = 192;
|
||||||
public static final float EMOJI_SIZE = 32.f;
|
|
||||||
|
|
||||||
private static final String LAST_USE_PREF = "emoji_last_use";
|
private static final String LAST_USE_PREF = "emoji_last_use";
|
||||||
|
|
||||||
private Emoji[] _emojiArray;
|
private Emoji[] _emojiArray;
|
||||||
private HashMap<Emoji, Integer> _lastUsed;
|
private HashMap<Emoji, Integer> _lastUsed;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** TODO: adapt column width and emoji size
|
** TODO: adapt column width and emoji size
|
||||||
** TODO: use ArraySet instead of Emoji[]
|
** TODO: use ArraySet instead of Emoji[]
|
||||||
*/
|
*/
|
||||||
public EmojiGridView(Context context, AttributeSet attrs)
|
public EmojiGridView(Context context, AttributeSet attrs)
|
||||||
{
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
Emoji.init(context.getResources());
|
Emoji.init(context.getResources());
|
||||||
setOnItemClickListener(this);
|
setOnItemClickListener(this);
|
||||||
setColumnWidth(COLUMN_WIDTH);
|
setColumnWidth(COLUMN_WIDTH);
|
||||||
loadLastUsed();
|
loadLastUsed();
|
||||||
setEmojiGroup((_lastUsed.size() == 0) ? 0 : GROUP_LAST_USE);
|
setEmojiGroup((_lastUsed.size() == 0) ? 0 : GROUP_LAST_USE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmojiGroup(int group)
|
public void setEmojiGroup(int group)
|
||||||
{
|
{
|
||||||
_emojiArray = (group == GROUP_LAST_USE) ? getLastEmojis() : Emoji.getEmojisByGroup(group);
|
_emojiArray = (group == GROUP_LAST_USE) ? getLastEmojis() : Emoji.getEmojisByGroup(group);
|
||||||
setAdapter(new EmojiViewAdpater((Keyboard2)getContext(), _emojiArray));
|
setAdapter(new EmojiViewAdpater(getContext(), _emojiArray));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onItemClick(AdapterView<?> parent, View v, int pos, long id)
|
public void onItemClick(AdapterView<?> parent, View v, int pos, long id)
|
||||||
{
|
{
|
||||||
Keyboard2 main = (Keyboard2)getContext();
|
Config config = Config.globalConfig();
|
||||||
Integer used = _lastUsed.get(_emojiArray[pos]);
|
Integer used = _lastUsed.get(_emojiArray[pos]);
|
||||||
|
_lastUsed.put(_emojiArray[pos], (used == null) ? 1 : used.intValue() + 1);
|
||||||
|
config.handler.handleKeyUp(_emojiArray[pos], 0);
|
||||||
|
saveLastUsed(); // TODO: opti
|
||||||
|
}
|
||||||
|
|
||||||
_lastUsed.put(_emojiArray[pos], (used == null) ? 1 : used.intValue() + 1);
|
@Override
|
||||||
main.handleKeyUp(_emojiArray[pos], 0);
|
public void onMeasure(int wSpec, int hSpec)
|
||||||
saveLastUsed(); // TODO: opti
|
{
|
||||||
}
|
super.onMeasure(wSpec, hSpec);
|
||||||
|
setNumColumns(getMeasuredWidth() / COLUMN_WIDTH);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
private Emoji[] getLastEmojis()
|
||||||
public void onMeasure(int wSpec, int hSpec)
|
{
|
||||||
{
|
final HashMap<Emoji, Integer> map = _lastUsed;
|
||||||
super.onMeasure(wSpec, hSpec);
|
Emoji[] array = new Emoji[map.size()];
|
||||||
setNumColumns(getMeasuredWidth() / COLUMN_WIDTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Emoji[] getLastEmojis()
|
map.keySet().toArray(array);
|
||||||
{
|
Arrays.sort(array, 0, array.length, new Comparator<Emoji>()
|
||||||
final HashMap<Emoji, Integer> map = _lastUsed;
|
{
|
||||||
Emoji[] array = new Emoji[map.size()];
|
public int compare(Emoji a, Emoji b)
|
||||||
|
{
|
||||||
|
return (map.get(b).intValue() - map.get(a).intValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return (array);
|
||||||
|
}
|
||||||
|
|
||||||
map.keySet().toArray(array);
|
private void saveLastUsed()
|
||||||
Arrays.sort(array, 0, array.length, new Comparator<Emoji>()
|
{
|
||||||
{
|
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
|
||||||
public int compare(Emoji a, Emoji b)
|
HashSet<String> set = new HashSet<String>();
|
||||||
{
|
|
||||||
return (map.get(b).intValue() - map.get(a).intValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return (array);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveLastUsed()
|
for (Emoji emoji : _lastUsed.keySet())
|
||||||
{
|
set.add(String.valueOf(_lastUsed.get(emoji)) + "-" + emoji.name);
|
||||||
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
|
edit.putStringSet(LAST_USE_PREF, set);
|
||||||
HashSet<String> set = new HashSet<String>();
|
edit.apply();
|
||||||
|
}
|
||||||
|
|
||||||
for (Emoji emoji : _lastUsed.keySet())
|
private void loadLastUsed()
|
||||||
set.add(String.valueOf(_lastUsed.get(emoji)) + "-" + emoji.name);
|
{
|
||||||
edit.putStringSet(LAST_USE_PREF, set);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||||
edit.apply();
|
Set<String> lastUseSet = prefs.getStringSet(LAST_USE_PREF, null);
|
||||||
}
|
|
||||||
|
|
||||||
private void loadLastUsed()
|
_lastUsed = new HashMap<Emoji, Integer>();
|
||||||
{
|
if (lastUseSet != null)
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
for (String emojiData : lastUseSet)
|
||||||
Set<String> lastUseSet = prefs.getStringSet(LAST_USE_PREF, null);
|
{
|
||||||
|
String[] data = emojiData.split("-", 2);
|
||||||
|
Emoji emoji;
|
||||||
|
|
||||||
_lastUsed = new HashMap<Emoji, Integer>();
|
if (data.length != 2)
|
||||||
if (lastUseSet != null)
|
continue ;
|
||||||
for (String emojiData : lastUseSet)
|
emoji = Emoji.getEmojiByName(data[1]);
|
||||||
{
|
if (emoji == null)
|
||||||
String[] data = emojiData.split("-", 2);
|
continue ;
|
||||||
Emoji emoji;
|
_lastUsed.put(emoji, Integer.valueOf(data[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (data.length != 2)
|
private static class EmojiView extends TextView
|
||||||
continue ;
|
{
|
||||||
emoji = Emoji.getEmojiByName(data[1]);
|
public EmojiView(Context context)
|
||||||
if (emoji == null)
|
{
|
||||||
continue ;
|
super(context);
|
||||||
_lastUsed.put(emoji, Integer.valueOf(data[0]));
|
setTextAppearance(context, R.style.emojiGridButton);
|
||||||
}
|
setGravity(Gravity.CENTER);
|
||||||
}
|
setLayoutParams(new GridView.LayoutParams(GridView.LayoutParams.WRAP_CONTENT, GridView.LayoutParams.WRAP_CONTENT));
|
||||||
|
}
|
||||||
|
|
||||||
private static class EmojiView extends TextView
|
public void setEmoji(Emoji emoji)
|
||||||
{
|
{
|
||||||
public EmojiView(Keyboard2 context)
|
setText(emoji.symbol);
|
||||||
{
|
}
|
||||||
super(context);
|
}
|
||||||
setTextSize(EMOJI_SIZE);
|
|
||||||
setGravity(Gravity.CENTER);
|
|
||||||
setBackgroundColor(0x0);
|
|
||||||
setTextColor(getResources().getColor(R.color.emoji_color));
|
|
||||||
setLayoutParams(new GridView.LayoutParams(GridView.LayoutParams.WRAP_CONTENT, GridView.LayoutParams.WRAP_CONTENT));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEmoji(Emoji emoji)
|
private static class EmojiViewAdpater extends BaseAdapter
|
||||||
{
|
{
|
||||||
setText(emoji.symbol);
|
private Context _context;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class EmojiViewAdpater extends BaseAdapter
|
private Emoji[] _emojiArray;
|
||||||
{
|
|
||||||
private Keyboard2 _main;
|
|
||||||
|
|
||||||
private Emoji[] _emojiArray;
|
public EmojiViewAdpater(Context context, Emoji[] emojiArray)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
_emojiArray = emojiArray;
|
||||||
|
}
|
||||||
|
|
||||||
public EmojiViewAdpater(Keyboard2 main, Emoji[] emojiArray)
|
public int getCount()
|
||||||
{
|
{
|
||||||
_main = main;
|
if (_emojiArray == null)
|
||||||
_emojiArray = emojiArray;
|
return (0);
|
||||||
}
|
return (_emojiArray.length);
|
||||||
|
}
|
||||||
|
|
||||||
public int getCount()
|
public Object getItem(int pos)
|
||||||
{
|
{
|
||||||
if (_emojiArray == null)
|
return (_emojiArray[pos]);
|
||||||
return (0);
|
}
|
||||||
return (_emojiArray.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getItem(int pos)
|
public long getItemId(int pos)
|
||||||
{
|
{
|
||||||
return (_emojiArray[pos]);
|
return (pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getItemId(int pos)
|
public View getView(int pos, View convertView, ViewGroup parent)
|
||||||
{
|
{
|
||||||
return (pos);
|
EmojiView view = (EmojiView)convertView;
|
||||||
}
|
|
||||||
|
|
||||||
public View getView(int pos, View convertView, ViewGroup parent)
|
if (view == null)
|
||||||
{
|
view = new EmojiView(_context);
|
||||||
EmojiView view = (EmojiView)convertView;
|
view.setEmoji(_emojiArray[pos]);
|
||||||
|
return (view);
|
||||||
if (view == null)
|
}
|
||||||
view = new EmojiView(_main);
|
}
|
||||||
view.setEmoji(_emojiArray[pos]);
|
|
||||||
return (view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -6,24 +6,23 @@ import android.view.View;
|
|||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
|
||||||
public class EmojiKeyButton extends Button
|
public class EmojiKeyButton extends Button
|
||||||
implements View.OnClickListener
|
implements View.OnClickListener
|
||||||
{
|
{
|
||||||
KeyValue _key;
|
KeyValue _key;
|
||||||
|
|
||||||
public EmojiKeyButton(Context context, AttributeSet attrs)
|
public EmojiKeyButton(Context context, AttributeSet attrs)
|
||||||
{
|
{
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
setOnClickListener(this);
|
setOnClickListener(this);
|
||||||
_key = KeyValue.getKeyByName(attrs.getAttributeValue(null, "key"));
|
_key = KeyValue.getKeyByName(attrs.getAttributeValue(null, "key"));
|
||||||
setText(_key.symbol);
|
setText(_key.symbol);
|
||||||
if ((_key.flags & KeyValue.FLAG_KEY_FONT) != 0)
|
if ((_key.flags & KeyValue.FLAG_KEY_FONT) != 0)
|
||||||
setTypeface(((Keyboard2)context).getSpecialKeyFont());
|
setTypeface(Theme.getSpecialKeyFont(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick(View v)
|
public void onClick(View v)
|
||||||
{
|
{
|
||||||
Keyboard2 main = (Keyboard2)getContext();
|
Config config = Config.globalConfig();
|
||||||
|
config.handler.handleKeyUp(_key, 0);
|
||||||
main.handleKeyUp(_key, 0);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -10,28 +10,28 @@ import android.widget.Button;
|
|||||||
/* Emoji "types" are groups. This class is misnamed. */
|
/* Emoji "types" are groups. This class is misnamed. */
|
||||||
|
|
||||||
public class EmojiTypeButton extends Button
|
public class EmojiTypeButton extends Button
|
||||||
implements View.OnTouchListener
|
implements View.OnTouchListener
|
||||||
{
|
{
|
||||||
private int _emojiType;
|
private int _emojiType;
|
||||||
|
|
||||||
static private final int DEFAULT_GROUP = 0;
|
static private final int DEFAULT_GROUP = 0;
|
||||||
|
|
||||||
public EmojiTypeButton(Context context, int group_id, String symbol)
|
public EmojiTypeButton(Context context, int group_id, String symbol)
|
||||||
{
|
{
|
||||||
super(new ContextThemeWrapper(context, R.style.emojiTypeButton), null, 0);
|
super(new ContextThemeWrapper(context, R.style.emojiTypeButton), null, 0);
|
||||||
_emojiType = group_id;
|
_emojiType = group_id;
|
||||||
setText(symbol);
|
setText(symbol);
|
||||||
setOnTouchListener(this);
|
setOnTouchListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onTouch(View view, MotionEvent event)
|
public boolean onTouch(View view, MotionEvent event)
|
||||||
{
|
{
|
||||||
EmojiGridView emojiGrid;
|
EmojiGridView emojiGrid;
|
||||||
|
|
||||||
if (event.getAction() != MotionEvent.ACTION_DOWN)
|
if (event.getAction() != MotionEvent.ACTION_DOWN)
|
||||||
return (false);
|
return (false);
|
||||||
emojiGrid = (EmojiGridView)((ViewGroup)(getParent().getParent())).findViewById(R.id.emoji_grid);
|
emojiGrid = (EmojiGridView)((ViewGroup)(getParent().getParent())).findViewById(R.id.emoji_grid);
|
||||||
emojiGrid.setEmojiGroup(_emojiType);
|
emojiGrid.setEmojiGroup(_emojiType);
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
78
srcs/juloo.keyboard2/KeyEventHandler.java
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
package juloo.keyboard2;
|
||||||
|
|
||||||
|
import android.view.KeyEvent;
|
||||||
|
|
||||||
|
class KeyEventHandler implements Config.IKeyEventHandler
|
||||||
|
{
|
||||||
|
private IReceiver _recv;
|
||||||
|
|
||||||
|
public KeyEventHandler(IReceiver recv)
|
||||||
|
{
|
||||||
|
_recv = recv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleKeyUp(KeyValue key, int flags)
|
||||||
|
{
|
||||||
|
key = KeyModifier.handleFlags(key, flags);
|
||||||
|
switch (key.eventCode)
|
||||||
|
{
|
||||||
|
case KeyValue.EVENT_CONFIG: _recv.showKeyboardConfig(); return;
|
||||||
|
case KeyValue.EVENT_SWITCH_TEXT: _recv.setLayout(-1); return;
|
||||||
|
case KeyValue.EVENT_SWITCH_NUMERIC: _recv.setLayout(R.xml.numeric); return;
|
||||||
|
case KeyValue.EVENT_SWITCH_EMOJI: _recv.setPane_emoji(); return;
|
||||||
|
case KeyValue.EVENT_SWITCH_BACK_EMOJI: _recv.setPane_normal(); return;
|
||||||
|
case KeyValue.EVENT_CHANGE_METHOD: _recv.switchToNextInputMethod(); return;
|
||||||
|
case KeyValue.EVENT_ACTION: _recv.performAction(); return;
|
||||||
|
default:
|
||||||
|
if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT)) != 0)
|
||||||
|
handleMetaKeyUp(key, flags);
|
||||||
|
else if (key.char_ != KeyValue.CHAR_NONE)
|
||||||
|
_recv.commitChar(key.char_);
|
||||||
|
else if (key.eventCode != KeyValue.EVENT_NONE)
|
||||||
|
handleMetaKeyUp(key, flags);
|
||||||
|
else
|
||||||
|
_recv.commitText(key.symbol);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// private void handleDelKey(int before, int after)
|
||||||
|
// {
|
||||||
|
// CharSequence selection = getCurrentInputConnection().getSelectedText(0);
|
||||||
|
|
||||||
|
// if (selection != null && selection.length() > 0)
|
||||||
|
// getCurrentInputConnection().commitText("", 1);
|
||||||
|
// else
|
||||||
|
// getCurrentInputConnection().deleteSurroundingText(before, after);
|
||||||
|
// }
|
||||||
|
|
||||||
|
private void handleMetaKeyUp(KeyValue key, int flags)
|
||||||
|
{
|
||||||
|
int meta = 0;
|
||||||
|
if (key.eventCode == KeyValue.EVENT_NONE)
|
||||||
|
return ;
|
||||||
|
if ((flags & KeyValue.FLAG_CTRL) != 0)
|
||||||
|
meta |= KeyEvent.META_CTRL_LEFT_ON | KeyEvent.META_CTRL_ON;
|
||||||
|
if ((flags & KeyValue.FLAG_ALT) != 0)
|
||||||
|
meta |= KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_ON;
|
||||||
|
if ((flags & KeyValue.FLAG_SHIFT) != 0)
|
||||||
|
meta |= KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON;
|
||||||
|
_recv.sendKeyEvent(key.eventCode, meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static interface IReceiver
|
||||||
|
{
|
||||||
|
public void switchToNextInputMethod();
|
||||||
|
public void setPane_emoji();
|
||||||
|
public void setPane_normal();
|
||||||
|
public void showKeyboardConfig();
|
||||||
|
public void performAction();
|
||||||
|
|
||||||
|
/** 'res_id' is '-1' for the currently selected layout. */
|
||||||
|
public void setLayout(int res_id);
|
||||||
|
|
||||||
|
public void sendKeyEvent(int eventCode, int meta);
|
||||||
|
|
||||||
|
public void commitText(String text);
|
||||||
|
public void commitChar(char c);
|
||||||
|
}
|
||||||
|
}
|
@@ -73,11 +73,7 @@ class KeyModifier
|
|||||||
default: return (char)KeyCharacterMap.getDeadChar('\u00B4', c);
|
default: return (char)KeyCharacterMap.getDeadChar('\u00B4', c);
|
||||||
}
|
}
|
||||||
case KeyValue.FLAG_ACCENT3:
|
case KeyValue.FLAG_ACCENT3:
|
||||||
switch (c)
|
return (char)KeyCharacterMap.getDeadChar('\u02C6', c);
|
||||||
{
|
|
||||||
case '*': return '°';
|
|
||||||
default: return (char)KeyCharacterMap.getDeadChar('\u02C6', c);
|
|
||||||
}
|
|
||||||
case KeyValue.FLAG_ACCENT4:
|
case KeyValue.FLAG_ACCENT4:
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@@ -102,11 +98,21 @@ class KeyModifier
|
|||||||
case '-': return '÷';
|
case '-': return '÷';
|
||||||
default: return (char)KeyCharacterMap.getDeadChar('\u00A8', c);
|
default: return (char)KeyCharacterMap.getDeadChar('\u00A8', c);
|
||||||
}
|
}
|
||||||
|
case KeyValue.FLAG_ACCENT_CARON:
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
default: return (char)KeyCharacterMap.getDeadChar('\u02C7', c);
|
||||||
|
}
|
||||||
case KeyValue.FLAG_ACCENT_RING:
|
case KeyValue.FLAG_ACCENT_RING:
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
default: return (char)KeyCharacterMap.getDeadChar('\u02DA', c);
|
default: return (char)KeyCharacterMap.getDeadChar('\u02DA', c);
|
||||||
}
|
}
|
||||||
|
case KeyValue.FLAG_ACCENT_MACRON:
|
||||||
|
switch (c)
|
||||||
|
{
|
||||||
|
default: return (char)KeyCharacterMap.getDeadChar('\u00AF', c);
|
||||||
|
}
|
||||||
case KeyValue.FLAG_ACCENT_SUPERSCRIPT:
|
case KeyValue.FLAG_ACCENT_SUPERSCRIPT:
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@@ -186,6 +192,8 @@ class KeyModifier
|
|||||||
case "esc": name = "insert"; break;
|
case "esc": name = "insert"; break;
|
||||||
case "$": name = "€"; break;
|
case "$": name = "€"; break;
|
||||||
case "#": name = "£"; break;
|
case "#": name = "£"; break;
|
||||||
|
case "*": name = "°"; break;
|
||||||
|
case "tab": name = "\\t"; break;
|
||||||
default: return k;
|
default: return k;
|
||||||
}
|
}
|
||||||
return KeyValue.getKeyByName(name);
|
return KeyValue.getKeyByName(name);
|
||||||
|
@@ -6,14 +6,15 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
class KeyValue
|
class KeyValue
|
||||||
{
|
{
|
||||||
public static final int EVENT_NONE = -1;
|
public static final int EVENT_NONE = -1;
|
||||||
public static final int EVENT_CONFIG = -2;
|
public static final int EVENT_CONFIG = -2;
|
||||||
public static final int EVENT_SWITCH_TEXT = -3;
|
public static final int EVENT_SWITCH_TEXT = -3;
|
||||||
public static final int EVENT_SWITCH_NUMERIC = -4;
|
public static final int EVENT_SWITCH_NUMERIC = -4;
|
||||||
public static final int EVENT_SWITCH_EMOJI = -5;
|
public static final int EVENT_SWITCH_EMOJI = -5;
|
||||||
public static final int EVENT_SWITCH_BACK_EMOJI = -6;
|
public static final int EVENT_SWITCH_BACK_EMOJI = -6;
|
||||||
public static final int EVENT_CHANGE_METHOD = -7;
|
public static final int EVENT_CHANGE_METHOD = -7;
|
||||||
public static final char CHAR_NONE = '\0';
|
public static final int EVENT_ACTION = -8;
|
||||||
|
public static final char CHAR_NONE = '\0';
|
||||||
|
|
||||||
// Behavior flags
|
// Behavior flags
|
||||||
public static final int FLAG_KEEP_ON = 1;
|
public static final int FLAG_KEEP_ON = 1;
|
||||||
@@ -42,10 +43,24 @@ class KeyValue
|
|||||||
public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22);
|
public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22);
|
||||||
public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23);
|
public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23);
|
||||||
public static final int FLAG_ACCENT_RING = (1 << 24);
|
public static final int FLAG_ACCENT_RING = (1 << 24);
|
||||||
|
public static final int FLAG_ACCENT_CARON = (1 << 26);
|
||||||
|
public static final int FLAG_ACCENT_MACRON = (1 << 27);
|
||||||
|
|
||||||
public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 |
|
public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 |
|
||||||
FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 |
|
FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 |
|
||||||
FLAG_ACCENT_SUPERSCRIPT | FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_RING;
|
FLAG_ACCENT_CARON | FLAG_ACCENT_MACRON | FLAG_ACCENT_SUPERSCRIPT |
|
||||||
|
FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_RING;
|
||||||
|
|
||||||
|
// Language specific keys
|
||||||
|
public static final int FLAG_LANG_SZLIG = (1 << 25);
|
||||||
|
|
||||||
|
public static final int FLAGS_LANGS = FLAG_LANG_SZLIG;
|
||||||
|
|
||||||
|
public static final int FLAGS_NOT_HIDDEN_ACCENTS = FLAG_ACCENT_SUPERSCRIPT |
|
||||||
|
FLAG_ACCENT_SUBSCRIPT;
|
||||||
|
// Keys that have to be enabled per language
|
||||||
|
public static final int FLAGS_HIDDEN_KEYS =
|
||||||
|
(FLAGS_ACCENTS & ~FLAGS_NOT_HIDDEN_ACCENTS) | FLAGS_LANGS;
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
public final String symbol;
|
public final String symbol;
|
||||||
@@ -75,14 +90,15 @@ class KeyValue
|
|||||||
flags = f;
|
flags = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KeyValue getKeyByName(String name)
|
public static KeyValue getKeyByName(String name)
|
||||||
{
|
{
|
||||||
if (name == null)
|
if (name == null)
|
||||||
return null;
|
return null;
|
||||||
KeyValue kv = KeyValue.keys.get(name);
|
KeyValue kv = KeyValue.keys.get(name);
|
||||||
if (kv != null)
|
if (kv != null)
|
||||||
return kv;
|
return kv;
|
||||||
return new KeyValue(name, name, CHAR_NONE, EVENT_NONE, 0);
|
char c = (name.length() == 1) ? name.charAt(0) : CHAR_NONE;
|
||||||
|
return new KeyValue(name, name, c, EVENT_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addKey(String name, String symbol, char c, int event, int flags)
|
private static void addKey(String name, String symbol, char c, int event, int flags)
|
||||||
@@ -90,10 +106,15 @@ class KeyValue
|
|||||||
keys.put(name, new KeyValue(name, symbol, c, event, flags));
|
keys.put(name, new KeyValue(name, symbol, c, event, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addCharKey(char c, int event)
|
private static void addCharKey(char c, int event, int flags)
|
||||||
{
|
{
|
||||||
String name = String.valueOf(c);
|
String name = String.valueOf(c);
|
||||||
addKey(name, name, c, event, 0);
|
addKey(name, name, c, event, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addCharKey(char c, int event)
|
||||||
|
{
|
||||||
|
addCharKey(c, event, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void addModifierKey(String name, String symbol, int extra_flags)
|
private static void addModifierKey(String name, String symbol, int extra_flags)
|
||||||
@@ -126,11 +147,13 @@ class KeyValue
|
|||||||
addModifierKey("shift", "⇧", FLAG_LOCK | FLAG_SHIFT);
|
addModifierKey("shift", "⇧", FLAG_LOCK | FLAG_SHIFT);
|
||||||
addModifierKey("ctrl", "Ctrl", FLAG_CTRL);
|
addModifierKey("ctrl", "Ctrl", FLAG_CTRL);
|
||||||
addModifierKey("alt", "Alt", FLAG_ALT);
|
addModifierKey("alt", "Alt", FLAG_ALT);
|
||||||
addModifierKey("accent_grave", "◌̀", FLAG_ACCENT1);
|
|
||||||
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
|
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
|
||||||
addModifierKey("accent_circonflexe", "◌̂", FLAG_ACCENT3);
|
addModifierKey("accent_caron", "◌̌", FLAG_ACCENT_CARON);
|
||||||
addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4);
|
|
||||||
addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5);
|
addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5);
|
||||||
|
addModifierKey("accent_circonflexe", "◌̂", FLAG_ACCENT3);
|
||||||
|
addModifierKey("accent_grave", "◌̀", FLAG_ACCENT1);
|
||||||
|
addModifierKey("accent_macron", "◌̄", FLAG_ACCENT_MACRON);
|
||||||
|
addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4);
|
||||||
addModifierKey("accent_trema", "◌̈", FLAG_ACCENT6);
|
addModifierKey("accent_trema", "◌̈", FLAG_ACCENT6);
|
||||||
addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING);
|
addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING);
|
||||||
addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);
|
addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);
|
||||||
@@ -190,13 +213,15 @@ class KeyValue
|
|||||||
addCharKey('#', KeyEvent.KEYCODE_POUND);
|
addCharKey('#', KeyEvent.KEYCODE_POUND);
|
||||||
addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN);
|
addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN);
|
||||||
addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN);
|
addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN);
|
||||||
|
addCharKey('ß', EVENT_NONE, FLAG_LANG_SZLIG);
|
||||||
|
|
||||||
addSpecialKey("config", "Conf", EVENT_CONFIG);
|
addSpecialKey("config", "⛭", EVENT_CONFIG);
|
||||||
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT);
|
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT);
|
||||||
addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC);
|
addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC);
|
||||||
addSpecialKey("switch_emoji", ":)", EVENT_SWITCH_EMOJI);
|
addSpecialKey("switch_emoji", "☻", EVENT_SWITCH_EMOJI);
|
||||||
addSpecialKey("switch_back_emoji", "ABC", EVENT_SWITCH_BACK_EMOJI);
|
addSpecialKey("switch_back_emoji", "ABC", EVENT_SWITCH_BACK_EMOJI);
|
||||||
addSpecialKey("change_method", "⊞", EVENT_CHANGE_METHOD);
|
addSpecialKey("change_method", "⊞", EVENT_CHANGE_METHOD);
|
||||||
|
addSpecialKey("action", "Action", EVENT_ACTION); // Will always be replaced
|
||||||
|
|
||||||
addEventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE);
|
addEventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE);
|
||||||
addEventKey("enter", "\uE800", KeyEvent.KEYCODE_ENTER, FLAG_KEY_FONT);
|
addEventKey("enter", "\uE800", KeyEvent.KEYCODE_ENTER, FLAG_KEY_FONT);
|
||||||
@@ -206,7 +231,7 @@ class KeyValue
|
|||||||
addEventKey("left", "\uE80A", KeyEvent.KEYCODE_DPAD_LEFT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
|
addEventKey("left", "\uE80A", KeyEvent.KEYCODE_DPAD_LEFT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
|
||||||
addEventKey("page_up", "⇞", KeyEvent.KEYCODE_PAGE_UP);
|
addEventKey("page_up", "⇞", KeyEvent.KEYCODE_PAGE_UP);
|
||||||
addEventKey("page_down", "⇟", KeyEvent.KEYCODE_PAGE_DOWN);
|
addEventKey("page_down", "⇟", KeyEvent.KEYCODE_PAGE_DOWN);
|
||||||
addEventKey("home", "↖", KeyEvent.KEYCODE_HOME);
|
addEventKey("home", "↖", KeyEvent.KEYCODE_MOVE_HOME);
|
||||||
addEventKey("end", "↗", KeyEvent.KEYCODE_MOVE_END);
|
addEventKey("end", "↗", KeyEvent.KEYCODE_MOVE_END);
|
||||||
addEventKey("backspace", "⌫", KeyEvent.KEYCODE_DEL, FLAG_PRECISE_REPEAT);
|
addEventKey("backspace", "⌫", KeyEvent.KEYCODE_DEL, FLAG_PRECISE_REPEAT);
|
||||||
addEventKey("delete", "⌦", KeyEvent.KEYCODE_FORWARD_DEL, FLAG_PRECISE_REPEAT);
|
addEventKey("delete", "⌦", KeyEvent.KEYCODE_FORWARD_DEL, FLAG_PRECISE_REPEAT);
|
||||||
@@ -221,8 +246,9 @@ class KeyValue
|
|||||||
addEventKey("f8", "F8", KeyEvent.KEYCODE_F8);
|
addEventKey("f8", "F8", KeyEvent.KEYCODE_F8);
|
||||||
addEventKey("f9", "F9", KeyEvent.KEYCODE_F9);
|
addEventKey("f9", "F9", KeyEvent.KEYCODE_F9);
|
||||||
addEventKey("f10", "F10", KeyEvent.KEYCODE_F10);
|
addEventKey("f10", "F10", KeyEvent.KEYCODE_F10);
|
||||||
|
addEventKey("tab", "↹", KeyEvent.KEYCODE_TAB);
|
||||||
|
|
||||||
addKey("tab", "↹", '\t', KeyEvent.KEYCODE_TAB, 0);
|
addKey("\\t", "\\t", '\t', EVENT_NONE, 0); // Send the tab character
|
||||||
addKey("space", " ", ' ', KeyEvent.KEYCODE_SPACE, 0);
|
addKey("space", " ", ' ', KeyEvent.KEYCODE_SPACE, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,12 +12,15 @@ import android.os.IBinder;
|
|||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.view.inputmethod.InputMethodInfo;
|
import android.view.inputmethod.InputMethodInfo;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.view.inputmethod.InputMethodSubtype;
|
import android.view.inputmethod.InputMethodSubtype;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.view.ViewParent;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -25,14 +28,13 @@ import java.util.Locale;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Keyboard2 extends InputMethodService
|
public class Keyboard2 extends InputMethodService
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener
|
implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||||
{
|
{
|
||||||
private Keyboard2View _keyboardView;
|
private Keyboard2View _keyboardView;
|
||||||
private int _currentTextLayout;
|
private int _currentTextLayout;
|
||||||
private ViewGroup _emojiPane = null;
|
private ViewGroup _emojiPane = null;
|
||||||
private Typeface _specialKeyFont = null;
|
|
||||||
|
|
||||||
private Config _config;
|
private Config _config;
|
||||||
|
|
||||||
private Map<Integer, KeyboardData> _layoutCache = new HashMap<Integer, KeyboardData>();
|
private Map<Integer, KeyboardData> _layoutCache = new HashMap<Integer, KeyboardData>();
|
||||||
|
|
||||||
@@ -47,27 +49,18 @@ public class Keyboard2 extends InputMethodService
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate()
|
public void onCreate()
|
||||||
{
|
{
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
_specialKeyFont = Typeface.createFromAsset(getAssets(), "fonts/keys.ttf");
|
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
|
||||||
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
|
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
|
||||||
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
|
Config.initGlobalConfig(this, new KeyEventHandler(this.new Receiver()));
|
||||||
_config = new Config(this);
|
_config = Config.globalConfig();
|
||||||
_keyboardView = (Keyboard2View)getLayoutInflater().inflate(R.layout.keyboard, null);
|
_config.refresh(this);
|
||||||
_keyboardView.reset();
|
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
|
||||||
}
|
_keyboardView.reset();
|
||||||
|
}
|
||||||
public Config getConfig()
|
|
||||||
{
|
|
||||||
return (_config);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Typeface getSpecialKeyFont()
|
|
||||||
{
|
|
||||||
return (_specialKeyFont);
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<InputMethodSubtype> getEnabledSubtypes(InputMethodManager imm)
|
private List<InputMethodSubtype> getEnabledSubtypes(InputMethodManager imm)
|
||||||
{
|
{
|
||||||
@@ -80,7 +73,7 @@ public class Keyboard2 extends InputMethodService
|
|||||||
|
|
||||||
private void refreshSubtypeLayout(InputMethodSubtype subtype)
|
private void refreshSubtypeLayout(InputMethodSubtype subtype)
|
||||||
{
|
{
|
||||||
int l = _config.layout;;
|
int l = _config.layout;
|
||||||
if (l == -1)
|
if (l == -1)
|
||||||
{
|
{
|
||||||
String s = subtype.getExtraValueOf("default_layout");
|
String s = subtype.getExtraValueOf("default_layout");
|
||||||
@@ -90,33 +83,32 @@ public class Keyboard2 extends InputMethodService
|
|||||||
_currentTextLayout = l;
|
_currentTextLayout = l;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int accents_of_subtype(InputMethodSubtype subtype)
|
private int extra_keys_of_subtype(InputMethodSubtype subtype)
|
||||||
{
|
{
|
||||||
String accents_option = subtype.getExtraValueOf("accents");
|
String extra_keys = subtype.getExtraValueOf("extra_keys");
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (accents_option != null)
|
if (extra_keys != null)
|
||||||
for (String acc : accents_option.split("\\|"))
|
for (String acc : extra_keys.split("\\|"))
|
||||||
flags |= Config.accentFlag_of_name(acc);
|
flags |= Config.extra_key_flag_of_name(acc);
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
|
private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
|
||||||
{
|
{
|
||||||
final int DONT_REMOVE = KeyValue.FLAG_ACCENT_SUPERSCRIPT | KeyValue.FLAG_ACCENT_SUBSCRIPT;
|
int to_keep = 0;
|
||||||
int to_keep = DONT_REMOVE;
|
|
||||||
switch (_config.accents)
|
switch (_config.accents)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
to_keep |= accents_of_subtype(subtype);
|
to_keep |= extra_keys_of_subtype(subtype);
|
||||||
for (InputMethodSubtype s : getEnabledSubtypes(imm))
|
for (InputMethodSubtype s : getEnabledSubtypes(imm))
|
||||||
to_keep |= accents_of_subtype(s);
|
to_keep |= extra_keys_of_subtype(s);
|
||||||
break;
|
break;
|
||||||
case 2: to_keep |= accents_of_subtype(subtype); break;
|
case 2: to_keep |= extra_keys_of_subtype(subtype); break;
|
||||||
case 3: to_keep = KeyValue.FLAGS_ACCENTS; break;
|
case 3: to_keep = KeyValue.FLAGS_HIDDEN_KEYS; break;
|
||||||
case 4: break;
|
case 4: break;
|
||||||
default: throw new IllegalArgumentException();
|
default: throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
_config.accent_flags_to_remove = ~to_keep & KeyValue.FLAGS_ACCENTS;
|
_config.key_flags_to_remove = ~to_keep & KeyValue.FLAGS_HIDDEN_KEYS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshSubtypeLegacyFallback()
|
private void refreshSubtypeLegacyFallback()
|
||||||
@@ -124,8 +116,8 @@ public class Keyboard2 extends InputMethodService
|
|||||||
// Fallback for the accents option: Only respect the "None" case
|
// Fallback for the accents option: Only respect the "None" case
|
||||||
switch (_config.accents)
|
switch (_config.accents)
|
||||||
{
|
{
|
||||||
case 1: case 2: case 3: _config.accent_flags_to_remove = 0; break;
|
case 1: case 2: case 3: _config.key_flags_to_remove = 0; break;
|
||||||
case 4: _config.accent_flags_to_remove = KeyValue.FLAGS_ACCENTS; break;
|
case 4: _config.key_flags_to_remove = KeyValue.FLAGS_HIDDEN_KEYS; break;
|
||||||
}
|
}
|
||||||
// Fallback for the layout option: Use qwerty in the "system settings" case
|
// Fallback for the layout option: Use qwerty in the "system settings" case
|
||||||
_currentTextLayout = (_config.layout == -1) ? R.xml.qwerty : _config.layout;
|
_currentTextLayout = (_config.layout == -1) ? R.xml.qwerty : _config.layout;
|
||||||
@@ -148,26 +140,76 @@ public class Keyboard2 extends InputMethodService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private String actionLabel_of_imeAction(int action)
|
||||||
public View onCreateInputView()
|
{
|
||||||
{
|
int res;
|
||||||
ViewGroup parent = (ViewGroup)_keyboardView.getParent();
|
switch (action)
|
||||||
|
{
|
||||||
|
case EditorInfo.IME_ACTION_NEXT: res = R.string.key_action_next; break;
|
||||||
|
case EditorInfo.IME_ACTION_DONE: res = R.string.key_action_done; break;
|
||||||
|
case EditorInfo.IME_ACTION_GO: res = R.string.key_action_go; break;
|
||||||
|
case EditorInfo.IME_ACTION_PREVIOUS: res = R.string.key_action_prev; break;
|
||||||
|
case EditorInfo.IME_ACTION_SEARCH: res = R.string.key_action_search; break;
|
||||||
|
case EditorInfo.IME_ACTION_SEND: res = R.string.key_action_send; break;
|
||||||
|
case EditorInfo.IME_ACTION_UNSPECIFIED:
|
||||||
|
case EditorInfo.IME_ACTION_NONE:
|
||||||
|
default: return null;
|
||||||
|
}
|
||||||
|
return getResources().getString(res);
|
||||||
|
}
|
||||||
|
|
||||||
if (parent != null)
|
private void refreshEditorInfo(EditorInfo info)
|
||||||
parent.removeView(_keyboardView);
|
{
|
||||||
return (_keyboardView);
|
// First try to look at 'info.actionLabel', if it isn't set, look at
|
||||||
}
|
// 'imeOptions'.
|
||||||
|
if (info.actionLabel != null)
|
||||||
@Override
|
{
|
||||||
public void onStartInputView(EditorInfo info, boolean restarting)
|
_config.actionLabel = info.actionLabel.toString();
|
||||||
{
|
_config.actionId = info.actionId;
|
||||||
refreshSubtypeImm();
|
_config.swapEnterActionKey = false;
|
||||||
if ((info.inputType & InputType.TYPE_CLASS_NUMBER) != 0)
|
}
|
||||||
_keyboardView.setKeyboard(getLayout(R.xml.numeric));
|
|
||||||
else
|
else
|
||||||
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
|
{
|
||||||
_keyboardView.reset(); // Layout might need to change due to rotation
|
int action = info.imeOptions & EditorInfo.IME_MASK_ACTION;
|
||||||
}
|
_config.actionLabel = actionLabel_of_imeAction(action); // Might be null
|
||||||
|
_config.actionId = action;
|
||||||
|
_config.swapEnterActionKey =
|
||||||
|
(info.imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshConfig()
|
||||||
|
{
|
||||||
|
int prev_theme = _config.theme;
|
||||||
|
_config.refresh(this);
|
||||||
|
refreshSubtypeImm();
|
||||||
|
// Refreshing the theme config requires re-creating the views
|
||||||
|
if (prev_theme != _config.theme)
|
||||||
|
{
|
||||||
|
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
|
||||||
|
_emojiPane = null;
|
||||||
|
}
|
||||||
|
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStartInputView(EditorInfo info, boolean restarting)
|
||||||
|
{
|
||||||
|
refreshConfig();
|
||||||
|
refreshEditorInfo(info);
|
||||||
|
if ((info.inputType & InputType.TYPE_CLASS_NUMBER) != 0)
|
||||||
|
_keyboardView.setKeyboard(getLayout(R.xml.numeric));
|
||||||
|
setInputView(_keyboardView);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInputView(View v)
|
||||||
|
{
|
||||||
|
ViewParent parent = v.getParent();
|
||||||
|
if (parent != null && parent instanceof ViewGroup)
|
||||||
|
((ViewGroup)parent).removeView(v);
|
||||||
|
super.setInputView(v);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype)
|
public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype)
|
||||||
@@ -183,95 +225,85 @@ public class Keyboard2 extends InputMethodService
|
|||||||
_keyboardView.reset();
|
_keyboardView.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
|
||||||
{
|
{
|
||||||
_config.refresh();
|
refreshConfig();
|
||||||
refreshSubtypeImm();
|
}
|
||||||
_keyboardView.refreshConfig(_config, getLayout(_currentTextLayout));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/** Not static */
|
||||||
public void onConfigurationChanged(Configuration newConfig)
|
public class Receiver implements KeyEventHandler.IReceiver
|
||||||
{
|
{
|
||||||
_keyboardView.reset();
|
public void switchToNextInputMethod()
|
||||||
}
|
{
|
||||||
|
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
|
||||||
|
imm.showInputMethodPicker();
|
||||||
|
// deprecated in version 28: imm.switchToNextInputMethod(getConnectionToken(), false);
|
||||||
|
// added in version 28: switchToNextInputMethod(false);
|
||||||
|
}
|
||||||
|
|
||||||
public void handleKeyUp(KeyValue key, int flags)
|
public void setPane_emoji()
|
||||||
{
|
{
|
||||||
if (getCurrentInputConnection() == null)
|
if (_emojiPane == null)
|
||||||
return ;
|
_emojiPane = (ViewGroup)inflate_view(R.layout.emoji_pane);
|
||||||
key = KeyModifier.handleFlags(key, flags);
|
setInputView(_emojiPane);
|
||||||
if (key.eventCode == KeyValue.EVENT_CONFIG)
|
}
|
||||||
{
|
|
||||||
Intent intent = new Intent(this, SettingsActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
else if (key.eventCode == KeyValue.EVENT_SWITCH_TEXT)
|
|
||||||
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
|
|
||||||
else if (key.eventCode == KeyValue.EVENT_SWITCH_NUMERIC)
|
|
||||||
_keyboardView.setKeyboard(getLayout(R.xml.numeric));
|
|
||||||
else if (key.eventCode == KeyValue.EVENT_SWITCH_EMOJI)
|
|
||||||
{
|
|
||||||
if (_emojiPane == null)
|
|
||||||
_emojiPane = (ViewGroup)getLayoutInflater().inflate(R.layout.emoji_pane, null);
|
|
||||||
setInputView(_emojiPane);
|
|
||||||
}
|
|
||||||
else if (key.eventCode == KeyValue.EVENT_SWITCH_BACK_EMOJI)
|
|
||||||
setInputView(_keyboardView);
|
|
||||||
else if (key.eventCode == KeyValue.EVENT_CHANGE_METHOD)
|
|
||||||
{
|
|
||||||
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
|
|
||||||
imm.switchToNextInputMethod(getConnectionToken(), false);
|
|
||||||
}
|
|
||||||
else if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT)) != 0)
|
|
||||||
handleMetaKeyUp(key, flags);
|
|
||||||
// else if (eventCode == KeyEvent.KEYCODE_DEL)
|
|
||||||
// handleDelKey(1, 0);
|
|
||||||
// else if (eventCode == KeyEvent.KEYCODE_FORWARD_DEL)
|
|
||||||
// handleDelKey(0, 1);
|
|
||||||
else if (key.char_ == KeyValue.CHAR_NONE)
|
|
||||||
{
|
|
||||||
if (key.eventCode != KeyValue.EVENT_NONE)
|
|
||||||
handleMetaKeyUp(key, flags);
|
|
||||||
else
|
|
||||||
getCurrentInputConnection().commitText(key.symbol, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sendKeyChar(key.char_);
|
|
||||||
}
|
|
||||||
|
|
||||||
// private void handleDelKey(int before, int after)
|
public void setPane_normal()
|
||||||
// {
|
{
|
||||||
// CharSequence selection = getCurrentInputConnection().getSelectedText(0);
|
setInputView(_keyboardView);
|
||||||
|
}
|
||||||
|
|
||||||
// if (selection != null && selection.length() > 0)
|
public void performAction()
|
||||||
// getCurrentInputConnection().commitText("", 1);
|
{
|
||||||
// else
|
InputConnection conn = getCurrentInputConnection();
|
||||||
// getCurrentInputConnection().deleteSurroundingText(before, after);
|
if (conn == null)
|
||||||
// }
|
return;
|
||||||
|
conn.performEditorAction(_config.actionId);
|
||||||
|
}
|
||||||
|
|
||||||
private void handleMetaKeyUp(KeyValue key, int flags)
|
public void setLayout(int res_id)
|
||||||
{
|
{
|
||||||
int metaState = 0;
|
if (res_id == -1)
|
||||||
KeyEvent event;
|
res_id = _currentTextLayout;
|
||||||
|
_keyboardView.setKeyboard(getLayout(res_id));
|
||||||
|
}
|
||||||
|
|
||||||
if (key.eventCode == KeyValue.EVENT_NONE)
|
public void sendKeyEvent(int eventCode, int meta)
|
||||||
return ;
|
{
|
||||||
if ((flags & KeyValue.FLAG_CTRL) != 0)
|
InputConnection conn = getCurrentInputConnection();
|
||||||
metaState |= KeyEvent.META_CTRL_LEFT_ON | KeyEvent.META_CTRL_ON;
|
if (conn == null)
|
||||||
if ((flags & KeyValue.FLAG_ALT) != 0)
|
return;
|
||||||
metaState |= KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_ON;
|
KeyEvent event = new KeyEvent(1, 1, KeyEvent.ACTION_DOWN, eventCode, 0, meta);
|
||||||
if ((flags & KeyValue.FLAG_SHIFT) != 0)
|
conn.sendKeyEvent(event);
|
||||||
metaState |= KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON;
|
conn.sendKeyEvent(KeyEvent.changeAction(event, KeyEvent.ACTION_UP));
|
||||||
event = new KeyEvent(1, 1, KeyEvent.ACTION_DOWN, key.eventCode, 0, metaState);
|
}
|
||||||
getCurrentInputConnection().sendKeyEvent(event);
|
|
||||||
getCurrentInputConnection().sendKeyEvent(KeyEvent.changeAction(event, KeyEvent.ACTION_UP));
|
public void showKeyboardConfig()
|
||||||
}
|
{
|
||||||
|
Intent intent = new Intent(Keyboard2.this, SettingsActivity.class);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void commitText(String text)
|
||||||
|
{
|
||||||
|
getCurrentInputConnection().commitText(text, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void commitChar(char c)
|
||||||
|
{
|
||||||
|
sendKeyChar(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private IBinder getConnectionToken()
|
private IBinder getConnectionToken()
|
||||||
{
|
{
|
||||||
return getWindow().getWindow().getAttributes().token;
|
return getWindow().getWindow().getAttributes().token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private View inflate_view(int layout)
|
||||||
|
{
|
||||||
|
return View.inflate(new ContextThemeWrapper(this, _config.theme), layout, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,256 +1,232 @@
|
|||||||
package juloo.keyboard2;
|
package juloo.keyboard2;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.RectF;
|
import android.graphics.RectF;
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.PopupWindow;
|
import android.widget.PopupWindow;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Keyboard2View extends View
|
public class Keyboard2View extends View
|
||||||
implements View.OnTouchListener, Handler.Callback
|
implements View.OnTouchListener, Handler.Callback
|
||||||
{
|
{
|
||||||
private static final long VIBRATE_MIN_INTERVAL = 100;
|
private static final long VIBRATE_MIN_INTERVAL = 100;
|
||||||
|
|
||||||
private KeyboardData _keyboard;
|
private KeyboardData _keyboard;
|
||||||
|
|
||||||
private ArrayList<KeyDown> _downKeys = new ArrayList<KeyDown>();
|
private ArrayList<KeyDown> _downKeys = new ArrayList<KeyDown>();
|
||||||
|
|
||||||
private int _flags = 0;
|
private int _flags = 0;
|
||||||
|
|
||||||
private Vibrator _vibratorService;
|
private Vibrator _vibratorService;
|
||||||
private long _lastVibration = 0;
|
private long _lastVibration = 0;
|
||||||
|
|
||||||
private Handler _handler;
|
private Handler _handler;
|
||||||
private static int _currentWhat = 0;
|
private static int _currentWhat = 0;
|
||||||
|
|
||||||
private Config _config;
|
private Config _config;
|
||||||
|
|
||||||
private float _keyWidth;
|
private float _keyWidth;
|
||||||
|
|
||||||
private Paint _keyBgPaint = new Paint();
|
private Theme _theme;
|
||||||
private Paint _keyDownBgPaint = new Paint();
|
|
||||||
private Paint _keyLabelPaint;
|
|
||||||
private Paint _keySubLabelPaint;
|
|
||||||
private Paint _specialKeyLabelPaint;
|
|
||||||
private Paint _specialKeySubLabelPaint;
|
|
||||||
private int _lockedColor;
|
|
||||||
private int _activatedColor;
|
|
||||||
private int _labelColor;
|
|
||||||
private int _subLabelColor;
|
|
||||||
private float _labelTextSize;
|
|
||||||
private float _sublabelTextSize;
|
|
||||||
|
|
||||||
private static RectF _tmpRect = new RectF();
|
private static RectF _tmpRect = new RectF();
|
||||||
|
|
||||||
public Keyboard2View(Context context, AttributeSet attrs)
|
public Keyboard2View(Context context, AttributeSet attrs)
|
||||||
{
|
|
||||||
super(context, attrs);
|
|
||||||
_vibratorService = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
_handler = new Handler(this);
|
|
||||||
refreshConfig(((Keyboard2)context).getConfig(), null);
|
|
||||||
setOnTouchListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Internally calls [reset()]. */
|
|
||||||
public void refreshConfig(Config config, KeyboardData kw)
|
|
||||||
{
|
{
|
||||||
Resources res = getResources();
|
super(context, attrs);
|
||||||
_config = config;
|
_vibratorService = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
_lockedColor = res.getColor(R.color.key_label_locked);
|
_handler = new Handler(this);
|
||||||
_activatedColor = res.getColor(R.color.key_label_activated);
|
_theme = new Theme(getContext(), attrs);
|
||||||
_labelColor = res.getColor(R.color.key_label);
|
_config = Config.globalConfig();
|
||||||
_subLabelColor = res.getColor(R.color.key_sub_label);
|
setOnTouchListener(this);
|
||||||
_labelTextSize = res.getDimension(R.dimen.label_text_size) * config.characterSize;
|
reset();
|
||||||
_sublabelTextSize = res.getDimension(R.dimen.sublabel_text_size) * config.characterSize;
|
|
||||||
_keyBgPaint.setColor(res.getColor(R.color.key_bg));
|
|
||||||
_keyDownBgPaint.setColor(res.getColor(R.color.key_down_bg));
|
|
||||||
_keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null);
|
|
||||||
_keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null);
|
|
||||||
Typeface specialKeysFont = ((Keyboard2)getContext()).getSpecialKeyFont();
|
|
||||||
_specialKeyLabelPaint = initLabelPaint(Paint.Align.CENTER, specialKeysFont);
|
|
||||||
_specialKeySubLabelPaint = initLabelPaint(Paint.Align.LEFT, specialKeysFont);
|
|
||||||
if (kw != null)
|
|
||||||
setKeyboard(kw); // handle layout options then calls reset().
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Paint initLabelPaint(Paint.Align align, Typeface font)
|
public void setKeyboard(KeyboardData kw)
|
||||||
{
|
|
||||||
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
||||||
paint.setTextAlign(align);
|
|
||||||
if (font != null)
|
|
||||||
paint.setTypeface(font);
|
|
||||||
return (paint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setKeyboard(KeyboardData kw)
|
|
||||||
{
|
{
|
||||||
if (!_config.shouldOfferSwitchingToNextInputMethod)
|
if (!_config.shouldOfferSwitchingToNextInputMethod)
|
||||||
kw = kw.removeKeys(new KeyboardData.RemoveKeysByEvent(KeyValue.EVENT_CHANGE_METHOD));
|
kw = kw.replaceKeys(
|
||||||
if (_config.accent_flags_to_remove != 0)
|
new KeyboardData.ReplaceKeysByEvent(KeyValue.EVENT_CHANGE_METHOD, null));
|
||||||
kw = kw.removeKeys(new KeyboardData.RemoveKeysByFlags(_config.accent_flags_to_remove));
|
if (_config.key_flags_to_remove != 0)
|
||||||
|
kw = kw.replaceKeys(
|
||||||
|
new KeyboardData.ReplaceKeysByFlags(_config.key_flags_to_remove, null));
|
||||||
|
// Replace the action key to show the right label.
|
||||||
|
KeyValue action_key = null;
|
||||||
|
if (_config.actionLabel != null)
|
||||||
|
{
|
||||||
|
action_key = new KeyValue(_config.actionLabel, _config.actionLabel,
|
||||||
|
KeyValue.CHAR_NONE, KeyValue.EVENT_ACTION, KeyValue.FLAG_NOREPEAT);
|
||||||
|
}
|
||||||
|
if (_config.swapEnterActionKey && action_key != null)
|
||||||
|
kw = kw.replaceKeys(
|
||||||
|
new KeyboardData.ReplaceKeysByEvent2(KeyEvent.KEYCODE_ENTER,
|
||||||
|
action_key, KeyValue.EVENT_ACTION,
|
||||||
|
KeyValue.getKeyByName("enter")));
|
||||||
|
else
|
||||||
|
kw = kw.replaceKeys(
|
||||||
|
new KeyboardData.ReplaceKeysByEvent(KeyValue.EVENT_ACTION, action_key));
|
||||||
_keyboard = kw;
|
_keyboard = kw;
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
{
|
{
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
_downKeys.clear();
|
_downKeys.clear();
|
||||||
requestLayout();
|
requestLayout();
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouch(View v, MotionEvent event)
|
public boolean onTouch(View v, MotionEvent event)
|
||||||
{
|
{
|
||||||
float x;
|
float x;
|
||||||
float y;
|
float y;
|
||||||
float keyW;
|
float keyW;
|
||||||
int p;
|
int p;
|
||||||
|
|
||||||
switch (event.getActionMasked())
|
switch (event.getActionMasked())
|
||||||
{
|
{
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_POINTER_UP:
|
case MotionEvent.ACTION_POINTER_UP:
|
||||||
onTouchUp(event.getPointerId(event.getActionIndex()));
|
onTouchUp(event.getPointerId(event.getActionIndex()));
|
||||||
break ;
|
break ;
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
case MotionEvent.ACTION_POINTER_DOWN:
|
case MotionEvent.ACTION_POINTER_DOWN:
|
||||||
p = event.getActionIndex();
|
p = event.getActionIndex();
|
||||||
onTouchDown(event.getX(p), event.getY(p), event.getPointerId(p));
|
onTouchDown(event.getX(p), event.getY(p), event.getPointerId(p));
|
||||||
break ;
|
break ;
|
||||||
case MotionEvent.ACTION_MOVE:
|
case MotionEvent.ACTION_MOVE:
|
||||||
for (p = 0; p < event.getPointerCount(); p++)
|
for (p = 0; p < event.getPointerCount(); p++)
|
||||||
onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
|
onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyDown getKeyDown(int pointerId)
|
private KeyDown getKeyDown(int pointerId)
|
||||||
{
|
{
|
||||||
for (KeyDown k : _downKeys)
|
for (KeyDown k : _downKeys)
|
||||||
{
|
{
|
||||||
if (k.pointerId == pointerId)
|
if (k.pointerId == pointerId)
|
||||||
return (k);
|
return (k);
|
||||||
}
|
}
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyDown getKeyDown(KeyboardData.Key key)
|
private KeyDown getKeyDown(KeyboardData.Key key)
|
||||||
{
|
{
|
||||||
for (KeyDown k : _downKeys)
|
for (KeyDown k : _downKeys)
|
||||||
{
|
{
|
||||||
if (k.key == key)
|
if (k.key == key)
|
||||||
return (k);
|
return (k);
|
||||||
}
|
}
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private KeyDown getKeyDown(KeyValue kv)
|
private KeyDown getKeyDown(KeyValue kv)
|
||||||
{
|
{
|
||||||
for (KeyDown k : _downKeys)
|
for (KeyDown k : _downKeys)
|
||||||
{
|
{
|
||||||
if (k.value == kv)
|
if (k.value == kv)
|
||||||
return (k);
|
return (k);
|
||||||
}
|
}
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTouchMove(float moveX, float moveY, int pointerId)
|
private void onTouchMove(float moveX, float moveY, int pointerId)
|
||||||
{
|
{
|
||||||
KeyDown key = getKeyDown(pointerId);
|
KeyDown key = getKeyDown(pointerId);
|
||||||
KeyValue newValue;
|
KeyValue newValue;
|
||||||
|
|
||||||
if (key != null)
|
if (key != null)
|
||||||
{
|
{
|
||||||
moveX -= key.downX;
|
moveX -= key.downX;
|
||||||
moveY -= key.downY;
|
moveY -= key.downY;
|
||||||
float absDist = Math.abs(moveX) + Math.abs(moveY);
|
float absDist = Math.abs(moveX) + Math.abs(moveY);
|
||||||
key.ptrDist = absDist;
|
key.ptrDist = absDist;
|
||||||
if (absDist < _config.subValueDist)
|
if (absDist < _config.swipe_dist_px)
|
||||||
newValue = key.key.key0;
|
newValue = key.key.key0;
|
||||||
else if (moveX < 0)
|
else if (moveX < 0)
|
||||||
newValue = (moveY < 0) ? key.key.key1 : key.key.key3;
|
newValue = (moveY < 0) ? key.key.key1 : key.key.key3;
|
||||||
else if (moveY < 0)
|
else if (moveY < 0)
|
||||||
newValue = key.key.key2;
|
newValue = key.key.key2;
|
||||||
else
|
else
|
||||||
newValue = key.key.key4;
|
newValue = key.key.key4;
|
||||||
if (newValue != null && newValue != key.value)
|
if (newValue != null && newValue != key.value)
|
||||||
{
|
{
|
||||||
if (key.timeoutWhat != -1)
|
if (key.timeoutWhat != -1)
|
||||||
{
|
{
|
||||||
_handler.removeMessages(key.timeoutWhat);
|
_handler.removeMessages(key.timeoutWhat);
|
||||||
if ((newValue.flags & KeyValue.FLAG_NOREPEAT) == 0)
|
if ((newValue.flags & KeyValue.FLAG_NOREPEAT) == 0)
|
||||||
_handler.sendEmptyMessageDelayed(key.timeoutWhat, _config.longPressTimeout);
|
_handler.sendEmptyMessageDelayed(key.timeoutWhat, _config.longPressTimeout);
|
||||||
}
|
}
|
||||||
key.value = newValue;
|
key.value = newValue;
|
||||||
key.flags = newValue.flags;
|
key.flags = newValue.flags;
|
||||||
updateFlags();
|
updateFlags();
|
||||||
invalidate();
|
invalidate();
|
||||||
handleKeyDown(newValue);
|
handleKeyDown(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTouchDown(float touchX, float touchY, int pointerId)
|
private void onTouchDown(float touchX, float touchY, int pointerId)
|
||||||
{
|
{
|
||||||
float y = _config.marginTop - _config.keyHeight;
|
float y = _config.marginTop - _config.keyHeight;
|
||||||
for (KeyboardData.Row row : _keyboard.rows)
|
for (KeyboardData.Row row : _keyboard.rows)
|
||||||
{
|
{
|
||||||
y += _config.keyHeight;
|
y += _config.keyHeight;
|
||||||
if (touchY < y || touchY >= (y + _config.keyHeight))
|
if (touchY < y || touchY >= (y + _config.keyHeight))
|
||||||
continue ;
|
continue ;
|
||||||
float x = _config.horizontalMargin;
|
float x = _config.horizontalMargin;
|
||||||
for (KeyboardData.Key key : row.keys)
|
for (KeyboardData.Key key : row.keys)
|
||||||
{
|
{
|
||||||
x += key.shift * _keyWidth;
|
x += key.shift * _keyWidth;
|
||||||
float keyW = _keyWidth * key.width;
|
float keyW = _keyWidth * key.width;
|
||||||
if (touchX >= x && touchX < (x + keyW))
|
if (touchX >= x && touchX < (x + keyW))
|
||||||
{
|
{
|
||||||
int what = _currentWhat++;
|
int what = _currentWhat++;
|
||||||
if (key.key0 != null && (key.key0.flags & KeyValue.FLAG_NOREPEAT) == 0)
|
if (key.key0 != null && (key.key0.flags & KeyValue.FLAG_NOREPEAT) == 0)
|
||||||
_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
|
_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
|
||||||
_downKeys.add(new KeyDown(pointerId, key, touchX, touchY, what));
|
_downKeys.add(new KeyDown(pointerId, key, touchX, touchY, what));
|
||||||
handleKeyDown(key.key0);
|
handleKeyDown(key.key0);
|
||||||
updateFlags();
|
updateFlags();
|
||||||
invalidate();
|
invalidate();
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
x += keyW;
|
x += keyW;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Whether a key is already activated (key down but pointer up)
|
// Whether a key is already activated (key down but pointer up)
|
||||||
private KeyDown getActivatedKey(KeyValue kv)
|
private KeyDown getActivatedKey(KeyValue kv)
|
||||||
{
|
{
|
||||||
for (KeyDown k : _downKeys)
|
for (KeyDown k : _downKeys)
|
||||||
{
|
{
|
||||||
if (k.value == kv && k.pointerId == -1)
|
if (k.value == kv && k.pointerId == -1)
|
||||||
return (k);
|
return (k);
|
||||||
}
|
}
|
||||||
return (null);
|
return (null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTouchUp(int pointerId)
|
private void onTouchUp(int pointerId)
|
||||||
{
|
{
|
||||||
KeyDown k = getKeyDown(pointerId);
|
KeyDown k = getKeyDown(pointerId);
|
||||||
|
|
||||||
if (k != null)
|
if (k != null)
|
||||||
{
|
{
|
||||||
// Stop key repeat
|
// Stop key repeat
|
||||||
if (k.timeoutWhat != -1)
|
if (k.timeoutWhat != -1)
|
||||||
{
|
{
|
||||||
@@ -295,124 +271,122 @@ public class Keyboard2View extends View
|
|||||||
}
|
}
|
||||||
updateFlags();
|
updateFlags();
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleKeyUp(KeyDown key)
|
private void handleKeyUp(KeyDown key)
|
||||||
{
|
{
|
||||||
if (key.value != null && (key.flags & (KeyValue.FLAG_LOCKED | KeyValue.FLAG_NOCHAR)) == 0)
|
if (key.value != null && (key.flags & (KeyValue.FLAG_LOCKED | KeyValue.FLAG_NOCHAR)) == 0)
|
||||||
((Keyboard2)getContext()).handleKeyUp(key.value, _flags);
|
_config.handler.handleKeyUp(key.value, _flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleKeyDown(KeyValue key)
|
private void handleKeyDown(KeyValue key)
|
||||||
{
|
{
|
||||||
if (key == null)
|
if (key == null)
|
||||||
return ;
|
return ;
|
||||||
vibrate();
|
vibrate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateFlags()
|
private void updateFlags()
|
||||||
{
|
{
|
||||||
_flags = 0;
|
_flags = 0;
|
||||||
for (KeyDown k : _downKeys)
|
for (KeyDown k : _downKeys)
|
||||||
_flags |= k.flags;
|
_flags |= k.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void vibrate()
|
private void vibrate()
|
||||||
{
|
{
|
||||||
if (!_config.vibrateEnabled)
|
if (!_config.vibrateEnabled)
|
||||||
return ;
|
return ;
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if ((now - _lastVibration) > VIBRATE_MIN_INTERVAL)
|
if ((now - _lastVibration) > VIBRATE_MIN_INTERVAL)
|
||||||
{
|
{
|
||||||
_lastVibration = now;
|
_lastVibration = now;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_vibratorService.vibrate(_config.vibrateDuration);
|
_vibratorService.vibrate(_config.vibrateDuration);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handleMessage(Message msg)
|
public boolean handleMessage(Message msg)
|
||||||
{
|
{
|
||||||
for (KeyDown key : _downKeys)
|
for (KeyDown key : _downKeys)
|
||||||
{
|
{
|
||||||
if (key.timeoutWhat == msg.what)
|
if (key.timeoutWhat == msg.what)
|
||||||
{
|
{
|
||||||
long nextInterval = _config.longPressInterval;
|
long nextInterval = _config.longPressInterval;
|
||||||
if (_config.preciseRepeat && (key.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
|
if (_config.preciseRepeat && (key.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
|
||||||
{
|
{
|
||||||
// Modulate repeat interval depending on the distance of the pointer
|
// Modulate repeat interval depending on the distance of the pointer
|
||||||
float accel = Math.min(4.f, Math.max(0.3f, key.ptrDist / (_config.subValueDist * 15.f)));
|
float accel = Math.min(4.f, Math.max(0.3f, key.ptrDist / (_config.swipe_dist_px * 15.f)));
|
||||||
nextInterval = (long)((float)nextInterval / accel);
|
nextInterval = (long)((float)nextInterval / accel);
|
||||||
}
|
}
|
||||||
_handler.sendEmptyMessageDelayed(msg.what, nextInterval);
|
_handler.sendEmptyMessageDelayed(msg.what, nextInterval);
|
||||||
((Keyboard2)getContext()).handleKeyUp(key.value, _flags);
|
_config.handler.handleKeyUp(key.value, _flags);
|
||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (false);
|
return (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMeasure(int wSpec, int hSpec)
|
public void onMeasure(int wSpec, int hSpec)
|
||||||
{
|
{
|
||||||
DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
|
DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
|
||||||
int width = dm.widthPixels;
|
int width = dm.widthPixels;
|
||||||
int height =
|
int height =
|
||||||
(int)(_config.keyHeight * _keyboard.keysHeight
|
(int)(_config.keyHeight * _keyboard.keysHeight
|
||||||
+ _keyboard.rows.size() * _config.keyVerticalInterval
|
+ _keyboard.rows.size()
|
||||||
+ _config.marginTop + _config.marginBottom);
|
+ _config.marginTop + _config.marginBottom);
|
||||||
setMeasuredDimension(width, height);
|
setMeasuredDimension(width, height);
|
||||||
_keyWidth = (width - (_config.horizontalMargin * 2)) / _keyboard.keysWidth;
|
_keyWidth = (width - (_config.horizontalMargin * 2)) / _keyboard.keysWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas)
|
protected void onDraw(Canvas canvas)
|
||||||
{
|
{
|
||||||
float y = _config.marginTop;
|
float y = _config.marginTop + _config.keyVerticalInterval / 2;
|
||||||
for (KeyboardData.Row row : _keyboard.rows)
|
for (KeyboardData.Row row : _keyboard.rows)
|
||||||
{
|
{
|
||||||
y += row.shift * _config.keyHeight;
|
y += row.shift * _config.keyHeight;
|
||||||
float x = _config.horizontalMargin;
|
float x = _config.horizontalMargin + _config.keyHorizontalInterval / 2;
|
||||||
float keyH = row.height * _config.keyHeight;
|
float keyH = row.height * _config.keyHeight - _config.keyVerticalInterval;
|
||||||
for (KeyboardData.Key k : row.keys)
|
for (KeyboardData.Key k : row.keys)
|
||||||
{
|
{
|
||||||
x += k.shift * _keyWidth + _config.keyHorizontalInterval;
|
x += k.shift * _keyWidth;
|
||||||
float keyW = _keyWidth * k.width - _config.keyHorizontalInterval;
|
float keyW = _keyWidth * k.width - _config.keyHorizontalInterval;
|
||||||
KeyDown keyDown = getKeyDown(k);
|
KeyDown keyDown = getKeyDown(k);
|
||||||
_tmpRect.set(x, y, x + keyW, y + keyH);
|
_tmpRect.set(x, y, x + keyW, y + keyH);
|
||||||
if (keyDown != null)
|
canvas.drawRoundRect(_tmpRect, _theme.keyBorderRadius, _theme.keyBorderRadius,
|
||||||
canvas.drawRect(_tmpRect, _keyDownBgPaint);
|
(keyDown != null) ? _theme.keyDownBgPaint : _theme.keyBgPaint);
|
||||||
else
|
if (k.key0 != null)
|
||||||
canvas.drawRoundRect(_tmpRect, _config.keyRound, _config.keyRound, _keyBgPaint);
|
drawLabel(canvas, k.key0, keyW / 2f + x, (keyH + _theme.labelTextSize) / 2f + y, keyDown);
|
||||||
if (k.key0 != null)
|
float subPadding = _config.keyPadding;
|
||||||
drawLabel(canvas, k.key0, keyW / 2f + x, (keyH + _labelTextSize) / 2f + y, keyDown);
|
if (k.key1 != null)
|
||||||
float subPadding = _config.keyPadding;
|
drawSubLabel(canvas, k.key1, x + subPadding, y + subPadding, false, true, keyDown);
|
||||||
if (k.key1 != null)
|
if (k.key3 != null)
|
||||||
drawSubLabel(canvas, k.key1, x + subPadding, y + subPadding, false, true, keyDown);
|
drawSubLabel(canvas, k.key3, x + subPadding, y + keyH - subPadding, false, false, keyDown);
|
||||||
if (k.key3 != null)
|
if (k.key2 != null)
|
||||||
drawSubLabel(canvas, k.key3, x + subPadding, y + keyH - subPadding, false, false, keyDown);
|
drawSubLabel(canvas, k.key2, x + keyW - subPadding, y + subPadding, true, true, keyDown);
|
||||||
if (k.key2 != null)
|
if (k.key4 != null)
|
||||||
drawSubLabel(canvas, k.key2, x + keyW - subPadding, y + subPadding, true, true, keyDown);
|
drawSubLabel(canvas, k.key4, x + keyW - subPadding, y + keyH - subPadding, true, false, keyDown);
|
||||||
if (k.key4 != null)
|
x += _keyWidth * k.width;
|
||||||
drawSubLabel(canvas, k.key4, x + keyW - subPadding, y + keyH - subPadding, true, false, keyDown);
|
}
|
||||||
x += keyW;
|
y += row.height * _config.keyHeight;
|
||||||
}
|
}
|
||||||
y += keyH + _config.keyVerticalInterval;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDetachedFromWindow()
|
public void onDetachedFromWindow()
|
||||||
{
|
{
|
||||||
super.onDetachedFromWindow();
|
super.onDetachedFromWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int labelColor(KeyValue k, KeyDown hasKeyDown, int defaultColor)
|
private int labelColor(KeyValue k, KeyDown hasKeyDown, int defaultColor)
|
||||||
{
|
{
|
||||||
@@ -422,62 +396,61 @@ public class Keyboard2View extends View
|
|||||||
if (kd != null)
|
if (kd != null)
|
||||||
{
|
{
|
||||||
if ((kd.flags & KeyValue.FLAG_LOCKED) != 0)
|
if ((kd.flags & KeyValue.FLAG_LOCKED) != 0)
|
||||||
return _lockedColor;
|
return _theme.lockedColor;
|
||||||
if (kd.pointerId == -1)
|
if (kd.pointerId == -1)
|
||||||
return _activatedColor;
|
return _theme.activatedColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawLabel(Canvas canvas, KeyValue k, float x, float y, KeyDown keyDown)
|
private void drawLabel(Canvas canvas, KeyValue k, float x, float y, KeyDown keyDown)
|
||||||
{
|
{
|
||||||
k = KeyModifier.handleFlags(k, _flags);
|
k = KeyModifier.handleFlags(k, _flags);
|
||||||
Paint p = ((k.flags & KeyValue.FLAG_KEY_FONT) != 0) ? _specialKeyLabelPaint : _keyLabelPaint;
|
Paint p = _theme.labelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0));
|
||||||
p.setColor(labelColor(k, keyDown, _labelColor));
|
p.setColor(labelColor(k, keyDown, _theme.labelColor));
|
||||||
p.setTextSize(_labelTextSize * scaleTextSize(k));
|
p.setTextSize(_theme.labelTextSize * scaleTextSize(k));
|
||||||
canvas.drawText(k.symbol, x, y, p);
|
canvas.drawText(k.symbol, x, y, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawSubLabel(Canvas canvas, KeyValue k, float x, float y, boolean right, boolean up, KeyDown keyDown)
|
private void drawSubLabel(Canvas canvas, KeyValue k, float x, float y, boolean right, boolean up, KeyDown keyDown)
|
||||||
{
|
{
|
||||||
k = KeyModifier.handleFlags(k, _flags);
|
k = KeyModifier.handleFlags(k, _flags);
|
||||||
Paint p = ((k.flags & KeyValue.FLAG_KEY_FONT) != 0) ? _specialKeySubLabelPaint : _keySubLabelPaint;
|
Paint p = _theme.subLabelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0), right);
|
||||||
p.setColor(labelColor(k, keyDown, _subLabelColor));
|
p.setColor(labelColor(k, keyDown, _theme.subLabelColor));
|
||||||
p.setTextAlign(right ? Paint.Align.RIGHT : Paint.Align.LEFT);
|
p.setTextSize(_theme.sublabelTextSize * scaleTextSize(k));
|
||||||
p.setTextSize(_sublabelTextSize * scaleTextSize(k));
|
|
||||||
y -= up ? p.ascent() : p.descent();
|
y -= up ? p.ascent() : p.descent();
|
||||||
canvas.drawText(k.symbol, x, y, p);
|
canvas.drawText(k.symbol, x, y, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float scaleTextSize(KeyValue k)
|
private float scaleTextSize(KeyValue k)
|
||||||
{
|
{
|
||||||
return (k.symbol.length() < 2) ? 1.f : 0.8f;
|
return ((k.symbol.length() < 2) ? 1.f : 0.8f) * _config.characterSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class KeyDown
|
private static class KeyDown
|
||||||
{
|
{
|
||||||
/* -1 if pointer is up. */
|
/* -1 if pointer is up. */
|
||||||
public int pointerId;
|
public int pointerId;
|
||||||
public KeyValue value;
|
public KeyValue value;
|
||||||
public KeyboardData.Key key;
|
public KeyboardData.Key key;
|
||||||
public float downX;
|
public float downX;
|
||||||
public float downY;
|
public float downY;
|
||||||
/* Manhattan distance of the pointer to the center of the key */
|
/* Manhattan distance of the pointer to the center of the key */
|
||||||
public float ptrDist;
|
public float ptrDist;
|
||||||
public int flags;
|
public int flags;
|
||||||
public int timeoutWhat;
|
public int timeoutWhat;
|
||||||
|
|
||||||
public KeyDown(int pointerId, KeyboardData.Key key, float x, float y, int what)
|
public KeyDown(int pointerId, KeyboardData.Key key, float x, float y, int what)
|
||||||
{
|
{
|
||||||
this.pointerId = pointerId;
|
this.pointerId = pointerId;
|
||||||
value = key.key0;
|
value = key.key0;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
downX = x;
|
downX = x;
|
||||||
downY = y;
|
downY = y;
|
||||||
ptrDist = 0.f;
|
ptrDist = 0.f;
|
||||||
flags = (value == null) ? 0 : value.flags;
|
flags = (value == null) ? 0 : value.flags;
|
||||||
timeoutWhat = what;
|
timeoutWhat = what;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
class KeyboardData
|
class KeyboardData
|
||||||
{
|
{
|
||||||
public final List<Row> rows;
|
public final List<Row> rows;
|
||||||
/* Total width of the keyboard. Unit is abstract. */
|
/* Total width of the keyboard. Unit is abstract. */
|
||||||
public final float keysWidth;
|
public final float keysWidth;
|
||||||
/* Total height of the keyboard. Unit is abstract. */
|
/* Total height of the keyboard. Unit is abstract. */
|
||||||
@@ -26,54 +26,54 @@ class KeyboardData
|
|||||||
keysHeight = kh;
|
keysHeight = kh;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KeyboardData parse(XmlResourceParser parser)
|
public static KeyboardData parse(XmlResourceParser parser)
|
||||||
{
|
|
||||||
ArrayList<Row> rows = new ArrayList<Row>();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int status;
|
|
||||||
|
|
||||||
while (parser.next() != XmlResourceParser.START_TAG)
|
|
||||||
continue ;
|
|
||||||
if (!parser.getName().equals("keyboard"))
|
|
||||||
throw new Exception("Unknow tag: " + parser.getName());
|
|
||||||
while ((status = parser.next()) != XmlResourceParser.END_DOCUMENT)
|
|
||||||
{
|
|
||||||
if (status == XmlResourceParser.START_TAG)
|
|
||||||
{
|
|
||||||
String tag = parser.getName();
|
|
||||||
if (tag.equals("row"))
|
|
||||||
rows.add(Row.parse(parser));
|
|
||||||
else
|
|
||||||
throw new Exception("Unknow keyboard tag: " + tag);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return new KeyboardData(rows);
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyboardData removeKeys(MapKeys f)
|
|
||||||
{
|
{
|
||||||
ArrayList<Row> rows_ = new ArrayList<Row>();
|
ArrayList<Row> rows = new ArrayList<Row>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
|
||||||
|
while (parser.next() != XmlResourceParser.START_TAG)
|
||||||
|
continue ;
|
||||||
|
if (!parser.getName().equals("keyboard"))
|
||||||
|
throw new Exception("Unknow tag: " + parser.getName());
|
||||||
|
while ((status = parser.next()) != XmlResourceParser.END_DOCUMENT)
|
||||||
|
{
|
||||||
|
if (status == XmlResourceParser.START_TAG)
|
||||||
|
{
|
||||||
|
String tag = parser.getName();
|
||||||
|
if (tag.equals("row"))
|
||||||
|
rows.add(Row.parse(parser));
|
||||||
|
else
|
||||||
|
throw new Exception("Unknow keyboard tag: " + tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return new KeyboardData(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyboardData replaceKeys(MapKeys f)
|
||||||
|
{
|
||||||
|
ArrayList<Row> rows_ = new ArrayList<Row>();
|
||||||
for (Row r : rows)
|
for (Row r : rows)
|
||||||
rows_.add(r.removeKeys(f));
|
rows_.add(r.replaceKeys(f));
|
||||||
return new KeyboardData(rows_);
|
return new KeyboardData(rows_);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Row
|
public static class Row
|
||||||
{
|
{
|
||||||
public final List<Key> keys;
|
public final List<Key> keys;
|
||||||
/* Height of the row. Unit is abstract. */
|
/* Height of the row. Unit is abstract. */
|
||||||
public final float height;
|
public final float height;
|
||||||
/* Extra empty space on the top. */
|
/* Extra empty space on the top. */
|
||||||
public final float shift;
|
public final float shift;
|
||||||
/* Total width of very keys. Unit is abstract. */
|
/* Total width of very keys. Unit is abstract. */
|
||||||
private final float keysWidth;
|
private final float keysWidth;
|
||||||
|
|
||||||
public Row(List<Key> keys_, float h, float s)
|
public Row(List<Key> keys_, float h, float s)
|
||||||
{
|
{
|
||||||
@@ -85,34 +85,34 @@ class KeyboardData
|
|||||||
keysWidth = kw;
|
keysWidth = kw;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Row parse(XmlResourceParser parser) throws Exception
|
public static Row parse(XmlResourceParser parser) throws Exception
|
||||||
{
|
{
|
||||||
ArrayList<Key> keys = new ArrayList<Key>();
|
ArrayList<Key> keys = new ArrayList<Key>();
|
||||||
int status;
|
int status;
|
||||||
float h = parser.getAttributeFloatValue(null, "height", 1f);
|
float h = parser.getAttributeFloatValue(null, "height", 1f);
|
||||||
float shift = parser.getAttributeFloatValue(null, "shift", 0f);
|
float shift = parser.getAttributeFloatValue(null, "shift", 0f);
|
||||||
while ((status = parser.next()) != XmlResourceParser.END_TAG)
|
while ((status = parser.next()) != XmlResourceParser.END_TAG)
|
||||||
{
|
{
|
||||||
if (status == XmlResourceParser.START_TAG)
|
if (status == XmlResourceParser.START_TAG)
|
||||||
{
|
{
|
||||||
String tag = parser.getName();
|
String tag = parser.getName();
|
||||||
if (tag.equals("key"))
|
if (tag.equals("key"))
|
||||||
keys.add(Key.parse(parser));
|
keys.add(Key.parse(parser));
|
||||||
else
|
else
|
||||||
throw new Exception("Unknow row tag: " + tag);
|
throw new Exception("Unknow row tag: " + tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Row(keys, h, shift);
|
return new Row(keys, h, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Row removeKeys(MapKeys f)
|
public Row replaceKeys(MapKeys f)
|
||||||
{
|
{
|
||||||
ArrayList<Key> keys_ = new ArrayList<Key>();
|
ArrayList<Key> keys_ = new ArrayList<Key>();
|
||||||
for (Key k : keys)
|
for (Key k : keys)
|
||||||
keys_.add(k.removeKeys(f));
|
keys_.add(k.replaceKeys(f));
|
||||||
return new Row(keys_, height, shift);
|
return new Row(keys_, height, shift);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Key
|
public static class Key
|
||||||
{
|
{
|
||||||
@@ -157,7 +157,7 @@ class KeyboardData
|
|||||||
return new Key(k0, k1, k2, k3, k4, width, shift);
|
return new Key(k0, k1, k2, k3, k4, width, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Key removeKeys(MapKeys f)
|
public Key replaceKeys(MapKeys f)
|
||||||
{
|
{
|
||||||
return new Key(f.map(key0), f.map(key1), f.map(key2), f.map(key3), f.map(key4), width, shift);
|
return new Key(f.map(key0), f.map(key1), f.map(key2), f.map(key3), f.map(key4), width, shift);
|
||||||
}
|
}
|
||||||
@@ -168,27 +168,63 @@ class KeyboardData
|
|||||||
public abstract KeyValue map(KeyValue k);
|
public abstract KeyValue map(KeyValue k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RemoveKeysByFlags implements MapKeys
|
public static class ReplaceKeysByFlags implements MapKeys
|
||||||
{
|
{
|
||||||
private final int _flags;
|
private final int _flags;
|
||||||
|
private final KeyValue _replacement;
|
||||||
|
|
||||||
public RemoveKeysByFlags(int flags) { _flags = flags; }
|
public ReplaceKeysByFlags(int flags, KeyValue r)
|
||||||
|
{
|
||||||
|
_flags = flags;
|
||||||
|
_replacement = r;
|
||||||
|
}
|
||||||
|
|
||||||
public KeyValue map(KeyValue k)
|
public KeyValue map(KeyValue k)
|
||||||
{
|
{
|
||||||
return (k == null || (k.flags & _flags) != 0) ? null : k;
|
return (k != null && (k.flags & _flags) != 0) ? _replacement : k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RemoveKeysByEvent implements MapKeys
|
public static class ReplaceKeysByEvent implements MapKeys
|
||||||
{
|
{
|
||||||
private final int _eventCode;
|
private final int _eventCode;
|
||||||
|
private final KeyValue _replacement;
|
||||||
|
|
||||||
public RemoveKeysByEvent(int ev) { _eventCode = ev; }
|
public ReplaceKeysByEvent(int ev, KeyValue r)
|
||||||
|
{
|
||||||
|
_eventCode = ev;
|
||||||
|
_replacement = r;
|
||||||
|
}
|
||||||
|
|
||||||
public KeyValue map(KeyValue k)
|
public KeyValue map(KeyValue k)
|
||||||
{
|
{
|
||||||
return (k == null || k.eventCode == _eventCode) ? null : k;
|
return (k != null && k.eventCode == _eventCode) ? _replacement : k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Replace two keys at the same time. Used for swaping keys. */
|
||||||
|
public static class ReplaceKeysByEvent2 implements MapKeys
|
||||||
|
{
|
||||||
|
private final int _e1;
|
||||||
|
private final KeyValue _r1;
|
||||||
|
private final int _e2;
|
||||||
|
private final KeyValue _r2;
|
||||||
|
|
||||||
|
public ReplaceKeysByEvent2(int e1, KeyValue r1, int e2, KeyValue r2)
|
||||||
|
{
|
||||||
|
_e1 = e1;
|
||||||
|
_r1 = r1;
|
||||||
|
_e2 = e2;
|
||||||
|
_r2 = r2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public KeyValue map(KeyValue k)
|
||||||
|
{
|
||||||
|
if (k == null)
|
||||||
|
return null;
|
||||||
|
if (k.eventCode == _e1) return _r1;
|
||||||
|
if (k.eventCode == _e2) return _r2;
|
||||||
|
return k;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,10 +5,10 @@ import android.preference.PreferenceActivity;
|
|||||||
|
|
||||||
public class SettingsActivity extends PreferenceActivity
|
public class SettingsActivity extends PreferenceActivity
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
addPreferencesFromResource(R.xml.settings);
|
addPreferencesFromResource(R.xml.settings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
83
srcs/juloo.keyboard2/Theme.java
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package juloo.keyboard2;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.res.Resources;
|
||||||
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.Typeface;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
|
||||||
|
public class Theme
|
||||||
|
{
|
||||||
|
public final Paint keyBgPaint = new Paint();
|
||||||
|
public final Paint keyDownBgPaint = new Paint();
|
||||||
|
public final int lockedColor;
|
||||||
|
public final int activatedColor;
|
||||||
|
public final int labelColor;
|
||||||
|
public final int subLabelColor;
|
||||||
|
|
||||||
|
public final float labelTextSize;
|
||||||
|
public final float sublabelTextSize;
|
||||||
|
|
||||||
|
public final float keyBorderRadius;
|
||||||
|
|
||||||
|
private final Paint _keyLabelPaint;
|
||||||
|
private final Paint _specialKeyLabelPaint;
|
||||||
|
private final Paint _keySubLabelPaint;
|
||||||
|
private final Paint _specialKeySubLabelPaint;
|
||||||
|
|
||||||
|
public Theme(Context context, AttributeSet attrs)
|
||||||
|
{
|
||||||
|
TypedArray s = context.getTheme().obtainStyledAttributes(attrs, R.styleable.keyboard, 0, 0);
|
||||||
|
keyBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKey, 0));
|
||||||
|
keyDownBgPaint.setColor(s.getColor(R.styleable.keyboard_colorKeyActivated, 0));
|
||||||
|
// colorKeyboard = s.getColor(R.styleable.keyboard_colorKeyboard, 0);
|
||||||
|
labelColor = s.getColor(R.styleable.keyboard_colorLabel, 0);
|
||||||
|
activatedColor = s.getColor(R.styleable.keyboard_colorLabelActivated, 0);
|
||||||
|
lockedColor = s.getColor(R.styleable.keyboard_colorLabelLocked, 0);
|
||||||
|
subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0);
|
||||||
|
keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0);
|
||||||
|
s.recycle();
|
||||||
|
Resources res = context.getResources();
|
||||||
|
labelTextSize = res.getDimension(R.dimen.label_text_size);
|
||||||
|
sublabelTextSize = res.getDimension(R.dimen.sublabel_text_size);
|
||||||
|
_keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null);
|
||||||
|
_keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null);
|
||||||
|
Typeface specialKeyFont = getSpecialKeyFont(context);
|
||||||
|
_specialKeyLabelPaint = initLabelPaint(Paint.Align.CENTER, specialKeyFont);
|
||||||
|
_specialKeySubLabelPaint = initLabelPaint(Paint.Align.LEFT, specialKeyFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paint labelPaint(boolean special_font)
|
||||||
|
{
|
||||||
|
Paint p = special_font ? _specialKeyLabelPaint : _keyLabelPaint;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Paint subLabelPaint(boolean special_font, boolean align_right)
|
||||||
|
{
|
||||||
|
Paint p = special_font ? _specialKeySubLabelPaint : _keySubLabelPaint;
|
||||||
|
p.setTextAlign(align_right ? Paint.Align.RIGHT : Paint.Align.LEFT);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Paint initLabelPaint(Paint.Align align, Typeface font)
|
||||||
|
{
|
||||||
|
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
paint.setTextAlign(align);
|
||||||
|
if (font != null)
|
||||||
|
paint.setTypeface(font);
|
||||||
|
return (paint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Typeface _specialKeyFont = null;
|
||||||
|
|
||||||
|
static public Typeface getSpecialKeyFont(Context context)
|
||||||
|
{
|
||||||
|
if (_specialKeyFont == null)
|
||||||
|
{
|
||||||
|
_specialKeyFont = Typeface.createFromAsset(context.getAssets(), "fonts/keys.ttf");
|
||||||
|
}
|
||||||
|
return _specialKeyFont;
|
||||||
|
}
|
||||||
|
}
|