From 2315bfc7c8df0f6d9fb627456f2a298f5580b52d Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 29 Aug 2011 21:12:36 +0900 Subject: [PATCH 01/11] Clean up some MiniKeyboard.Builder code Change-Id: I5832421cab3d496d4bb8a5e9902d0b5f4929fd0b --- .../inputmethod/keyboard/KeyboardView.java | 15 ++++++--------- .../inputmethod/keyboard/MiniKeyboard.java | 16 ++++++---------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index bc021a690..dfc893db1 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -681,15 +681,6 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } } - // This method is currently being used only by MiniKeyboardBuilder - public int getDefaultLabelSizeAndSetPaint(Paint paint) { - // For characters, use large font. For labels like "Done", use small font. - final int labelSize = mKeyDrawParams.mKeyLabelSize; - paint.setTextSize(labelSize); - paint.setTypeface(mKeyDrawParams.mKeyTextStyle); - return labelSize; - } - private static final Rect sTextBounds = new Rect(); private static float getCharHeight(Paint paint) { @@ -733,6 +724,12 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { return sTextBounds.width(); } + public float getDefaultLabelWidth(CharSequence label, Paint paint) { + paint.setTextSize(mKeyDrawParams.mKeyLabelSize); + paint.setTypeface(mKeyDrawParams.mKeyTextStyle); + return getLabelWidth(label, paint); + } + private static void drawIcon(Canvas canvas, Drawable icon, int x, int y, int width, int height) { canvas.translate(x, y); diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index 17c253963..8f4791630 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -236,8 +236,7 @@ public class MiniKeyboard extends Keyboard { private static int getMaxKeyWidth(KeyboardView view, CharSequence[] popupCharacters, int minKeyWidth) { Paint paint = null; - Rect bounds = null; - int maxWidth = 0; + int maxWidth = minKeyWidth; for (CharSequence popupSpec : popupCharacters) { final CharSequence label = PopupCharactersParser.getLabel(popupSpec.toString()); // If the label is single letter, minKeyWidth is enough to hold @@ -247,18 +246,15 @@ public class MiniKeyboard extends Keyboard { paint = new Paint(); paint.setAntiAlias(true); } - final int labelSize = view.getDefaultLabelSizeAndSetPaint(paint); - paint.setTextSize(labelSize); - if (bounds == null) - bounds = new Rect(); - paint.getTextBounds(label.toString(), 0, label.length(), bounds); - if (maxWidth < bounds.width()) - maxWidth = bounds.width(); + final int width = (int)view.getDefaultLabelWidth(label, paint); + if (maxWidth < width) { + maxWidth = width; + } } } final int horizontalPadding = (int) view.getContext().getResources() .getDimension(R.dimen.mini_keyboard_key_horizontal_padding); - return Math.max(minKeyWidth, maxWidth + horizontalPadding); + return maxWidth + horizontalPadding; } @Override From 83da6c18fb2314dd45d3244a23ba59a5e0e21cd6 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 29 Aug 2011 20:28:46 +0900 Subject: [PATCH 02/11] Add keyLetterSize and keyLabelSize as KeyboardView attribute Bug: 5023981 Change-Id: Iea7f8f340775cbb093c50d6e741b2f1476e9ac39 --- java/res/values/attrs.xml | 7 +++++- .../inputmethod/keyboard/KeyboardView.java | 23 +++++++++++++++---- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 4cabe93a8..8362226d6 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -38,11 +38,16 @@ checkable+checked+pressed. --> + + + + - + diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index bc021a690..32259442e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -211,6 +211,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { private final float mKeyHintLetterRatio; private final float mKeyUppercaseLetterRatio; private final float mKeyHintLabelRatio; + private static final float UNDEFINED_RATIO = -1.0f; public final Rect mPadding = new Rect(); public int mKeyLetterSize; @@ -222,9 +223,21 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { public KeyDrawParams(TypedArray a) { mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground); - mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio); + if (a.hasValue(R.styleable.KeyboardView_keyLabelSize)) { + mKeyLetterRatio = UNDEFINED_RATIO; + mKeyLetterSize = a.getDimensionPixelSize( + R.styleable.KeyboardView_keyLetterRatio, 0); + } else { + mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio); + } mKeyLargeLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLargeLetterRatio); - mKeyLabelRatio = getRatio(a, R.styleable.KeyboardView_keyLabelRatio); + if (a.hasValue(R.styleable.KeyboardView_keyLabelSize)) { + mKeyLabelRatio = UNDEFINED_RATIO; + mKeyLabelSize = a.getDimensionPixelSize( + R.styleable.KeyboardView_keyLabelRatio, 0); + } else { + mKeyLabelRatio = getRatio(a, R.styleable.KeyboardView_keyLabelRatio); + } mKeyHintLetterRatio = getRatio(a, R.styleable.KeyboardView_keyHintLetterRatio); mKeyUppercaseLetterRatio = getRatio(a, R.styleable.KeyboardView_keyUppercaseLetterRatio); @@ -253,9 +266,11 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { } public void updateKeyHeight(int keyHeight) { - mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); + if (mKeyLetterRatio >= 0.0f) + mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio); - mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio); + if (mKeyLabelRatio >= 0.0f) + mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio); mKeyHintLetterSize = (int)(keyHeight * mKeyHintLetterRatio); mKeyUppercaseLetterSize = (int)(keyHeight * mKeyUppercaseLetterRatio); mKeyHintLabelSize = (int)(keyHeight * mKeyHintLabelRatio); From aed8598e3f90bd609e4d9072e2579408b9b4b324 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 09:23:23 +0900 Subject: [PATCH 03/11] Add translatable=false to the device list Bug: 5222586 Change-Id: I0a1dd27c6719d38f6344300fc027162cc47a2976 --- java/res/values/sudden-jumping-touch-event-device-list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/res/values/sudden-jumping-touch-event-device-list.xml b/java/res/values/sudden-jumping-touch-event-device-list.xml index 275a262d9..af1eefc12 100644 --- a/java/res/values/sudden-jumping-touch-event-device-list.xml +++ b/java/res/values/sudden-jumping-touch-event-device-list.xml @@ -18,7 +18,7 @@ */ --> - + passion From 2d80400a23bb2bd777e09421fc76ac632f7ac705 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 14:15:55 +0900 Subject: [PATCH 04/11] Fix keyLetterSize and keyLabelSize format This is a followup of Iea7f8f34. Bug: 5023981 Change-Id: I375a1647343e1d5fa80b328a6824f6c549135e80 --- java/res/values/attrs.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 8362226d6..bc1bb0801 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -39,10 +39,10 @@ - + - + From 60dfe896d48618f3c57f8566736b9389eb998b8c Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 14:38:19 +0900 Subject: [PATCH 05/11] Update "search" icon Bug: 5232726 Change-Id: Ie42729d15dad05c1650b021396596c1f09c844c2 --- .../sym_keyboard_search_holo.png | Bin 1218 -> 1988 bytes .../sym_keyboard_search_holo.png | Bin 819 -> 1298 bytes .../sym_keyboard_search_holo.png | Bin 1769 -> 2924 bytes java/res/values/keyboard-icons-ics.xml | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) diff --git a/java/res/drawable-hdpi/sym_keyboard_search_holo.png b/java/res/drawable-hdpi/sym_keyboard_search_holo.png index 86b925217e7c5aa42606e0841df9d934ba4f8d42..72d9e24bf688aff20bd5183406c6c126bb990ddd 100644 GIT binary patch delta 1891 zcmV-p2b}oA3B(UGiBL{Q4GJ0x0000DNk~Le0000j0000p2nGNE00YK>aR2}S24YJ` zL;(K){{a7>y{D6rFCc#{0000p09uRA(EtDj$Vo&&RA}DqnO%q^R~5&9_f}Qcbk9dJ zv%8wjL|Bsug5tuitUf5j)u?eahS88HBx)c}Za@+C!HdrOLXsID7V@zWBA68u_G4ytyQjOW>i&JGTRqi1y|Xjjs#Pkaa@LWKvrs+o0-;n`q(t+ z5^MlOk)<{k+WpqBAMsAmTYxD~d>ZK$2Y+ojjxT4N0TLhu+-53&N$9=DP8$y#Rjip9 zi_HBNz5;AVAi94AlvF-wIrvrE@!f_quLEr$+bq@lLVMr<7@4ftj|YZ_foTuajaxoe z{%7S_bq5b#$m}Bymc8;r`+K++@KnVfw1#g2rljuQo%mfQPNdR58yV+DEMt+;PHT9t zf!mF^RmcLP1`dteY+pn6zC>oB0N*sFy$^>T_*>R+u%v(HsZ1PNNOa71oRLqw^1T8e z8nbS9U^rx?4|PI{^i+f3v#HDykPhQ2w$E`iS+RFp!$Fk$s)Ik)Q$D#b$3#l8`UwA!v-GkZuV-!MEe{aH`y?>EvXZXhh`UO*8i3!j<2TT;zof1{P`Ks zY!V!n^ba3gZW?jP9eyM>v?6yw`-_9nau*N*IO%^6OQ}vW#B49XQ|tx7qq))o>2sR_ zZGphRt;OWa#IHT@u&bE^(l){4f+iB64+hFc8E`^&l(vQn(rzD%o68v|@cF|q#QuS^ z#02Lhz2IFW4qdvN)zNEx(8X-8S*{0003^MZ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27>~b=>9n);6h`IA z$x+h_5?@*~?@UYz>eV8OYcoN%ot_2bmOH zPq&bNHfm(}1xZyTS*+Cx0Opa#MsGTaSxI6-t5u~jAu*Q+3c86M1XVv1z_23wGB zDvSmZ-B1g0SOw*|Rx%aRgDN8XSz%-naMaSXDcz($MLE|;g)q^+)}nPQOpNxCFiO3B z-OwfZit$mc0ufQ0eXT`{_FK8thKQ(lzeq@bNRHE>$dD@$MuFP={#Lt5^Y{K!6mt(3 zqnK?-eu;@g{6Sbll_C)i!%?8j`0TOfT$3iv4_QMA%QYO1a=N?oM~8XluXT?4NgC9s zQDWlS1hf%|~h$&Jr zt9K7^kR7a3g*$d#Kb9|4?#RoRT`r3g-n<11 zcF&>Set-oO51{g^>p|!GC(pSPVo{MKv8!{wy-|_up+P1ErITmeNr8r7yW%q{J_1NG z8RVLY! zF$Wq*HZ3wYR53If&qlamKAe-;o3 diff --git a/java/res/drawable-mdpi/sym_keyboard_search_holo.png b/java/res/drawable-mdpi/sym_keyboard_search_holo.png index 423dff7f57c485ecc9a83f152b5558d8ac6e0790..709012a73372b53a614461f56e222e5e7ab16ed5 100644 GIT binary patch delta 1196 zcmV;d1XKI729gRhiBL{Q4GJ0x0000DNk~Le0000U0000Y2nGNE07!^wbN~PV24YJ` zL;(K){{a7>y{D6rFCc#&0000Y0E@hs!TBj&4@yC_Ehq?55L~FG_|sYyT&dI_#8QKxxKk7{R79kx z3$3Kssx_^-_TD>l&gqCJ8Tfxc{-vW$0w%^Nc%I}PlTW$AR|L#F&=By%-#!_0=_Zw=*6G`qd$QBk_Y!Ft|+8CLlq|13WY9 zZLi1vn3@<1%Lad!&^0x;*Nlgd6yR_Xc;Z~4Zvh`uU0s`6oRpvK4h4+!t0(ZlCOFyqtaufI$~qTUc_AdZDvP?K z?5Bk5JfnYFwH!cGc1ltU*pQ*#Dy5nii4?Aqgs>m0g5^a^(v+lnkA*EjvJ9xp^5)e@ z*GM{5r1kHp&?*;uR0Q$5Bn&-h&=Z|(sW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a/java/res/drawable-xhdpi/sym_keyboard_search_holo.png b/java/res/drawable-xhdpi/sym_keyboard_search_holo.png index 118f4f9aac4a6ca59390d3df1fb5bed7273c15b1..1009706cb43d701be9aabe73d6569f6d4f0c2e88 100644 GIT binary patch delta 2879 zcmV-F3&8a04eS;(iBL{Q4GJ0x0000DNk~Le0000y0000)2nGNE0NssN-T(jq24YJ` zL;(K){{a7>y{D6rFCc$B0000)0P=tE-T(j!a7jc#RCwC$n`?|+RT+k#Z>@bUbEdSV z+%FLjf)b=$3W$INBq1OPfeHvj6Jz8ijYPz#zx|`~0}?Psi7^I3AV!doT8uX^2r9G$ zC?Jw*xr`PlluO$=m%Z2PkG=Of>s)5qGG|~&`X#4(X3yDc?RS5@-+isZZrLrnWw-2> zg)26$fmW=ZnrUp6H`bni(1(q8Zh#ArZe+jQ}hli>{&g zu=f0ev@`R5;D95Qje&X~G4P8k?vn;f4ebXk!l(jBOi65+4tlyBm} z0*-)|3|4?-N!5RyF$LPHTvZn#_BYs9u!5ZBE@Hu?!BvUr(8Tz5Dx0R~)aFHo7#?6Y zSzK{PCB_xbxN!jJcHm!`_+cmT^tMb>M79_W=>S)AT2eKR@aUVsNx=U3P~EToDZtO( z3;qFe+wOlb4>mm$!(G6MahWqN9{`&P?hNALw>w%>u#y%)!-%o073{4RtX<@ElQYh6 za3j*v-ng7@$R(yfq_XYBcra$09>uT&e9hUOjl?eS#_bVM1P=spX92X!1QD|_E0MywK)U+`2v0 zlk~z#R)8GIMDem(v3g1c;1tkyxfdn~cT@=H0mqVS6rgiFyaYVYXcHL^!x7k8Vl(o>CRN}t3J6fHJt>nzk$*ziLOLJ&8@&69u`;szJ38w+6b#;1Ve zx_8B^0Uj=1uC&)VPdvzUhCL$qdp@TC4k3THZO3pyGB?1H{U*-1$l$o#C5sIGd~2$^ z=`lMt2NE%zHZ6G}z)w{sGop^dh2#vEdHi?)M?YJ!vZ%;{gLp0#O~&jkBPq+rkm5Ix z7a3&^zMoe%QGy+ZT9<$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(`s#H*yW!^=iP7oezt?|(rC*CC(09eJi=fI z(^|aWe@36m)>6Q>NuYkpWi+_a&+#dgoN^KINx!C!POipDo=U++GxuXC-M3-T&RIL1rS&ueFm$6k2Qe}mnNz{PlV ztT9R4%OYHiC66J)S6|KEjL&J5y?lgCG?-FiUgd53OmwpH9v)%KhZ5s|9_@C9V6;2A zo8L9w0<;i|<=+SMEqqY?Y;oHc-v$l=mZ~c6{he(++b1(#9c%WmSe7J3UN|x`QaU6g zBy{MIk`;L?JU*^!^J4e&EM~S6V2cR#mo_a2UpNxwxhq<45^Bj@iSgRlNS8(5G&f5| zkNNU6uSrYXgJE}k_r)%Mi%a=%r1+i)X0|2w_yaP%AO(v%*G&?mVN2wSk!qeTAJpr) z=LHTqi)7#IIxGa21^_=0!k1_Cw43l>Sae*A75JUm*~ZJ4%wXZPHP4g}^7_*AAdJHS zLw6A?LwFqV$m!ac{l3(*NtlDRBj`ggSj=MNOywy~_QWC$jx?u#a`pL8w!or(mwjZO zh52jnt&Pvp8K#vU!irMbxUg&D#6&ugOq@D*&&*bp@}~Y0^I$1NUhz7$cGJ4%MN&K& z7+ofSuGHsUm2i1|Gnb3OA|A!%Wpq2pJ^*1?kU1&jjE4XK03~!qSaf7zbY(hYa%Ew3 zWdJfTF)=MLHZ3v~H&ih+IyE*rGdV3VH##sds4kY@lL`wO7d9<2H&ih+IyE*rGdV3V PH##sd*>f&qlRFDBmZUK7 diff --git a/java/res/values/keyboard-icons-ics.xml b/java/res/values/keyboard-icons-ics.xml index 004dab7c5..28859b670 100644 --- a/java/res/values/keyboard-icons-ics.xml +++ b/java/res/values/keyboard-icons-ics.xml @@ -25,7 +25,7 @@ @drawable/sym_keyboard_settings_holo @drawable/sym_keyboard_space_holo @drawable/sym_keyboard_return_holo - @drawable/sym_keyboard_search + @drawable/sym_keyboard_search_holo @drawable/sym_keyboard_tab_holo @drawable/sym_keyboard_voice_holo @drawable/sym_keyboard_label_mic_holo From 3e63fbe400e9c0888c3829a5f641ffb2dec6379a Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 14:55:56 +0900 Subject: [PATCH 06/11] Fix mismatched attribute in KeyboardView This is a followup of Iea7f8f34. Bug: 5023981 Change-Id: Ice6d949581aea7ca68799be2b91ff28234dd88d6 --- java/src/com/android/inputmethod/keyboard/KeyboardView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index d6d0f5c37..d6b7ed05a 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -223,7 +223,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { public KeyDrawParams(TypedArray a) { mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground); - if (a.hasValue(R.styleable.KeyboardView_keyLabelSize)) { + if (a.hasValue(R.styleable.KeyboardView_keyLetterSize)) { mKeyLetterRatio = UNDEFINED_RATIO; mKeyLetterSize = a.getDimensionPixelSize( R.styleable.KeyboardView_keyLetterRatio, 0); From 619f707c95113e87afc924ba884639f83a959dad Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 15:19:42 +0900 Subject: [PATCH 07/11] Fix another mismatched attribute in KeyboardView This is a followup of Iea7f8f34. Bug: 5023981 Change-Id: I1135383ff0f0a2b8a5940d0d5c407fd01706a7f7 --- .../com/android/inputmethod/keyboard/KeyboardView.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index d6b7ed05a..5f824537e 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -225,19 +225,17 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { mKeyBackground = a.getDrawable(R.styleable.KeyboardView_keyBackground); if (a.hasValue(R.styleable.KeyboardView_keyLetterSize)) { mKeyLetterRatio = UNDEFINED_RATIO; - mKeyLetterSize = a.getDimensionPixelSize( - R.styleable.KeyboardView_keyLetterRatio, 0); + mKeyLetterSize = a.getDimensionPixelSize(R.styleable.KeyboardView_keyLetterSize, 0); } else { mKeyLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLetterRatio); } - mKeyLargeLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLargeLetterRatio); if (a.hasValue(R.styleable.KeyboardView_keyLabelSize)) { mKeyLabelRatio = UNDEFINED_RATIO; - mKeyLabelSize = a.getDimensionPixelSize( - R.styleable.KeyboardView_keyLabelRatio, 0); + mKeyLabelSize = a.getDimensionPixelSize(R.styleable.KeyboardView_keyLabelSize, 0); } else { mKeyLabelRatio = getRatio(a, R.styleable.KeyboardView_keyLabelRatio); } + mKeyLargeLetterRatio = getRatio(a, R.styleable.KeyboardView_keyLargeLetterRatio); mKeyHintLetterRatio = getRatio(a, R.styleable.KeyboardView_keyHintLetterRatio); mKeyUppercaseLetterRatio = getRatio(a, R.styleable.KeyboardView_keyUppercaseLetterRatio); @@ -268,9 +266,9 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy { public void updateKeyHeight(int keyHeight) { if (mKeyLetterRatio >= 0.0f) mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio); - mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio); if (mKeyLabelRatio >= 0.0f) mKeyLabelSize = (int)(keyHeight * mKeyLabelRatio); + mKeyLargeLetterSize = (int)(keyHeight * mKeyLargeLetterRatio); mKeyHintLetterSize = (int)(keyHeight * mKeyHintLetterRatio); mKeyUppercaseLetterSize = (int)(keyHeight * mKeyUppercaseLetterRatio); mKeyHintLabelSize = (int)(keyHeight * mKeyHintLabelRatio); From be34d973349909196dc3427a5653f4e119092ea7 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 16:48:38 +0900 Subject: [PATCH 08/11] Add hintLabel to Key constructor This change also partialy reverts I5832421c, because of incorrect popup mini key width calculation. Bug: 5023981 Change-Id: I1acde090c01d3d861fcc5559cad81e638de2c2bb --- java/src/com/android/inputmethod/keyboard/Key.java | 6 +++--- .../android/inputmethod/keyboard/MiniKeyboard.java | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index f56b52388..e64f14d9b 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -195,15 +195,15 @@ public class Key { /** * This constructor is being used only for key in popup mini keyboard. */ - public Key(Resources res, KeyboardParams params, CharSequence popupCharacter, int x, int y, - int width, int height, int edgeFlags) { + public Key(Resources res, KeyboardParams params, CharSequence popupCharacter, + CharSequence hintLabel, int x, int y, int width, int height, int edgeFlags) { mHeight = height - params.mVerticalGap; mHorizontalGap = params.mHorizontalGap; mVerticalGap = params.mVerticalGap; mVisualInsetsLeft = mVisualInsetsRight = 0; mWidth = width - mHorizontalGap; mEdgeFlags = edgeFlags; - mHintLabel = null; + mHintLabel = hintLabel; mLabelOption = 0; mFunctional = false; mSticky = false; diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index 8f4791630..4a7655e34 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -17,7 +17,6 @@ package com.android.inputmethod.keyboard; import android.graphics.Paint; -import android.graphics.Rect; import com.android.inputmethod.keyboard.internal.KeyboardBuilder; import com.android.inputmethod.keyboard.internal.KeyboardParams; @@ -235,6 +234,8 @@ public class MiniKeyboard extends Keyboard { private static int getMaxKeyWidth(KeyboardView view, CharSequence[] popupCharacters, int minKeyWidth) { + final int padding = (int) view.getContext().getResources() + .getDimension(R.dimen.mini_keyboard_key_horizontal_padding); Paint paint = null; int maxWidth = minKeyWidth; for (CharSequence popupSpec : popupCharacters) { @@ -246,15 +247,13 @@ public class MiniKeyboard extends Keyboard { paint = new Paint(); paint.setAntiAlias(true); } - final int width = (int)view.getDefaultLabelWidth(label, paint); + final int width = (int)view.getDefaultLabelWidth(label, paint) + padding; if (maxWidth < width) { maxWidth = width; } } } - final int horizontalPadding = (int) view.getContext().getResources() - .getDimension(R.dimen.mini_keyboard_key_horizontal_padding); - return maxWidth + horizontalPadding; + return maxWidth; } @Override @@ -263,7 +262,7 @@ public class MiniKeyboard extends Keyboard { for (int n = 0; n < mPopupCharacters.length; n++) { final CharSequence label = mPopupCharacters[n]; final int row = n / params.mNumColumns; - final Key key = new Key(mResources, params, label, params.getX(n, row), + final Key key = new Key(mResources, params, label, null, params.getX(n, row), params.getY(row), params.mDefaultKeyWidth, params.mDefaultRowHeight, params.getRowFlags(row)); params.onAddKey(key); From 84b1284d01ffa1f730763471e1f2e9eddfb8ddea Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 18:37:19 +0900 Subject: [PATCH 09/11] Revert "Add hintLabel to Key constructor" This reverts commit be34d973349909196dc3427a5653f4e119092ea7. Bug: 5023981 Change-Id: I34f75cde035f04a9a82c9259442ed0e255cb7118 --- java/src/com/android/inputmethod/keyboard/Key.java | 6 +++--- java/src/com/android/inputmethod/keyboard/MiniKeyboard.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index e64f14d9b..f56b52388 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -195,15 +195,15 @@ public class Key { /** * This constructor is being used only for key in popup mini keyboard. */ - public Key(Resources res, KeyboardParams params, CharSequence popupCharacter, - CharSequence hintLabel, int x, int y, int width, int height, int edgeFlags) { + public Key(Resources res, KeyboardParams params, CharSequence popupCharacter, int x, int y, + int width, int height, int edgeFlags) { mHeight = height - params.mVerticalGap; mHorizontalGap = params.mHorizontalGap; mVerticalGap = params.mVerticalGap; mVisualInsetsLeft = mVisualInsetsRight = 0; mWidth = width - mHorizontalGap; mEdgeFlags = edgeFlags; - mHintLabel = hintLabel; + mHintLabel = null; mLabelOption = 0; mFunctional = false; mSticky = false; diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index 4a7655e34..f84eb19cd 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -262,7 +262,7 @@ public class MiniKeyboard extends Keyboard { for (int n = 0; n < mPopupCharacters.length; n++) { final CharSequence label = mPopupCharacters[n]; final int row = n / params.mNumColumns; - final Key key = new Key(mResources, params, label, null, params.getX(n, row), + final Key key = new Key(mResources, params, label, params.getX(n, row), params.getY(row), params.mDefaultKeyWidth, params.mDefaultRowHeight, params.getRowFlags(row)); params.onAddKey(key); From 392276d73dd6a1787afd3b859c213378e8e7bdb5 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 18:35:56 +0900 Subject: [PATCH 10/11] Add Key constructor for suggestions pane Bug: 5023981 Change-Id: I737bacb1a6bb40f70be65d6eff85614afe6c79ed --- .../com/android/inputmethod/keyboard/Key.java | 36 +++++++++++-------- .../inputmethod/keyboard/MiniKeyboard.java | 2 +- .../android/inputmethod/latin/LatinIME.java | 4 +-- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index f56b52388..c3db1b318 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -26,10 +26,10 @@ import android.util.Xml; import com.android.inputmethod.keyboard.internal.KeyStyles; import com.android.inputmethod.keyboard.internal.KeyStyles.KeyStyle; -import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; -import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.KeyboardBuilder; import com.android.inputmethod.keyboard.internal.KeyboardBuilder.ParseException; +import com.android.inputmethod.keyboard.internal.KeyboardIconsSet; +import com.android.inputmethod.keyboard.internal.KeyboardParams; import com.android.inputmethod.keyboard.internal.PopupCharactersParser; import com.android.inputmethod.keyboard.internal.Row; import com.android.inputmethod.latin.R; @@ -184,8 +184,8 @@ public class Key { sRtlParenthesisMap.put(right, left); } - public static int getRtlParenthesisCode(int code) { - if (sRtlParenthesisMap.containsKey(code)) { + public static int getRtlParenthesisCode(int code, boolean isRtl) { + if (isRtl && sRtlParenthesisMap.containsKey(code)) { return sRtlParenthesisMap.get(code); } else { return code; @@ -195,27 +195,35 @@ public class Key { /** * This constructor is being used only for key in popup mini keyboard. */ - public Key(Resources res, KeyboardParams params, CharSequence popupCharacter, int x, int y, - int width, int height, int edgeFlags) { + public Key(Resources res, KeyboardParams params, String popupSpec, + int x, int y, int width, int height, int edgeFlags) { + this(params, getRtlParenthesisCode(PopupCharactersParser.getCode(res, popupSpec), + params.mIsRtlKeyboard), + popupSpec, null, x, y, width, height, edgeFlags); + } + + /** + * This constructor is being used only for key in popup suggestions pane. + */ + public Key(KeyboardParams params, int code, String popupSpec, String hintLabel, + int x, int y, int width, int height, int edgeFlags) { mHeight = height - params.mVerticalGap; mHorizontalGap = params.mHorizontalGap; mVerticalGap = params.mVerticalGap; mVisualInsetsLeft = mVisualInsetsRight = 0; mWidth = width - mHorizontalGap; mEdgeFlags = edgeFlags; - mHintLabel = null; + mHintLabel = hintLabel; mLabelOption = 0; mFunctional = false; mSticky = false; mRepeatable = false; mPopupCharacters = null; mMaxPopupColumn = 0; - final String popupSpecification = popupCharacter.toString(); - mLabel = PopupCharactersParser.getLabel(popupSpecification); - mOutputText = PopupCharactersParser.getOutputText(popupSpecification); - final int code = PopupCharactersParser.getCode(res, popupSpecification); - mCode = params.mIsRtlKeyboard ? getRtlParenthesisCode(code) : code; - mIcon = params.mIconsSet.getIcon(PopupCharactersParser.getIconId(popupSpecification)); + mLabel = PopupCharactersParser.getLabel(popupSpec); + mOutputText = PopupCharactersParser.getOutputText(popupSpec); + mCode = code; + mIcon = params.mIconsSet.getIcon(PopupCharactersParser.getIconId(popupSpec)); // Horizontal gap is divided equally to both sides of the key. mX = x + mHorizontalGap / 2; mY = y; @@ -344,7 +352,7 @@ public class Key { Keyboard.CODE_UNSPECIFIED); if (code == Keyboard.CODE_UNSPECIFIED && !TextUtils.isEmpty(mLabel)) { final int firstChar = mLabel.charAt(0); - mCode = params.mIsRtlKeyboard ? getRtlParenthesisCode(firstChar) : firstChar; + mCode = getRtlParenthesisCode(firstChar, params.mIsRtlKeyboard); } else if (code != Keyboard.CODE_UNSPECIFIED) { mCode = code; } else { diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index f84eb19cd..ff4e72853 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -262,7 +262,7 @@ public class MiniKeyboard extends Keyboard { for (int n = 0; n < mPopupCharacters.length; n++) { final CharSequence label = mPopupCharacters[n]; final int row = n / params.mNumColumns; - final Key key = new Key(mResources, params, label, params.getX(n, row), + final Key key = new Key(mResources, params, label.toString(), params.getX(n, row), params.getY(row), params.mDefaultKeyWidth, params.mDefaultRowHeight, params.getRowFlags(row)); params.onAddKey(key); diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 229bf0f4c..7559108f3 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1708,8 +1708,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final int rawPrimaryCode = suggestion.charAt(0); // Maybe apply the "bidi mirrored" conversions for parentheses final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard(); - final int primaryCode = keyboard.mIsRtlKeyboard - ? Key.getRtlParenthesisCode(rawPrimaryCode) : rawPrimaryCode; + final int primaryCode = Key.getRtlParenthesisCode( + rawPrimaryCode, keyboard.mIsRtlKeyboard); final CharSequence beforeText = ic != null ? ic.getTextBeforeCursor(1, 0) : ""; final int toLeft = (ic == null || TextUtils.isEmpty(beforeText)) From c06d0ef01ddf286080fd421829a587741b1ebc1b Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Tue, 30 Aug 2011 18:56:27 +0900 Subject: [PATCH 11/11] Cleanup keyboard related code a bit Change-Id: I04f1014ab3b115bd457e25a267d2e46d306c8a0e --- .../inputmethod/keyboard/LatinKeyboardView.java | 2 +- .../keyboard/PopupMiniKeyboardView.java | 4 ++-- .../keyboard/internal/KeyboardParams.java | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java index 5fa9b8fc4..69cbcb154 100644 --- a/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboardView.java @@ -463,7 +463,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke mPopupPanelPointerTrackerId = tracker.mPointerId; final Keyboard keyboard = getKeyboard(); - mPopupPanel.setShifted(keyboard.isShiftedOrShiftLocked()); + popupPanel.setShifted(keyboard.isShiftedOrShiftLocked()); final int pointX = (mConfigShowMiniKeyboardAtTouchedPoint) ? tracker.getLastX() : parentKey.mX + parentKey.mWidth / 2; final int pointY = parentKey.mY - keyboard.mVerticalGap; diff --git a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java index c4428dc60..7ace46cac 100644 --- a/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/PopupMiniKeyboardView.java @@ -197,8 +197,8 @@ public class PopupMiniKeyboardView extends KeyboardView implements PopupPanel { @Override public void setShifted(boolean shifted) { - final MiniKeyboard miniKeyboard = (MiniKeyboard)getKeyboard(); - if (miniKeyboard.setShifted(shifted)) { + final Keyboard keyboard = getKeyboard(); + if (keyboard.setShifted(shifted)) { invalidateAllKeys(); } } diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java index 4ccaa72d2..980115200 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java @@ -64,6 +64,15 @@ public class KeyboardParams { public int mMostCommonKeyWidth = 0; + protected void clearKeys() { + mKeys.clear(); + mShiftKeys.clear(); + mShiftLockKeys.clear(); + mShiftedIcons.clear(); + mUnshiftedIcons.clear(); + clearHistogram(); + } + public void onAddKey(Key key) { mKeys.add(key); updateHistogram(key); @@ -83,6 +92,12 @@ public class KeyboardParams { private int mMaxCount = 0; private final Map mHistogram = new HashMap(); + private void clearHistogram() { + mMostCommonKeyWidth = 0; + mMaxCount = 0; + mHistogram.clear(); + } + private void updateHistogram(Key key) { final Integer width = key.mWidth + key.mHorizontalGap; final int count = (mHistogram.containsKey(width) ? mHistogram.get(width) : 0) + 1;