Compare commits

..

13 Commits

Author SHA1 Message Date
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
16 changed files with 165 additions and 72 deletions

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="17" android:versionName="1.13.0" android:hardwareAccelerated="false"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="juloo.keyboard2" android:versionCode="18" android:versionName="1.13.1" android:hardwareAccelerated="false">
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="30"/> <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"> <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"> <service android:name="juloo.keyboard2.Keyboard2" android:label="@string/app_name" android:permission="android.permission.BIND_INPUT_METHOD">
@@ -8,7 +8,7 @@
</intent-filter> </intent-filter>
<meta-data android:name="android.view.im" android:resource="@xml/method"/> <meta-data android:name="android.view.im" android:resource="@xml/method"/>
</service> </service>
<activity android:name="juloo.keyboard2.SettingsActivity" android:icon="@drawable/ic_launcher" android:label="@string/settings_activity_label"> <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> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
</intent-filter> </intent-filter>

15
assets/fonts/README.md Normal file
View File

@@ -0,0 +1,15 @@
# Fonts
The glyphs from this font are made by:
- Home and End
Author: @sdrapha
- Cog
Copyright (C) 2016 by Dave Gandy
Author: Dave Gandy
License: SIL ()
- Emoticon, PageUp and PageDown
IcoMoon-Free is a free vector icon pack by Keyamoon.
License: Attribution 4.0 International (CC BY 4.0)

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,5 @@
Improved text size, especially on large screens
Increased contrasts
Improved symbols (thanks @sdrapha)
German translation (thanks @polyctena)
Fix to some layouts.

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

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Unexpected Keyboard</string>
<string name="settings_activity_label">Unexpected Keyboard - 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>

View File

@@ -4,7 +4,8 @@
<dimen name="margin_bottom">3dp</dimen> <dimen name="margin_bottom">3dp</dimen>
<dimen name="key_padding">3dp</dimen> <dimen name="key_padding">3dp</dimen>
<dimen name="key_height">36dp</dimen> <dimen name="key_height">36dp</dimen>
<dimen name="label_text_size">18dp</dimen> <item name="label_text_size" type="integer" format="float">0.4</item>
<dimen name="sublabel_text_size">11dp</dimen> <item name="sublabel_text_size" type="integer" format="float">0.3</item>
<dimen name="emoji_type_button_height">48dp</dimen> <dimen name="emoji_type_button_height">48dp</dimen>
<dimen name="extra_horizontal_margin">20dp</dimen>
</resources> </resources>

View File

@@ -7,10 +7,10 @@
<dimen name="key_vertical_interval">2dp</dimen> <dimen name="key_vertical_interval">2dp</dimen>
<dimen name="key_horizontal_interval">2dp</dimen> <dimen name="key_horizontal_interval">2dp</dimen>
<dimen name="key_height">51dp</dimen> <dimen name="key_height">51dp</dimen>
<dimen name="label_text_size">18dp</dimen> <item name="label_text_size" type="integer" format="float">0.33</item>
<dimen name="sublabel_text_size">12dp</dimen> <item name="sublabel_text_size" type="integer" format="float">0.22</item>
<dimen name="emoji_type_button_height">56dp</dimen> <dimen name="emoji_type_button_height">56dp</dimen>
<dimen name="emoji_grid_height">250dp</dimen> <dimen name="emoji_grid_height">250dp</dimen>
<dimen name="emoji_text_size">28dp</dimen> <dimen name="emoji_text_size">28dp</dimen>
<dimen name="landscape_extra_horizontal_margin">20dp</dimen> <dimen name="extra_horizontal_margin">0dp</dimen>
</resources> </resources>

View File

@@ -3,10 +3,10 @@
<style name="emojiTypeButton"> <style name="emojiTypeButton">
<item name="android:padding">1px</item> <item name="android:padding">1px</item>
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:minHeight">@dimen/label_text_size</item> <item name="android:minHeight">18dp</item>
<item name="android:background">?attr/emoji_button_bg</item> <item name="android:background">?attr/emoji_button_bg</item>
<item name="android:textColor">?attr/emoji_key_text</item> <item name="android:textColor">?attr/emoji_key_text</item>
<item name="android:textSize">@dimen/label_text_size</item> <item name="android:textSize">18dp</item>
</style> </style>
<style name="emojiKeyButton"> <style name="emojiKeyButton">
<item name="android:layout_width">0px</item> <item name="android:layout_width">0px</item>
@@ -15,7 +15,7 @@
<item name="android:padding">0px</item> <item name="android:padding">0px</item>
<item name="android:background">?attr/emoji_key_bg</item> <item name="android:background">?attr/emoji_key_bg</item>
<item name="android:textColor">?attr/emoji_key_text</item> <item name="android:textColor">?attr/emoji_key_text</item>
<item name="android:textSize">@dimen/label_text_size</item> <item name="android:textSize">18dp</item>
</style> </style>
<!-- Passed to TextView.setTextAppearance --> <!-- Passed to TextView.setTextAppearance -->
<style name="emojiGridButton"> <style name="emojiGridButton">

View File

@@ -24,16 +24,16 @@
<style name="Dark"> <style name="Dark">
<item name="android:isLightTheme">false</item> <item name="android:isLightTheme">false</item>
<item name="android:forceDarkAllowed">false</item> <item name="android:forceDarkAllowed">false</item>
<item name="colorKeyboard">#1B1B1B</item> <item name="colorKeyboard">#1b1b1b</item>
<item name="colorKey">#303030</item> <item name="colorKey">#333333</item>
<item name="colorKeyActivated">#1B1B1B</item> <item name="colorKeyActivated">#1b1b1b</item>
<item name="colorLabel">#FFFFFF</item> <item name="colorLabel">#ffffff</item>
<item name="colorLabelActivated">#226b99</item> <item name="colorLabelActivated">#3399ff</item>
<item name="colorLabelLocked">#229933</item> <item name="colorLabelLocked">#33cc33</item>
<item name="colorSubLabel">#A0A0A0</item> <item name="colorSubLabel">#cccccc</item>
<item name="keyBorderRadius">5dp</item> <item name="keyBorderRadius">5dp</item>
<item name="emoji_button_bg" type="color">#202020</item> <item name="emoji_button_bg" type="color">#202020</item>
<item name="emoji_color" type="color">#FFFFFF</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_bg" type="color">?attr/emoji_button_bg</item>
<item name="emoji_key_text" type="color">?attr/colorLabel</item> <item name="emoji_key_text" type="color">?attr/colorLabel</item>
</style> </style>
@@ -41,12 +41,12 @@
<item name="android:isLightTheme">true</item> <item name="android:isLightTheme">true</item>
<item name="android:forceDarkAllowed">false</item> <item name="android:forceDarkAllowed">false</item>
<item name="colorKeyboard">#e3e3e3</item> <item name="colorKeyboard">#e3e3e3</item>
<item name="colorKey">#cfcfcf</item> <item name="colorKey">#cccccc</item>
<item name="colorKeyActivated">#e3e3e3</item> <item name="colorKeyActivated">#e3e3e3</item>
<item name="colorLabel">#000000</item> <item name="colorLabel">#000000</item>
<item name="colorLabelActivated">#64afdd</item> <item name="colorLabelActivated">#0066cc</item>
<item name="colorLabelLocked">#64dd76</item> <item name="colorLabelLocked">#33cc33</item>
<item name="colorSubLabel">#5e5e5e</item> <item name="colorSubLabel">#333333</item>
<item name="keyBorderRadius">5dp</item> <item name="keyBorderRadius">5dp</item>
<item name="emoji_button_bg" type="color">#dedede</item> <item name="emoji_button_bg" type="color">#dedede</item>
<item name="emoji_color" type="color">#000000</item> <item name="emoji_color" type="color">#000000</item>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="juloo.keyboard2.SettingsActivity" android:supportsSwitchingToNextInputMethod="true"> <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|euro"/> <subtype android:label="%s" android:languageTag="bg" android:imeSubtypeLocale="bg_BG" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=bgph1,extra_keys=euro"/>
<subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=trema|szlig|euro"/> <subtype android:label="%s" android:languageTag="de" android:imeSubtypeLocale="de_DE" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwertz,extra_keys=trema|szlig|euro"/>
<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=pound|euro"/> <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=pound|euro"/>
<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="en-US" android:imeSubtypeLocale="en_US" android:imeSubtypeMode="keyboard" android:isAsciiCapable="true" android:imeSubtypeExtraValue="default_layout=qwerty"/>

View File

@@ -29,9 +29,9 @@
<key key0="x"/> <key key0="x"/>
<key key0="c" key1="č"/> <key key0="c" key1="č"/>
<key key0="v"/> <key key0="v"/>
<key key0="b" key3="&lt;" key4="&gt;"/> <key key0="b" key2="\?" key3="&lt;" key4="&gt;"/>
<key key0="n" key1="ņ" key2="`" key3=":" key4=";"/> <key key0="n" key1="ņ" key2="`" key3=":" key4=";"/>
<key key0="m" key1="'" key2="&quot;" key3="," key4="\?"/> <key key0="m" key1="'" key2="&quot;" key3="," key4="."/>
<key width="1.5" key0="backspace" key2="delete"/> <key width="1.5" key0="backspace" key2="delete"/>
</row> </row>
</keyboard> </keyboard>

View File

@@ -15,6 +15,9 @@ final class Config
public final float marginTop; public final float marginTop;
public final float keyPadding; public final float keyPadding;
public final float labelTextSize;
public final float sublabelTextSize;
// From preferences // From preferences
public int layout; // Or '-1' for the system defaults public int layout; // Or '-1' for the system defaults
private float swipe_dist_dp; private float swipe_dist_dp;
@@ -48,6 +51,8 @@ final class Config
// static values // static values
marginTop = res.getDimension(R.dimen.margin_top); marginTop = res.getDimension(R.dimen.margin_top);
keyPadding = res.getDimension(R.dimen.key_padding); keyPadding = res.getDimension(R.dimen.key_padding);
labelTextSize = res.getFloat(R.integer.label_text_size);
sublabelTextSize = res.getFloat(R.integer.sublabel_text_size);
// default values // default values
layout = -1; layout = -1;
vibrateEnabled = true; vibrateEnabled = true;
@@ -85,16 +90,13 @@ final class Config
// is not the actual size of the keyboard, which will be bigger if the // is not the actual size of the keyboard, which will be bigger if the
// layout has a fifth row. // layout has a fifth row.
int keyboardHeightPercent; int keyboardHeightPercent;
float extra_horizontal_margin;
if (res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) // Landscape mode if (res.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) // Landscape mode
{ {
keyboardHeightPercent = 55; keyboardHeightPercent = 55;
extra_horizontal_margin = res.getDimension(R.dimen.landscape_extra_horizontal_margin);
} }
else else
{ {
keyboardHeightPercent = prefs.getInt("keyboard_height", 35); keyboardHeightPercent = prefs.getInt("keyboard_height", 35);
extra_horizontal_margin = 0.f;
} }
layout = layoutId_of_string(prefs.getString("layout", "system")); layout = layoutId_of_string(prefs.getString("layout", "system"));
swipe_dist_dp = Float.valueOf(prefs.getString("swipe_dist", "15")); swipe_dist_dp = Float.valueOf(prefs.getString("swipe_dist", "15"));
@@ -109,7 +111,7 @@ final class Config
// Do not substract keyVerticalInterval from keyHeight because this is done // Do not substract keyVerticalInterval from keyHeight because this is done
// during rendered. // during rendered.
keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4; keyHeight = dm.heightPixels * keyboardHeightPercent / 100 / 4;
horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + extra_horizontal_margin; horizontalMargin = getDipPref(dm, prefs, "horizontal_margin", horizontalMargin) + res.getDimension(R.dimen.extra_horizontal_margin);
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat); preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
characterSize = prefs.getFloat("character_size", characterSize); characterSize = prefs.getFloat("character_size", characterSize);
accents = Integer.valueOf(prefs.getString("accents", "1")); accents = Integer.valueOf(prefs.getString("accents", "1"));

View File

@@ -22,7 +22,10 @@ class KeyValue
public static final int FLAG_NOREPEAT = (1 << 2); public static final int FLAG_NOREPEAT = (1 << 2);
public static final int FLAG_NOCHAR = (1 << 3); public static final int FLAG_NOCHAR = (1 << 3);
public static final int FLAG_PRECISE_REPEAT = (1 << 4); 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_KEY_FONT = (1 << 5);
public static final int FLAG_SMALLER_FONT = (1 << 6);
// Internal flags // Internal flags
public static final int FLAG_LOCKED = (1 << 8); public static final int FLAG_LOCKED = (1 << 8);
@@ -151,9 +154,10 @@ class KeyValue
static static
{ {
addModifierKey("shift", "\uE808", FLAG_LOCK | FLAG_SHIFT | FLAG_KEY_FONT); addModifierKey("shift", "\uE808",
addModifierKey("ctrl", "Ctrl", FLAG_CTRL); FLAG_LOCK | FLAG_SHIFT | FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addModifierKey("alt", "Alt", FLAG_ALT); addModifierKey("ctrl", "Ctrl", FLAG_CTRL | FLAG_SMALLER_FONT);
addModifierKey("alt", "Alt", FLAG_ALT | FLAG_SMALLER_FONT);
addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2); addModifierKey("accent_aigu", "◌́", FLAG_ACCENT2);
addModifierKey("accent_caron", "◌̌", FLAG_ACCENT_CARON); addModifierKey("accent_caron", "◌̌", FLAG_ACCENT_CARON);
addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5); addModifierKey("accent_cedille", "◌̧", FLAG_ACCENT5);
@@ -165,8 +169,8 @@ class KeyValue
addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING); addModifierKey("accent_ring", "◌̊", FLAG_ACCENT_RING);
addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT); addModifierKey("superscript", "◌͆", FLAG_ACCENT_SUPERSCRIPT);
addModifierKey("subscript", "◌̺", FLAG_ACCENT_SUBSCRIPT); addModifierKey("subscript", "◌̺", FLAG_ACCENT_SUBSCRIPT);
addModifierKey("ordinal", "ºʳᵈ", FLAG_ACCENT_ORDINAL); addModifierKey("ordinal", "ºʳᵈ", FLAG_ACCENT_ORDINAL | FLAG_SMALLER_FONT);
addModifierKey("fn", "Fn", FLAG_FN); addModifierKey("fn", "Fn", FLAG_FN | FLAG_SMALLER_FONT);
addModifierKey("meta", "", FLAG_META); addModifierKey("meta", "", FLAG_META);
addCharKey('a', KeyEvent.KEYCODE_A); addCharKey('a', KeyEvent.KEYCODE_A);
@@ -226,28 +230,27 @@ class KeyValue
addCharKey('€', EVENT_NONE, FLAG_LANG_EURO); addCharKey('€', EVENT_NONE, FLAG_LANG_EURO);
addCharKey('£', EVENT_NONE, FLAG_LANG_POUND); addCharKey('£', EVENT_NONE, FLAG_LANG_POUND);
addSpecialKey("config", "", EVENT_CONFIG); addSpecialKey("config", "\uE806", EVENT_CONFIG, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT); addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT);
addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC); addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC);
addSpecialKey("switch_emoji", "", EVENT_SWITCH_EMOJI); addSpecialKey("switch_emoji", "\uE812" , EVENT_SWITCH_EMOJI, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_back_emoji", "ABC", EVENT_SWITCH_BACK_EMOJI); addSpecialKey("switch_back_emoji", "ABC", EVENT_SWITCH_BACK_EMOJI);
addSpecialKey("change_method", "\ue807", EVENT_CHANGE_METHOD, FLAG_KEY_FONT); addSpecialKey("change_method", "\ue807", EVENT_CHANGE_METHOD, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("action", "Action", EVENT_ACTION); // Will always be replaced addSpecialKey("action", "Action", EVENT_ACTION); // Will always be replaced
addEventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE); addEventKey("esc", "Esc", KeyEvent.KEYCODE_ESCAPE, FLAG_SMALLER_FONT);
// Enter should be '\u23CE' but using what is in the font file at the moment
addEventKey("enter", "\ue800", KeyEvent.KEYCODE_ENTER, FLAG_KEY_FONT); addEventKey("enter", "\ue800", KeyEvent.KEYCODE_ENTER, FLAG_KEY_FONT);
addEventKey("up", "\uE80B", KeyEvent.KEYCODE_DPAD_UP, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT); 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("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("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("left", "\uE80A", KeyEvent.KEYCODE_DPAD_LEFT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("page_up", "", KeyEvent.KEYCODE_PAGE_UP); addEventKey("page_up", "\uE810", KeyEvent.KEYCODE_PAGE_UP, FLAG_KEY_FONT);
addEventKey("page_down", "", KeyEvent.KEYCODE_PAGE_DOWN); addEventKey("page_down", "\uE811", KeyEvent.KEYCODE_PAGE_DOWN, FLAG_KEY_FONT);
addEventKey("home", "", KeyEvent.KEYCODE_MOVE_HOME); addEventKey("home", "\uE80E", KeyEvent.KEYCODE_MOVE_HOME, FLAG_KEY_FONT);
addEventKey("end", "", KeyEvent.KEYCODE_MOVE_END); addEventKey("end", "\uE80F", KeyEvent.KEYCODE_MOVE_END, FLAG_KEY_FONT);
addEventKey("backspace", "", KeyEvent.KEYCODE_DEL); addEventKey("backspace", "", KeyEvent.KEYCODE_DEL, FLAG_SMALLER_FONT);
addEventKey("delete", "", KeyEvent.KEYCODE_FORWARD_DEL); addEventKey("delete", "", KeyEvent.KEYCODE_FORWARD_DEL, FLAG_SMALLER_FONT);
addEventKey("insert", "Ins", KeyEvent.KEYCODE_INSERT); addEventKey("insert", "Ins", KeyEvent.KEYCODE_INSERT, FLAG_SMALLER_FONT);
addEventKey("f1", "F1", KeyEvent.KEYCODE_F1); addEventKey("f1", "F1", KeyEvent.KEYCODE_F1);
addEventKey("f2", "F2", KeyEvent.KEYCODE_F2); addEventKey("f2", "F2", KeyEvent.KEYCODE_F2);
addEventKey("f3", "F3", KeyEvent.KEYCODE_F3); addEventKey("f3", "F3", KeyEvent.KEYCODE_F3);
@@ -261,6 +264,6 @@ class KeyValue
addEventKey("tab", "", KeyEvent.KEYCODE_TAB); addEventKey("tab", "", KeyEvent.KEYCODE_TAB);
addKey("\\t", "\\t", '\t', EVENT_NONE, 0); // Send the tab character addKey("\\t", "\\t", '\t', EVENT_NONE, 0); // Send the tab character
addKey("space", "\ue80d", ' ', KeyEvent.KEYCODE_SPACE, FLAG_KEY_FONT); addKey("space", "\ue80d", ' ', KeyEvent.KEYCODE_SPACE, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
} }
} }

View File

@@ -237,29 +237,28 @@ public class Keyboard2View extends View
canvas.drawRoundRect(_tmpRect, _theme.keyBorderRadius, _theme.keyBorderRadius, canvas.drawRoundRect(_tmpRect, _theme.keyBorderRadius, _theme.keyBorderRadius,
isKeyDown ? _theme.keyDownBgPaint : _theme.keyBgPaint); isKeyDown ? _theme.keyDownBgPaint : _theme.keyBgPaint);
if (k.key0 != null) if (k.key0 != null)
drawLabel(canvas, k.key0, keyW / 2f + x, (keyH + _theme.labelTextSize) / 2f + y, isKeyDown); drawLabel(canvas, k.key0, keyW / 2f + x, y, keyH, isKeyDown);
float subPadding = _config.keyPadding;
if (k.edgekeys) if (k.edgekeys)
{ {
if (k.key1 != null) // top key if (k.key1 != null) // top key
drawSubLabel(canvas, k.key1, x + keyW / 2f, y + subPadding, Paint.Align.CENTER, Vertical.TOP, isKeyDown); drawSubLabel(canvas, k.key1, x, y, keyW, keyH, Paint.Align.CENTER, Vertical.TOP, isKeyDown);
if (k.key3 != null) // left key if (k.key3 != null) // left key
drawSubLabel(canvas, k.key3, x + subPadding, y + keyH / 2f, Paint.Align.LEFT, Vertical.CENTER, isKeyDown); drawSubLabel(canvas, k.key3, x, y, keyW, keyH, Paint.Align.LEFT, Vertical.CENTER, isKeyDown);
if (k.key2 != null) // right key if (k.key2 != null) // right key
drawSubLabel(canvas, k.key2, x + keyW - subPadding, y + keyH / 2f, Paint.Align.RIGHT, Vertical.CENTER, isKeyDown); drawSubLabel(canvas, k.key2, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.CENTER, isKeyDown);
if (k.key4 != null) // bottom key if (k.key4 != null) // bottom key
drawSubLabel(canvas, k.key4, x + keyW / 2f, y + keyH - subPadding, Paint.Align.CENTER, Vertical.BOTTOM, isKeyDown); drawSubLabel(canvas, k.key4, x, y, keyW, keyH, Paint.Align.CENTER, Vertical.BOTTOM, isKeyDown);
} }
else else
{ {
if (k.key1 != null) // top left key if (k.key1 != null) // top left key
drawSubLabel(canvas, k.key1, x + subPadding, y + subPadding, Paint.Align.LEFT, Vertical.TOP, isKeyDown); drawSubLabel(canvas, k.key1, x, y, keyW, keyH, Paint.Align.LEFT, Vertical.TOP, isKeyDown);
if (k.key3 != null) // bottom left key if (k.key3 != null) // bottom left key
drawSubLabel(canvas, k.key3, x + subPadding, y + keyH - subPadding, Paint.Align.LEFT, Vertical.BOTTOM, isKeyDown); drawSubLabel(canvas, k.key3, x, y, keyW, keyH, Paint.Align.LEFT, Vertical.BOTTOM, isKeyDown);
if (k.key2 != null) // top right key if (k.key2 != null) // top right key
drawSubLabel(canvas, k.key2, x + keyW - subPadding, y + subPadding, Paint.Align.RIGHT, Vertical.TOP, isKeyDown); drawSubLabel(canvas, k.key2, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.TOP, isKeyDown);
if (k.key4 != null) // bottom right key if (k.key4 != null) // bottom right key
drawSubLabel(canvas, k.key4, x + keyW - subPadding, y + keyH - subPadding, Paint.Align.RIGHT, Vertical.BOTTOM, isKeyDown); drawSubLabel(canvas, k.key4, x, y, keyW, keyH, Paint.Align.RIGHT, Vertical.BOTTOM, isKeyDown);
} }
x += _keyWidth * k.width; x += _keyWidth * k.width;
} }
@@ -289,30 +288,38 @@ public class Keyboard2View extends View
return defaultColor; return defaultColor;
} }
private void drawLabel(Canvas canvas, KeyValue k, float x, float y, boolean isKeyDown) private void drawLabel(Canvas canvas, KeyValue k, float x, float y, float keyH, boolean isKeyDown)
{ {
float textSize = scaleTextSize(k, _config.labelTextSize, keyH);
k = KeyModifier.handleFlags(k, _flags); k = KeyModifier.handleFlags(k, _flags);
Paint p = _theme.labelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0)); Paint p = _theme.labelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0));
p.setColor(labelColor(k, isKeyDown, _theme.labelColor)); p.setColor(labelColor(k, isKeyDown, _theme.labelColor));
p.setTextSize(_theme.labelTextSize * scaleTextSize(k)); p.setTextSize(textSize);
canvas.drawText(k.symbol, x, y, p); canvas.drawText(k.symbol, x, (keyH - p.ascent() - p.descent()) / 2f + y, p);
} }
private void drawSubLabel(Canvas canvas, KeyValue k, float x, float y, Paint.Align a, Vertical v, boolean isKeyDown) private void drawSubLabel(Canvas canvas, KeyValue k, float x, float y, float keyW, float keyH, Paint.Align a, Vertical v, boolean isKeyDown)
{ {
float textSize = scaleTextSize(k, _config.sublabelTextSize, keyH);
k = KeyModifier.handleFlags(k, _flags); k = KeyModifier.handleFlags(k, _flags);
Paint p = _theme.subLabelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0), a); Paint p = _theme.subLabelPaint(((k.flags & KeyValue.FLAG_KEY_FONT) != 0), a);
p.setColor(labelColor(k, isKeyDown, _theme.subLabelColor)); p.setColor(labelColor(k, isKeyDown, _theme.subLabelColor));
p.setTextSize(_theme.sublabelTextSize * scaleTextSize(k)); p.setTextSize(textSize);
float subPadding = _config.keyPadding;
if (v == Vertical.CENTER) if (v == Vertical.CENTER)
y -= (p.ascent() + p.descent()) / 2f; y += (keyH - p.ascent() - p.descent()) / 2f;
else else
y -= (v == Vertical.TOP) ? p.ascent() : p.descent(); 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); canvas.drawText(k.symbol, x, y, p);
} }
private float scaleTextSize(KeyValue k) private float scaleTextSize(KeyValue k, float rel_size, float keyH)
{ {
return ((k.symbol.length() < 2) ? 1.f : 0.8f) * _config.characterSize; float smaller_font = ((k.flags & KeyValue.FLAG_SMALLER_FONT) == 0) ? 1.f : 0.75f;
return keyH * rel_size * smaller_font * _config.characterSize;
} }
} }

View File

@@ -16,9 +16,6 @@ public class Theme
public final int labelColor; public final int labelColor;
public final int subLabelColor; public final int subLabelColor;
public final float labelTextSize;
public final float sublabelTextSize;
public final float keyBorderRadius; public final float keyBorderRadius;
private final Paint _keyLabelPaint; private final Paint _keyLabelPaint;
@@ -38,9 +35,6 @@ public class Theme
subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0); subLabelColor = s.getColor(R.styleable.keyboard_colorSubLabel, 0);
keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0); keyBorderRadius = s.getDimension(R.styleable.keyboard_keyBorderRadius, 0);
s.recycle(); s.recycle();
Resources res = context.getResources();
labelTextSize = res.getDimension(R.dimen.label_text_size);
sublabelTextSize = res.getDimension(R.dimen.sublabel_text_size);
_keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null); _keyLabelPaint = initLabelPaint(Paint.Align.CENTER, null);
_keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null); _keySubLabelPaint = initLabelPaint(Paint.Align.LEFT, null);
Typeface specialKeyFont = getSpecialKeyFont(context); Typeface specialKeyFont = getSpecialKeyFont(context);