Compare commits

..

179 Commits

Author SHA1 Message Date
Jules Aguillon
65cc0c736e Release 1.14.2 (21) 2022-04-16 23:43:25 +02:00
Jules Aguillon
2cce0fed67 Makefile: Pass -r to adb install
Fails to update on some versions of Android without it.
2022-04-16 23:38:16 +02:00
Jules Aguillon
9a8c4f291d Fix compatibility with Android 6
Android 6 uses Java 1.7, the only incompatible feature in use was
lambdas.
2022-04-16 23:36:54 +02:00
marciozomb13
14cc318a0e Update PT strings (#121)
Tiny fixes and improvements.
2022-04-16 23:17:17 +02:00
Jules Aguillon
8d8a58462c Release 1.14.1 (20) 2022-04-06 09:50:33 +02:00
Jules Aguillon
5562ee1391 Fix mismatch layout name
The Korean layout id was not consistent and this caused a crash.
2022-04-06 09:50:33 +02:00
Jules Aguillon
120c0a9d23 Fix compat with older version of Android
Resources.getFloat is new from API 29.
2022-04-06 09:50:33 +02:00
Jules Aguillon
aaff8689e3 Release 1.14.0 (19) 2022-04-03 20:59:42 +02:00
Jules Aguillon
2b348b7a31 Revert "Swap Ctrl and switch_numeric keys"
This reverts commit b85b67c2f0.

The Ctrl key was too hard to use in the new position, especially in
combination with arrows or backspace.

Leave the switching key in the numeric layout however, where the Ctrl
key is not very useful. Put Ctrl on the top-right because bottom-right
is where the switching key is in the other layouts.
2022-04-03 20:27:25 +02:00
Jules Aguillon
19289bec27 Update screenshots
Many things changed since: new keys, better font, sizes and colors
changed, keys moved.
2022-04-03 18:09:23 +02:00
Jules Aguillon
aa78229b2a Add the Programming Layout option
Allow specifying a layout for programming and add a key for switching to
it easily.

The switching key is placed on the top edge of the space bar.

The option has no effect by default because the ergonomic isn't ideal,
it needs to be enabled explicitly.
Users of Latin-script languages certainly prefer to use one layout (for
programming or not). This feature might be removed in favor of a better
language-switching mechanisms in the future.
2022-04-03 17:15:12 +02:00
Jules Aguillon
d62e7647e0 Move keys away from the edges of the screen
These keys are harder to hit as the finger might exit the screen before
traveling enough to hit a corner. It might be particularly harder for
people that use a phone case.

Every layouts are changed, the notable changes are:

- The Escape key is in the bottom-right corner of the first key.
  This position looks weird at first but is a lot easier to type.

- The 0 key is on the top-left of the last key on the first row.
  It is not like the other digits.

- The Tab key is on the top-right. This might be hard to re-learn.

- Some layouts had more changes to accomodate these new positions.

Co-authored-by: Raphael <rapha.a.r@gmail.com>
2022-04-03 13:30:24 +02:00
Jules Aguillon
9411f59ed5 Rename the Meta key
The symbol isn't clear enough.
2022-04-03 12:49:14 +02:00
Jules Aguillon
b85b67c2f0 Swap Ctrl and switch_numeric keys
The switch_numeric key is generally more important, especially in the
numeric pane.
2022-04-03 12:48:29 +02:00
Jules Aguillon
695f5b4371 Swap Fn and Alt
Fn is increasingly more important while Alt is generally not.
2022-04-03 12:42:50 +02:00
Raphael
b995da9985 Update Space Glyph
Revert to previous version, the original google material icon,
which is not rounded, and it looks better with the rest of the keyboard,
also more correct to represent the open box unicode space char,
instead of a smile
2022-04-02 17:36:10 +02:00
Jules Aguillon
5f47beb5b0 Add currency symbols under the Fn key
Fn+e = €
Fn+l = £
Fn+r = ₹
Fn+y = ¥
Fn+c = ¢
Fn+p = ₱
2022-04-02 16:56:40 +02:00
Raphael
2dda39f453 Arrows and Box system (#114)
* Add `Arrows` and `Box` accent system
2022-04-02 16:42:40 +02:00
nickid
fbf8901bdb Add Korean layout (#115)
* Add Korean layout
2022-04-02 16:33:32 +02:00
Raphael
723c7e9aec Upgrade CI workflow (#111)
* Cache dependencies on CI workflow

* Use available fontforge version for CI action
Avoid a dirty OS upgrade to get a newer version of FontForge,
use what is available at Ubuntu 20.04

* Upgrade CI Workflow
By using an appimage of FontForge, it's easier to install the latest version, to cache it, and there is no extra dependencies clashes with  Ubuntu 20.04

* Make paths for fontforge absolute in makefile
It's necessary because fontforge is an AppImage and requires it

* Improve cache step on CI

wget don't download a duplicate if file already exists

* Generate base64 ascii encoded debug keystore

That can be used to transfer the keystore to a Github Secret

* Restore debug.keystore from github secrets

Get the asc encoded keystore from github secrets, 
and decode it back to a bynary file inside the CI run.

* Cleanup redundant lines and add explanation comment

* runs-on  ubuntu-latest

Co-authored-by: Jules Aguillon <jules@j3s.fr>

* add *.keystore.asc to .gitignore

* Clean up lines, adjust documentation

* use CURDIR automatic makefile variable

Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-04-02 16:33:12 +02:00
Jules Aguillon
2b6c2b98e0 Compute the swipe distance from the physical dpi
The previous computation was very different depending on the device's
screen and accessibility options.
Given that the keyboard is supposed to fill all the space in one
dimension, the dpi unit makes little sense.

The formula doesn't mean anything in particular, it takes into account
both dimensions (x and y) and should be close to the dpi in the
diagonals (which is the direction of swipe).

This changes the actual value, on a 1920x1080 480dpi screen, the value
is increased by 20%.
2022-04-02 16:16:24 +02:00
ArenaL5
281f779121 µ, æ and œ also generated by Fn 2022-03-31 19:05:40 +02:00
ArenaL5
6b3123090c Add arrows
Add simple arrows to the numeric keypad. Using the Fn key with these arrows will
output double arrows.
2022-03-31 19:05:40 +02:00
ArenaL5
363a65223c Add non-breaking space as Fn+Space 2022-03-31 19:05:40 +02:00
ArenaL5
4355225646 Add extra symbols to Fn
Also removed almost all combinations of diacritics and symbols to create extra
symbols.
2022-03-31 19:05:40 +02:00
ArenaL5
21c76b5b41 Add interpunct and move Tab in Spanish keyboard
Added the middle dot (·) to the Spanish keyboard, in order to be able to type
Catalan words and names. Catalan is spoken in Eastern Spain, and the middle top
is therefore included in standard PC Spanish keyboards.

Also changed the Tab key to an upwards-leftwards swipe, as to follow more closely
the programmer's layout qwerty.xml
2022-03-31 19:05:40 +02:00
Jules Aguillon
ed2dea9630 CI: Install fontforge with Nix
And cache the nix store.
2022-03-27 16:26:58 +02:00
Jules Aguillon
67487d0ef0 Fix CI since recent font changes
Requires the latest version of fontforge.
Re-order the steps to improve caching.
2022-03-25 00:51:11 +01:00
Michael Levi
611f2c8111 More reliable CI without Nix 2022-03-25 00:16:40 +01:00
Jules Aguillon
6db57500ee Add glyphs for Tab, Backspace and Delete
Tab is from IcoMoon. Backspace and Delete are from materialdesignicons.
2022-03-25 00:12:41 +01:00
Jules Aguillon
1b6deb7fed Improve glyphs for accents
The accents are taken from the Roboto Regular font (Apache 2.0), added
the dotted circle and exported with FontForge.

The argument to FontForge's Import function are changed, the fifth
argument controls the accuracy and needed to be lowered otherwise the
grave accent wouldn't be rendered at all.
2022-03-24 23:55:20 +01:00
Raphael
94751bae3e Update Home and End glyphs
Revert them to previous version, but now using SVG icons
instead of a ttf font file
2022-03-24 18:54:41 +01:00
Jules Aguillon
0fb7150a06 Revert to the previous CI
The new CI script doesn't work on forks.

This reverts commit f3aa218de4.
This reverts commit 3373c59b90.
2022-03-24 18:43:09 +01:00
Jules Aguillon
f3aa218de4 Improve CI script
Upgrade nixbuild-action to put back spaces in the workflow name.
Improve the script for retrieving the result, thanks to @rickynils.
2022-03-23 16:27:07 +01:00
nickid
c093b45c96 Korean translations 2022-03-23 15:47:14 +01:00
Jules Aguillon
3373c59b90 CI: Use nixbuild.net
The build takes place on the remote, which takes advantage of Nix's
caching.
The previous workflow used a remote cache but in order to build locally,
all the dependencies needed to be downloaded from the cache everytime.
The dependencies are 462M, downloading took most of the time.
2022-03-23 13:02:38 +01:00
six-6
0d1ddcce3f Translate into Chinese-Simplified 2022-03-21 00:44:57 +01:00
ArenaL5
f736a169a4 Update Spanish translation
and fix a couple typos
2022-03-21 00:39:40 +01:00
ArenaL5
743f6cbc91 Add dead macron to Spanish layout
This is only to make this layout more similar to the default English layout.
Macrons are not actually used in any language spoken in Spain, but they
appear to be used in some varieties of Nahuatl?

Also added C-cedilla to the N-tilde key. Even if both C-cedilla and N-tilde
are redundant in this keyboard, both letters are a staple of Spain keyboards,
and Spaniards are used to have a dedicated key for C-cedilla in PC keyboards.
2022-03-21 00:39:40 +01:00
ArenaL5
47f9043096 Correct displayed value when cancelling settings modification
When changing any numeric setting and cancelling this change, the change would not
be persisted, but the summary in the setting screen would show the last position
of the slider instead of the correct unchanged value.

This commit fixes this on the most simple way by resetting the slider position to
the persisted value.
2022-03-21 00:39:40 +01:00
ArenaL5
a516246e52 Increase vibration maximum from 50 ms to 100 ms 2022-03-21 00:39:40 +01:00
Jules Aguillon
ba6d62dee2 Add F11 and F12
These keys are shown only when Fn is activated, "placeholder" keys are
placed in the layouts.
2022-03-19 16:27:57 +01:00
Jules Aguillon
e872c58788 Allow modifiers to hide keys
Modifiers can temporarily remove a key from the layout by returning
'null'.
Make sure pointer handling code handle these modified keys gracefully
and doesn't trigger a key event and a vibration for the removed key.
2022-03-19 15:39:20 +01:00
Jules Aguillon
57c6208b50 Add glyphs for accent keys
The "dotted circle" character combined with the accent was badly
rendered on many devices.
2022-03-18 17:31:23 +01:00
Jules Aguillon
d733f8c78c Build all special glyphs from SVG
Recover the provenance of each glyphs and remove the base_font.ttf file.
2022-03-18 12:55:08 +01:00
Jules Aguillon
e63ff8f837 Stateless build of the special font file
Keep the glyphs in SVG format and build the font using a FontForge
script.
A part of the previous font is kept because the sources is lost.

This adds a new dependency to the build system, fontforge.
2022-03-17 20:23:28 +01:00
Jules Aguillon
fe35d5fd5a Avoid ghost touches while holding modulated keys
On some devices, bogus touch events can be sent while holding a key.
With modulated keys, it can happens on top of other keys.
Ignore every new pointers when a modulated key is pressed.
2022-03-17 11:24:33 +01:00
Jules Aguillon
2eb615dbf6 Show the switching key if there's several languages
Ensure the switching key is shown when there's several subtypes enabled,
even if Android says not to show it.
2022-03-16 13:09:10 +01:00
igorSilCar
2dae2105b2 Brazilian portuguese layout (#91)
* Providing a comprehensible Brazilian Portuguese keyboard layout

removed cedille as it is already provided by an independent key;
changed layout to correspond to the locale
2022-03-15 21:05:16 +01:00
Jules Aguillon
d53ee811d9 Handle CANCEL touch events
Handling this event is part of the API but was never done. This caused
unstoppable key-repeat.

This event isn't common, the only way I found on Android 10 is to switch
to the emoji keyboard while holding a key. Some apps might cause this
event more often.
2022-03-15 20:44:02 +01:00
Jacob Strömgren
fadedfd58f Add Swedish layout 2022-03-15 18:42:29 +01:00
Jules Aguillon
f9cd4ca2d8 Log editor infos while debugging
Useful when debugging why the keyboard doesn't work as expected with a
specific app.
2022-03-15 18:42:29 +01:00
Jules Aguillon
9bb7c7e66f Identify debug version in app name
Using the --product option of aapt.

Remove the app name from translations because it is never translated. It
is still possible to translate it by specifying 'product="default"'.
2022-03-14 18:37:37 +01:00
Jules Aguillon
f4978f5266 Fix crash since 2ea256e 2022-03-13 00:45:16 +01:00
Jules Aguillon
a0d90496c1 Improve symbols for Sup, Sub and Ord 2022-03-13 00:43:11 +01:00
Jules Aguillon
7aa241b10a Make superscript and subscript modifiers lockable 2022-03-13 00:40:39 +01:00
Jules Aguillon
a57bdf8cfb Avoid showing some symbols twice in Fn mode 2022-03-13 00:35:15 +01:00
Jules Aguillon
ee6e892ef4 Define localized keys as a set instead of flags
Using flags for removing keys like € and ß need too many flags and won't
scale to more localized keys.
2022-03-13 00:14:18 +01:00
Jules Aguillon
2ea256e769 Fix inconsistent highlighting of lockable keys
Pointers.getKeyFlags might receive a different KeyValue than what's
stored in the pointer due to caching. Compare names instead.
2022-03-12 21:38:47 +01:00
igorSilCar
5665d6a7c5 Brazilian portuguese translations (#100)
* Translations for new setting, lockable modifier keys

Co-authored-by: Igor da Silva de Carvalho <igu@coiso.meanhouse>
2022-03-09 10:49:13 +01:00
Jules Aguillon
534e4cb843 Make the font smaller for the action key 2022-03-06 19:36:09 +01:00
Jules Aguillon
e303008e66 Fix action key not updating when switching field
The keyboard was updated before the action key is.
2022-03-05 20:21:37 +01:00
Raphael
5404e7432d Clicking twice on CTRL or ALT will lock them in 'ON' state (#72)
* Clicking twice on CTRL or ALT will lock them in 'ON' state

* Make Locking behaviour optional, configurable in preferences

* Nest the new settings into a different page

To avoid spamming the settings page and repetition in the summaries.
Cannot be a popup unfortunately because that would require API >= 11.

* Add Fn and Meta

Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-03-05 20:17:45 +01:00
Jules Aguillon
e92504ae92 Improve the code for dynamic updates of the layout 2022-03-05 19:22:01 +01:00
igorSilCar
4964bfb87f Brazilian portuguese translations (#87)
* Added brazilian portuguese translations for app description and settings

* making the swiping option more intelligible

* fix typo on full_description pt-BR translation

Co-authored-by: Igor da Silva de Carvalho <igu@coiso.meanhouse>
2022-03-05 17:33:04 +01:00
Jules Aguillon
39da035135 Release 1.13.1 (18) 2022-02-27 18:41:03 +01:00
Jules Aguillon
4ee29f355e Use the Material theme for the settings activity
This is a dark theme. It's probably better than the default theme for
most users.
2022-02-27 18:31:17 +01:00
Jules Aguillon
87144fd3a8 Reduce the text size for some keys
The symbols are now smaller for Shift, Space, Backspace, Delete and
some keys on the bottom row.

The previous rule was to make the text smaller for symbols made of
several characters.
This is changed to a flag approach.
2022-02-27 15:23:36 +01:00
Jules Aguillon
f6d4554669 Increase contrasts
For the Dark and Light theme. At the same time, use only "web safe
colors" to have nice round numbers and ensure enough contrasts between
colors.

The background color is kept at the previous value, there's not enough
contrast between the background and the keys but that's better than a
solid black background.
2022-02-27 15:08:38 +01:00
Jules Aguillon
1451857c92 Compute text size depending on actual row height
Use the height of the row currently being rendered instead of the base
row size.
Concretely, the bottom row is slightly smaller and will get slightly
smaller text.

Also:
- Rewrite the label rendering code
- Render labels at the middle of the key (was slightly off)
2022-02-27 02:26:45 +01:00
Jules Aguillon
23685ddb3c Compute text size relative to key height
Instead of a fixed size that don't work at all for bigger screens.

Other tweaks:
- Use the value-land dimens to vary 'extra_horizontal_margin'
- Move label size to Config, because it can change at runtime (rotation)
- Slightly decrease the size of "long" symbols
2022-02-27 01:50:24 +01:00
Jules Aguillon
ce5cee42a1 Add attributions for font glyphs 2022-02-26 20:49:09 +01:00
Raphael
067ab90847 Update symbols from unicode to font-Icon 2022-02-26 20:49:09 +01:00
Jules Aguillon
937d5d728e Fix typo in subtype description for Bulgarian
This causes a crash.
2022-02-26 20:27:08 +01:00
Edgars
d6757019dc Add a missing full stop to Latvian QWERTY layout
`res/xml/qwerty_lv.xml` was updated to add the missing full stop
character (`.`) as it got lost when the bottom row was moved to a
separate XML `res/xml/bottom_row.xml` as it was placed on the
arrows key.

Additionally `?` was relocated, giving its place to the full stop.
2022-02-26 13:12:10 +01:00
Jules Aguillon
5581cf33f9 Merge pull request #81 from polyctena/german
German translation
2022-02-26 13:06:00 +01:00
Benjamin
35058628c1 German translation 2022-02-25 17:29:52 +01:00
Benjamin
d581c8b1e4 German translation strings.xml and full_description.txt 2022-02-25 17:14:58 +01:00
Jules Aguillon
44b1086be9 Release 1.13.0 (17) 2022-02-22 20:06:31 +01:00
Jules Aguillon
d277ed1a8a Remove translated changelogs
A single changelog is easier to write. The existence of translated older
changelogs is probably not a good idea either.
2022-02-22 19:52:09 +01:00
Jules Aguillon
7aa280b888 Tweak repeat timing for modulated keys
Make modulated keys repeat twice as slow by default and start repeating
twice as early.
2022-02-22 19:46:41 +01:00
Jules Aguillon
14dabb6f51 Send key events for the modifiers
Before sending a key event while modifiers are active, send events for
the modifier keys.

Some applications don't look at the "metaState" flags but instead keep
track of the up and down events for the modifiers.

For example, the basic text views that are in every applications
correctly handle the "metaState" flags except for one binding:
Selecting text with the arrows while pressing shift.
2022-02-22 19:32:16 +01:00
Jules Aguillon
84bce23fec Merge pull request #75 from gh0ste/master
spanish translation and layout
2022-02-22 19:10:10 +01:00
Jules Aguillon
583aa55259 Update the spanish locale
To use the new layout.
2022-02-22 19:08:44 +01:00
Invert White
4873b8e22a spanish translation and layout 2022-02-22 00:20:11 -03:00
Jules Aguillon
c85e9a91d1 Improve modulated key repeat
Change the formula: don't use an external constant, add a state.
It's now the ratio between where the finger is at the first repeat and
where it is now.

Keep the repeat going when swiping into an other key. Currently only for
arrows: It's now possible to go from an arrow to an other without
waiting again for the key repeat timeout.

The backspace and delete keys don't work well with this.
2022-02-21 00:24:57 +01:00
Jules Aguillon
51ff795be4 Move pointer handling code to its own class
Separate the concerns and have a clearer interface between the two parts
of the code.
2022-02-20 13:09:39 +01:00
Jules Aguillon
632a9ac590 Localize € and £
Show these characters only for users that have the corresponding locale
installed (a supported eu language for €, en-GB for £).
Add these characters to most layouts.
2022-02-19 21:48:48 +01:00
Raphael
d73be58c1a add colon key to numeric keyboard 2022-02-19 21:02:39 +01:00
Jules Aguillon
04c84a8f66 Add Ord+* = ° 2022-02-19 21:01:52 +01:00
Raphael
d2570bc2ea add-ordinal-numbers-symbol-system 2022-02-19 20:59:49 +01:00
Raphael
4b1a6e4b92 Create github action to compile debug_APK (#60)
* Create github action to make debug apk

* Cache debug signing certificate

* Setup cachix

* Run on pull request

Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-02-14 00:42:41 +01:00
Jules Aguillon
c05fdea765 Define the height of the keyboard relative to the screen size
Depending on the pixel density isn't ideal for a keyboard, which would
render differently depending on the "scaling" accessibility option.

Landscape mode needs a special values. At the same time, increase the
horizontal margin when landscape.
2022-02-13 15:58:30 +01:00
Vladimir Chernov
4e98ab7515 Add Russian layout (#66)
* Add Russian layout

Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-02-13 13:56:46 +01:00
Jules Aguillon
fda6895dc8 Use the improved font for shift, globe, enter and space
These glyph were available in the custom font but not used yet.
2022-02-13 13:46:37 +01:00
Jules Aguillon
b488c766b1 Add ю to the bulgarian layout
Thanks Zdravko for pointing out.
2022-02-13 13:23:49 +01:00
Jules Aguillon
94fed03a67 Scale the bottom row depending on the host layout
1ff8526 added a bug for layouts that weren't 10 units wide.
2022-02-13 13:20:22 +01:00
Jules Aguillon
adb77466f5 Fix forced inverted colors on Xiaomi phones
MIUI inverts the colors of the app it thinks doesn't implement dark
themes correctly. Also, it inverts the colors in the dumbest possible
way: it doesn't invert all the colors the same way.

It thinks that presumably because I don't use the Material base themes.
2022-02-13 11:45:13 +01:00
Roy-Orbison
6ab6a6811b Invert return key in TTF (#67)
Was a "level-up" symbol, now looks like a return key in identical style.
2022-02-13 11:25:59 +01:00
Jules Aguillon
b1ef21f62f Improve QWERTZ
- Add the umlauts back.
- Remove the accents. QWERTZ changes from "programming layout" to
  "localized layout".
- Move the '?' away from the edge of the screen.
2022-02-07 01:22:42 +01:00
Jules Aguillon
75c736709d build: Use d8 instead of dx
dx have been removed in android build tools >30.0.3 in favor of d8.
Lift the version constraint on the build tools.
2022-02-07 01:11:55 +01:00
Jules Aguillon
1ff8526d24 Define the bottom row separately
Avoid divergences when the bottom row is modified.
2022-02-07 00:55:32 +01:00
AlexandraAlter
a76541458d Dvorak layout (#16) 2022-02-07 00:06:49 +01:00
Max Schillinger
d014a7dd8c Replace unusual return symbol 2022-02-06 23:58:17 +01:00
Max Schillinger
93edc4ac42 Allow egde keys instead of corner keys (swipe vertically/horizontally)
Add a new boolean parameter "edgekeys" for defining keys that have the
additional (swipe) keys on the edges (top, right, left, bottom) instead
of at the corners (top left, top right, bottom left, bottom right).
2022-02-06 23:49:43 +01:00
Jules Aguillon
7383cc4b68 Add the Meta key to every layouts
To follow soon: Define the bottom row separately from layouts.
2022-02-06 23:12:24 +01:00
Jules Aguillon
95c8acc31e Add the Meta key
Currently using the diamond symbol like the history meta key: https://en.wikipedia.org/wiki/Meta_key
However, this key is actually interpreted as the Super/Windows key but
Android calls it "meta" internally.
2022-02-06 23:01:35 +01:00
Jules Aguillon
e86173b895 Use apksigner from the build tools for release builds too 2022-02-05 20:22:40 +01:00
Max Schillinger
be0f4a1fc9 Makefile: Pass full path when calling apksigner 2022-02-05 20:15:29 +01:00
Raphael
b913d6842f Add supoort to show accents for Portuguese language 2022-02-05 20:07:32 +01:00
Jules Aguillon
93b4cc2e7b Release 1.12.0 (16) 2022-01-31 00:24:44 +01:00
Jules Aguillon
7a451d5a36 Turn the key spacing options to ints
Float values were not rendered properly and the granularity isn't
needed.
2022-01-31 00:04:02 +01:00
Jules Aguillon
2d2f0dd51d Add options for the spacing between the keys
Two options: vertical and horizontal.
2022-01-30 23:55:15 +01:00
Jules Aguillon
8631dfb723 Select theme depending on system settings
Automatically choose between the Dark and Light themes.
2022-01-30 23:29:50 +01:00
Jules Aguillon
c9f7f2cfc8 Avoid color inversion in dark theme 2022-01-30 20:39:09 +01:00
Jules Aguillon
f2893437d2 Contributing guidelines for layouts and translations 2022-01-30 13:10:37 +01:00
Jules Aguillon
2f47d2400b Improve Action key detection
There were two problems:
- The Action key was swapped when it shouldn't be. The flag
  'IME_FLAG_NO_ENTER_ACTION' wasn't interpreted correctly for inputs
  that specified both an action and this flag.
- The value 'IME_ACTION_UNSPECIFIED' should remove the Action key.
2022-01-30 12:17:31 +01:00
Jules Aguillon
348c278eae Missing Action key in the QWERTZ layout
This caused an even bigger problem: The Enter key would disappear
instead of being swapped with the Action key.
2022-01-30 12:02:49 +01:00
Jules Aguillon
7af579a1bc Fn+Tab to send the tab character 2022-01-29 20:03:17 +01:00
Jules Aguillon
4333575bb9 Add support for the Bulgarian language and layout
Thanks Zdravko Iskrenov for the contribution.
2022-01-29 19:27:33 +01:00
Jules Aguillon
e0217c650d Fix modifier not working on non-ASCII
Characters defined in layouts that aren't defined in KeyValue weren't
recognized as character keys. Not working with modifiers.
2022-01-29 18:56:10 +01:00
Edgars
1723288f5d Add Latvian translation 2022-01-29 18:00:52 +01:00
Edgars
88e21758bc Add Latvian specific QWERTY layout
A customised Latvian specific QWERTY layout (QWERTY (Latvian)) was added
to access all Latvian diacritic characters with a swipe.

Additionally caron, cedille and macron accents were enabled for this
layout.
2022-01-29 17:56:25 +01:00
Jules Aguillon
e031de6b57 Globe key: Open keyboard switching dialog
instead of immediately switching to the next input method.
2022-01-23 19:40:45 +01:00
Jules Aguillon
baf867a9f9 Translate to French 2022-01-23 19:20:28 +01:00
Jules Aguillon
04f15fbfee Improve some strings 2022-01-23 19:20:11 +01:00
Jules Aguillon
cb95e99f50 Make action key labels translatable 2022-01-23 19:20:02 +01:00
Jules Aguillon
28f98cc129 Update feature graphic according to Google's guidelines 2022-01-22 21:23:33 +01:00
Edgars
3ab2228065 Use symbols for configuration and emoji keys
`srcs/juloo.keyboard2/KeyValue.java` was updated to replace `Conf` with
`⛭` (`\u2699`) and `:)` with `☻` (`\u263B`).
2022-01-22 21:13:46 +01:00
Poussinou
eda171d57a Update README.md 2022-01-22 20:54:27 +01:00
Edgars
0bf7ff5f34 Add keys for Latvian
New accents - caron and macron - were defined and QWERTY layout was
updated to add accents for Latvian specific characters.
2022-01-20 22:01:34 +01:00
Jules Aguillon
aa12466767 Release 1.11.1 (15) 2022-01-20 21:34:35 +01:00
Jules Aguillon
100e0b270d Fix crash when switching app 2022-01-20 21:22:09 +01:00
Jules Aguillon
38adf7d7b9 Makefile: Sign the debug apk with scheme v2 2022-01-20 21:21:27 +01:00
Jules Aguillon
9485770372 Update doc for Android 11 2022-01-20 21:21:07 +01:00
Raphael
c489b5aba7 Fix broken link (because of case sensitivity) 2022-01-17 18:59:02 +01:00
Jules Aguillon
96c4b165ac Release 1.11.0 (14) 2022-01-16 23:50:11 +01:00
Jules Aguillon
40897f2c26 Update and improve the description
Explain better what the app is and mention some of the features.

Unfortunately, the German translation needs to be dropped because I
can't maintain it.
2022-01-16 23:44:04 +01:00
Moini
133b6ec2c1 German keyboard added (#20)
* Add German metadata translation

* Add German keyboard

Co-authored-by: Jules Aguillon <jules@j3s.fr>
2022-01-15 20:56:08 +01:00
Jules Aguillon
833dfa31bb Fix miscalculation of the space between the keys
'keyVerticalInterval' was mistakenly used to compute the height of the
keyboard and the vertical position of keys.
While the code handling pointers did not use this value, the hit box of
the bottom row was shifted by several pixels.

Make sure 'keyVerticalInterval' is only used for rendering and not for
placing the keys.
2022-01-15 20:24:27 +01:00
Jules Aguillon
fa9250a89e Contributing: Mention enabling the virtual keyboard 2022-01-15 19:51:40 +01:00
Jules Aguillon
854eb431f3 CONTRIBUTING: Document debug installation failure 2022-01-15 19:03:53 +01:00
Jules Aguillon
d4eef00a8a Add a CONTRIBUTING guide 2022-01-15 18:55:05 +01:00
Jules Aguillon
f22d040eda Update screenshots 2022-01-10 01:02:14 +01:00
Jules Aguillon
dfec26a93b Swap the Enter and Action keys when needed
When IME_FLAG_NO_ENTER_ACTION is set.
2022-01-10 00:27:22 +01:00
Jules Aguillon
53113cadd9 Add the Action key
It is placed on the top-right of the enter key on every layouts.
It sends a special event (performEditorAction) instead of writing a
newline.

The "actionId" is passed through the EditorInfo object in an obfuscated
way so it's not clear whether it's using the right one.
2022-01-09 20:26:06 +01:00
Moini
4b43645c4b Fix a few strings 2022-01-09 12:53:14 +01:00
Jules Aguillon
93e84ba7e9 Add the German language
Add the 'ß' character on the bottom-left corner of the 's' key, which is
hidden for other languages.

Co-authored-by: Moini <moini@noreply.invalid>
2022-01-09 12:49:28 +01:00
Jules Aguillon
23e59c6b09 Allow to hide more keys than just accents
Add the "FLAGS_LANGS" set of flags, which will be used to hide
individual keys that are not accents.
2022-01-09 12:47:47 +01:00
Jules Aguillon
2764e96eb1 Change the key combination for °
To Fn+*

Was previously accent^+*, which was not available for most languages.
2022-01-01 19:00:27 +01:00
Jules Aguillon
9c82c9cfdc Improve the "precision" option
Now named "swiping distance". Changed to a dropdown.
2021-12-30 22:22:25 +01:00
Jules Aguillon
8bef0728ae Turn the "precision" option to dp instead of px 2021-12-30 21:59:48 +01:00
Jules Aguillon
b05f6e8447 Simplify string definitions
Inline constants in settings.xml, strings.xml is only for strings that
can be translated.
2021-12-30 21:37:34 +01:00
Jules Aguillon
f69a0605a8 Add the Black theme
Friendly to Amoled screens.
The background of keys is the same as the background of the whole
keyboard: pure black.
Colors are also slightly stronger.
2021-12-30 00:53:48 +01:00
Jules Aguillon
29367f127d Move the border radius from Config to Theme
Also, draw activated keys with a round border too.
2021-12-30 00:52:50 +01:00
Jules Aguillon
093a00c572 Add themes
Add a "Theme" option to choose between a dark and light theme.
The light theme uses the colors of the dark theme with the luminance
inversed.

The reloading after a configuration change is changed slightly:
- Special handling is needed when the Theme is changed (recreate the views)
- The default implementation of 'onConfigurationChanged' is used
  Which triggers more refresh (but don't recreate the views)
- 'onCreateInputView' is no longer needed
2021-12-30 00:26:05 +01:00
Jules Aguillon
40b1ec63a9 Use the themes abstraction
Themes replace 'colors.xml' and soon will replace 'dimens.xml'.
2021-12-28 19:12:50 +01:00
Jules Aguillon
93704cca0a Reference the "special key font" in the Theme object
Remove the last cast of the context.
2021-12-28 17:53:58 +01:00
Jules Aguillon
15ce200ce3 Separate "handler" code
As with the previous commit, remove casts of the context.
The "handler" object is referenced in the "config" object for now.
2021-12-28 17:47:18 +01:00
Jules Aguillon
0190cfc29a Turn Config into a singleton object
The goal is to remove a cast of the 'context' into 'Keyboard2'.
2021-12-28 16:47:19 +01:00
Jules Aguillon
dd24ad323b Move Theme code to its own class 2021-12-26 23:55:18 +01:00
Jules Aguillon
86655d4959 Always send the keycode for the tab key
Don't write the tab character and always send the keycode, which is most
probably handled by applications.
2021-12-22 20:40:39 +01:00
Jules Aguillon
3e332dbf54 Use the right keycode for the home key
The previous keycode wasn't the classical "home" movement key but
Android's actual home key, which has no effect when generated from the
keyboard.
2021-12-22 20:19:59 +01:00
Jules Aguillon
d721cc86d1 Avoid crash when removing a layout
Might happen when downgrading the app.
2021-12-19 20:04:17 +01:00
Jules Aguillon
1cfecbdf48 Auto-format Java and XML files
Use xmllint.
Re-indent Java files using spaces.
2021-12-19 19:44:27 +01:00
Jules Aguillon
988d8db7e8 Use apksigner for signing the apk
The Play Store now requires the "Signing Scheme V2", which is
implemented by apksigner.
2021-12-14 00:13:34 +01:00
Jules Aguillon
e5fa23e1f7 Upgrade to Android SDK version 30 2021-12-12 23:48:05 +01:00
Jules Aguillon
d787d982cf Release 1.10.0 (13) 2021-12-12 23:36:19 +01:00
Jules Aguillon
573c13fb82 Add Swedish
First add the 'ring' accent.
The swedish language uses the qwerty layout and three accents (aigu,
trema, ring)
2021-12-11 17:05:49 +01:00
Jules Aguillon
58e37b484c Fix Android's builtin shortcut not working
The 'repeat' field of generated key events was incorrectly set to '1'.
2021-12-11 01:03:36 +01:00
Jules Aguillon
cca832954e Increase the maximum value of the key height option 2021-12-05 21:00:38 +01:00
Jules Aguillon
0727ea38e9 Fix swapped page_up/page_down 2021-12-05 20:55:52 +01:00
Jules Aguillon
5e5c7ef86a Add the euro and pound symbols
Fn+$ and Fn+# respectively.
2021-12-05 20:16:01 +01:00
Jules Aguillon
d8d3cf85e5 Avoid using getWidth() from onMeasure() 2021-12-05 19:38:46 +01:00
Poussinou
7775213504 Update README.md 2021-12-05 18:22:20 +01:00
Jules Aguillon
ac1dd23144 Release 1.9.2 (12) 2021-10-18 22:45:17 +02:00
Jules Aguillon
d4d5b67181 Add fastlane metadata 2021-10-18 22:39:15 +02:00
Jules Aguillon
d606a7924d Build requires Android Build Tools <= 30.0.3
'dx' is missing in 31.0.0.
2021-09-21 00:42:26 +02:00
Jules Aguillon
666b51993f Make the project open source !
Under GNU GPLv3. The license applies to every parent commits.
Add a README.
2021-09-20 22:55:20 +02:00
130 changed files with 4423 additions and 1663 deletions

55
.github/workflows/make-apk.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: Make Apk CI
on:
workflow_dispatch:
push:
pull_request:
jobs:
Build-Apk:
runs-on: ubuntu-latest
steps:
- name: Cache fontforge and extra dependencies
uses: actions/cache@v2
with:
path: /usr/local/bin
key: usr-local-bin
- name: Install latest FontForge version (using AppImage)
run: |
# Get most recent version of FontForge
# Using AppImage there is no dependecy problem, it is the latest version and it's easier to cache
cd /usr/local/bin
sudo wget -c -N https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage
sudo chmod +x ./FontForge-2022-03-08-582bd41-x86_64.AppImage
sudo ln --symbolic --force /usr/local/bin/FontForge-2022-03-08-582bd41-x86_64.AppImage /usr/local/bin/fontforge
- uses: actions/setup-java@v2
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- name: Checkout repo
uses: actions/checkout@v2
- name: Cache debug certificate
uses: actions/cache@v2
with:
path: _build/debug.keystore
key: debug-keystore
- name: Restore debug keystore from github Secrets
run: |
mkdir -p _build
cd "$GITHUB_WORKSPACE/_build"
# Check if exist and use the secret named DEBUG_KEYSTORE
# The contents of the secret can be obtained -
# from the debug.keystore.asc from you local _build folder
if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" == "" ]]; then
echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc"
if [[ -s "debug.keystore.asc" ]]; then
gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore"
fi
fi
- name: Build
run: make
- name: Save debug apk
uses: actions/upload-artifact@v2
with:
name: debug apk
path: _build/*.apk

2
.gitignore vendored
View File

@@ -1,2 +1,4 @@
*.keystore
*.keystore.asc
_build
/*-keystore.conf

View File

@@ -1,38 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="juloo.keyboard2"
android:versionCode="11"
android:versionName="1.9.1"
android:hardwareAccelerated="false">
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="29" />
<application android:label="@string/app_name"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:hardwareAccelerated="false">
<service android:name="juloo.keyboard2.Keyboard2"
android:label="@string/app_name"
android:permission="android.permission.BIND_INPUT_METHOD">
<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 xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="21" android:versionName="1.14.2" android:hardwareAccelerated="false">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="30"/>
<application android:label="@string/app_name" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:hardwareAccelerated="false">
<service android:name="juloo.keyboard2.Keyboard2" android:label="@string/app_name" android:permission="android.permission.BIND_INPUT_METHOD">
<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" android:theme="@style/android:Theme.Material">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.VIBRATE"/>
</manifest>

103
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,103 @@
# 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 (minimum `28.0.1`), 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`.
## Using the local debug.keystore on the Github CI actions
It's possible to save the local debug.keystore into a github secret, so the same keystore is utilized to build the debug apk in the CI github actions.
Doing this, they wil have the same signature, thus the debug apk can be updated without having to uninstall it first.
After you sucessfully run `make`, (thus a debug.keystore exists) you can use this second command to generate a base64 stringified version of it
```sh
cd _build
gpg -c --armor --pinentry-mode loopback --passphrase debug0 --yes "debug.keystore"
```
A file will be generated inside the local `_build/` folder, called `debug.keystore.asc`
You can copy the content of this file, and with that, paste it into a new github secret in your repo settings.
The secret must be named `DEBUG_KEYSTORE`
## 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.

674
LICENSE Normal file
View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -2,11 +2,10 @@
PACKAGE_NAME = juloo.keyboard2
ANDROID_PLATFORM_VERSION = android-29
ANDROID_PLATFORM_VERSION = android-30
JAVA_VERSION = 1.7
SRC_DIR = srcs
ASSETS_DIR = assets
RES_DIR = res
EXTRA_JARS =
@@ -17,9 +16,13 @@ debug: _build/$(PACKAGE_NAME).debug.apk
release: _build/$(PACKAGE_NAME).apk
installd: _build/$(PACKAGE_NAME).debug.apk
adb install "$<"
adb install -r "$<"
.PHONY: release debug installd
clean:
rm -rf _build/*.dex _build/class _build/gen _build/*.apk _build/*.unsigned-apk \
_build/*.idsig _build/assets
.PHONY: release debug installd clean
$(shell mkdir -p _build)
@@ -42,12 +45,6 @@ JAVAC_FLAGS = -source $(JAVA_VERSION) -target $(JAVA_VERSION) -encoding utf8
MANIFEST_FILE = AndroidManifest.xml
JAVA_FILES = $(shell find $(SRC_DIR) -name '*.java')
RES_FILES = $(shell find $(RES_DIR) -type f)
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
@@ -59,31 +56,34 @@ $(DEBUG_KEYSTORE):
-alias debug -keypass $(DEBUG_PASSWD) -keystore "$@" \
-keyalg rsa -storepass $(DEBUG_PASSWD) -validity 10000
_build/%.debug.signed-apk: _build/%.debug.unsigned-apk $(DEBUG_KEYSTORE)
jarsigner -keystore $(DEBUG_KEYSTORE) \
-storepass $(DEBUG_PASSWD) -keypass $(DEBUG_PASSWD) \
-signedjar "$@" "$<" debug
_build/%.debug.apk: _build/%.debug.unsigned-apk $(DEBUG_KEYSTORE)
$(ANDROID_BUILD_TOOLS)/apksigner sign --in "$<" --out "$@" \
--ks $(DEBUG_KEYSTORE) --ks-key-alias debug --ks-pass "pass:$(DEBUG_PASSWD)"
# Debug apk
_build/$(PACKAGE_NAME).debug.unsigned-apk: AAPT_PACKAGE_FLAGS+=--rename-manifest-package $(PACKAGE_NAME).debug
_build/$(PACKAGE_NAME).debug.unsigned-apk: AAPT_PACKAGE_FLAGS+=--rename-manifest-package $(PACKAGE_NAME).debug --product debug
# 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
# OPTS can be used to pass -storepass or -keypass options to jarsigner
_build/%.signed-apk: _build/%.unsigned-apk %-keystore.conf
_build/%.apk: _build/%.unsigned-apk %-keystore.conf
eval `cat $(word 2,$^)` && \
jarsigner -sigalg SHA1withRSA -digestalg SHA1 -keystore "$$KEYSTORE" $$OPTS -signedjar "$@" "$<" "$$KEYNAME"
$(ANDROID_BUILD_TOOLS)/apksigner sign --in "$<" --out "$@" \
--ks "$$KEYSTORE" --ks-key-alias "$$KEYNAME" --ks-pass "pass:$$KEYSTOREPASS"
# Package
_build/%.unsigned-apk: _build/classes.dex $(MANIFEST_FILE) $(ASSETS_FILES)
_build/%.unsigned-apk: _build/%.unaligned-apk
$(ANDROID_BUILD_TOOLS)/zipalign -fp 4 "$<" "$@"
APK_EXTRA_FILES = classes.dex assets/special_font.ttf
_build/%.unaligned-apk: $(addprefix _build/,$(APK_EXTRA_FILES)) $(MANIFEST_FILE)
$(ANDROID_BUILD_TOOLS)/aapt package -f -M $(MANIFEST_FILE) -S $(RES_DIR) \
-I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS)
[ -z "$(ASSETS_FILES)" ] || $(ANDROID_BUILD_TOOLS)/aapt add "$@" $(ASSETS_FILES)
cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) classes.dex
cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) $(APK_EXTRA_FILES)
# R.java
@@ -95,6 +95,15 @@ $(R_FILE): $(RES_FILES) $(MANIFEST_FILE)
$(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(RES_DIR) -J $(GEN_DIR) \
-M $(MANIFEST_FILE) -I $(ANDROID_PLATFORM)/android.jar
# Special font
SPECIAL_FONT_GLYPHS = $(wildcard $(CURDIR)/srcs/special_font/*.svg)
SPECIAL_FONT_SCRIPT = $(CURDIR)/srcs/special_font/build.pe
_build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_GLYPHS)
mkdir -p $(@D)
fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $(CURDIR)/$@ $(SPECIAL_FONT_GLYPHS)
# Compile java classes and build classes.dex
OBJ_DIR = _build/class
@@ -108,4 +117,4 @@ _build/classes.dex: $(JAVA_FILES) $(R_FILE)
-classpath $(ANDROID_PLATFORM)/android.jar:$(EXTRA_JARS) \
-sourcepath $(SRC_DIR):$(GEN_DIR) \
$^
$(ANDROID_BUILD_TOOLS)/dx --dex --output="$@" $(OBJ_DIR) $(subst :, ,$(EXTRA_JARS))
$(ANDROID_BUILD_TOOLS)/d8 --output $(@D) $(OBJ_DIR)/*/*/* $(subst :, ,$(EXTRA_JARS))

36
README.md Normal file
View File

@@ -0,0 +1,36 @@
# Unexpected Keyboard
A lightweight virtual keyboard for developers.
![Unexpected Keyboard](metadata/android/en-US/images/featureGraphic.png)
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..).
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.
Highlight of some of the features:
- 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"
alt="Get it on F-Droid"
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).

Binary file not shown.

View File

@@ -0,0 +1,18 @@
Diese App ist eine virtuelle Tastatur für Android. Hauptfunktionen sind das einfache Tippen eines jeden ASCII-Zeichens durch Wischgesten, Hilfstasten, Tottasten für Akzente, sowie das Vorhandensein spezieller Tasten (Tabulator, Esc, Pfeiltasten etc.).
Die Tastatur hat bis zu vier Extrazeichen in den Ecken jeder Taste. Diese Extrazeichen werden durch das Wischen mit dem Finger auf der Taste ausgewählt.
Highlights mancher Funktionen:
- Jedes Zeichen und jede spezielle Taste gibt es auch auf einer PC-Tastatur. Das ist perfekt für die Nutzung von Anwendungen wie Termux.
- Dies schließt auch Tab, Esc und die Pfeil- und Funktionstasten sowie Strg und Alt mit ein!
- Akzenttasten sind über Tottasten verfügbar. Nach Aktivieren des Akzents kan der akzentuierte Buchstabe getippt werden.
- Sehr schlank und schnell. Braucht 500x weniger Speicherplatz als Googles Tastatur und 15x weniger als die Standardtastatur. Keine Werbung, kein Tracking.
- Verschiedene Layouts: QWERTY, QWERTZ, AZERTY. Themes: Weiß, Dunkel, OLED Schwarz. Und viele weitere Optionen.
Wie jede andere virtuelle Tastatur muss diese Tastatur in den Systemeinstellungen aktiviert werden. Dazu Systemeinstellungen öffnen und wie folgt vorgehen:
System > Sprachen und Eingabe > Bildschirmtastatur > Bildschirmtastaturen verwalten.

View File

@@ -0,0 +1 @@
Eine schlanke Bildschirmtastatur für Entwickler

View File

@@ -0,0 +1 @@
Unexpected Keyboard

View File

@@ -0,0 +1,3 @@
- Add support for Spanish and Italian
- Improved the placement of some characters (especially accents) and added more (french quotes, dash and em-dash).
- Fixed some bugs (a crash on old versions of Android and a graphical bug due to rotation)

View File

@@ -0,0 +1 @@
First open-source release!

View File

@@ -0,0 +1,3 @@
- Add support for Swedish
- Fix keyboard shortcuts not working in some applications
- Fix a graphical bug and add some tweaks

View 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.

View 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.

View 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

View File

@@ -0,0 +1,13 @@
New languages: Portuguese (thanks @sdrapha), Russian (thanks @carrot-cookie), Spanish (thanks @gh0ste)
New layouts: Dvorak (thanks @AlexandraAlter), Russian Jcuken, Spanish Qwerty
Added the Meta key (the equivalent of the Win on Windows)
Added ordinal symbols on the number pane (thanks @sdrapha)
Better position for the arrow keys (thanks @MaxGyver83)
Improvements to some of the symbols (thanks @MaxGyver83, @Roy-Orbison)
Improvements to the layouts
Improvements to the key-repeat for arrows
Fixed Shift+Arrows for selecting text
Fixed dark theme bugs on Xiaomi phones
Thanks to all the contributors: @sdrapha, @MaxGyver83, @AlexandraAlter, @Roy-Orbison, @carrot-cookie, @gh0ste

View File

@@ -0,0 +1,5 @@
Improved text size, especially on large screens
Increased contrasts
Improved symbols (thanks @sdrapha)
German translation (thanks @polyctena)
Fix to some layouts.

View File

@@ -0,0 +1,21 @@
Translations: Brazilian portuguese (@igorSilCar), Chinese-Simplified (@9-2-1), Korean (@notnickid)
New layouts: Swedish (@thabubble), Korean (@notnickid)
Improved computation of the swipe gesture and fix unstoppable key-repeat on
some devices.
Moved keys away from the edges of the screen and other improvements to the layouts.
Improved rendering of some symbols.
Added more characters to the keyboard:
- New combinations to Fn (@ArenaL5)
- Currency symbols
- Added arrow and box symbols (@sdrapha)
- F11 and F12.
Option for making modifiers lockable. (@sdrapha)
Fixes to the Spanish layout and other fixes. (@ArenaL5)
Many other fixes.
Huge thanks to the contributors: @igorSilCar, @sdrapha, @ArenaL5, @notnickid, @9-2-1, @thabubble

View File

@@ -0,0 +1,25 @@
Quick fix release.
Previously:
Translations: Brazilian portuguese (@igorSilCar), Chinese-Simplified (@9-2-1), Korean (@notnickid)
New layouts: Swedish (@thabubble), Korean (@notnickid)
Improved computation of the swipe gesture and fix unstoppable key-repeat on
some devices.
Moved keys away from the edges of the screen and other improvements to the layouts.
Improved rendering of some symbols.
Added more characters to the keyboard:
- New combinations to Fn (@ArenaL5)
- Currency symbols
- Added arrow and box symbols (@sdrapha)
- F11 and F12.
Option for making modifiers lockable. (@sdrapha)
Fixes to the Spanish layout and other fixes. (@ArenaL5)
Many other fixes.
Huge thanks to the contributors: @igorSilCar, @sdrapha, @ArenaL5, @notnickid, @9-2-1, @thabubble

View File

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

View File

@@ -0,0 +1,18 @@
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..).
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.
Highlight of some of the features:
- 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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1 @@
A lightweight virtual keyboard for developers.

View File

@@ -0,0 +1 @@
Unexpected Keyboard

View File

@@ -0,0 +1 @@
Un teclado virtual ligero para desarrolladores.

View File

@@ -0,0 +1 @@
Unexpected Keyboard

View File

@@ -0,0 +1,18 @@
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..).
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.

View File

@@ -0,0 +1 @@
Le meilleur clavier pour les développeurs.

View File

@@ -0,0 +1 @@
Unexpected Keyboard

View File

@@ -0,0 +1,18 @@
이 앱은 안드로이드용 가상 키보드입니다. 주요 기능은 스와이프 제스처를 사용하여 모든 ASCII 문자를 쉽게 입력할 수 있다는 점과 악센트 및 수정자 키를 위한 데드 키와 특수 키(tab, esc, 방향키 등)이 있다는 것입니다.
키보드는 각 키의 모서리에 최대 4개의 추가 문자를 표시합니다. 이러한 추가 문자는 키에서 손가락을 스와이프하여 적중됩니다.
일부 하이라이트 기능:
- PC 키보드에서 사용할 수 있는 모든 문자 및 특수 키를 사요 가능합니다. 이것은 Termux와 같은 앱을 사용하는 데 효과적입니다.
- 여기에는 Tab, Esc, 방향키 및 function 키뿐만이 아닌 Ctrl 및 Alt 키도 포함되어 있습니다 !
- 악센트 키는 데드 키를 사용하여 액세스할 수 있습니다. 먼저 악센트 키를 활성화한 다음 악센트 문자를 입력합니다.
- 매우 가볍고 빠릅니다. Google 키보드보다 500배, 기본 키보드보다 15배 적은 공간을 사용합니다. 광고와 사용 기록 추적 없음.
- 다중 레이아웃: QWERTY, QWERTZ, AZERTY. 다양한 테마: White, Dark, OLED Black. 또한 다른 많은 옵션들.
다른 가상 키보드와 마찬가지로 시스템 설정에서 활성화해야 합니다. 시스템 설정을 열고 다음으로 이동합니다.
시스템 > 언어 및 입력 > 키보드 > 키보드 관리.

View File

@@ -0,0 +1 @@
개발자들을 위한 가벼운 가상 키보드.

View File

@@ -0,0 +1 @@
Unexpected Keyboard

View 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.

View File

@@ -0,0 +1 @@
Viegla un ātra tālruņa tastatūra izstrādātājiem.

View File

@@ -0,0 +1,18 @@
Um teclado virtual para aparelhos Android. Os recursos principais são facilidade de digitar todos os caracteres ASCII deslizando o dedo, teclas "mortas" para acentos e teclas modificadoras e a presença de teclas especiais (tab, esc, setas, etc..).
O teclado mostra até 4 caracteres extras nos cantos de cada tecla. Esses caracteres são digitáveis com o deslizar do dedo na tecla.
Alguns dos recursos interessantes:
- Todos caracteres e teclas especiais que também estão disponíveis num teclado de PC. Perfeito para usar com aplicativos como Termux.
- Incluindo Tab, Esc, as setas e teclas de função, e também Ctrl e Alt!
- Caracteres acentuados são digitáveis usando teclas "mortas". Primeiro ative o acento e depois digite a letra.
- Muito leve e rápido. Ocupa 500x menos espaço que o teclado da Google e 15x menos espaço que o teclado padrão. Sem propaganda, sem rastreio.
- Vários layouts: QWERTY, QWERTZ, AZERTY. Temas: Branco, Escuro, Preto OLED. E muitas outras opções.
Como qualquer outro teclado virtual, tem de ser ativado nas configurações de sistema. Abra as configurações e vá para:
Sistema > Idioma e entrada > Teclado virtual > Gerenciar teclados virtuais.

View File

@@ -0,0 +1 @@
Um teclado virtual leve para desenvolvedores.

View File

@@ -0,0 +1 @@
Unexpected Keyboard

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -1,38 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:hardwareAccelerated="false">
<juloo.keyboard2.EmojiGroupButtonsBar
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<juloo.keyboard2.EmojiGridView
android:id="@+id/emoji_grid"
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 xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:hardwareAccelerated="false">
<juloo.keyboard2.EmojiGroupButtonsBar android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<juloo.keyboard2.EmojiGridView android:id="@+id/emoji_grid" android:background="?attr/colorKeyboard" 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>

View File

@@ -1,5 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/bg"
android:hardwareAccelerated="false"
/>
<juloo.keyboard2.Keyboard2View xmlns:android="http://schemas.android.com/apk/res/android" android:hardwareAccelerated="false" android:background="?attr/colorKeyboard"/>

47
res/values-de/strings.xml Normal file
View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="settings_activity_label">Unexpected Keyboard - Einstellungen</string>
<string name="pref_category_layout">Layout</string>
<string name="pref_layout_title">Tastaturlayout ändern</string>
<string name="pref_layout_e_system">Systemeinstellung</string>
<string name="pref_accents_title">Akzente</string>
<string name="pref_accents_e_all_installed">Akzente für alle installierten Sprachen anzeigen</string>
<string name="pref_accents_e_selected">Akzente nur für die gewählte Sprache anzeigen</string>
<string name="pref_accents_e_all">Alle Akzente anzeigen</string>
<string name="pref_accents_e_none">Akzente verbergen</string>
<string name="pref_category_typing">Tippen</string>
<string name="pref_swipe_dist_title">Länge der Wischgeste</string>
<string name="pref_swipe_dist_summary">Abstand der Zeichen in den Ecken der Tasten (%s)</string>
<string name="pref_long_timeout_title">Zeitüberschreitung bei Tastenwiederholung</string>
<string name="pref_long_interval_title">Intervall der Tastenwiederholung</string>
<string name="pref_category_vibrate">Vibration</string>
<string name="pref_vibrate_title">Vibration</string>
<string name="pref_vibrate_summary">Vibration bei Tastendruck ein-/ausschalten</string>
<string name="pref_vibrate_duration_title">Dauer</string>
<string name="pref_precise_repeat_title">Präzise Cursorsteuerung</string>
<string name="pref_precise_repeat_summary">Geschwindigkeit der Tastenwiederholung durch weniger oder mehr Wischen anpassen</string>
<string name="pref_category_style">Design</string>
<string name="pref_margin_bottom_title">Unterer Abstand</string>
<string name="pref_keyboard_height_title">Höhe der Tastatur</string>
<string name="pref_horizontal_margin_title">Horizontaler Abstand</string>
<string name="pref_character_size_title">Größe der Beschriftung</string>
<string name="pref_character_size_summary">Größe der Buchstaben auf den Tasten (%.2fx)</string>
<string name="pref_theme">Theme</string>
<string name="pref_theme_e_system">Systemeinstellung</string>
<string name="pref_theme_e_dark">Dunkel</string>
<string name="pref_theme_e_light">Hell</string>
<string name="pref_theme_e_black">Schwarz</string>
<string name="pref_swipe_dist_e_very_short">Sehr kurz</string>
<string name="pref_swipe_dist_e_short">Kurz</string>
<string name="pref_swipe_dist_e_default">Normal</string>
<string name="pref_swipe_dist_e_far">Weit</string>
<string name="pref_swipe_dist_e_very_far">Sehr weit</string>
<string name="pref_key_horizontal_space">Horizontaler Abstand zwischen den Tasten</string>
<string name="pref_key_vertical_space">Vertikaler Abstand zwischen den Tasten</string>
<string name="key_action_next">Nächstes</string>
<string name="key_action_done">Fertig</string>
<string name="key_action_go">Los</string>
<string name="key_action_prev">Vorheriges</string>
<string name="key_action_search">Suchen</string>
<string name="key_action_send">Senden</string>
</resources>

49
res/values-es/strings.xml Normal file
View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="settings_activity_label">Ajustes de Unexpected Keyboard</string>
<string name="pref_category_layout">Formato</string>
<string name="pref_layout_title">Cambiar formato de teclado</string>
<string name="pref_layout_e_system">Ajustes del sistema</string>
<string name="pref_accents_title">Acentos</string>
<string name="pref_accents_e_all_installed">Mostrar acentos para todos los lenguajes instalados</string>
<string name="pref_accents_e_selected">Solo mostrar acentos para el lenguaje seleccionado</string>
<string name="pref_accents_e_all">Mostrar todos los acentos</string>
<string name="pref_accents_e_none">Ocultar acentos</string>
<string name="pref_category_typing">Escribiendo</string>
<string name="pref_swipe_dist_title">Distancia para deslizar</string>
<string name="pref_swipe_dist_summary">Distancia de caracteres en las esquinas de las letras (%s)</string>
<string name="pref_long_timeout_title">Tiempo de espera de repetición de tecla</string>
<string name="pref_long_interval_title">Intervalo de repetición de tecla</string>
<string name="pref_category_vibrate">Vibración</string>
<string name="pref_vibrate_title">Vibración</string>
<string name="pref_vibrate_summary">Habilitar/deshabilitar vibración al presionar una tecla</string>
<string name="pref_vibrate_duration_title">Duración</string>
<string name="pref_precise_repeat_title">Movimientos de cursor preciso</string>
<string name="pref_precise_repeat_summary">Modular la velocidad de repetición de teclas según si se desliza más o menos</string>
<string name="pref_lockable_keys_title">Bloqueo de teclas modificadoras</string>
<string name="pref_lockable_keys_summary">Teclas modificadoras que se pueden bloquear pulsándolas dos veces</string>
<string name="pref_category_style">Estilo</string>
<string name="pref_margin_bottom_title">Margen del pie</string>
<string name="pref_keyboard_height_title">Altura del teclado</string>
<string name="pref_horizontal_margin_title">Margen horizontal</string>
<string name="pref_character_size_title">Tamaño de etiqueta</string>
<string name="pref_character_size_summary">Tamaño de caracteres mostrados en el teclado (%.2fx)</string>
<string name="pref_theme">Tema</string>
<string name="pref_theme_e_system">Ajustes de sistema</string>
<string name="pref_theme_e_dark">Oscuro</string>
<string name="pref_theme_e_light">Claro</string>
<string name="pref_theme_e_black">Negro</string>
<string name="pref_swipe_dist_e_very_short">Muy corto</string>
<string name="pref_swipe_dist_e_short">Corto</string>
<string name="pref_swipe_dist_e_default">Normal</string>
<string name="pref_swipe_dist_e_far">Lejano</string>
<string name="pref_swipe_dist_e_very_far">Muy lejano</string>
<string name="pref_key_horizontal_space">Espaciado horizontal entre las teclas</string>
<string name="pref_key_vertical_space">Espaciado vertical entre las teclas</string>
<string name="key_action_next">Siguiente</string>
<string name="key_action_done">Hecho</string>
<string name="key_action_go">Ir</string>
<string name="key_action_prev">Anterior</string>
<string name="key_action_search">Buscar</string>
<string name="key_action_send">Enviar</string>
</resources>

47
res/values-fr/strings.xml Normal file
View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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_keyboard_height_title">Hauteur du clavier</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>

47
res/values-ko/strings.xml Normal file
View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="settings_activity_label">Unexpected Keyboard 설정</string>
<string name="pref_category_layout">레이아웃</string>
<string name="pref_layout_title">키보드 레이아웃 변경</string>
<string name="pref_layout_e_system">시스템 세팅</string>
<string name="pref_accents_title">악센트</string>
<string name="pref_accents_e_all_installed">설치된 모든 언어의 악센트 표시</string>
<string name="pref_accents_e_selected">선택한 언어의 악센트만 표시</string>
<string name="pref_accents_e_all">모든 언어의 악센트 표시</string>
<string name="pref_accents_e_none">모든 언어의 악센트 숨기기</string>
<string name="pref_category_typing">타자</string>
<string name="pref_swipe_dist_title">스와이프 범위</string>
<string name="pref_swipe_dist_summary">키 모서리 문자의 입력 범위 (%s)</string>
<string name="pref_long_timeout_title">키 길게 누르기 지연</string>
<string name="pref_long_interval_title">키 반복 간격</string>
<string name="pref_category_vibrate">진동</string>
<string name="pref_vibrate_title">진동</string>
<string name="pref_vibrate_summary">키 누를 때 진동 키거/끄기</string>
<string name="pref_vibrate_duration_title">지속 시간</string>
<string name="pref_precise_repeat_title">정확한 커서 움직임</string>
<string name="pref_precise_repeat_summary">더 많거나 적은 스와이프로 키 반복 조절</string>
<string name="pref_category_style">스타일</string>
<string name="pref_margin_bottom_title">아래 넓이</string>
<string name="pref_keyboard_height_title">키보드 높이</string>
<string name="pref_horizontal_margin_title">양 옆 넓이</string>
<string name="pref_character_size_title">폰트 크기</string>
<string name="pref_character_size_summary">키보드의 표시되는 폰트 크기 (%.2fx)</string>
<string name="pref_theme">테마</string>
<string name="pref_theme_e_system">시스템 테마</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">매우 짧음</string>
<string name="pref_swipe_dist_e_short">짧음</string>
<string name="pref_swipe_dist_e_default">보통</string>
<string name="pref_swipe_dist_e_far">넓음</string>
<string name="pref_swipe_dist_e_very_far">매우 넓음</string>
<string name="pref_key_horizontal_space">키보드 양 옆 간격</string>
<string name="pref_key_vertical_space">키보드 세로 간격</string>
<string name="key_action_next">다음</string>
<string name="key_action_done">확인</string>
<string name="key_action_go">Go</string>
<string name="key_action_prev">이전</string>
<string name="key_action_search">검색</string>
<string name="key_action_send">보내기</string>
</resources>

View File

@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="horizontal_margin">12dp</dimen>
<dimen name="margin_bottom">3dp</dimen>
<dimen name="key_padding">3dp</dimen>
<dimen name="key_height">36dp</dimen>
<dimen name="label_text_size">18dp</dimen>
<dimen name="sublabel_text_size">11dp</dimen>
<dimen name="emoji_type_button_height">48dp</dimen>
<dimen name="horizontal_margin">12dp</dimen>
<dimen name="margin_bottom">3dp</dimen>
<dimen name="key_padding">3dp</dimen>
<dimen name="key_height">36dp</dimen>
<item name="label_text_size" type="integer" format="float">0.4</item>
<item name="sublabel_text_size" type="integer" format="float">0.3</item>
<dimen name="emoji_type_button_height">48dp</dimen>
<dimen name="extra_horizontal_margin">20dp</dimen>
</resources>

45
res/values-lv/strings.xml Normal file
View File

@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<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_keyboard_height_title">Tastatūras 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>

53
res/values-pt/strings.xml Normal file
View File

@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" product="debug">Unexpected Keyboard</string>
<string name="app_name" product="default">Unexpected Keyboard</string>
<string name="settings_activity_label">Configurações Unexpected Keyboard</string>
<string name="pref_category_layout">Layout</string>
<string name="pref_layout_title">Mudar layout do teclado</string>
<string name="pref_layout_e_system">Mesmo do sistema</string>
<string name="pref_accents_title">Acentos</string>
<string name="pref_accents_e_all_installed">Mostrar acentos para todos os idiomas instalados</string>
<string name="pref_accents_e_selected">Mostrar acentos só para o idioma selecionado</string>
<string name="pref_accents_e_all">Mostrar todos acentos</string>
<string name="pref_accents_e_none">Ocultar acentos</string>
<string name="pref_programming_layout_title">Layout do teclado para programação</string>
<string name="pref_programming_layout_none">Nenhum</string>
<string name="pref_category_typing">Digitação</string>
<string name="pref_swipe_dist_title">Distância a deslizar</string>
<string name="pref_swipe_dist_summary">Distância até acionar os cantos das teclas (%s)</string>
<string name="pref_long_timeout_title">Tempo até repetir tecla</string>
<string name="pref_long_interval_title">Intervalo de repetição de tecla</string>
<string name="pref_category_vibrate">Vibração</string>
<string name="pref_vibrate_title">Vibração</string>
<string name="pref_vibrate_summary">Ativar/desativar vibração ao digitar</string>
<string name="pref_vibrate_duration_title">Duração</string>
<string name="pref_precise_repeat_title">Precisão nos movimentos do cursor</string>
<string name="pref_precise_repeat_summary">Varia a velocidade de repetição a depender do quanto deslizar</string>
<string name="pref_lockable_keys_title">Teclas traváveis</string>
<string name="pref_lockable_keys_summary">Teclas que podem ficar seguradas ao teclar duas vezes</string>
<string name="pref_category_style">Estilo</string>
<string name="pref_margin_bottom_title">Margem inferior</string>
<string name="pref_keyboard_height_title">Altura do teclado</string>
<string name="pref_horizontal_margin_title">Margem horizontal</string>
<string name="pref_character_size_title">Tamanho dos indicadores</string>
<string name="pref_character_size_summary">Tamanho dos caracteres visíveis no teclado (%.2fx)</string>
<string name="pref_theme">Tema</string>
<string name="pref_theme_e_system">Mesmo do sistema</string>
<string name="pref_theme_e_dark">Escuro</string>
<string name="pref_theme_e_light">Claro</string>
<string name="pref_theme_e_black">Preto</string>
<string name="pref_swipe_dist_e_very_short">Muito curto</string>
<string name="pref_swipe_dist_e_short">Curto</string>
<string name="pref_swipe_dist_e_default">Normal</string>
<string name="pref_swipe_dist_e_far">Longo</string>
<string name="pref_swipe_dist_e_very_far">Muito longo</string>
<string name="pref_key_horizontal_space">Distância horizontal entre teclas</string>
<string name="pref_key_vertical_space">Distância vertical entre teclas</string>
<string name="key_action_next">Próximo</string>
<string name="key_action_done">Pronto</string>
<string name="key_action_go">Ir</string>
<string name="key_action_prev">Anterior</string>
<string name="key_action_search">Buscar</string>
<string name="key_action_send">Enviar</string>
</resources>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name" product="debug">Unexpected Keyboard (debug)</string>
<string name="app_name" product="default">Unexpected Keyboard</string>
<string name="settings_activity_label">Unexpected Keyboard 设置</string>
<string name="pref_category_layout">布局</string>
<string name="pref_layout_title">改变键盘布局</string>
<string name="pref_layout_e_system">系统设置</string>
<string name="pref_accents_title">声调</string>
<string name="pref_accents_e_all_installed">显示所有安装的语言的声调符号</string>
<string name="pref_accents_e_selected">只显示选择的语言的声调符号</string>
<string name="pref_accents_e_all">显示所有声调符号</string>
<string name="pref_accents_e_none">隐藏声调符号</string>
<string name="pref_category_typing">输入</string>
<string name="pref_swipe_dist_title">滑动触发距离</string>
<string name="pref_swipe_dist_summary">输入按键四角的符号需要滑动的距离 (%s)</string>
<string name="pref_long_timeout_title">长按到开始重复输入的时间</string>
<string name="pref_long_interval_title">长按后每次重复输入的时间间隔</string>
<string name="pref_category_vibrate">振动</string>
<string name="pref_vibrate_title">振动</string>
<string name="pref_vibrate_summary">启用或者禁用按下按键时振动</string>
<string name="pref_vibrate_duration_title">每次振动持续的时间</string>
<string name="pref_precise_repeat_title">精确控制光标移速</string>
<string name="pref_precise_repeat_summary">按键重复按下速度由手指滑动的距离决定</string>
<string name="pref_lockable_keys_title">组合键锁定</string>
<string name="pref_lockable_keys_summary">可以通过输入两次锁定任何组合键(Ctrl, Alt, Fn, 声调符号等)</string>
<string name="pref_category_style">样式</string>
<string name="pref_margin_bottom_title">键盘下边距</string>
<string name="pref_keyboard_height_title">键盘高度</string>
<string name="pref_horizontal_margin_title">键盘左右边距</string>
<string name="pref_character_size_title">字符大小</string>
<string name="pref_character_size_summary">按键上显示的字符的大小 (%.2fx)</string>
<string name="pref_theme">主题</string>
<string name="pref_theme_e_system">跟随系统设置</string>
<string name="pref_theme_e_dark">暗色</string>
<string name="pref_theme_e_light">亮色</string>
<string name="pref_theme_e_black">黑色</string>
<string name="pref_swipe_dist_e_very_short">非常短</string>
<string name="pref_swipe_dist_e_short"></string>
<string name="pref_swipe_dist_e_default">中(默认)</string>
<string name="pref_swipe_dist_e_far"></string>
<string name="pref_swipe_dist_e_very_far">非常长</string>
<string name="pref_key_horizontal_space">按键的左右边距</string>
<string name="pref_key_vertical_space">按键的上下边距</string>
<string name="key_action_next">下一项</string>
<string name="key_action_done">完成</string>
<string name="key_action_go">前往</string>
<string name="key_action_prev">前一项</string>
<string name="key_action_search">搜索</string>
<string name="key_action_send">发送</string>
</resources>

View File

@@ -4,10 +4,40 @@
<item>system</item>
<item>azerty</item>
<item>qwerty</item>
<item>qwerty_pt</item>
<item>qwerty_es</item>
<item>qwerty_ko</item>
<item>qwerty_lv</item>
<item>qwerty_sv_se</item>
<item>ru_jcuken</item>
<item>qwertz</item>
<item>bgph1</item>
<item>dvorak</item>
</string-array>
<string-array name="pref_layout_entries">
<item>@string/pref_layout_e_system</item>
<item>AZERTY</item>
<item>QWERTY</item>
<item>QWERTY (Brasileiro)</item>
<item>QWERTY (Español)</item>
<item>QWERTY (Korean)</item>
<item>QWERTY (Latvian)</item>
<item>QWERTY (Swedish)</item>
<item>ЙЦУКЕН (Русский)</item>
<item>QWERTZ</item>
<item>Bulgarian (Phonetic Traditional)</item>
<item>Dvorak</item>
</string-array>
<string-array name="pref_programming_layout_values">
<item>none</item>
<item>qwerty</item>
<item>dvorak</item>
</string-array>
<string-array name="pref_programming_layout_entries">
<item>@string/pref_programming_layout_none</item>
<item>QWERTY</item>
<item>Dvorak</item>
</string-array>
<string name="pref_accents_default">1</string>
<string-array name="pref_accents_entries">
<item>@string/pref_accents_e_all_installed</item>
<item>@string/pref_accents_e_selected</item>
@@ -20,4 +50,30 @@
<item>3</item>
<item>4</item>
</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>

View File

@@ -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>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="horizontal_margin">3dp</dimen>
<dimen name="margin_top">3dp</dimen>
<dimen name="margin_bottom">7dp</dimen>
<dimen name="key_padding">2dp</dimen>
<dimen name="key_vertical_interval">2dp</dimen>
<dimen name="key_horizontal_interval">2dp</dimen>
<dimen name="key_height">51dp</dimen>
<dimen name="key_round">5dp</dimen>
<dimen name="label_text_size">18dp</dimen>
<dimen name="sublabel_text_size">12dp</dimen>
<dimen name="emoji_type_button_height">56dp</dimen>
<dimen name="emoji_grid_height">250dp</dimen>
</resources>

View File

@@ -1,51 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Unexpected Keyboard</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="app_name" product="debug">Unexpected Keyboard (debug)</string>
<string name="app_name" product="default">Unexpected Keyboard</string>
<string name="settings_activity_label">Unexpected Keyboard Settings</string>
<string name="pref_category_layout">Layout</string>
<string name="pref_layout_title">Change keyboard layout</string>
<string name="pref_layout_summary">%s</string>
<string-array name="pref_layout_entries">
<item>System settings</item>
<item>Azerty</item>
<item>Qwerty</item>
</string-array>
<string name="pref_layout_e_system">System settings</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 the installed languages</string>
<string name="pref_accents_e_selected">Show accents for the selected language</string>
<string name="pref_accents_e_all">Show every accents</string>
<string name="pref_accents_e_all_installed">Show accents for all installed languages</string>
<string name="pref_accents_e_selected">Only show accents for the selected language</string>
<string name="pref_accents_e_all">Show all accents</string>
<string name="pref_accents_e_none">Hide accents</string>
<string name="pref_category_typing">Typing</string>
<string name="pref_preci_title">Precision</string>
<string name="pref_preci_summary">Distance of corner values (%spx)</string>
<string name="pref_long_timeout_title">Long press timeout</string>
<string name="pref_long_timeout_summary">%sms</string>
<string name="pref_long_interval_title">Long press interval</string>
<string name="pref_long_interval_summary">%sms</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_programming_layout_title">Keyboard layout for programming</string>
<string name="pref_programming_layout_none">None</string>
<string name="pref_category_typing">Typing</string>
<string name="pref_swipe_dist_title">Swiping distance</string>
<string name="pref_swipe_dist_summary">Distance of characters in the corners of the keys (%s)</string>
<string name="pref_long_timeout_title">Key repeat timeout</string>
<string name="pref_long_interval_title">Key repeat interval</string>
<string name="pref_category_vibrate">Vibration</string>
<string name="pref_vibrate_title">Vibration</string>
<string name="pref_vibrate_summary">Enable/disable vibration on keypress</string>
<string name="pref_vibrate_duration_title">Duration</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_category_style">Style</string>
<string name="pref_margin_bottom_title">Margin bottom</string>
<string name="pref_margin_bottom_summary">%sdp</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_precise_repeat_summary">Modulate key repeat speed by swiping more or less</string>
<string name="pref_lockable_keys_title">Lockable modifiers</string>
<string name="pref_lockable_keys_summary">Modifiers that can be locked by typing them twice</string>
<string name="pref_category_style">Style</string>
<string name="pref_margin_bottom_title">Margin bottom</string>
<string name="pref_keyboard_height_title">Keyboard height</string>
<string name="pref_horizontal_margin_title">Horizontal margin</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_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>

View File

@@ -1,20 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="emojiTypeButton">
<item name="android:padding">1px</item>
<item name="android:gravity">center</item>
<item name="android:minHeight">@dimen/label_text_size</item>
<item name="android:background">@color/emoji_button_bg</item>
<item name="android:textColor">@color/emoji_key_text</item>
<item name="android:textSize">@dimen/label_text_size</item>
</style>
<style name="emojiKeyButton">
<item name="android:layout_width">0px</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:padding">0px</item>
<item name="android:background">@color/emoji_key_bg</item>
<item name="android:textColor">@color/emoji_key_text</item>
<item name="android:textSize">@dimen/label_text_size</item>
</style>
<style name="emojiTypeButton">
<item name="android:padding">1px</item>
<item name="android:gravity">center</item>
<item name="android:minHeight">18dp</item>
<item name="android:background">?attr/emoji_button_bg</item>
<item name="android:textColor">?attr/emoji_key_text</item>
<item name="android:textSize">18dp</item>
</style>
<style name="emojiKeyButton">
<item name="android:layout_width">0px</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:padding">0px</item>
<item name="android:background">?attr/emoji_key_bg</item>
<item name="android:textColor">?attr/emoji_key_text</item>
<item name="android:textSize">18dp</item>
</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>

72
res/values/themes.xml Normal file
View File

@@ -0,0 +1,72 @@
<?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="android:forceDarkAllowed">false</item>
<item name="colorKeyboard">#1b1b1b</item>
<item name="colorKey">#333333</item>
<item name="colorKeyActivated">#1b1b1b</item>
<item name="colorLabel">#ffffff</item>
<item name="colorLabelActivated">#3399ff</item>
<item name="colorLabelLocked">#33cc33</item>
<item name="colorSubLabel">#cccccc</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">#cccccc</item>
<item name="colorKeyActivated">#e3e3e3</item>
<item name="colorLabel">#000000</item>
<item name="colorLabelActivated">#0066cc</item>
<item name="colorLabelLocked">#33cc33</item>
<item name="colorSubLabel">#333333</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="android:forceDarkAllowed">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>

18
res/values/values.xml Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="horizontal_margin">3dp</dimen>
<dimen name="margin_top">3dp</dimen>
<dimen name="margin_bottom">7dp</dimen>
<dimen name="key_padding">2dp</dimen>
<dimen name="key_vertical_interval">2dp</dimen>
<dimen name="key_horizontal_interval">2dp</dimen>
<dimen name="key_height">51dp</dimen>
<item name="label_text_size" type="integer" format="float">0.33</item>
<item name="sublabel_text_size" type="integer" format="float">0.22</item>
<dimen name="emoji_type_button_height">56dp</dimen>
<dimen name="emoji_grid_height">250dp</dimen>
<dimen name="emoji_text_size">28dp</dimen>
<dimen name="extra_horizontal_margin">0dp</dimen>
<bool name="debug_logs" product="debug">true</bool>
<bool name="debug_logs" product="default">false</bool>
</resources>

View File

@@ -1,44 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="a" key1="esc" key2="1" key3="&amp;" />
<key key0="z" key2="2" key4="~" />
<key key0="e" key2="3" key3="&quot;" key4="\#" />
<key key0="r" key2="4" key3="'" />
<key key0="t" key2="5" key3="(" key4=")" />
<key key0="y" key2="6" key3="-" key4="|" />
<key key0="u" key2="7" key4="`" />
<key key0="i" key2="8" key3="_" key4="\\" />
<key key0="o" key2="9" />
<key key0="p" key2="0" key4="\@" />
</row>
<row>
<key key0="q" key1="tab" />
<key key0="s" />
<key key0="d" key1="accent_grave" key3="accent_aigu" />
<key key0="f" key3="{" key4="}" />
<key key0="g" key3="[" key4="]" />
<key key0="h" key3="=" key4="+" />
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key3="^" />
<key key0="k" key2="€" key3="$" key4="£" />
<key key0="l" key2="%" />
<key key0="m" key4="*" />
</row>
<row>
<key width="2.0" key0="shift" />
<key key0="w" key3="&lt;" key4="&gt;" />
<key key0="x" />
<key key0="c" key1="accent_cedille" key3="," key4="\?" />
<key key0="v" key3=";" key4="." />
<key key0="b" key3=":" key4="/" />
<key key0="n" key1="accent_tilde" key2="§" key4="!" />
<key width="2.0" 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" />
</row>
<row>
<key key0="a" key2="1" key4="esc"/>
<key key0="z" key2="2" key3="&amp;" key4="~"/>
<key key0="e" key2="3" key3="&quot;" key4="\#"/>
<key key0="r" key2="4" key3="'"/>
<key key0="t" key2="5" key3="(" key4=")"/>
<key key0="y" key2="6" key3="-" key4="|"/>
<key key0="u" key2="7" key4="`"/>
<key key0="i" key2="8" key3="_" key4="\\"/>
<key key0="o" key2="9" key3="\@" key4="f11_placeholder"/>
<key key0="p" key1="0" key3="f12_placeholder"/>
</row>
<row>
<key key0="q" key2="tab"/>
<key key0="s" key1="accent_ring" key3="ß"/>
<key key0="d" key1="accent_grave" key3="accent_aigu"/>
<key key0="f" key3="{" key4="}"/>
<key key0="g" key3="[" key4="]"/>
<key key0="h" key3="=" key4="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key3="^"/>
<key key0="k" key2="€" key3="$" key4="£"/>
<key key0="l" key2="%"/>
<key key0="m" key3="*"/>
</row>
<row>
<key width="2.0" key0="shift"/>
<key key0="w" key3="&lt;" key4="&gt;"/>
<key key0="x"/>
<key key0="c" key1="accent_cedille" key3="," key4="\?"/>
<key key0="v" key3=";" key4="."/>
<key key0="b" key3=":" key4="/"/>
<key key0="n" key1="accent_tilde" key2="§" key4="!"/>
<key width="2.0" key0="backspace" key2="delete"/>
</row>
</keyboard>

8
res/xml/bottom_row.xml Normal file
View File

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

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

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="shift" width="1.5" key2="esc" key4="tab"/>
<key key0="p" key1="accent_ring" key2="." key3="&lt;" key4="f11_placeholder"/>
<key key0="y" key1="accent_grave" key2="," key3="&gt;" key4="f12_placeholder"/>
<key key0="f" key4="€"/>
<key key0="g" key2="\\" key3="|"/>
<key key0="c" key1="accent_trema" key2="accent_circonflexe" key3="{" key4="}"/>
<key key0="r" key3="[" key4="]"/>
<key key0="l" key2="=" key3="+" key4="£"/>
<key key0="backspace" key2="delete" width="1.5"/>
</row>
<row>
<key key0="a" key2="1" key4="!"/>
<key key0="o" key1="accent_macron" key2="2" key3="\@"/>
<key key0="e" key1="accent_caron" key2="3" key3="\#"/>
<key key0="u" key2="4" key3="$"/>
<key key0="i" key2="5" key3="%"/>
<key key0="d" key2="6" key3="^"/>
<key key0="h" key2="7" key3="&amp;"/>
<key key0="t" key2="8" key3="*"/>
<key key0="n" key2="9" key3="(" key4=")"/>
<key key0="s" key1="0" key3="ß"/>
</row>
<row>
<key key0="q" shift="0.5" key1="accent_tilde" key2="`" key3="~"/>
<key key0="j" key1="accent_aigu" key2="'" key3="&quot;"/>
<key key0="k" key2=";" key3=":"/>
<key key0="x" key1="accent_cedille"/>
<key key0="b"/>
<key key0="m" key2="/" key3="\?"/>
<key key0="w"/>
<key key0="v"/>
<key key0="z" key2="-" key3="_"/>
</row>
</keyboard>

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

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="я" key2="1" key4="esc"/>
<key key0="в" key1="!" key2="2" key3="\@" key4="ч"/>
<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="&amp;" key4="§"/>
<key key0="и" key2="8" key3="*"/>
<key key0="о" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="п" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="а" key1="tab" key2="`"/>
<key key0="с" key2="£"/>
<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="к" key2="ш" key3="[" key4="]"/>
<key key0="л" key1="щ" key2="|" key3="\\" key4="ю"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="з"/>
<key key0="ь" key1="accent_ring" key3="ѝ"/>
<key key0="ц" key1="accent_cedille" key2="&lt;" key3="."/>
<key key0="ж" key2="&gt;" key3=","/>
<key key0="б" key2="\?" key3="/"/>
<key key0="н" key1="accent_tilde" key2=":" key3=";"/>
<key key0="м" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="й" key2="1" key4="esc"/>
<key key0="ц" key2="2" key3="\@" key4="~"/>
<key key0="у" key2="3" key3="\#" key4="!"/>
<key key0="к" key2="4" key3="$"/>
<key key0="е" key1="ё" key2="5" key3="%"/>
<key key0="н" key2="6" key3="^"/>
<key key0="г" key2="7" key3="&amp;"/>
<key key0="ш" key2="8" key3="*"/>
<key key0="щ" key2="9" key3="(" key4=")"/>
<key key0="з" key2="0"/>
<key key0="х" key1="{" key2="}" key4="f11_placeholder"/>
<key key0="ъ" key1="[" key2="]" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="ф" key1="tab" key2="`"/>
<key key0="ы"/>
<key key0="в"/>
<key key0="а"/>
<key key0="п"/>
<key key0="р"/>
<key key0="о"/>
<key key0="л"/>
<key key0="д" key2="-" key3="_"/>
<key key0="ж" key2="=" key3="+"/>
<key key0="э" key2="|" key3="\\"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="я"/>
<key key0="ч"/>
<key key0="с"/>
<key key0="м"/>
<key key0="и" key2="&lt;" key3="."/>
<key key0="т" key2="&gt;" key3=","/>
<key key0="ь" key2="\?" key3="/"/>
<key key0="б" key2=":" key3=";"/>
<key key0="ю" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@@ -1,33 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="juloo.keyboard2.SettingsActivity"
android:supportsSwitchingToNextInputMethod="true">
<subtype android:label="@string/subtype_label"
android:languageTag="en"
android:imeSubtypeLocale="en_US"
android:imeSubtypeMode="keyboard"
android:isAsciiCapable="true"
android:imeSubtypeExtraValue="default_layout=qwerty"
/>
<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"
/>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true">
<subtype android:label="%s" android:languageTag="bg" android:imeSubtypeLocale="bg_BG" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=bgph1,extra_keys=€"/>
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=accent_trema|ß|€"/>
<subtype android:label="%s" android:languageTag="en-GB" android:imeSubtypeLocale="en_GB" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=£|€"/>
<subtype android:label="%s" android:languageTag="en-US" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/>
<subtype android:label="%s" android:languageTag="es" android:imeSubtypeLocale="es_ES" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_es,extra_keys=accent_grave|accent_aigu|accent_tilde|accent_trema|€"/>
<subtype android:label="%s" android:languageTag="fr" android:imeSubtypeLocale="fr_FR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=azerty,extra_keys=accent_grave|accent_aigu|accent_circonflexe|accent_cedille|accent_trema|€"/>
<subtype android:label="%s" android:languageTag="it" android:imeSubtypeLocale="it_IT" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty,extra_keys=accent_grave|accent_aigu|€"/>
<subtype android:label="%s" android:languageTag="ko" android:imeSubtypeLocale="ko_KR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_ko"/>
<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=accent_caron|accent_cedille|accent_macron|€"/>
<subtype android:label="%s" android:languageTag="pt" android:imeSubtypeLocale="pt_BR" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_pt,extra_keys=accent_aigu|accent_cedille|accent_circonflexe|accent_grave|accent_tilde|€"/>
<subtype android:label="%s" android:languageTag="ru" android:imeSubtypeLocale="ru_RU" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=ru_jcuken"/>
<subtype android:label="%s" android:languageTag="sv" android:imeSubtypeLocale="sv_SE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty_sv_se,extra_keys=accent_aigu|accent_trema|accent_ring|€"/>
</input-method>

View File

@@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<keyboard bottom_row="false">
<row>
<key width="0.75" key0="esc" key2="~" key4="!" />
<key width="0.75" key0="(" key2="[" key4="{" />
<key key0="7" key3="&lt;" key4="&gt;" />
<key key0="8" key2="∞" />
<key key0="9" key2="π" />
<key width="0.75" key0="*" key1="√" key2="×" />
<key width="0.75" key0="/" key1="%" key3="÷" />
<key width="0.75" key0="esc" key2="~" key4="!"/>
<key width="0.75" key0="(" key2="[" key4="{"/>
<key key0="7" key1="&lt;" key2="&gt;"/>
<key key0="8" key2="∞"/>
<key key0="9" key2="π"/>
<key width="0.75" key0="*" key1="√" key2="×"/>
<key width="0.75" key0="/" key1="%" key3="÷"/>
</row>
<row>
<key width="0.75" key0="tab" key1=";" key2="|" key4="\\" />
<key width="0.75" key0=")" key2="]" key4="}" />
<key key0="4" />
<key key0="5" key1="up" key2="right" key3="left" key4="down" />
<key key0="6" />
<key width="0.75" key0="+" key1="Σ" key2="$" />
<key width="0.75" key0="-" key2="^" />
<key width="0.75" key0="tab" key2="|" key4="\\"/>
<key width="0.75" key0=")" key2="]" key4="}"/>
<key key0="4" key1="box" key3="arrows"/>
<key key0="5" key1="up" key2="right" key3="left" key4="down" edgekeys="true"/>
<key key0="6"/>
<key width="0.75" key0="+" key1="Σ" key2="$"/>
<key width="0.75" key0="-" key1="^"/>
</row>
<row>
<key shift="0.35" width="1.15" key0="shift" key2="fn" key4="alt" />
<key key0="1" key1="superscript" key3="subscript" />
<key key0="2" />
<key key0="3" />
<key width="1.15" key0="backspace" key2="delete" />
<key shift="0.35" width="1.15" key0="shift" key2="fn" key4="alt"/>
<key key0="1" key1="superscript" key2="ordinal" key3="subscript"/>
<key key0="2"/>
<key key0="3"/>
<key width="1.15" key0="backspace" key2="delete"/>
</row>
<row height="0.95">
<key width="1.5" key0="ctrl" key3="switch_text" />
<key width="1.5" key0="0" />
<key width="0.75" key0="." key2="," />
<key width="0.75" key0="space" key1="&quot;" key2="'" key4="_" />
<key width="1.5" key0="enter" key2=" key3="=" />
<row height="0.95">
<key width="1.5" key0="switch_text" key2="ctrl"/>
<key width="1.5" key0="0" key3="f11_placeholder" key4="f12_placeholder"/>
<key width="0.75" key0="." key1=":" key2="," key3=";"/>
<key width="0.75" key0="space" key1="&quot;" key2="'" key4="_"/>
<key width="1.5" key0="enter" key1="±" key2="action" key3="="/>
</row>
</keyboard>

View File

@@ -1,44 +1,37 @@
<?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" key2="3" key3="\#" />
<key key0="r" key2="4" key3="$" />
<key key0="t" key2="5" key3="%" />
<key key0="y" key2="6" key3="^" />
<key key0="u" key2="7" key3="&amp;" />
<key key0="i" key2="8" key3="*" />
<key key0="o" key2="9" key3="(" key4=")" />
<key key0="p" key2="0" />
</row>
<row>
<key shift="0.5" key0="a" key1="tab" key2="`" />
<key key0="s" />
<key key0="d" key1="accent_grave" key3="accent_aigu" />
<key key0="f" />
<key key0="g" key2="-" key3="_" />
<key key0="h" key2="=" key3="+" />
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{" />
<key key0="k" key4="]" key3="[" />
<key key0="l" key2="|" key3="\\" />
</row>
<row>
<key width="1.5" key0="shift" />
<key key0="z" />
<key key0="x" />
<key key0="c" key1="accent_cedille" key2="&lt;" key3="." />
<key key0="v" key2="&gt;" key3="," />
<key key0="b" key2="\?" key3="/" />
<key key0="n" key1="accent_tilde" key2=":" key3=";" />
<key key0="m" key2="&quot;" 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" />
</row>
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="~" key2="2" key3="\@"/>
<key key0="e" key1="!" key2="3" key3="\#" key4="€"/>
<key key0="r" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/>
<key key0="y" key2="6" key3="^"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="p" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="a" key1="tab" key2="`"/>
<key key0="s" key1="accent_ring" key3="ß"/>
<key key0="d" key1="accent_grave" key2="£" key3="accent_aigu"/>
<key key0="f"/>
<key key0="g" key1="accent_caron" key2="-" key3="_"/>
<key key0="h" key2="=" key3="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
<key key0="k" key3="[" key4="]"/>
<key key0="l" key2="|" key3="\\"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="z"/>
<key key0="x"/>
<key key0="c" key1="accent_cedille" key2="&lt;" key3="."/>
<key key0="v" key2="&gt;" key3=","/>
<key key0="b" key2="\?" key3="/"/>
<key key0="n" key1="accent_tilde" key2=":" key3=";"/>
<key key0="m" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

38
res/xml/qwerty_es.xml Normal file
View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="~" key2="2" key3="\@"/>
<key key0="e" key1="!" key2="3" key3="\#" key4="€"/>
<key key0="r" key2="4" key3="$"/>
<key key0="t" key2="5" key3="%"/>
<key key0="y" key2="6" key3="^"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key1="accent_macron" key2="9" key3="(" key4=")"/>
<key key0="p" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key key0="a" key2="tab" key4="`"/>
<key key0="s" key1="accent_ring" key2="¡" key3="ß"/>
<key key0="d" key1="accent_grave" key2="£" key3="accent_aigu"/>
<key key0="f"/>
<key key0="g" key1="accent_caron" key2="-" key3="_"/>
<key key0="h" key2="=" key3="+"/>
<key key0="j" key1="accent_trema" key2="accent_circonflexe" key4="}" key3="{"/>
<key key0="k" key3="[" key4="]"/>
<key key0="l" key2="|" key3="\\"/>
<key key0="ñ" key1="·" key3="ç" />
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="z"/>
<key key0="x"/>
<key key0="c" key1="accent_cedille" key2="&lt;" key3="."/>
<key key0="v" key2="&gt;" key3=","/>
<key key0="b" key2="\?" key3="/" key4="¿"/>
<key key0="n" key1="accent_tilde" key2=":" key3=";"/>
<key key0="m" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

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

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="ㅂ" key2="1" key4="esc"/>
<key key0="ㅈ" key1="~" key2="2" key3="\@"/>
<key key0="ㄷ" key1="!" key2="3" key3="\#" key4="€"/>
<key key0="ㄱ" key2="4" key3="$"/>
<key key0="ㅅ" key2="5" key3="%"/>
<key key0="ㅛ" key2="6" key3="^"/>
<key key0="ㅕ" key2="7" key3="&amp;"/>
<key key0="ㅑ" key2="8" key3="*"/>
<key key0="ㅐ" key2="9" key3="(" key4=")"/>
<key key0="ㅔ" key1="0" key3="f11_placeholder" key4="f12_placeholder"/>
</row>
<row>
<key shift="0.5" key0="ㅁ" key1="tab" key2="`"/>
<key key0="ㄴ" key3="ß"/>
<key key0="ㅇ" key2="£"/>
<key key0="ㄹ"/>
<key key0="ㅎ" key2="-" key3="_"/>
<key key0="ㅗ" key2="=" key3="+"/>
<key key0="ㅓ" key4="}" key3="{"/>
<key key0="ㅏ" key3="[" key4="]"/>
<key key0="ㅣ" key2="|" key3="\\"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="ㅋ"/>
<key key0="ㅌ"/>
<key key0="ㅊ" key2="&lt;" key3="."/>
<key key0="ㅍ" key2="&gt;" key3=","/>
<key key0="ㅠ" key2="\?" key3="/"/>
<key key0="ㅜ" key2=":" key3=";"/>
<key key0="ㅡ" key2="&quot;" key3="'"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

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

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="~" key2="2" key3="\@" key4="!"/>
<key key0="e" key1="ē" key2="3" key3="\#" key4="€"/>
<key key0="r" key1="ŗ" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="y" key2="6" key3="^"/>
<key key0="u" key1="ū" key2="7" key3="&amp;" key4="*"/>
<key key0="i" key1="ī" key2="8" key3="(" key4=")"/>
<key key0="o" key1="ō" key2="9" key3="{" key4="}"/>
<key key0="p" key1="0"/>
</row>
<row>
<key shift="0.5" key0="a" key1="ā" key2="tab"/>
<key key0="s" key1="š" key3="ß"/>
<key key0="d" key2="£"/>
<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"/>
<key key0="z" key1="ž"/>
<key key0="x"/>
<key key0="c" key1="č"/>
<key key0="v"/>
<key key0="b" key2="\?" key3="&lt;" key4="&gt;"/>
<key key0="n" key1="ņ" key2="`" key3=":" key4=";"/>
<key key0="m" key1="'" key2="&quot;" key3="," key4="."/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

38
res/xml/qwerty_pt.xml Normal file
View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="~" key2="2" key3="\@" key4="!"/>
<key key0="e" key1="£" key2="3" key3="\#" key4="€"/>
<key key0="r" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="y" key1="accent_caron" key2="6" key3="^" key4="accent_trema"/>
<key key0="u" key2="7" key3="&amp;"/>
<key key0="i" key2="8" key3="*"/>
<key key0="o" key2="9" key3="(" key4=")"/>
<key key0="p" key1="0" key3="\\"/>
</row>
<row>
<key key0="a" key2="tab" key4="`"/>
<key key0="s" key1="'" key3="ß" key4="accent_cedille"/>
<key key0="d" key1="&quot;" key2="accent_ring"/>
<key key0="f" key2="accent_caron"/>
<key key0="g"/>
<key key0="h"/>
<key key0="j" key1="-" key2="=" key4="+" key3="_"/>
<key key0="k" key1="accent_grave" key2="accent_aigu" key3="accent_tilde" key4="accent_circonflexe"/>
<key key0="l" key1="[" key2="]" key3="{" key4="}"/>
<key key0="ç" key1="|"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="z"/>
<key key0="x"/>
<key key0="c"/>
<key key0="v"/>
<key key0="b"/>
<key key0="n" key1="&lt;" key2="&gt;" key3="," key4="."/>
<key key0="m" key1=":" key2=";" key3="/" key4="\?"/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

41
res/xml/qwerty_sv_se.xml Normal file
View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="q" key4="esc" key2="1"/>
<key key0="w" key2="2" key3="`" key4="\@"/>
<key key0="e" key2="3" key4="\#" key3="€"/>
<key key0="r" key2="4" key4="$"/>
<key key0="t" key2="5" key3="&amp;" key4="|"/>
<key key0="y" key2="6" key3="^" key4="%"/>
<key key0="u" key2="7" key3="~" key4="\\"/>
<key key0="i" key2="8" key3="*" key4="/"/>
<key key0="o" key2="9" key3="+" key4="-"/>
<key key0="p" key2="0" key3="=" key4="f11_placeholder"/>
<key key0="å" key1="\?" key3="!" key4="f12_placeholder"/>
</row>
<row>
<key key0="a" key2="tab"/>
<key key0="s" key1="accent_ring" key2="accent_cedille" key3="ß" key4="accent_tilde"/>
<key key0="d" key1="accent_grave" key2="accent_caron" key3="accent_aigu"/>
<key key0="f" key1="accent_trema" key2="accent_circonflexe"/>
<key key0="g"/>
<key key0="h"/>
<key key0="j" key1="{" key4="}"/>
<key key0="k" key1="[" key4="]"/>
<key key0="l" key1="(" key4=")"/>
<key key0="ö" key1="&lt;" key4="&gt;"/>
<key key0="ä" key1="'" key3="&quot;"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="z"/>
<key key0="x"/>
<key key0="c"/>
<key key0="v"/>
<key key0="b" key2=";" key4=","/>
<key key0="n" key2=":" key4="."/>
<key key0="m" key2="-" key4="_"/>
<key width="1.0" key0="." key1="!" key2="\?" key3="'" key4=","/>
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

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

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
<key key0="q" key2="1" key4="esc"/>
<key key0="w" key1="^" key2="2" key3="&quot;" key4="\@"/>
<key key0="e" key1="§" key2="3" key3="!" key4="€"/>
<key key0="r" key2="4" key3="$" key4="f11_placeholder"/>
<key key0="t" key2="5" key3="%" key4="f12_placeholder"/>
<key key0="z" key2="6" key3="&amp;" key4="{"/>
<key key0="u" key2="7" key3="ü" key4="}"/>
<key key0="i" key1="(" key2="8" key3="[" key4="]"/>
<key key0="o" key1=")" key2="9" key3="ö" key4="="/>
<key key0="p" key1="0" key3="\?"/>
</row>
<row>
<key shift="0.5" key0="a" key1="tab" key2="`" key3="ä"/>
<key key0="s" key3="ß"/>
<key key0="d" key2="£"/>
<key key0="f" key1="~"/>
<key key0="g" key3="-"/>
<key key0="h" key3="+"/>
<key key0="j" key3="*"/>
<key key0="k" key3="/" key4="\\"/>
<key key0="l" key1="'" key3="\#"/>
</row>
<row>
<key width="1.5" key0="shift"/>
<key key0="y" key1="&gt;" key2="|" key3="&lt;"/>
<key key0="x"/>
<key key0="c"/>
<key key0="v" />
<key key0="b" key1=";" key3=","/>
<key key0="n" key1=":" key3="."/>
<key key0="m" key1="_" />
<key width="1.5" key0="backspace" key2="delete"/>
</row>
</keyboard>

View File

@@ -1,102 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/pref_category_layout">
<ListPreference
android:key="layout"
android:title="@string/pref_layout_title"
android:summary="@string/pref_layout_summary"
android:defaultValue="system"
android:entries="@array/pref_layout_entries"
android:entryValues="@array/pref_layout_values" />
/>
<ListPreference
android:key="accents"
android:title="@string/pref_accents_title"
android:summary="@string/pref_accents_summary"
android:defaultValue="@string/pref_accents_default"
android:entries="@array/pref_accents_entries"
android:entryValues="@array/pref_accents_values" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_typing">
<juloo.common.SlideBarPreference
android:key="sub_value_dist"
android:title="@string/pref_preci_title"
android:summary="@string/pref_preci_summary"
android:defaultValue="10.0"
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="60"
/>
<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>
<PreferenceCategory android:title="@string/pref_category_layout">
<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"/>
<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"/>
<ListPreference android:key="programming_layout" android:title="@string/pref_programming_layout_title" android:summary="%s" android:defaultValue="none" android:entries="@array/pref_programming_layout_entries" android:entryValues="@array/pref_programming_layout_values"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_typing">
<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"/>
<juloo.common.IntSlideBarPreference android:key="longpress_timeout" android:title="@string/pref_long_timeout_title" android:summary="%sms" android:defaultValue="600" min="50" max="2000"/>
<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"/>
<PreferenceScreen android:title="@string/pref_lockable_keys_title" android:summary="@string/pref_lockable_keys_summary">
<CheckBoxPreference android:key="lockable_shift" android:title="Shift" android:defaultValue="true"/>
<CheckBoxPreference android:key="lockable_ctrl" android:title="Ctrl" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_alt" android:title="Alt" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_fn" android:title="Fn" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_meta" android:title="Meta" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_sup" android:title="Sup" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_sub" android:title="Sub" android:defaultValue="false"/>
<CheckBoxPreference android:key="lockable_box" android:title="Box" android:defaultValue="false"/>
</PreferenceScreen>
</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="%sms" android:defaultValue="20" min="5" max="100"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/pref_category_style">
<ListPreference android:key="theme" android:title="@string/pref_theme" android:summary="%s" android:defaultValue="system" android:entries="@array/pref_theme_entries" android:entryValues="@array/pref_theme_values"/>
<juloo.common.IntSlideBarPreference android:key="margin_bottom" android:title="@string/pref_margin_bottom_title" android:summary="%sdp" android:defaultValue="5" min="0" max="100"/>
<juloo.common.IntSlideBarPreference android:key="keyboard_height" android:title="@string/pref_keyboard_height_title" android:summary="%s%%" android:defaultValue="35" min="25" max="50"/>
<juloo.common.IntSlideBarPreference android:key="horizontal_margin" android:title="@string/pref_horizontal_margin_title" android:summary="%sdp" 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"/>
<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"/>
<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"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -4,17 +4,16 @@
} }:
let
jdk = pkgs.openjdk8;
android = pkgs.androidenv.composeAndroidPackages {
platformVersions = [ "29" ];
buildToolsVersions = [ "30.0.3" ];
platformVersions = [ "30" ];
abiVersions = [ "armeabi-v7a" ];
};
in
pkgs.mkShell {
buildInputs = with pkgs; [
findutils openjdk8 android.androidsdk
];
buildInputs = [ pkgs.findutils jdk android.androidsdk pkgs.fontforge ];
ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
}

View File

@@ -11,106 +11,110 @@ import android.widget.TextView;
import android.widget.SeekBar;
/*
** IntSlideBarPreference
** -
** Open a dialog showing a seekbar
** -
** xml attrs:
** android:defaultValue Default value (int)
** min min value (int)
** max max value (int)
** -
** Summary field allow to show the current value using %s flag
*/
** IntSlideBarPreference
** -
** Open a dialog showing a seekbar
** -
** xml attrs:
** android:defaultValue Default value (int)
** min min value (int)
** max max value (int)
** -
** Summary field allow to show the current value using %s flag
*/
public class IntSlideBarPreference extends DialogPreference
implements SeekBar.OnSeekBarChangeListener
implements SeekBar.OnSeekBarChangeListener
{
private LinearLayout _layout;
private TextView _textView;
private SeekBar _seekBar;
private LinearLayout _layout;
private TextView _textView;
private SeekBar _seekBar;
private int _min;
private int _min;
private String _initialSummary;
private String _initialSummary;
public IntSlideBarPreference(Context context, AttributeSet attrs)
{
super(context, attrs);
_initialSummary = getSummary().toString();
_textView = new TextView(context);
_textView.setPadding(48, 40, 48, 40);
_seekBar = new SeekBar(context);
_seekBar.setOnSeekBarChangeListener(this);
_min = attrs.getAttributeIntValue(null, "min", 0);
int max = attrs.getAttributeIntValue(null, "max", 0);
_seekBar.setMax(max - _min);
_layout = new LinearLayout(getContext());
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.addView(_textView);
_layout.addView(_seekBar);
}
public IntSlideBarPreference(Context context, AttributeSet attrs)
{
super(context, attrs);
_initialSummary = getSummary().toString();
_textView = new TextView(context);
_textView.setPadding(48, 40, 48, 40);
_seekBar = new SeekBar(context);
_seekBar.setOnSeekBarChangeListener(this);
_min = attrs.getAttributeIntValue(null, "min", 0);
int max = attrs.getAttributeIntValue(null, "max", 0);
_seekBar.setMax(max - _min);
_layout = new LinearLayout(getContext());
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.addView(_textView);
_layout.addView(_seekBar);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
updateText();
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
updateText();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
@Override
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
{
int value;
@Override
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
{
int value;
if (restorePersistedValue)
{
value = getPersistedInt(_min);
}
else
{
value = (Integer)defaultValue;
persistInt(value);
}
_seekBar.setProgress(value - _min);
updateText();
}
if (restorePersistedValue)
{
value = getPersistedInt(_min);
}
else
{
value = (Integer)defaultValue;
persistInt(value);
}
_seekBar.setProgress(value - _min);
updateText();
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index)
{
return (a.getInt(index, _min));
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index)
{
return (a.getInt(index, _min));
}
@Override
protected void onDialogClosed(boolean positiveResult)
{
if (positiveResult)
persistInt(_seekBar.getProgress() + _min);
}
@Override
protected void onDialogClosed(boolean positiveResult)
{
if (positiveResult)
persistInt(_seekBar.getProgress() + _min);
else
_seekBar.setProgress(getPersistedInt(_min) - _min);
protected View onCreateDialogView()
{
ViewGroup parent = (ViewGroup)_layout.getParent();
updateText();
}
if (parent != null)
parent.removeView(_layout);
return (_layout);
}
protected View onCreateDialogView()
{
ViewGroup parent = (ViewGroup)_layout.getParent();
private void updateText()
{
String f = String.format(_initialSummary, _seekBar.getProgress() + _min);
if (parent != null)
parent.removeView(_layout);
return (_layout);
}
_textView.setText(f);
setSummary(f);
}
private void updateText()
{
String f = String.format(_initialSummary, _seekBar.getProgress() + _min);
_textView.setText(f);
setSummary(f);
}
}

View File

@@ -11,117 +11,121 @@ import android.widget.TextView;
import android.widget.SeekBar;
/*
** SideBarPreference
** -
** Open a dialog showing a seekbar
** -
** xml attrs:
** android:defaultValue Default value (float)
** min min value (float)
** max max value (float)
** -
** Summary field allow to show the current value using %f or %s flag
*/
** SideBarPreference
** -
** Open a dialog showing a seekbar
** -
** xml attrs:
** android:defaultValue Default value (float)
** min min value (float)
** max max value (float)
** -
** Summary field allow to show the current value using %f or %s flag
*/
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 TextView _textView;
private SeekBar _seekBar;
private LinearLayout _layout;
private TextView _textView;
private SeekBar _seekBar;
private float _min;
private float _max;
private float _value;
private float _min;
private float _max;
private float _value;
private String _initialSummary;
private String _initialSummary;
public SlideBarPreference(Context context, AttributeSet attrs)
{
super(context, attrs);
_initialSummary = getSummary().toString();
_textView = new TextView(context);
_textView.setPadding(48, 40, 48, 40);
_seekBar = new SeekBar(context);
_seekBar.setOnSeekBarChangeListener(this);
_seekBar.setMax(STEPS);
_min = float_of_string(attrs.getAttributeValue(null, "min"));
_value = _min;
_max = Math.max(1f, float_of_string(attrs.getAttributeValue(null, "max")));
_layout = new LinearLayout(getContext());
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.addView(_textView);
_layout.addView(_seekBar);
}
public SlideBarPreference(Context context, AttributeSet attrs)
{
super(context, attrs);
_initialSummary = getSummary().toString();
_textView = new TextView(context);
_textView.setPadding(48, 40, 48, 40);
_seekBar = new SeekBar(context);
_seekBar.setOnSeekBarChangeListener(this);
_seekBar.setMax(STEPS);
_min = float_of_string(attrs.getAttributeValue(null, "min"));
_value = _min;
_max = Math.max(1f, float_of_string(attrs.getAttributeValue(null, "max")));
_layout = new LinearLayout(getContext());
_layout.setOrientation(LinearLayout.VERTICAL);
_layout.addView(_textView);
_layout.addView(_seekBar);
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
_value = Math.round(progress * (_max - _min)) / (float)STEPS + _min;
updateText();
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
_value = Math.round(progress * (_max - _min)) / (float)STEPS + _min;
updateText();
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStartTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
@Override
public void onStopTrackingTouch(SeekBar seekBar)
{
}
@Override
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
{
if (restorePersistedValue)
{
_value = getPersistedFloat(_min);
}
else
{
_value = (Float)defaultValue;
persistFloat(_value);
}
_seekBar.setProgress((int)((_value - _min) * STEPS / (_max - _min)));
updateText();
}
@Override
protected void onSetInitialValue(boolean restorePersistedValue, Object defaultValue)
{
if (restorePersistedValue)
{
_value = getPersistedFloat(_min);
}
else
{
_value = (Float)defaultValue;
persistFloat(_value);
}
_seekBar.setProgress((int)((_value - _min) * STEPS / (_max - _min)));
updateText();
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index)
{
return (a.getFloat(index, _min));
}
@Override
protected Object onGetDefaultValue(TypedArray a, int index)
{
return (a.getFloat(index, _min));
}
@Override
protected void onDialogClosed(boolean positiveResult)
{
if (positiveResult)
persistFloat(_value);
}
@Override
protected void onDialogClosed(boolean positiveResult)
{
if (positiveResult)
persistFloat(_value);
else
_seekBar.setProgress((int)((getPersistedFloat(_min) - _min) * STEPS / (_max - _min)));
protected View onCreateDialogView()
{
ViewGroup parent = (ViewGroup)_layout.getParent();
updateText();
}
if (parent != null)
parent.removeView(_layout);
return (_layout);
}
protected View onCreateDialogView()
{
ViewGroup parent = (ViewGroup)_layout.getParent();
private void updateText()
{
String f = String.format(_initialSummary, _value);
if (parent != null)
parent.removeView(_layout);
return (_layout);
}
_textView.setText(f);
setSummary(f);
}
private void updateText()
{
String f = String.format(_initialSummary, _value);
private static float float_of_string(String str)
{
if (str == null)
return (0f);
return (Float.parseFloat(str));
}
_textView.setText(f);
setSummary(f);
}
private static float float_of_string(String str)
{
if (str == null)
return (0f);
return (Float.parseFloat(str));
}
}

View File

@@ -1,124 +1,260 @@
package juloo.keyboard2;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.Configuration;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.KeyEvent;
import java.util.Set;
import java.util.HashSet;
class Config
final class Config
{
private Keyboard2 _context;
// From resources
public final float marginTop;
public final float keyPadding;
public final float keyVerticalInterval;
public final float keyHorizontalInterval;
public final float keyRound;
public final float marginTop;
public final float keyPadding;
public final float labelTextSize;
public final float sublabelTextSize;
// From preferences
public int layout; // Or '-1' for the system defaults
public float subValueDist;
public boolean vibrateEnabled;
public long vibrateDuration;
public long longPressTimeout;
public long longPressInterval;
public float marginBottom;
public float keyHeight;
public float horizontalMargin;
public int programming_layout; // Or '-1' for none
public float swipe_dist_px;
public boolean vibrateEnabled;
public long vibrateDuration;
public long longPressTimeout;
public long longPressInterval;
public float marginBottom;
public float keyHeight;
public float horizontalMargin;
public float keyVerticalInterval;
public float keyHorizontalInterval;
public boolean preciseRepeat;
public int lockable_modifiers;
public float characterSize; // Ratio
public int accents; // Values are R.values.pref_accents_v_*
public int theme; // Values are R.style.*
// Dynamically set
public boolean shouldOfferSwitchingToNextInputMethod;
public int accent_flags_to_remove;
public boolean shouldOfferSwitchingToProgramming;
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 Set<String> extra_keys; // 'null' means all the keys
public Config(Keyboard2 context)
{
Resources res = context.getResources();
public final IKeyEventHandler handler;
_context = context;
// static values
marginTop = res.getDimension(R.dimen.margin_top);
keyPadding = res.getDimension(R.dimen.key_padding);
keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval);
keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval);
keyRound = res.getDimension(R.dimen.key_round);
// default values
private Config(Context context, IKeyEventHandler h)
{
Resources res = context.getResources();
// static values
marginTop = res.getDimension(R.dimen.margin_top);
keyPadding = res.getDimension(R.dimen.key_padding);
labelTextSize = Float.valueOf(res.getString(R.integer.label_text_size));
sublabelTextSize = Float.valueOf(res.getString(R.integer.sublabel_text_size));
// default values
layout = -1;
subValueDist = 10f;
vibrateEnabled = true;
vibrateDuration = 20;
longPressTimeout = 600;
longPressInterval = 65;
marginBottom = res.getDimension(R.dimen.margin_bottom);
keyHeight = res.getDimension(R.dimen.key_height);
horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
programming_layout = -1;
vibrateEnabled = true;
vibrateDuration = 20;
longPressTimeout = 600;
longPressInterval = 65;
marginBottom = res.getDimension(R.dimen.margin_bottom);
keyHeight = res.getDimension(R.dimen.key_height);
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;
characterSize = 1.f;
accents = 1;
// from prefs
refresh();
// from prefs
refresh(context);
// initialized later
shouldOfferSwitchingToNextInputMethod = false;
accent_flags_to_remove = 0;
}
shouldOfferSwitchingToProgramming = false;
actionLabel = null;
actionId = 0;
swapEnterActionKey = false;
extra_keys = null;
handler = h;
}
/*
** Reload prefs
*/
public void refresh()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_context);
layout = layoutId_of_string(prefs.getString("layout", "system"));
subValueDist = prefs.getFloat("sub_value_dist", subValueDist);
vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
marginBottom = getDipPref(prefs, "margin_bottom", marginBottom);
keyHeight = getDipPref(prefs, "key_height", keyHeight);
horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
/*
** Reload prefs
*/
public void refresh(Context context)
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
Resources res = context.getResources();
DisplayMetrics dm = res.getDisplayMetrics();
// The height of the keyboard is relative to the height of the screen. This
// is not the actual size of the keyboard, which will be bigger if the
// layout has a fifth row.
int keyboardHeightPercent;
if (res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) // Landscape mode
{
keyboardHeightPercent = 55;
}
else
{
keyboardHeightPercent = prefs.getInt("keyboard_height", 35);
}
String layout_s = prefs.getString("layout", "system");
layout = layout_s.equals("system") ? -1 : layoutId_of_string(layout_s);
String prog_layout_s = prefs.getString("programming_layout", "none");
programming_layout = prog_layout_s.equals("none") ? -1 : layoutId_of_string(prog_layout_s);
// The swipe distance is defined relatively to the "exact physical pixels
// per inch of the screen", which isn't affected by the scaling settings.
// Take the mean of both dimensions as an approximation of the diagonal.
float physical_scaling = (dm.widthPixels + dm.heightPixels) / (dm.xdpi + dm.ydpi);
swipe_dist_px = Float.valueOf(prefs.getString("swipe_dist", "15")) * physical_scaling;;
vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
marginBottom = getDipPref(dm, prefs, "margin_bottom", marginBottom);
keyVerticalInterval = getDipPref(dm, prefs, "key_vertical_space", keyVerticalInterval);
keyHorizontalInterval = getDipPref(dm, prefs, "key_horizontal_space", keyHorizontalInterval);
// Do not substract keyVerticalInterval from keyHeight because this is done
// during rendered.
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + res.getDimension(R.dimen.extra_horizontal_margin);
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
characterSize = prefs.getFloat("character_size", characterSize);
lockable_modifiers =
(prefs.getBoolean("lockable_shift", true) ? KeyValue.FLAG_SHIFT : 0)
| (prefs.getBoolean("lockable_ctrl", false) ? KeyValue.FLAG_CTRL : 0)
| (prefs.getBoolean("lockable_alt", false) ? KeyValue.FLAG_ALT : 0)
| (prefs.getBoolean("lockable_fn", false) ? KeyValue.FLAG_FN : 0)
| (prefs.getBoolean("lockable_meta", false) ? KeyValue.FLAG_META : 0)
| (prefs.getBoolean("lockable_sup", false) ? KeyValue.FLAG_ACCENT_SUPERSCRIPT : 0)
| (prefs.getBoolean("lockable_sub", false) ? KeyValue.FLAG_ACCENT_SUBSCRIPT : 0)
| (prefs.getBoolean("lockable_box", false) ? KeyValue.FLAG_ACCENT_BOX : 0);
characterSize = prefs.getFloat("character_size", characterSize);
accents = Integer.valueOf(prefs.getString("accents", "1"));
}
theme = getThemeId(res, prefs.getString("theme", ""));
}
private float getDipPref(SharedPreferences prefs, String pref_name, float def)
{
int value = prefs.getInt(pref_name, -1);
/** Update the layout according to the configuration.
* - Remove the switching key if it isn't needed
* - Remove keys from other locales (not in 'extra_keys')
* - Replace the action key to show the right label
* - Swap the enter and action keys
*/
public KeyboardData modify_layout(KeyboardData kw)
{
// Update the name to avoid caching in KeyModifier
final KeyValue action_key = (actionLabel == null) ? null :
KeyValue.getKeyByName("action").withNameAndSymbol(actionLabel, actionLabel);
return kw.replaceKeys(new KeyboardData.MapKeys() {
public KeyValue apply(KeyValue key)
{
if (key == null)
return null;
switch (key.eventCode)
{
case KeyValue.EVENT_CHANGE_METHOD:
return shouldOfferSwitchingToNextInputMethod ? key : null;
case KeyEvent.KEYCODE_ENTER:
return (swapEnterActionKey && action_key != null) ? action_key : key;
case KeyValue.EVENT_ACTION:
return (swapEnterActionKey && action_key != null) ?
KeyValue.getKeyByName("enter") : action_key;
case KeyValue.EVENT_SWITCH_PROGRAMMING:
return shouldOfferSwitchingToProgramming ? key : null;
default:
if (key.flags != 0)
{
if ((key.flags & KeyValue.FLAG_LOCALIZED) != 0 &&
extra_keys != null &&
!extra_keys.contains(key.name))
return null;
if ((key.flags & lockable_modifiers) != 0)
return key.withFlags(key.flags | KeyValue.FLAG_LOCK);
}
return key;
}
}
});
}
if (value < 0)
return (def);
return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value,
_context.getResources().getDisplayMetrics()));
}
private float getDipPref(DisplayMetrics dm, SharedPreferences prefs, String pref_name, float def)
{
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));
}
private int getThemeId(Resources res, String theme_name)
{
switch (theme_name)
{
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)
{
switch (name)
{
case "azerty": return R.xml.azerty;
case "bgph1": return R.xml.local_bgph1;
case "dvorak": return R.xml.dvorak;
case "qwerty_es": return R.xml.qwerty_es;
case "qwerty_ko": return R.xml.qwerty_ko;
case "qwerty_lv": return R.xml.qwerty_lv;
case "qwerty_pt": return R.xml.qwerty_pt;
case "qwerty": return R.xml.qwerty;
case "system": return -1;
default: throw new IllegalArgumentException();
case "qwerty_sv_se": return R.xml.qwerty_sv_se;
case "qwertz": return R.xml.qwertz;
case "ru_jcuken": return R.xml.local_ru_jcuken;
default: return R.xml.qwerty; // The config might store an invalid layout, don't crash
}
}
/* Used for the accents option. */
public static int accentFlag_of_name(String name)
public static int themeId_of_string(String name)
{
switch (name)
{
case "grave": return KeyValue.FLAG_ACCENT1;
case "aigu": return KeyValue.FLAG_ACCENT2;
case "circonflexe": return KeyValue.FLAG_ACCENT3;
case "tilde": return KeyValue.FLAG_ACCENT4;
case "cedille": return KeyValue.FLAG_ACCENT5;
case "trema": return KeyValue.FLAG_ACCENT6;
default: throw new RuntimeException(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);
}
}

View File

@@ -10,35 +10,35 @@ import java.util.HashMap;
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>();
protected Emoji(String name, String bytecode, String desc)
{
super(name, bytecode, CHAR_NONE, EVENT_NONE, 0);
_desc = desc;
protected Emoji(String name, String bytecode, String desc)
{
super(name, bytecode, CHAR_NONE, EVENT_NONE, 0);
_desc = desc;
emojis_by_name.put(name, this);
}
}
public String getDescription()
{
return (_desc);
}
public String getDescription()
{
return (_desc);
}
public static int num_groups = 0;
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);
}
}
public static Emoji[] getEmojisByGroup(int group_id)
{
return (emojis_by_group[group_id]);
}
public static Emoji[] getEmojisByGroup(int group_id)
{
return (emojis_by_group[group_id]);
}
/* Read the list of emojis from a raw file. Will initialize only once. */
public static void init(Resources res)

View File

@@ -19,158 +19,154 @@ import java.util.Set;
import java.util.HashSet;
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 float EMOJI_SIZE = 32.f;
public static final int COLUMN_WIDTH = 192;
private static final String LAST_USE_PREF = "emoji_last_use";
private static final String LAST_USE_PREF = "emoji_last_use";
private Emoji[] _emojiArray;
private HashMap<Emoji, Integer> _lastUsed;
private Emoji[] _emojiArray;
private HashMap<Emoji, Integer> _lastUsed;
/*
** TODO: adapt column width and emoji size
** TODO: use ArraySet instead of Emoji[]
*/
public EmojiGridView(Context context, AttributeSet attrs)
{
super(context, attrs);
/*
** TODO: adapt column width and emoji size
** TODO: use ArraySet instead of Emoji[]
*/
public EmojiGridView(Context context, AttributeSet attrs)
{
super(context, attrs);
Emoji.init(context.getResources());
setOnItemClickListener(this);
setColumnWidth(COLUMN_WIDTH);
loadLastUsed();
setEmojiGroup((_lastUsed.size() == 0) ? 0 : GROUP_LAST_USE);
}
setOnItemClickListener(this);
setColumnWidth(COLUMN_WIDTH);
loadLastUsed();
setEmojiGroup((_lastUsed.size() == 0) ? 0 : GROUP_LAST_USE);
}
public void setEmojiGroup(int group)
{
_emojiArray = (group == GROUP_LAST_USE) ? getLastEmojis() : Emoji.getEmojisByGroup(group);
setAdapter(new EmojiViewAdpater((Keyboard2)getContext(), _emojiArray));
}
public void setEmojiGroup(int group)
{
_emojiArray = (group == GROUP_LAST_USE) ? getLastEmojis() : Emoji.getEmojisByGroup(group);
setAdapter(new EmojiViewAdpater(getContext(), _emojiArray));
}
public void onItemClick(AdapterView<?> parent, View v, int pos, long id)
{
Keyboard2 main = (Keyboard2)getContext();
Integer used = _lastUsed.get(_emojiArray[pos]);
public void onItemClick(AdapterView<?> parent, View v, int pos, long id)
{
Config config = Config.globalConfig();
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);
main.handleKeyUp(_emojiArray[pos], 0);
saveLastUsed(); // TODO: opti
}
@Override
public void onMeasure(int wSpec, int hSpec)
{
super.onMeasure(wSpec, hSpec);
setNumColumns(getMeasuredWidth() / COLUMN_WIDTH);
}
@Override
public void onMeasure(int wSpec, int hSpec)
{
super.onMeasure(wSpec, hSpec);
setNumColumns(getMeasuredWidth() / COLUMN_WIDTH);
}
private Emoji[] getLastEmojis()
{
final HashMap<Emoji, Integer> map = _lastUsed;
Emoji[] array = new Emoji[map.size()];
private Emoji[] getLastEmojis()
{
final HashMap<Emoji, Integer> map = _lastUsed;
Emoji[] array = new Emoji[map.size()];
map.keySet().toArray(array);
Arrays.sort(array, 0, array.length, new Comparator<Emoji>()
{
public int compare(Emoji a, Emoji b)
{
return (map.get(b).intValue() - map.get(a).intValue());
}
});
return (array);
}
map.keySet().toArray(array);
Arrays.sort(array, 0, array.length, new Comparator<Emoji>()
{
public int compare(Emoji a, Emoji b)
{
return (map.get(b).intValue() - map.get(a).intValue());
}
});
return (array);
}
private void saveLastUsed()
{
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
HashSet<String> set = new HashSet<String>();
private void saveLastUsed()
{
SharedPreferences.Editor edit = PreferenceManager.getDefaultSharedPreferences(getContext()).edit();
HashSet<String> set = new HashSet<String>();
for (Emoji emoji : _lastUsed.keySet())
set.add(String.valueOf(_lastUsed.get(emoji)) + "-" + emoji.name);
edit.putStringSet(LAST_USE_PREF, set);
edit.apply();
}
for (Emoji emoji : _lastUsed.keySet())
set.add(String.valueOf(_lastUsed.get(emoji)) + "-" + emoji.name);
edit.putStringSet(LAST_USE_PREF, set);
edit.apply();
}
private void loadLastUsed()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
Set<String> lastUseSet = prefs.getStringSet(LAST_USE_PREF, null);
private void loadLastUsed()
{
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
Set<String> lastUseSet = prefs.getStringSet(LAST_USE_PREF, null);
_lastUsed = new HashMap<Emoji, Integer>();
if (lastUseSet != null)
for (String emojiData : lastUseSet)
{
String[] data = emojiData.split("-", 2);
Emoji emoji;
_lastUsed = new HashMap<Emoji, Integer>();
if (lastUseSet != null)
for (String emojiData : lastUseSet)
{
String[] data = emojiData.split("-", 2);
Emoji emoji;
if (data.length != 2)
continue ;
emoji = Emoji.getEmojiByName(data[1]);
if (emoji == null)
continue ;
_lastUsed.put(emoji, Integer.valueOf(data[0]));
}
}
if (data.length != 2)
continue ;
emoji = Emoji.getEmojiByName(data[1]);
if (emoji == null)
continue ;
_lastUsed.put(emoji, Integer.valueOf(data[0]));
}
}
private static class EmojiView extends TextView
{
public EmojiView(Context context)
{
super(context);
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 EmojiView(Keyboard2 context)
{
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)
{
setText(emoji.symbol);
}
}
public void setEmoji(Emoji emoji)
{
setText(emoji.symbol);
}
}
private static class EmojiViewAdpater extends BaseAdapter
{
private Context _context;
private static class EmojiViewAdpater extends BaseAdapter
{
private Keyboard2 _main;
private Emoji[] _emojiArray;
private Emoji[] _emojiArray;
public EmojiViewAdpater(Context context, Emoji[] emojiArray)
{
_context = context;
_emojiArray = emojiArray;
}
public EmojiViewAdpater(Keyboard2 main, Emoji[] emojiArray)
{
_main = main;
_emojiArray = emojiArray;
}
public int getCount()
{
if (_emojiArray == null)
return (0);
return (_emojiArray.length);
}
public int getCount()
{
if (_emojiArray == null)
return (0);
return (_emojiArray.length);
}
public Object getItem(int pos)
{
return (_emojiArray[pos]);
}
public Object getItem(int pos)
{
return (_emojiArray[pos]);
}
public long getItemId(int pos)
{
return (pos);
}
public long getItemId(int pos)
{
return (pos);
}
public View getView(int pos, View convertView, ViewGroup parent)
{
EmojiView view = (EmojiView)convertView;
public View getView(int pos, View convertView, ViewGroup parent)
{
EmojiView view = (EmojiView)convertView;
if (view == null)
view = new EmojiView(_main);
view.setEmoji(_emojiArray[pos]);
return (view);
}
}
if (view == null)
view = new EmojiView(_context);
view.setEmoji(_emojiArray[pos]);
return (view);
}
}
}

View File

@@ -6,24 +6,23 @@ import android.view.View;
import android.widget.Button;
public class EmojiKeyButton extends Button
implements View.OnClickListener
implements View.OnClickListener
{
KeyValue _key;
KeyValue _key;
public EmojiKeyButton(Context context, AttributeSet attrs)
{
super(context, attrs);
setOnClickListener(this);
_key = KeyValue.getKeyByName(attrs.getAttributeValue(null, "key"));
setText(_key.symbol);
if ((_key.flags & KeyValue.FLAG_KEY_FONT) != 0)
setTypeface(((Keyboard2)context).getSpecialKeyFont());
}
public EmojiKeyButton(Context context, AttributeSet attrs)
{
super(context, attrs);
setOnClickListener(this);
_key = KeyValue.getKeyByName(attrs.getAttributeValue(null, "key"));
setText(_key.symbol);
if ((_key.flags & KeyValue.FLAG_KEY_FONT) != 0)
setTypeface(Theme.getSpecialKeyFont(context));
}
public void onClick(View v)
{
Keyboard2 main = (Keyboard2)getContext();
main.handleKeyUp(_key, 0);
}
public void onClick(View v)
{
Config config = Config.globalConfig();
config.handler.handleKeyUp(_key, 0);
}
}

View File

@@ -10,28 +10,28 @@ import android.widget.Button;
/* Emoji "types" are groups. This class is misnamed. */
public class EmojiTypeButton extends Button
implements View.OnTouchListener
implements View.OnTouchListener
{
private int _emojiType;
private int _emojiType;
static private final int DEFAULT_GROUP = 0;
public EmojiTypeButton(Context context, int group_id, String symbol)
{
super(new ContextThemeWrapper(context, R.style.emojiTypeButton), null, 0);
public EmojiTypeButton(Context context, int group_id, String symbol)
{
super(new ContextThemeWrapper(context, R.style.emojiTypeButton), null, 0);
_emojiType = group_id;
setText(symbol);
setOnTouchListener(this);
}
setText(symbol);
setOnTouchListener(this);
}
public boolean onTouch(View view, MotionEvent event)
{
EmojiGridView emojiGrid;
public boolean onTouch(View view, MotionEvent event)
{
EmojiGridView emojiGrid;
if (event.getAction() != MotionEvent.ACTION_DOWN)
return (false);
emojiGrid = (EmojiGridView)((ViewGroup)(getParent().getParent())).findViewById(R.id.emoji_grid);
emojiGrid.setEmojiGroup(_emojiType);
return (true);
}
if (event.getAction() != MotionEvent.ACTION_DOWN)
return (false);
emojiGrid = (EmojiGridView)((ViewGroup)(getParent().getParent())).findViewById(R.id.emoji_grid);
emojiGrid.setEmojiGroup(_emojiType);
return (true);
}
}

View File

@@ -0,0 +1,104 @@
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)
{
if (key == null || (key.flags & KeyValue.FLAG_NOCHAR) != 0)
return;
switch (key.eventCode)
{
case KeyValue.EVENT_CONFIG: _recv.showKeyboardConfig(); return;
case KeyValue.EVENT_SWITCH_TEXT: _recv.switchMain(); return;
case KeyValue.EVENT_SWITCH_NUMERIC: _recv.switchNumeric(); 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;
case KeyValue.EVENT_SWITCH_PROGRAMMING: _recv.switchProgramming(); return;
default:
if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT | KeyValue.FLAG_META)) != 0)
handleKeyUpWithModifier(key, flags);
else if (key.char_ != KeyValue.CHAR_NONE)
_recv.commitChar(key.char_);
else if (key.eventCode != KeyValue.EVENT_NONE)
handleKeyUpWithModifier(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 int sendMetaKey(int eventCode, int metaFlags, int metaState, boolean down)
{
int action;
int updatedMetaState;
if (down) { action = KeyEvent.ACTION_DOWN; updatedMetaState = metaState | metaFlags; }
else { action = KeyEvent.ACTION_UP; updatedMetaState = metaState & ~metaFlags; }
_recv.sendKeyEvent(action, eventCode, metaState);
return updatedMetaState;
}
/* Send key events corresponding to pressed modifier keys. */
private int sendMetaKeys(int flags, int metaState, boolean down)
{
if ((flags & KeyValue.FLAG_CTRL) != 0)
metaState = sendMetaKey(KeyEvent.KEYCODE_CTRL_LEFT, KeyEvent.META_CTRL_LEFT_ON | KeyEvent.META_CTRL_ON, metaState, down);
if ((flags & KeyValue.FLAG_ALT) != 0)
metaState = sendMetaKey(KeyEvent.KEYCODE_ALT_LEFT, KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_ON, metaState, down);
if ((flags & KeyValue.FLAG_SHIFT) != 0)
metaState = sendMetaKey(KeyEvent.KEYCODE_SHIFT_LEFT, KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON, metaState, down);
if ((flags & KeyValue.FLAG_META) != 0)
metaState = sendMetaKey(KeyEvent.KEYCODE_META_LEFT, KeyEvent.META_META_LEFT_ON | KeyEvent.META_META_ON, metaState, down);
return metaState;
}
/*
* Don't set KeyEvent.FLAG_SOFT_KEYBOARD.
*/
private void handleKeyUpWithModifier(KeyValue key, int flags)
{
if (key.eventCode == KeyValue.EVENT_NONE)
return ;
int metaState = sendMetaKeys(flags, 0, true);
_recv.sendKeyEvent(KeyEvent.ACTION_DOWN, key.eventCode, metaState);
_recv.sendKeyEvent(KeyEvent.ACTION_UP, key.eventCode, metaState);
sendMetaKeys(flags, metaState, false);
}
public static interface IReceiver
{
public void switchToNextInputMethod();
public void setPane_emoji();
public void setPane_normal();
public void showKeyboardConfig();
public void performAction();
public void switchMain();
public void switchNumeric();
public void switchProgramming();
public void sendKeyEvent(int eventAction, int eventCode, int meta);
public void commitText(String text);
public void commitChar(char c);
}
}

View File

@@ -7,25 +7,29 @@ import java.util.HashMap;
class KeyModifier
{
/* Cache key is KeyValue's name */
/** Cache key is KeyValue's name */
private static HashMap<String, SparseArray<KeyValue>> _cache =
new HashMap<String, SparseArray<KeyValue>>();
/* Modify a key according to modifiers. */
/** Represents a removed key, because a cache entry can't be [null]. */
private static final KeyValue removed_key = KeyValue.getKeyByName("removed");
/** Modify a key according to modifiers. */
public static KeyValue handleFlags(KeyValue k, int flags)
{
if (flags == 0) // No modifier
return k;
if (k == null)
return null;
SparseArray<KeyValue> ks = cacheEntry(k);
KeyValue r = ks.get(flags);
if (r != null) // Found in cache
return r;
r = k;
r = handleFn(r, flags);
r = handleShift(r, flags);
r = handleAccents(r, flags);
ks.put(flags, r);
return r;
if (r == null) // Cold cache
{
r = k;
r = handleFn(r, flags);
r = handleShift(r, flags);
r = handleAccents(r, flags);
ks.put(flags, r);
}
return (r == removed_key) ? null : r;
}
private static KeyValue handleAccents(KeyValue k, int flags)
@@ -45,16 +49,8 @@ class KeyModifier
char c = k.char_;
if (k.char_ != KeyValue.CHAR_NONE)
c = Character.toUpperCase(c);
if (c == k.char_) // More rules if toUpperCase() did nothing
switch (k.symbol)
{
case "": c = '⇒'; break;
case "": c = '⇐'; break;
case "<": c = '«'; break;
case ">": c = '»'; break;
case "": c = '”'; break;
default: return k;
}
if (c == k.char_) // Used to have more rules if toUpperCase() did nothing
return k;
return k.withCharAndSymbol(c);
}
@@ -65,42 +61,37 @@ class KeyModifier
case KeyValue.FLAG_ACCENT1:
return (char)KeyCharacterMap.getDeadChar('\u02CB', c);
case KeyValue.FLAG_ACCENT2:
switch (c)
{
case '`': return '´';
case '<': return '';
case '>': return '';
default: return (char)KeyCharacterMap.getDeadChar('\u00B4', c);
}
return (char)KeyCharacterMap.getDeadChar('\u00B4', c);
case KeyValue.FLAG_ACCENT3:
switch (c)
{
case '*': return '°';
default: return (char)KeyCharacterMap.getDeadChar('\u02C6', c);
}
return (char)KeyCharacterMap.getDeadChar('\u02C6', c);
case KeyValue.FLAG_ACCENT4:
switch (c)
{
case '?': return '¿';
case '!': return '¡';
default: return (char)KeyCharacterMap.getDeadChar('\u02DC', c);
}
return (char)KeyCharacterMap.getDeadChar('\u02DC', c);
case KeyValue.FLAG_ACCENT5:
switch (c)
{
case 'u': return 'µ';
case '"': return '„';
case '\'': return '';
case '-': return '¬';
case 'a': return 'æ';
case 'o': return 'œ';
default: return (char)KeyCharacterMap.getDeadChar('\u00B8', c);
}
return (char)KeyCharacterMap.getDeadChar('\u00B8', c);
case KeyValue.FLAG_ACCENT6:
return (char)KeyCharacterMap.getDeadChar('\u00A8', c);
case KeyValue.FLAG_ACCENT_CARON:
return (char)KeyCharacterMap.getDeadChar('\u02C7', c);
case KeyValue.FLAG_ACCENT_RING:
return (char)KeyCharacterMap.getDeadChar('\u02DA', c);
case KeyValue.FLAG_ACCENT_MACRON:
return (char)KeyCharacterMap.getDeadChar('\u00AF', c);
case KeyValue.FLAG_ACCENT_ORDINAL:
switch (c)
{
case '-': return '÷';
default: return (char)KeyCharacterMap.getDeadChar('\u00A8', c);
case 'a': return 'ª';
case 'o': return 'º';
case '1': return 'ª';
case '2': return 'º';
case '3': return 'ⁿ';
case '4': return 'ᵈ';
case '5': return 'ᵉ';
case '6': return 'ʳ';
case '7': return 'ˢ';
case '8': return 'ᵗ';
case '9': return 'ʰ';
case '*': return '°';
default: return c;
}
case KeyValue.FLAG_ACCENT_SUPERSCRIPT:
switch (c)
@@ -148,6 +139,74 @@ class KeyModifier
case 'o': return 'ₒ';
default: return c;
}
case KeyValue.FLAG_ACCENT_ARROWS:
if ((flags & KeyValue.FLAG_SHIFT) == 0)
{
switch (c)
{
case '1': return '↙';
case '2': return '↓';
case '3': return '↘';
case '4': return '←';
case '6': return '→';
case '7': return '↖';
case '8': return '↑';
case '9': return '↗';
default: return c;
}
}
else
{
switch (c)
{
case '1': return '⇙';
case '2': return '⇓';
case '3': return '⇘';
case '4': return '⇐';
case '6': return '⇒';
case '7': return '⇖';
case '8': return '⇑';
case '9': return '⇗';
default: return c;
}
}
case KeyValue.FLAG_ACCENT_BOX:
if ((flags & KeyValue.FLAG_SHIFT) == 0)
{
switch (c)
{
case '1': return '└';
case '2': return '┴';
case '3': return '┘';
case '4': return '├';
case '5': return '┼';
case '6': return '┤';
case '7': return '┌';
case '8': return '┬';
case '9': return '┐';
case '0': return '─';
case '.': return '│';
default: return c;
}
}
else
{
switch (c)
{
case '1': return '╚';
case '2': return '╩';
case '3': return '╝';
case '4': return '╠';
case '5': return '╬';
case '6': return '╣';
case '7': return '╔';
case '8': return '╦';
case '9': return '╗';
case '0': return '═';
case '.': return '║';
default: return c;
}
}
default: return c; // Can't happen
}
}
@@ -155,7 +214,15 @@ class KeyModifier
private static KeyValue handleFn(KeyValue k, int flags)
{
if ((flags & KeyValue.FLAG_FN) == 0)
return k;
{
switch (k.name)
{
// Remove some keys when Fn is *not* activated
case "f11_placeholder":
case "f12_placeholder": return removed_key;
default: return k;
}
}
String name;
switch (k.name)
{
@@ -169,16 +236,54 @@ class KeyModifier
case "8": name = "f8"; break;
case "9": name = "f9"; break;
case "0": name = "f10"; break;
case "f11_placeholder": name = "f11"; break;
case "f12_placeholder": name = "f12"; break;
case "up": name = "page_up"; break;
case "down": name = "page_down"; break;
case "left": name = "home"; break;
case "right": name = "end"; break;
case ">": name = ""; break;
case "<": name = ""; break;
case "\"": name = ""; break;
case "<": name = "«"; break;
case ">": name = "»"; break;
case "{": name = ""; break;
case "}": name = ""; break;
case "[": name = ""; break;
case "]": name = ""; break;
case "(": name = ""; break;
case ")": name = ""; break;
case "'": name = ""; break;
case "\"": name = ""; break;
case "-": name = ""; break;
case "_": name = ""; break;
case "^": name = "¬"; break;
case "%": name = ""; break;
case "=": name = ""; break;
case "u": name = "µ"; break;
case "a": name = "æ"; break;
case "o": name = "œ"; 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;
case "space": name = "nbsp"; break;
case "": name = ""; break;
case "": name = ""; break;
case "": name = ""; break;
case "": name = ""; break;
case "": name = ""; break;
case "": name = ""; break;
case "": name = ""; break;
case "": name = ""; break;
// Currency symbols
case "e": name = ""; break;
case "l": name = "£"; break;
case "r": name = ""; break;
case "y": name = "¥"; break;
case "c": name = "¢"; break;
case "p": name = ""; break;
case "": case "£": return removed_key; // Avoid showing these twice
default: return k;
}
return KeyValue.getKeyByName(name);

View File

@@ -6,22 +6,27 @@ import java.util.HashMap;
class KeyValue
{
public static final int EVENT_NONE = -1;
public static final int EVENT_CONFIG = -2;
public static final int EVENT_SWITCH_TEXT = -3;
public static final int EVENT_SWITCH_NUMERIC = -4;
public static final int EVENT_SWITCH_EMOJI = -5;
public static final int EVENT_SWITCH_BACK_EMOJI = -6;
public static final int EVENT_CHANGE_METHOD = -7;
public static final char CHAR_NONE = '\0';
public static final int EVENT_NONE = -1;
public static final int EVENT_CONFIG = -2;
public static final int EVENT_SWITCH_TEXT = -3;
public static final int EVENT_SWITCH_NUMERIC = -4;
public static final int EVENT_SWITCH_EMOJI = -5;
public static final int EVENT_SWITCH_BACK_EMOJI = -6;
public static final int EVENT_CHANGE_METHOD = -7;
public static final int EVENT_ACTION = -8;
public static final int EVENT_SWITCH_PROGRAMMING = -9;
public static final char CHAR_NONE = '\0';
// Behavior flags
public static final int FLAG_KEEP_ON = 1;
public static final int FLAG_LATCH = 1;
public static final int FLAG_LOCK = (1 << 1);
public static final int FLAG_NOREPEAT = (1 << 2);
public static final int FLAG_NOCHAR = (1 << 3);
public static final int FLAG_PRECISE_REPEAT = (1 << 4);
// Rendering flags
public static final int FLAG_KEY_FONT = (1 << 5);
public static final int FLAG_SMALLER_FONT = (1 << 6);
// Internal flags
public static final int FLAG_LOCKED = (1 << 8);
@@ -31,6 +36,7 @@ class KeyValue
public static final int FLAG_SHIFT = (1 << 11);
public static final int FLAG_ALT = (1 << 12);
public static final int FLAG_FN = (1 << 13);
public static final int FLAG_META = (1 << 14);
// Accent flags
public static final int FLAG_ACCENT1 = (1 << 16); // Grave
@@ -41,10 +47,21 @@ class KeyValue
public static final int FLAG_ACCENT6 = (1 << 21); // Tréma
public static final int FLAG_ACCENT_SUPERSCRIPT = (1 << 22);
public static final int FLAG_ACCENT_SUBSCRIPT = (1 << 23);
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 FLAG_ACCENT_ORDINAL = (1 << 28);
public static final int FLAG_ACCENT_ARROWS = (1 << 29);
public static final int FLAG_ACCENT_BOX = (1 << 30);
public static final int FLAGS_ACCENTS = FLAG_ACCENT1 | FLAG_ACCENT2 |
FLAG_ACCENT3 | FLAG_ACCENT4 | FLAG_ACCENT5 | FLAG_ACCENT6 |
FLAG_ACCENT_SUPERSCRIPT | FLAG_ACCENT_SUBSCRIPT;
FLAG_ACCENT_CARON | FLAG_ACCENT_MACRON | FLAG_ACCENT_SUPERSCRIPT |
FLAG_ACCENT_SUBSCRIPT | FLAG_ACCENT_ORDINAL | FLAG_ACCENT_ARROWS |
FLAG_ACCENT_BOX | FLAG_ACCENT_RING;
// Language specific keys that are removed from the keyboard by default
public static final int FLAG_LOCALIZED = (1 << 25);
public final String name;
public final String symbol;
@@ -63,6 +80,16 @@ class KeyValue
return new KeyValue(name, s, c, eventCode, flags);
}
public KeyValue withNameAndSymbol(String n, String s)
{
return new KeyValue(n, s, char_, eventCode, flags);
}
public KeyValue withFlags(int f)
{
return new KeyValue(name, symbol, char_, eventCode, f);
}
private static HashMap<String, KeyValue> keys = new HashMap<String, KeyValue>();
public KeyValue(String n, String s, char c, int e, int f)
@@ -74,14 +101,15 @@ class KeyValue
flags = f;
}
public static KeyValue getKeyByName(String name)
public static KeyValue getKeyByName(String name)
{
if (name == null)
return null;
KeyValue kv = KeyValue.keys.get(name);
if (kv != null)
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)
@@ -89,21 +117,31 @@ class KeyValue
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);
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)
{
addKey(name, symbol, CHAR_NONE, EVENT_NONE,
FLAG_KEEP_ON | FLAG_NOCHAR | FLAG_NOREPEAT | extra_flags);
FLAG_LATCH | FLAG_NOCHAR | FLAG_NOREPEAT | extra_flags);
}
private static void addSpecialKey(String name, String symbol, int event)
{
addKey(name, symbol, CHAR_NONE, event, FLAG_NOREPEAT);
addSpecialKey(name, symbol, event, 0);
}
private static void addSpecialKey(String name, String symbol, int event, int flags)
{
addKey(name, symbol, CHAR_NONE, event, flags | FLAG_NOREPEAT);
}
private static void addEventKey(String name, String symbol, int event)
@@ -118,22 +156,26 @@ class KeyValue
static
{
String chars = "<>&\"_°~{|^}$*:!£%µ?.§€";
for (int i = 0; i < chars.length(); i++)
addCharKey(chars.charAt(i), EVENT_NONE);
addModifierKey("shift", "", FLAG_LOCK | FLAG_SHIFT);
addModifierKey("ctrl", "Ctrl", FLAG_CTRL);
addModifierKey("alt", "Alt", FLAG_ALT);
addModifierKey("accent_grave", "◌̀", FLAG_ACCENT1);
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
addModifierKey("accent_circonflexe", "◌̂", FLAG_ACCENT3);
addModifierKey("accent_tilde", "◌̃", FLAG_ACCENT4);
addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5);
addModifierKey("accent_trema", "◌̈", FLAG_ACCENT6);
addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);
addModifierKey("subscript", "◌̺", FLAG_ACCENT_SUBSCRIPT);
addModifierKey("fn", "Fn", FLAG_FN);
addModifierKey("shift", "\n", // Can't write u000A because Java is stupid
FLAG_SHIFT | FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addModifierKey("ctrl", "Ctrl", FLAG_CTRL | FLAG_SMALLER_FONT);
addModifierKey("alt", "Alt", FLAG_ALT | FLAG_SMALLER_FONT);
addModifierKey("accent_aigu", "\u0050", FLAG_ACCENT2 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_caron", "\u0051", FLAG_ACCENT_CARON | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_cedille", "\u0052", FLAG_ACCENT5 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_circonflexe", "\u0053", FLAG_ACCENT3 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_grave", "\u0054", FLAG_ACCENT1 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_macron", "\u0055", FLAG_ACCENT_MACRON | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_ring", "\u0056", FLAG_ACCENT_RING | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_tilde", "\u0057", FLAG_ACCENT4 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("accent_trema", "\u0058", FLAG_ACCENT6 | FLAG_KEY_FONT | FLAG_LOCALIZED);
addModifierKey("superscript", "Sup", FLAG_ACCENT_SUPERSCRIPT | FLAG_SMALLER_FONT);
addModifierKey("subscript", "Sub", FLAG_ACCENT_SUBSCRIPT | FLAG_SMALLER_FONT);
addModifierKey("ordinal", "Ord", FLAG_ACCENT_ORDINAL | FLAG_SMALLER_FONT);
addModifierKey("arrows", "Arr", FLAG_ACCENT_ARROWS | FLAG_SMALLER_FONT);
addModifierKey("box", "Box", FLAG_ACCENT_BOX | FLAG_SMALLER_FONT);
addModifierKey("fn", "Fn", FLAG_FN | FLAG_SMALLER_FONT);
addModifierKey("meta", "Meta", FLAG_META | FLAG_SMALLER_FONT);
addCharKey('a', KeyEvent.KEYCODE_A);
addCharKey('b', KeyEvent.KEYCODE_B);
@@ -188,27 +230,32 @@ class KeyValue
addCharKey('#', KeyEvent.KEYCODE_POUND);
addCharKey('(', KeyEvent.KEYCODE_NUMPAD_LEFT_PAREN);
addCharKey(')', KeyEvent.KEYCODE_NUMPAD_RIGHT_PAREN);
addCharKey('ß', EVENT_NONE, FLAG_LOCALIZED);
addCharKey('€', EVENT_NONE, FLAG_LOCALIZED);
addCharKey('£', EVENT_NONE, FLAG_LOCALIZED);
addSpecialKey("config", "Conf", EVENT_CONFIG);
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT);
addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC);
addSpecialKey("switch_emoji", ":)", EVENT_SWITCH_EMOJI);
addSpecialKey("config", "\u0004", EVENT_CONFIG, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT, FLAG_SMALLER_FONT);
addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC, FLAG_SMALLER_FONT);
addSpecialKey("switch_emoji", "\u0001" , EVENT_SWITCH_EMOJI, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_back_emoji", "ABC", EVENT_SWITCH_BACK_EMOJI);
addSpecialKey("change_method", "", EVENT_CHANGE_METHOD);
addSpecialKey("switch_programming", "Prog", EVENT_SWITCH_PROGRAMMING, FLAG_SMALLER_FONT);
addSpecialKey("change_method", "\u0009", EVENT_CHANGE_METHOD, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("action", "Action", EVENT_ACTION, FLAG_SMALLER_FONT); // Will always be replaced
addEventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE);
addEventKey("enter", "\uE800", KeyEvent.KEYCODE_ENTER, FLAG_KEY_FONT);
addEventKey("up", "\uE80B", KeyEvent.KEYCODE_DPAD_UP, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("right", "\uE80C", KeyEvent.KEYCODE_DPAD_RIGHT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("down", "\uE809", KeyEvent.KEYCODE_DPAD_DOWN, 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_DOWN);
addEventKey("page_down", "", KeyEvent.KEYCODE_PAGE_UP);
addEventKey("home", "", KeyEvent.KEYCODE_HOME);
addEventKey("end", "", KeyEvent.KEYCODE_MOVE_END);
addEventKey("backspace", "", KeyEvent.KEYCODE_DEL, FLAG_PRECISE_REPEAT);
addEventKey("delete", "", KeyEvent.KEYCODE_FORWARD_DEL, FLAG_PRECISE_REPEAT);
addEventKey("insert", "Ins", KeyEvent.KEYCODE_INSERT);
addEventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE, FLAG_SMALLER_FONT);
addEventKey("enter", "\u000E", KeyEvent.KEYCODE_ENTER, FLAG_KEY_FONT);
addEventKey("up", "\u0005", KeyEvent.KEYCODE_DPAD_UP, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("right", "\u0006", KeyEvent.KEYCODE_DPAD_RIGHT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("down", "\u0007", KeyEvent.KEYCODE_DPAD_DOWN, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("left", "\u0008", KeyEvent.KEYCODE_DPAD_LEFT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("page_up", "\u0002", KeyEvent.KEYCODE_PAGE_UP, FLAG_KEY_FONT);
addEventKey("page_down", "\u0003", KeyEvent.KEYCODE_PAGE_DOWN, FLAG_KEY_FONT);
addEventKey("home", "\u000B", KeyEvent.KEYCODE_MOVE_HOME, FLAG_KEY_FONT);
addEventKey("end", "\u000C", KeyEvent.KEYCODE_MOVE_END, FLAG_KEY_FONT);
addEventKey("backspace", "\u0011", KeyEvent.KEYCODE_DEL, FLAG_KEY_FONT);
addEventKey("delete", "\u0010", KeyEvent.KEYCODE_FORWARD_DEL, FLAG_KEY_FONT);
addEventKey("insert", "Ins", KeyEvent.KEYCODE_INSERT, FLAG_SMALLER_FONT);
addEventKey("f1", "F1", KeyEvent.KEYCODE_F1);
addEventKey("f2", "F2", KeyEvent.KEYCODE_F2);
addEventKey("f3", "F3", KeyEvent.KEYCODE_F3);
@@ -219,8 +266,12 @@ class KeyValue
addEventKey("f8", "F8", KeyEvent.KEYCODE_F8);
addEventKey("f9", "F9", KeyEvent.KEYCODE_F9);
addEventKey("f10", "F10", KeyEvent.KEYCODE_F10);
addEventKey("f11", "F11", KeyEvent.KEYCODE_F11, FLAG_SMALLER_FONT);
addEventKey("f12", "F12", KeyEvent.KEYCODE_F12, FLAG_SMALLER_FONT);
addEventKey("tab", "\u000F", KeyEvent.KEYCODE_TAB, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addKey("tab", "", '\t', KeyEvent.KEYCODE_TAB, 0);
addKey("space", " ", ' ', KeyEvent.KEYCODE_SPACE, 0);
addKey("\\t", "\\t", '\t', EVENT_NONE, 0); // Send the tab character
addKey("space", "\r", ' ', KeyEvent.KEYCODE_SPACE, FLAG_KEY_FONT);
addKey("nbsp", "\u237d", '\u00a0', EVENT_NONE, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
}
}

View File

@@ -1,73 +1,60 @@
package juloo.keyboard2;
import android.content.Context;
import android.content.res.Configuration;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Typeface;
import android.inputmethodservice.InputMethodService;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.IBinder;
import android.text.InputType;
import android.preference.PreferenceManager;
import android.text.InputType;
import android.view.ContextThemeWrapper;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.util.Log;
import java.util.HashMap;
import android.util.LogPrinter;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.HashSet;
import java.util.Set;
public class Keyboard2 extends InputMethodService
implements SharedPreferences.OnSharedPreferenceChangeListener
implements SharedPreferences.OnSharedPreferenceChangeListener
{
private Keyboard2View _keyboardView;
static private final String TAG = "Keyboard2";
private Keyboard2View _keyboardView;
private int _currentTextLayout;
private ViewGroup _emojiPane = null;
private Typeface _specialKeyFont = null;
private ViewGroup _emojiPane = null;
private Config _config;
private Config _config;
private Map<Integer, KeyboardData> _layoutCache = new HashMap<Integer, KeyboardData>();
private boolean _debug_logs = false;
private KeyboardData getLayout(int resId)
{
KeyboardData l = _layoutCache.get(resId);
if (l == null)
{
l = KeyboardData.parse(getResources().getXml(resId));
_layoutCache.put(resId, l);
}
return l;
return KeyboardData.load(getResources(), resId);
}
@Override
public void onCreate()
{
super.onCreate();
_specialKeyFont = Typeface.createFromAsset(getAssets(), "fonts/keys.ttf");
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
_config = new Config(this);
_keyboardView = (Keyboard2View)getLayoutInflater().inflate(R.layout.keyboard, null);
_keyboardView.reset();
}
public Config getConfig()
{
return (_config);
}
public Typeface getSpecialKeyFont()
{
return (_specialKeyFont);
}
@Override
public void onCreate()
{
super.onCreate();
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
Config.initGlobalConfig(this, new KeyEventHandler(this.new Receiver()));
_config = Config.globalConfig();
_config.refresh(this);
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
_keyboardView.reset();
_debug_logs = getResources().getBoolean(R.bool.debug_logs);
}
private List<InputMethodSubtype> getEnabledSubtypes(InputMethodManager imm)
{
@@ -80,43 +67,49 @@ public class Keyboard2 extends InputMethodService
private void refreshSubtypeLayout(InputMethodSubtype subtype)
{
int l = _config.layout;;
int l = _config.layout;
if (l == -1)
{
String s = subtype.getExtraValueOf("default_layout");
if (s != null)
l = Config.layoutId_of_string(s);
else
l = R.xml.qwerty;
}
_currentTextLayout = l;
}
private int accents_of_subtype(InputMethodSubtype subtype)
private void extra_keys_of_subtype(Set<String> dst, InputMethodSubtype subtype)
{
String accents_option = subtype.getExtraValueOf("accents");
int flags = 0;
if (accents_option != null)
for (String acc : accents_option.split("\\|"))
flags |= Config.accentFlag_of_name(acc);
return flags;
String extra_keys = subtype.getExtraValueOf("extra_keys");
if (extra_keys == null)
return;
String[] ks = extra_keys.split("\\|");
for (int i = 0; i < ks.length; i++)
dst.add(ks[i]);
}
private void refreshAccentsOption(InputMethodManager imm, InputMethodSubtype subtype)
{
final int DONT_REMOVE = KeyValue.FLAG_ACCENT_SUPERSCRIPT | KeyValue.FLAG_ACCENT_SUBSCRIPT;
int to_keep = DONT_REMOVE;
HashSet<String> extra_keys = new HashSet<String>();
List<InputMethodSubtype> enabled_subtypes = getEnabledSubtypes(imm);
switch (_config.accents)
{
case 1:
to_keep |= accents_of_subtype(subtype);
for (InputMethodSubtype s : getEnabledSubtypes(imm))
to_keep |= accents_of_subtype(s);
extra_keys_of_subtype(extra_keys, subtype);
for (InputMethodSubtype s : enabled_subtypes)
extra_keys_of_subtype(extra_keys, s);
break;
case 2: to_keep |= accents_of_subtype(subtype); break;
case 3: to_keep = KeyValue.FLAGS_ACCENTS; break;
case 2:
extra_keys_of_subtype(extra_keys, subtype);
break;
case 3: extra_keys = null; break;
case 4: break;
default: throw new IllegalArgumentException();
}
_config.accent_flags_to_remove = ~to_keep & KeyValue.FLAGS_ACCENTS;
_config.extra_keys = extra_keys;
if (enabled_subtypes.size() > 1)
_config.shouldOfferSwitchingToNextInputMethod = true;
}
private void refreshSubtypeLegacyFallback()
@@ -124,8 +117,8 @@ public class Keyboard2 extends InputMethodService
// Fallback for the accents option: Only respect the "None" case
switch (_config.accents)
{
case 1: case 2: case 3: _config.accent_flags_to_remove = 0; break;
case 4: _config.accent_flags_to_remove = KeyValue.FLAGS_ACCENTS; break;
case 1: case 2: case 3: _config.extra_keys = null; break;
case 4: _config.extra_keys = new HashSet<String>(); break;
}
// Fallback for the layout option: Use qwerty in the "system settings" case
_currentTextLayout = (_config.layout == -1) ? R.xml.qwerty : _config.layout;
@@ -146,28 +139,94 @@ public class Keyboard2 extends InputMethodService
refreshSubtypeLayout(subtype);
refreshAccentsOption(imm, subtype);
}
_config.shouldOfferSwitchingToProgramming =
_config.programming_layout != -1 &&
_currentTextLayout != _config.programming_layout;
}
@Override
public View onCreateInputView()
{
ViewGroup parent = (ViewGroup)_keyboardView.getParent();
private String actionLabel_of_imeAction(int action)
{
int res;
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)
parent.removeView(_keyboardView);
return (_keyboardView);
}
private void refreshEditorInfo(EditorInfo info)
{
// First try to look at 'info.actionLabel', if it isn't set, look at
// 'imeOptions'.
if (info.actionLabel != null)
{
_config.actionLabel = info.actionLabel.toString();
_config.actionId = info.actionId;
_config.swapEnterActionKey = false;
}
else
{
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;
}
}
@Override
public void onStartInputView(EditorInfo info, boolean restarting)
{
private void refreshConfig()
{
int prev_theme = _config.theme;
_config.refresh(this);
refreshSubtypeImm();
if ((info.inputType & InputType.TYPE_CLASS_NUMBER) != 0)
// Refreshing the theme config requires re-creating the views
if (prev_theme != _config.theme)
{
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
_emojiPane = null;
}
}
private void log_editor_info(EditorInfo info)
{
LogPrinter p = new LogPrinter(Log.DEBUG, TAG);
info.dump(p, "");
if (info.extras != null)
Log.d(TAG, "extras: "+info.extras.toString());
Log.d(TAG, "swapEnterActionKey: "+_config.swapEnterActionKey);
Log.d(TAG, "actionLabel: "+_config.actionLabel);
}
@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));
else
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
_keyboardView.reset(); // Layout might need to change due to rotation
}
setInputView(_keyboardView);
if (_debug_logs)
log_editor_info(info);
}
@Override
public void setInputView(View v)
{
ViewParent parent = v.getParent();
if (parent != null && parent instanceof ViewGroup)
((ViewGroup)parent).removeView(v);
super.setInputView(v);
}
@Override
public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype)
@@ -183,95 +242,102 @@ public class Keyboard2 extends InputMethodService
_keyboardView.reset();
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
_config.refresh();
refreshSubtypeImm();
_keyboardView.refreshConfig(_config, getLayout(_currentTextLayout));
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key)
{
refreshConfig();
}
@Override
public void onConfigurationChanged(Configuration newConfig)
{
_keyboardView.reset();
}
/** Not static */
public class Receiver implements KeyEventHandler.IReceiver
{
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)
{
if (getCurrentInputConnection() == null)
return ;
key = KeyModifier.handleFlags(key, flags);
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_);
}
public void setPane_emoji()
{
if (_emojiPane == null)
_emojiPane = (ViewGroup)inflate_view(R.layout.emoji_pane);
setInputView(_emojiPane);
}
// private void handleDelKey(int before, int after)
// {
// CharSequence selection = getCurrentInputConnection().getSelectedText(0);
public void setPane_normal()
{
setInputView(_keyboardView);
}
// if (selection != null && selection.length() > 0)
// getCurrentInputConnection().commitText("", 1);
// else
// getCurrentInputConnection().deleteSurroundingText(before, after);
// }
public void performAction()
{
InputConnection conn = getCurrentInputConnection();
if (conn == null)
return;
conn.performEditorAction(_config.actionId);
}
private void handleMetaKeyUp(KeyValue key, int flags)
{
int metaState = 0;
KeyEvent event;
public void switchMain()
{
_keyboardView.setKeyboard(getLayout(_currentTextLayout));
}
if (key.eventCode == KeyValue.EVENT_NONE)
return ;
if ((flags & KeyValue.FLAG_CTRL) != 0)
metaState |= KeyEvent.META_CTRL_LEFT_ON | KeyEvent.META_CTRL_ON;
if ((flags & KeyValue.FLAG_ALT) != 0)
metaState |= KeyEvent.META_ALT_LEFT_ON | KeyEvent.META_ALT_ON;
if ((flags & KeyValue.FLAG_SHIFT) != 0)
metaState |= KeyEvent.META_SHIFT_LEFT_ON | KeyEvent.META_SHIFT_ON;
event = new KeyEvent(1, 1, KeyEvent.ACTION_DOWN, key.eventCode, 1, metaState);
getCurrentInputConnection().sendKeyEvent(event);
getCurrentInputConnection().sendKeyEvent(KeyEvent.changeAction(event, KeyEvent.ACTION_UP));
}
public void switchNumeric()
{
_keyboardView.setKeyboard(getLayout(R.xml.numeric));
}
public void switchProgramming()
{
if (_config.programming_layout == -1)
return;
KeyboardData layout =
getLayout(_config.programming_layout).replaceKeys(new KeyboardData.MapKeys() {
public KeyValue apply(KeyValue key)
{
if (key != null && key.eventCode == KeyValue.EVENT_SWITCH_PROGRAMMING)
return KeyValue.getKeyByName("switch_text");
return key;
}
});
_keyboardView.setKeyboard(layout);
}
public void sendKeyEvent(int eventAction, int eventCode, int meta)
{
InputConnection conn = getCurrentInputConnection();
if (conn == null)
return;
conn.sendKeyEvent(new KeyEvent(1, 1, eventAction, eventCode, 0, meta));
}
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()
{
return getWindow().getWindow().getAttributes().token;
}
private View inflate_view(int layout)
{
return View.inflate(new ContextThemeWrapper(this, _config.theme), layout, null);
}
}

View File

@@ -1,482 +1,301 @@
package juloo.keyboard2;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.os.Handler;
import android.os.Message;
import android.os.Vibrator;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.widget.PopupWindow;
import java.util.ArrayList;
public class Keyboard2View extends View
implements View.OnTouchListener, Handler.Callback
implements View.OnTouchListener, Pointers.IPointerEventHandler
{
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 Pointers _pointers;
private int _flags = 0;
private int _flags = 0;
private Vibrator _vibratorService;
private long _lastVibration = 0;
private Vibrator _vibratorService;
private long _lastVibration = 0;
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 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 Theme _theme;
private static RectF _tmpRect = new RectF();
private static RectF _tmpRect = new RectF();
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)
enum Vertical
{
Resources res = getResources();
_config = config;
_lockedColor = res.getColor(R.color.key_label_locked);
_activatedColor = res.getColor(R.color.key_label_activated);
_labelColor = res.getColor(R.color.key_label);
_subLabelColor = res.getColor(R.color.key_sub_label);
_labelTextSize = res.getDimension(R.dimen.label_text_size) * config.characterSize;
_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().
TOP,
CENTER,
BOTTOM
}
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);
}
public void setKeyboard(KeyboardData kw)
public Keyboard2View(Context context, AttributeSet attrs)
{
if (!_config.shouldOfferSwitchingToNextInputMethod)
kw = kw.removeKeys(new KeyboardData.RemoveKeysByEvent(KeyValue.EVENT_CHANGE_METHOD));
if (_config.accent_flags_to_remove != 0)
kw = kw.removeKeys(new KeyboardData.RemoveKeysByFlags(_config.accent_flags_to_remove));
_keyboard = kw;
super(context, attrs);
_vibratorService = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);
_theme = new Theme(getContext(), attrs);
_config = Config.globalConfig();
_pointers = new Pointers(this, _config);
setOnTouchListener(this);
reset();
}
public void reset()
{
_flags = 0;
_downKeys.clear();
requestLayout();
invalidate();
}
@Override
public boolean onTouch(View v, MotionEvent event)
{
float x;
float y;
float keyW;
int p;
switch (event.getActionMasked())
{
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
onTouchUp(event.getPointerId(event.getActionIndex()));
break ;
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
p = event.getActionIndex();
onTouchDown(event.getX(p), event.getY(p), event.getPointerId(p));
break ;
case MotionEvent.ACTION_MOVE:
for (p = 0; p < event.getPointerCount(); p++)
onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
break ;
default:
return (false);
}
return (true);
}
private KeyDown getKeyDown(int pointerId)
{
for (KeyDown k : _downKeys)
{
if (k.pointerId == pointerId)
return (k);
}
return (null);
}
private KeyDown getKeyDown(KeyboardData.Key key)
{
for (KeyDown k : _downKeys)
{
if (k.key == key)
return (k);
}
return (null);
}
private KeyDown getKeyDown(KeyValue kv)
{
for (KeyDown k : _downKeys)
{
if (k.value == kv)
return (k);
}
return (null);
}
private void onTouchMove(float moveX, float moveY, int pointerId)
{
KeyDown key = getKeyDown(pointerId);
KeyValue newValue;
if (key != null)
{
moveX -= key.downX;
moveY -= key.downY;
float absDist = Math.abs(moveX) + Math.abs(moveY);
key.ptrDist = absDist;
if (absDist < _config.subValueDist)
newValue = key.key.key0;
else if (moveX < 0)
newValue = (moveY < 0) ? key.key.key1 : key.key.key3;
else if (moveY < 0)
newValue = key.key.key2;
else
newValue = key.key.key4;
if (newValue != null && newValue != key.value)
{
if (key.timeoutWhat != -1)
{
_handler.removeMessages(key.timeoutWhat);
if ((newValue.flags & KeyValue.FLAG_NOREPEAT) == 0)
_handler.sendEmptyMessageDelayed(key.timeoutWhat, _config.longPressTimeout);
}
key.value = newValue;
key.flags = newValue.flags;
updateFlags();
invalidate();
handleKeyDown(newValue);
}
}
}
private void onTouchDown(float touchX, float touchY, int pointerId)
{
float y = _config.marginTop - _config.keyHeight;
for (KeyboardData.Row row : _keyboard.rows)
{
y += _config.keyHeight;
if (touchY < y || touchY >= (y + _config.keyHeight))
continue ;
float x = _config.horizontalMargin;
for (KeyboardData.Key key : row.keys)
{
x += key.shift * _keyWidth;
float keyW = _keyWidth * key.width;
if (touchX >= x && touchX < (x + keyW))
{
int what = _currentWhat++;
if (key.key0 != null && (key.key0.flags & KeyValue.FLAG_NOREPEAT) == 0)
_handler.sendEmptyMessageDelayed(what, _config.longPressTimeout);
_downKeys.add(new KeyDown(pointerId, key, touchX, touchY, what));
handleKeyDown(key.key0);
updateFlags();
invalidate();
return ;
}
x += keyW;
}
}
}
// Whether a key is already activated (key down but pointer up)
private KeyDown getActivatedKey(KeyValue kv)
public void setKeyboard(KeyboardData kw)
{
for (KeyDown k : _downKeys)
{
if (k.value == kv && k.pointerId == -1)
return (k);
}
return (null);
_keyboard = _config.modify_layout(kw);
reset();
}
private void onTouchUp(int pointerId)
{
KeyDown k = getKeyDown(pointerId);
public void reset()
{
_flags = 0;
_pointers.clear();
requestLayout();
invalidate();
}
if (k != null)
{
// Stop key repeat
if (k.timeoutWhat != -1)
public KeyValue onPointerDown(KeyValue k)
{
k = KeyModifier.handleFlags(k, _flags);
invalidate();
if (k != null)
vibrate();
return k;
}
public KeyValue onPointerSwipe(KeyValue k)
{
k = KeyModifier.handleFlags(k, _flags);
invalidate();
if (k != null)
vibrate();
return k;
}
public void onPointerUp(KeyValue k)
{
_config.handler.handleKeyUp(k, _flags);
invalidate();
}
public void onPointerHold(KeyValue k)
{
_config.handler.handleKeyUp(k, _flags);
}
public void onPointerFlagsChanged()
{
invalidate();
}
private void updateFlags()
{
_flags = _pointers.getFlags();
}
@Override
public boolean onTouch(View v, MotionEvent event)
{
int p;
switch (event.getActionMasked())
{
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
_pointers.onTouchUp(event.getPointerId(event.getActionIndex()));
break;
case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN:
p = event.getActionIndex();
float tx = event.getX(p);
float ty = event.getY(p);
KeyboardData.Key key = getKeyAtPosition(tx, ty);
if (key != null)
_pointers.onTouchDown(tx, ty, event.getPointerId(p), key);
break;
case MotionEvent.ACTION_MOVE:
for (p = 0; p < event.getPointerCount(); p++)
_pointers.onTouchMove(event.getX(p), event.getY(p), event.getPointerId(p));
break;
case MotionEvent.ACTION_CANCEL:
_pointers.onTouchCancel(event.getPointerId(event.getActionIndex()));
break;
default:
return (false);
}
return (true);
}
private KeyboardData.Row getRowAtPosition(float ty)
{
float y = _config.marginTop;
if (ty < y)
return null;
for (KeyboardData.Row row : _keyboard.rows)
{
y += (row.shift + row.height) * _config.keyHeight;
if (ty < y)
return row;
}
return null;
}
private KeyboardData.Key getKeyAtPosition(float tx, float ty)
{
KeyboardData.Row row = getRowAtPosition(ty);
float x = _config.horizontalMargin;
if (row == null || tx < x)
return null;
for (KeyboardData.Key key : row.keys)
{
x += (key.shift + key.width) * _keyWidth;
if (tx < x)
return key;
}
return null;
}
private void vibrate()
{
if (!_config.vibrateEnabled)
return ;
long now = System.currentTimeMillis();
if ((now - _lastVibration) > VIBRATE_MIN_INTERVAL)
{
_lastVibration = now;
try
{
_handler.removeMessages(k.timeoutWhat);
k.timeoutWhat = -1;
_vibratorService.vibrate(_config.vibrateDuration);
}
KeyDown k_on = getActivatedKey(k.value);
if (k_on != null)
catch (Exception e)
{
_downKeys.remove(k); // Remove dupplicate
// Same key with FLAG_LOCK is already on, do lock
if ((k_on.flags & KeyValue.FLAG_LOCK) != 0)
e.printStackTrace();
}
}
}
@Override
public void onMeasure(int wSpec, int hSpec)
{
DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
int width = dm.widthPixels;
int height =
(int)(_config.keyHeight * _keyboard.keysHeight
+ _keyboard.rows.size()
+ _config.marginTop + _config.marginBottom);
setMeasuredDimension(width, height);
_keyWidth = (width - (_config.horizontalMargin * 2)) / _keyboard.keysWidth;
}
@Override
protected void onDraw(Canvas canvas)
{
updateFlags();
float y = _config.marginTop + _config.keyVerticalInterval / 2;
for (KeyboardData.Row row : _keyboard.rows)
{
y += row.shift * _config.keyHeight;
float x = _config.horizontalMargin + _config.keyHorizontalInterval / 2;
float keyH = row.height * _config.keyHeight - _config.keyVerticalInterval;
for (KeyboardData.Key k : row.keys)
{
x += k.shift * _keyWidth;
float keyW = _keyWidth * k.width - _config.keyHorizontalInterval;
boolean isKeyDown = _pointers.isKeyDown(k);
_tmpRect.set(x, y, x + keyW, y + keyH);
canvas.drawRoundRect(_tmpRect, _theme.keyBorderRadius, _theme.keyBorderRadius,
isKeyDown ? _theme.keyDownBgPaint : _theme.keyBgPaint);
drawLabel(canvas, k.key0, keyW / 2f + x, y, keyH, isKeyDown);
if (k.edgekeys)
{
k_on.flags ^= KeyValue.FLAG_LOCK; // Next time, disable it
k_on.flags |= KeyValue.FLAG_LOCKED;
drawSubLabel(canvas, k.key1, x, y, keyW, keyH, Paint.Align.CENTER, Vertical.TOP, isKeyDown);
drawSubLabel(canvas, k.key3, x, y, keyW, keyH, Paint.Align.LEFT, Vertical.CENTER, isKeyDown);
drawSubLabel(canvas, k.key2, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.CENTER, isKeyDown);
drawSubLabel(canvas, k.key4, x, y, keyW, keyH, Paint.Align.CENTER, Vertical.BOTTOM, isKeyDown);
}
// Otherwise, toggle it
else
{
_downKeys.remove(k_on);
drawSubLabel(canvas, k.key1, x, y, keyW, keyH, Paint.Align.LEFT, Vertical.TOP, isKeyDown);
drawSubLabel(canvas, k.key3, x, y, keyW, keyH, Paint.Align.LEFT, Vertical.BOTTOM, isKeyDown);
drawSubLabel(canvas, k.key2, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.TOP, isKeyDown);
drawSubLabel(canvas, k.key4, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.BOTTOM, isKeyDown);
}
x += _keyWidth * k.width;
}
// Key stay activated
else if ((k.flags & KeyValue.FLAG_KEEP_ON) != 0)
{
k.pointerId = -1; // Set pointer up
}
else // Regular key up
{
for (int i = 0; i < _downKeys.size(); i++)
{
KeyDown downKey = _downKeys.get(i);
// Disable other activated keys that aren't locked
if (downKey.pointerId == -1 && (downKey.flags & KeyValue.FLAG_LOCKED) == 0)
_downKeys.remove(i--);
// Other keys currently down won't stay activated
else if ((downKey.flags & KeyValue.FLAG_KEEP_ON) != 0)
downKey.flags ^= KeyValue.FLAG_KEEP_ON;
}
_downKeys.remove(k);
handleKeyUp(k);
}
updateFlags();
invalidate();
}
}
y += row.height * _config.keyHeight;
}
}
private void handleKeyUp(KeyDown key)
{
if (key.value != null && (key.flags & (KeyValue.FLAG_LOCKED | KeyValue.FLAG_NOCHAR)) == 0)
((Keyboard2)getContext()).handleKeyUp(key.value, _flags);
}
private void handleKeyDown(KeyValue key)
{
if (key == null)
return ;
vibrate();
}
private void updateFlags()
{
_flags = 0;
for (KeyDown k : _downKeys)
_flags |= k.flags;
}
private void vibrate()
{
if (!_config.vibrateEnabled)
return ;
long now = System.currentTimeMillis();
if ((now - _lastVibration) > VIBRATE_MIN_INTERVAL)
{
_lastVibration = now;
try
{
_vibratorService.vibrate(_config.vibrateDuration);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
@Override
public boolean handleMessage(Message msg)
{
for (KeyDown key : _downKeys)
{
if (key.timeoutWhat == msg.what)
{
long nextInterval = _config.longPressInterval;
if (_config.preciseRepeat && (key.flags & KeyValue.FLAG_PRECISE_REPEAT) != 0)
{
// 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)));
nextInterval = (long)((float)nextInterval / accel);
}
_handler.sendEmptyMessageDelayed(msg.what, nextInterval);
((Keyboard2)getContext()).handleKeyUp(key.value, _flags);
return (true);
}
}
return (false);
}
@Override
public void onMeasure(int wSpec, int hSpec)
{
DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
int height;
height = (int)(_config.keyHeight * _keyboard.keysHeight
+ _keyboard.rows.size() * _config.keyVerticalInterval
+ _config.marginTop + _config.marginBottom);
setMeasuredDimension(dm.widthPixels, height);
_keyWidth = (getWidth() - (_config.horizontalMargin * 2)) / _keyboard.keysWidth;
}
@Override
protected void onDraw(Canvas canvas)
{
float y = _config.marginTop;
for (KeyboardData.Row row : _keyboard.rows)
{
y += row.shift * _config.keyHeight;
float x = _config.horizontalMargin;
float keyH = row.height * _config.keyHeight;
for (KeyboardData.Key k : row.keys)
{
x += k.shift * _keyWidth + _config.keyHorizontalInterval;
float keyW = _keyWidth * k.width - _config.keyHorizontalInterval;
KeyDown keyDown = getKeyDown(k);
_tmpRect.set(x, y, x + keyW, y + keyH);
if (keyDown != null)
canvas.drawRect(_tmpRect, _keyDownBgPaint);
else
canvas.drawRoundRect(_tmpRect, _config.keyRound, _config.keyRound, _keyBgPaint);
if (k.key0 != null)
drawLabel(canvas, k.key0, keyW / 2f + x, (keyH + _labelTextSize) / 2f + y, keyDown);
float subPadding = _config.keyPadding;
if (k.key1 != null)
drawSubLabel(canvas, k.key1, x + subPadding, y + subPadding, false, true, keyDown);
if (k.key3 != null)
drawSubLabel(canvas, k.key3, x + subPadding, y + keyH - subPadding, false, false, keyDown);
if (k.key2 != null)
drawSubLabel(canvas, k.key2, x + keyW - subPadding, y + subPadding, true, true, keyDown);
if (k.key4 != null)
drawSubLabel(canvas, k.key4, x + keyW - subPadding, y + keyH - subPadding, true, false, keyDown);
x += keyW;
}
y += keyH + _config.keyVerticalInterval;
}
}
@Override
public void onDetachedFromWindow()
{
super.onDetachedFromWindow();
}
private int labelColor(KeyValue k, KeyDown hasKeyDown, int defaultColor)
@Override
public void onDetachedFromWindow()
{
if (hasKeyDown != null)
super.onDetachedFromWindow();
}
private int labelColor(KeyValue k, boolean isKeyDown, int defaultColor)
{
if (isKeyDown && (k.flags & KeyValue.FLAG_LATCH) != 0)
{
KeyDown kd = getKeyDown(k);
if (kd != null)
int flags = _pointers.getKeyFlags(k);
if (flags != -1)
{
if ((kd.flags & KeyValue.FLAG_LOCKED) != 0)
return _lockedColor;
if (kd.pointerId == -1)
return _activatedColor;
if ((flags & KeyValue.FLAG_LOCKED) != 0)
return _theme.lockedColor;
if ((flags & KeyValue.FLAG_LATCH) == 0)
return _theme.activatedColor;
}
}
return defaultColor;
}
private void drawLabel(Canvas canvas, KeyValue k, float x, float y, KeyDown keyDown)
{
k = KeyModifier.handleFlags(k, _flags);
Paint p = ((k.flags & KeyValue.FLAG_KEY_FONT) != 0) ? _specialKeyLabelPaint : _keyLabelPaint;
p.setColor(labelColor(k, keyDown, _labelColor));
p.setTextSize(_labelTextSize * scaleTextSize(k));
canvas.drawText(k.symbol, x, y, p);
}
private void drawSubLabel(Canvas canvas, KeyValue k, float x, float y, boolean right, boolean up, KeyDown keyDown)
{
k = KeyModifier.handleFlags(k, _flags);
Paint p = ((k.flags & KeyValue.FLAG_KEY_FONT) != 0) ? _specialKeySubLabelPaint : _keySubLabelPaint;
p.setColor(labelColor(k, keyDown, _subLabelColor));
p.setTextAlign(right ? Paint.Align.RIGHT : Paint.Align.LEFT);
p.setTextSize(_sublabelTextSize * scaleTextSize(k));
y -= up ? p.ascent() : p.descent();
canvas.drawText(k.symbol, x, y, p);
}
private float scaleTextSize(KeyValue k)
private void drawLabel(Canvas canvas, KeyValue k, float x, float y, float keyH, boolean isKeyDown)
{
return (k.symbol.length() < 2) ? 1.f : 0.8f;
k = KeyModifier.handleFlags(k, _flags);
if (k == null)
return;
float textSize = scaleTextSize(k, _config.labelTextSize, keyH);
Paint p = _theme.labelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0));
p.setColor(labelColor(k, isKeyDown, _theme.labelColor));
p.setTextSize(textSize);
canvas.drawText(k.symbol, x, (keyH - p.ascent() - p.descent()) / 2f + y, p);
}
private static class KeyDown
{
/* -1 if pointer is up. */
public int pointerId;
public KeyValue value;
public KeyboardData.Key key;
public float downX;
public float downY;
/* Manhattan distance of the pointer to the center of the key */
public float ptrDist;
public int flags;
public int timeoutWhat;
private void drawSubLabel(Canvas canvas, KeyValue k, float x, float y, float keyW, float keyH, Paint.Align a, Vertical v, boolean isKeyDown)
{
k = KeyModifier.handleFlags(k, _flags);
if (k == null)
return;
float textSize = scaleTextSize(k, _config.sublabelTextSize, keyH);
Paint p = _theme.subLabelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0), a);
p.setColor(labelColor(k, isKeyDown, _theme.subLabelColor));
p.setTextSize(textSize);
float subPadding = _config.keyPadding;
if (v == Vertical.CENTER)
y += (keyH - p.ascent() - p.descent()) / 2f;
else
y += (v == Vertical.TOP) ? subPadding - p.ascent() : keyH - subPadding - p.descent();
if (a == Paint.Align.CENTER)
x += keyW / 2f;
else
x += (a == Paint.Align.LEFT) ? subPadding : keyW - subPadding;
canvas.drawText(k.symbol, x, y, p);
}
public KeyDown(int pointerId, KeyboardData.Key key, float x, float y, int what)
{
this.pointerId = pointerId;
value = key.key0;
this.key = key;
downX = x;
downY = y;
ptrDist = 0.f;
flags = (value == null) ? 0 : value.flags;
timeoutWhat = what;
}
}
private float scaleTextSize(KeyValue k, float rel_size, float keyH)
{
float smaller_font = ((k.flags & KeyValue.FLAG_SMALLER_FONT) == 0) ? 1.f : 0.75f;
return keyH * rel_size * smaller_font * _config.characterSize;
}
}

View File

@@ -1,81 +1,102 @@
package juloo.keyboard2;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
class KeyboardData
{
public final List<Row> rows;
public final List<Row> rows;
/* Total width of the keyboard. Unit is abstract. */
public final float keysWidth;
/* Total height of the keyboard. Unit is abstract. */
public final float keysHeight;
public KeyboardData(List<Row> rows_)
public KeyboardData replaceKeys(MapKeys f)
{
ArrayList<Row> rows_ = new ArrayList<Row>();
for (Row r : rows)
rows_.add(r.replaceKeys(f));
return new KeyboardData(rows_, keysWidth);
}
private static Row _bottomRow = null;
private static Map<Integer, KeyboardData> _layoutCache = new HashMap<Integer, KeyboardData>();
public static KeyboardData load(Resources res, int id)
{
KeyboardData l = _layoutCache.get(id);
if (l == null)
{
try
{
if (_bottomRow == null)
_bottomRow = parse_bottom_row(res.getXml(R.xml.bottom_row));
l = parse_keyboard(res.getXml(id));
_layoutCache.put(id, l);
}
catch (Exception e)
{
e.printStackTrace();
}
}
return l;
}
private static KeyboardData parse_keyboard(XmlResourceParser parser) throws Exception
{
if (!expect_tag(parser, "keyboard"))
throw new Exception("Empty layout file");
boolean bottom_row = parser.getAttributeBooleanValue(null, "bottom_row", true);
ArrayList<Row> rows = new ArrayList<Row>();
while (expect_tag(parser, "row"))
rows.add(Row.parse(parser));
float kw = compute_max_width(rows);
if (bottom_row)
rows.add(_bottomRow.updateWidth(kw));
return new KeyboardData(rows, kw);
}
private static float compute_max_width(List<Row> rows)
{
float w = 0.f;
for (Row r : rows)
w = Math.max(w, r.keysWidth);
return w;
}
private static Row parse_bottom_row(XmlResourceParser parser) throws Exception
{
if (!expect_tag(parser, "row"))
throw new Exception("Failed to parse bottom row");
return Row.parse(parser);
}
protected KeyboardData(List<Row> rows_, float kw)
{
float kw = 0.f;
float kh = 0.f;
for (Row r : rows_)
{
kw = Math.max(kw, r.keysWidth);
kh += r.height + r.shift;
}
rows = rows_;
keysWidth = kw;
keysHeight = kh;
}
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)
public static class Row
{
ArrayList<Row> rows_ = new ArrayList<Row>();
for (Row r : rows)
rows_.add(r.removeKeys(f));
return new KeyboardData(rows_);
}
public static class Row
{
public final List<Key> keys;
/* Height of the row. Unit is abstract. */
/* Height of the row, without 'shift'. Unit is abstract. */
public final float height;
/* Extra empty space on the top. */
public final float shift;
/* Total width of very keys. Unit is abstract. */
private final float keysWidth;
/* Total width of the row. Unit is abstract. */
private final float keysWidth;
public Row(List<Key> keys_, float h, float s)
protected Row(List<Key> keys_, float h, float s)
{
float kw = 0.f;
for (Key k : keys_) kw += k.width + k.shift;
@@ -85,34 +106,35 @@ class KeyboardData
keysWidth = kw;
}
public static Row parse(XmlResourceParser parser) throws Exception
{
public static Row parse(XmlResourceParser parser) throws Exception
{
ArrayList<Key> keys = new ArrayList<Key>();
int status;
int status;
float h = parser.getAttributeFloatValue(null, "height", 1f);
float shift = parser.getAttributeFloatValue(null, "shift", 0f);
while ((status = parser.next()) != XmlResourceParser.END_TAG)
{
if (status == XmlResourceParser.START_TAG)
{
String tag = parser.getName();
if (tag.equals("key"))
keys.add(Key.parse(parser));
else
throw new Exception("Unknow row tag: " + tag);
}
}
while (expect_tag(parser, "key"))
keys.add(Key.parse(parser));
return new Row(keys, h, shift);
}
}
public Row removeKeys(MapKeys f)
public Row replaceKeys(MapKeys f)
{
ArrayList<Key> keys_ = new ArrayList<Key>();
for (Key k : keys)
keys_.add(k.removeKeys(f));
keys_.add(k.replaceKeys(f));
return new Row(keys_, height, shift);
}
}
/** Change the width of every keys so that the row is 's' units wide. */
public Row updateWidth(float newWidth)
{
float s = newWidth / keysWidth;
ArrayList<Key> keys_ = new ArrayList<Key>();
for (Key k : keys)
keys_.add(k.scaleWidth(s));
return new Row(keys_, height, shift);
}
}
public static class Key
{
@@ -131,8 +153,10 @@ class KeyboardData
public final float width;
/* Extra empty space on the left of the key. */
public final float shift;
/* Put keys 1 to 4 on the edges instead of the corners. */
public final boolean edgekeys;
public Key(KeyValue k0, KeyValue k1, KeyValue k2, KeyValue k3, KeyValue k4, float w, float s)
protected Key(KeyValue k0, KeyValue k1, KeyValue k2, KeyValue k3, KeyValue k4, float w, float s, boolean e)
{
key0 = k0;
key1 = k1;
@@ -141,6 +165,7 @@ class KeyboardData
key4 = k4;
width = w;
shift = s;
edgekeys = e;
}
public static Key parse(XmlResourceParser parser) throws Exception
@@ -152,43 +177,57 @@ class KeyboardData
KeyValue k4 = KeyValue.getKeyByName(parser.getAttributeValue(null, "key4"));
float width = parser.getAttributeFloatValue(null, "width", 1f);
float shift = parser.getAttributeFloatValue(null, "shift", 0.f);
boolean edgekeys = parser.getAttributeBooleanValue(null, "edgekeys", false);
while (parser.next() != XmlResourceParser.END_TAG)
continue ;
return new Key(k0, k1, k2, k3, k4, width, shift);
return new Key(k0, k1, k2, k3, k4, width, shift, edgekeys);
}
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.apply(key0), f.apply(key1), f.apply(key2),
f.apply(key3), f.apply(key4), width, shift, edgekeys);
}
/** New key with the width multiplied by 's'. */
public Key scaleWidth(float s)
{
return new Key(key0, key1, key2, key3, key4, width * s, shift, edgekeys);
}
public KeyValue getValue(int index)
{
switch (index)
{
case 1: return key1;
case 2: return key2;
case 3: return key3;
case 4: return key4;
default: case 0: return key0;
}
}
}
public static abstract interface MapKeys
{
public abstract KeyValue map(KeyValue k);
// Not using Function<KeyValue, KeyValue> to keep compatibility with Android 6.
public static abstract interface MapKeys {
public KeyValue apply(KeyValue kv);
}
public static class RemoveKeysByFlags implements MapKeys
/** Parsing utils */
/** Returns [false] on [END_DOCUMENT] or [END_TAG], [true] otherwise. */
private static boolean expect_tag(XmlResourceParser parser, String name) throws Exception
{
private final int _flags;
public RemoveKeysByFlags(int flags) { _flags = flags; }
public KeyValue map(KeyValue k)
int status;
do
{
return (k == null || (k.flags & _flags) != 0) ? null : k;
}
}
public static class RemoveKeysByEvent implements MapKeys
{
private final int _eventCode;
public RemoveKeysByEvent(int ev) { _eventCode = ev; }
public KeyValue map(KeyValue k)
{
return (k == null || k.eventCode == _eventCode) ? null : k;
status = parser.next();
if (status == XmlResourceParser.END_DOCUMENT || status == XmlResourceParser.END_TAG)
return false;
}
while (status != XmlResourceParser.START_TAG);
if (!parser.getName().equals(name))
throw new Exception("Unknow tag: " + parser.getName());
return true;
}
}

Some files were not shown because too many files have changed in this diff Show More