abouttreesummaryrefslogcommitdiff
diff options
context:
space:
mode:
authorjuloo2015-07-31 23:17:07 +0200
committerjuloo2015-07-31 23:17:07 +0200
commit56612121f8c600fe0e71f631fbea8af47345831a (patch)
treeb53f416c4ffe0ecf83aa4927afa972474a4c471d
parent45ea215bb66f889c2f05fc492646ca7b6643d41a (diff)
downloadunexpected-keyboard-56612121f8c600fe0e71f631fbea8af47345831a.tar.gz
unexpected-keyboard-56612121f8c600fe0e71f631fbea8af47345831a.zip
Add sub more subkeys + Better drawing
-rw-r--r--res/values/colors.xml3
-rw-r--r--res/xml/azerty.xml23
-rw-r--r--srcs/juloo.keyboard2/KeyValue.java22
-rw-r--r--srcs/juloo.keyboard2/Keyboard2View.java20
4 files changed, 46 insertions, 22 deletions
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 3345d04..aeea9a9 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -3,5 +3,6 @@
<item name="bg" type="color">#111111</item>
<item name="key_bg" type="color">#303030</item>
<item name="key_down_bg" type="color">#FFFFFF</item>
- <item name="key_label" type="color">#BFBFBF</item>
+ <item name="key_label" type="color">#DFDFDF</item>
+ <item name="key_sub_label" type="color">#BFBFBF</item>
</resources>
diff --git a/res/xml/azerty.xml b/res/xml/azerty.xml
index 72e4753..c725307 100644
--- a/res/xml/azerty.xml
+++ b/res/xml/azerty.xml
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard>
<row>
- <key key0="a" key2="1" />
- <key key0="z" key2="2" />
- <key key0="e" key2="3" />
- <key key0="r" key2="4" />
- <key key0="t" key2="5" />
- <key key0="y" key2="6" />
- <key key0="u" key2="7" />
- <key key0="i" key2="8" />
- <key key0="o" key2="9" />
- <key key0="p" key2="0" />
+ <key key0="a" key2="1" key3="&amp;" />
+ <key key0="z" key2="2" key3="é" key4="~" />
+ <key key0="e" key2="3" key3="&quot;" key4="\#" />
+ <key key0="r" key2="4" key3="'" key4="{" />
+ <key key0="t" key2="5" key3="(" 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="\@" />
</row>
<row>
- <key key0="q" />
+ <key key0="q" key1="1" key2="2" key3="3" key4="4" />
<key key0="s" />
<key key0="d" />
<key key0="f" />
@@ -31,6 +31,7 @@
<key key0="v" />
<key key0="b" />
<key key0="n" />
+ <key width="1.5" key0="del" />
</row>
<row>
<key width="4.0" key0="space" />
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 2dca29b..8cdc6ea 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -41,8 +41,28 @@ enum KeyValue
KEY_7("7", '7'),
KEY_8("8", '8'),
KEY_9("9", '9'),
+ KEY_AND("&", '&'),
+ KEY_E2("é", 'é'),
+ KEY_DQUOTE("\"", '"'),
+ KEY_QUOTE("'", '\''),
+ KEY_PARENTHESIS("(", '('),
+ KEY_MINUS("-", '-'),
+ KEY_E3("è", 'è'),
+ KEY_UNDERSCORE("_", '_'),
+ KEY_C2("ç", 'ç'),
+ KEY_A2("à", 'à'),
+ KEY_TILDE("~", '~'),
+ KEY_DIESE("#", '#'),
+ KEY_BLOCK("{", '{'),
+ KEY_SQUARE("[", '['),
+ KEY_PIPE("|", '|'),
+ KEY_BACKQUOTE("`", '`'),
+ KEY_BACKSLASH("\\", '\\'),
+ KEY_XOR("^", '^'),
+ KEY_AROBASE("@", '@'),
KEY_ENTER("enter", '\n'),
- KEY_SPACE("space", ' ');
+ KEY_SPACE("space", ' '),
+ KEY_DEL("del", '\u007F');
private String _name;
private char _char;
diff --git a/srcs/juloo.keyboard2/Keyboard2View.java b/srcs/juloo.keyboard2/Keyboard2View.java
index 087b433..53bceae 100644
--- a/srcs/juloo.keyboard2/Keyboard2View.java
+++ b/srcs/juloo.keyboard2/Keyboard2View.java
@@ -14,10 +14,10 @@ public class Keyboard2View extends View
{
private static final float KEY_PER_ROW = 10;
private static final float KEY_MARGIN_DPI = 2;
- private static final float KEY_PADDING_DPI = 6;
+ private static final float KEY_PADDING_DPI = 5;
private static final float KEY_HEIGHT_DPI = 40;
private static final float KEY_LABEL_DPI = 16;
- private static final float KEY_SUBLABEL_DPI = 12;
+ private static final float KEY_SUBLABEL_DPI = 10;
private Keyboard2 _ime;
private KeyboardData _keyboard;
@@ -44,12 +44,12 @@ public class Keyboard2View extends View
_keyBgPaint.setColor(getResources().getColor(R.color.key_bg));
_keyDownBgPaint = new Paint();
_keyDownBgPaint.setColor(getResources().getColor(R.color.key_down_bg));
- _keyLabelPaint = new Paint();
+ _keyLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
_keyLabelPaint.setColor(getResources().getColor(R.color.key_label));
_keyLabelPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, KEY_LABEL_DPI, dm));
_keyLabelPaint.setTextAlign(Paint.Align.CENTER);
- _keySubLabelPaint = new Paint();
- _keySubLabelPaint.setColor(getResources().getColor(R.color.key_label));
+ _keySubLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ _keySubLabelPaint.setColor(getResources().getColor(R.color.key_sub_label));
_keySubLabelPaint.setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, KEY_SUBLABEL_DPI, dm));
_keySubLabelPaint.setTextAlign(Paint.Align.CENTER);
setOnTouchListener(this);
@@ -190,18 +190,20 @@ public class Keyboard2View extends View
if (k.key0 != null)
canvas.drawText(new char[]{k.key0.getChar()}, 0, 1,
keyW / 2 + x, (_keyHeight + _keyLabelPaint.getTextSize()) / 2 + y, _keyLabelPaint);
+ float textOffsetY = _keySubLabelPaint.getTextSize() / 2;
if (k.key1 != null)
canvas.drawText(new char[]{k.key1.getChar()}, 0, 1,
- x + _keyPadding, y + _keyPadding, _keySubLabelPaint);
+ x + _keyPadding, y + _keyPadding + textOffsetY, _keySubLabelPaint);
if (k.key2 != null)
canvas.drawText(new char[]{k.key2.getChar()}, 0, 1,
- x + keyW - _keyPadding, y + _keyPadding, _keySubLabelPaint);
+ x + keyW - _keyPadding, y + _keyPadding + textOffsetY, _keySubLabelPaint);
+ textOffsetY /= 2; // WTF it work
if (k.key3 != null)
canvas.drawText(new char[]{k.key3.getChar()}, 0, 1,
- x + _keyPadding, y + _keyHeight - _keyPadding, _keySubLabelPaint);
+ x + _keyPadding, y + _keyHeight - _keyPadding + textOffsetY, _keySubLabelPaint);
if (k.key4 != null)
canvas.drawText(new char[]{k.key4.getChar()}, 0, 1,
- x + keyW - _keyPadding, y + _keyHeight - _keyPadding, _keySubLabelPaint);
+ x + keyW - _keyPadding, y + _keyHeight - _keyPadding + textOffsetY, _keySubLabelPaint);
x += keyW + _keyMargin;
}
y += _keyHeight + _keyMargin;