From 2b2db815d29358d6ec6f023b09bb33d40cbefee0 Mon Sep 17 00:00:00 2001
From: satok <satok@google.com>
Date: Thu, 17 Jun 2010 11:18:54 +0900
Subject: [PATCH] Move KeyboardView in the framework to LatinKeyboardViewBase

Change-Id: I99e3ea5eb1f1f5e5f9b36306930cdf0f50acfb01
---
 .../keyboard_key_feedback_background.9.png    | Bin 0 -> 1372 bytes
 ...eyboard_key_feedback_more_background.9.png | Bin 0 -> 1637 bytes
 .../keyboard_key_feedback_background.9.png    | Bin 0 -> 1182 bytes
 ...eyboard_key_feedback_more_background.9.png | Bin 0 -> 1385 bytes
 java/res/drawable/keyboard_key_feedback.xml   |  22 ++
 java/res/layout/input.xml                     |   4 +-
 java/res/layout/input2.xml                    |   5 +-
 java/res/layout/input3.xml                    |   4 +-
 java/res/layout/input4.xml                    |   4 +-
 java/res/layout/input5.xml                    |   4 +-
 java/res/layout/input6.xml                    |   4 +-
 java/res/layout/input7.xml                    |  14 +-
 java/res/layout/input7_popup.xml              |  14 +-
 java/res/layout/input_trans.xml               |   4 +-
 java/res/layout/keyboard_key_preview.xml      |  29 ++
 java/res/layout/keyboard_popup_keyboard.xml   |  48 +++
 java/res/values/attrs.xml                     |  57 +++
 java/res/values/bools.xml                     |   1 +
 java/res/values/styles.xml                    |  34 ++
 .../android/inputmethod/latin/LatinIME.java   |   3 +-
 .../latin/LatinKeyboardBaseView.java          | 355 +++++++++---------
 .../inputmethod/latin/LatinKeyboardView.java  |   3 +-
 22 files changed, 412 insertions(+), 197 deletions(-)
 create mode 100644 java/res/drawable-hdpi/keyboard_key_feedback_background.9.png
 create mode 100644 java/res/drawable-hdpi/keyboard_key_feedback_more_background.9.png
 create mode 100644 java/res/drawable-mdpi/keyboard_key_feedback_background.9.png
 create mode 100755 java/res/drawable-mdpi/keyboard_key_feedback_more_background.9.png
 create mode 100644 java/res/drawable/keyboard_key_feedback.xml
 create mode 100644 java/res/layout/keyboard_key_preview.xml
 create mode 100644 java/res/layout/keyboard_popup_keyboard.xml
 create mode 100644 java/res/values/attrs.xml
 create mode 100644 java/res/values/styles.xml
 rename temp/KeyboardView.java => java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java (87%)

diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_background.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_background.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..6ba42db8237727d5d67b629bd60384fc014df3ab
GIT binary patch
literal 1372
zcmV-i1*7_jP)<h;3K|Lk000e1NJLTq002h-002q|1^@s6=`KmZ000FeNkl<Zc-rlo
z%WqXx6vnB_g;G!i5kw_bUIwCof*Rwa%0rC=0#c;+-o9VAuVHo8ChDLwQ(uX3Se^AB
z&`Ae6Xkr+2Ku9`}A*04w86Ll1vo<-cG{xL=&OJ9-D_Pm69o)U{x4*UaI_<YMZOV^D
z=5B6oZtGdY<mBWdt*xz(4h#%z)>;@F8{2|+b#-mc(%F;!iKC^Z<uPI+He$>i6gDRq
zd1I+mdc3!{cUO0J_nyAKzP;sg`5C;Yr)Pf_&Rzm&UweD|(;XchyY;+Nacu`QfXWJ_
z6{c`H@@>Up@ks(xP%kKumlW750_au!d|E%B(a*1^?d*ehc6Pp|^`zG0S`RCZ=Q%8a
zw*yuIQknqWXA2v`5Cw8j0iM$OuGWtg)K#sYX)Wq^B|VqZcJ?uE)4r`*FX{K^^!%p4
zIR;3u8ivPMl&o28DUd=?nG*sO`KJQv%Sxs4`|$Aaom#u%xH&jD_=`Xpumd}z=NH@B
z+Ma^#X)vgPRDv-8L;47m3wj=r-5MPojdJMs6!XuD^_swW%UHe}29W`YA!E1EHcKTK
zb3s)7iU4v7%zYP|{!+ZxNi%t~73)G$?4i~a_)yR%mGnHk7MSVj>1cj_K3ZH{tf|k=
z&PL<o<EsEtn*Ao$To%($aDi~piLl3NO(Rz&w*f_WZ7Kmuo@{w}IhvZ9S_KeHSL`hu
zFb7SUNF=4GHAcyIw8<BF24+2gDAce=-{EDhc&_)VQ;X_OKSLiQ{|Ji4Qz_3zn#B*2
zt6x3X8(N<w8>$9}dIQqjQ1UA(aJR!|b8~Z1-Ys5#NG+?G&2-RJ_dL*#TZ+z?s!uNw
zHsfUSZm>JVtM4(b?{Jp7L#apv9D7CJm7rM9;HU_HukUc4*9$#Au>m+6|KW|7H+!+;
z{iRgT;Pm(R|DZ$uQ03tW;B0W6KO8u8#r7guc5og5j=cq!>%8Xt7{IYk*}-ve92^J7
z!EtaL90$k2ac~@*{{>Fu;5ay*Rt}DX<KQ?r4vvH4;5axAj)UXiI5-YY9fITkD}M-Z
z>Rn|4IEX!i%A#s;Y>r`{Da3EoIXK@U;MQRuLQh?_J_ltNGX;nx(e%c_Sy))eJveb)
zpxE*aqDjUP5)m(<x<uTJR9@@FN~Q8=*lcEICfC3$EiJ9m1R^R&u#My&xoskXN%9ja
z>O()!^G{(j^mYW0S3{E=VjUS7xyx(>vl=EF-dZ&{P){^$QjR{yb<O~WHu@)Q3T=_K
z=FN}*$5|uB|7s%%M{Q7~kcfhvqRe0ga$7ctvj?A;n8=MD877nN@%W52H#l5U3MFY`
z^A9%pwjKR0s!}AkaXs={nSZUELweAFh?w%ZVt$|ghWg22CpKEd2l0U>)^0}VjLaXZ
z=6N_oH|yUNVHBh`q{cK~Q_^EaVGym6e6`6uI_6Kb`S{S#&>!(Slmk$1i`g?a7{|QB
zaT}}LL9Iz+Ag#gDD*$wWIRdS3bH&@F+!(!tnyv5XMseO}((<qe`eGV9{qAeU(#e3F
z>5b{?4<j;96PQ&1aShU8vMDU$WDs#1P~`SG3ODaDS-7RmSv|jJb5%5~N4R0_Ae-pd
zvKWMIh>c3GOa^n4naceDBZKrrR{Sz?*kPkW%>croQ6ITP!tiUFj9GV5*ivm}gqjnA
zz5qt!i1Vj`v^?yAvnOEC`2vU?Ud?99{{vP4EDYjj<zdel5H$zG&CSit&CSit&CSg%
eWs9otOzmH=G!68PlthsL0000<MNUMnLSTY@>yQ`#

literal 0
HcmV?d00001

diff --git a/java/res/drawable-hdpi/keyboard_key_feedback_more_background.9.png b/java/res/drawable-hdpi/keyboard_key_feedback_more_background.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..4d0b60109987c866268d42f30d8148829a1af76a
GIT binary patch
literal 1637
zcmV-r2AcVaP)<h;3K|Lk000e1NJLTq002h-002q|1^@s6=`KmZ000IoNkl<Zc-rlo
zYe;2P6vw?yV>6TGt!c_0Q%%!MR8!My?8)TNG}8lmTls!_uaEo92lhe168zv4W{D_%
zvJ^q3k5QmlD58l7lBj5)9|S)bA{vOY`~PK~%enUo8TXv)@v;{z?$OOXYoFg<Ywdk>
zt(X{lMTu(BqD6}p;;N~sxhXk0`AA`5;Zc0X`h31ysM*=s$0DVMP1;XNO1hcz;k-D%
z0|6qFhy|1rX=!P<=jG+ynUj-qDnCE}p7iwed#Sm(x%b(vv;#m1w40KWa#w0<>K*v~
zZJ66}S+FCKg5;txLdnR;xRpRSK|px~KR=G^i@1Ic*DqkgmohUm6YW&mpwb?GeiqkH
zVGfVs^I-ymy196SWVa`|=q=*PZbHF?&I^bn=sVDl@Vn3OnVOZAm4@qdyOnmJDbP=0
z_XFr#nA2<cd`1@SZhDf0oh@Euc+7En3-lox$AsP>47l`HUa$Ap;^N}J4p^r>9?wsh
zUnS=CA?9}(`Xm>Up-({KLDmUx$Qv`B#bqzS=z9eP1z(qxlq{E)mMW(y7Hb^yEXF*q
z0o2pb`w56C!Ad|b#w>3PH$4qw&(nQj{6{B33DSSyMPDMcu0t;{4>4Ctcv<5$3@64e
zT@)+uHeC0I;E8l}bf}S$5j8tIdtf>+FrXS68}|ZK!Muo_?NO!$dXFW!he?=T!*Bwe
zSK&QHG-w#Fudi22OH0a0!bK`CFZTmNE?U5%e!`uU`G-50C80&ixbaEc_zCVv2&Z2R
zqnyCz=B9F@OioS)co6dA4S4_S+`%OGgdJKg*}4;$Yq&EZ0sn0n<O(@i%pq1(RP;NZ
z;a#4`7+TDuRwUySOvKPv04dkJ8cy|^y}XB8J>YyS2h~%OcfwA_aiD#M2@U6&I>T6X
zb+vN3FiD%?;2A!b-8O+old$11KAGhaQdbeT-x|i~vWE~(Do^x$AKM2U^`CGMR`Iy$
zIUc5P{oP@P!&eO+VC7}?SXgl6PZ9C*4s{)#^Zj9lBkyC0+|D%|yW#K++<=3G+^pef
zI2w+Iqv2>c8jgme;b=Hf4@YS@8jcPt4M)S#a5NkZN5j!@G#m{_!_jb}4$jcfkZNmd
zQ@y>tYISurV2nTa_4TRN)>bt*I2iKX@$qrh-rlady1LZz@^W<jQ;!eq^ZEQ*TU)EP
zwzhW1wzs!cU0q$kcz=Jt|GN_t69HqDm6d9JeLZ^MG&D2>JRo&uW@dM6Zf-7QjIa!8
zX=w==A08gwHyr-2+!8oOl?4k4pl@1LNWgFjen2BUR#sL*#+sU%{NL^D><k&7nwr`d
z97_uc2!{pExanEe93$s6S^;NqaZy!NRQMl`4{Vn1?r#5BSy`D{SXl6n5nfeQm4Cds
zxmoS(?Ccj#iWHSwQ=h})B`KD?3{YQ~E4#uG=83VfF*QFwzvnoCjE;_~wY9a7v5k$5
z-K0D{J^jCSD^|I)4S;<TVZ$-X-Vj<30MJXgd8QeT)2c{=g{8M9IDZ1n`>aQ11Bn$i
zfiWa3{R0=-+rScfbM3KHh4qRo%`@ie@p$^An*BVFCoCZj8x9Gxte-b!=^Ko6n7zlT
z6{TD_bD=gC*NgeTjD>!Xslt*fcHV>~@eC~{GsZ28p3Q)IdU_mFS;{;UT*dD7dViKO
z+Y5{W?o^f(X&X%;tlgC@o$W)#<|=k`H9IGEP-+e%Q~mKDTu?xHkzT{2iR2qgT8no3
ztmr+=^3wls6>eJM)Q%YwnBQ1l%l<2=h&^eU*929S9_5*b2Pgq_g@)NZ<1|Rznb_{c
zo+~LXKgYss?!1zSt!+q?Gfyl5(SsyGCvpdX@nm`ujDN#gWxi%m`J!sK8n(pl4IVcL
zg^R~C4GYX=>o&JDS}%qNF~p=<<TQIKISE;zB!(P;Nsm)Rl=gUnXX6LYV?1^+jN~24
z&6X&7jBQ}dfM`g1CgUVgClC}@iIbumi)TedrHK42Px7*>az}DY<5_GZJA?!J$!VNP
zj&944lieU*D&O69t6@vpgyJ|4E}YReZM(PZ2bKZM1TA7}*fq6ByJECx(V|6*7A;z|
jXwjl2x<!Sd5tV-d&Zw-wCl_oA00000NkvXXu0mjfqz4Nx

literal 0
HcmV?d00001

diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_background.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_background.9.png
new file mode 100644
index 0000000000000000000000000000000000000000..2a80f096d200d5ae8a7700d7b7399be4f7743d8a
GIT binary patch
literal 1182
zcmV;P1Y!G$P)<h;3K|Lk000e1NJLTq001ul001!v1^@s6O8f9f0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU$KuJVFRCwC#nomztK@h;-?%P+f2k?M$
zwj2m16%%4&IC>!g4&nzO(G#5f2*!`V2~L{u0l<SLfrCfmg{Im>!hssErY1s2t?ld9
zow{45+u7Gb|2#<8WYSG{yYrjb+4pv5%j)&IH;BR*YYeQ$XWoDc!|+OB$Nm>-S7S@U
zC{FyYlLzaO@D6ZB)LDo2Zc4pFy&eVLWQGa>&WKOD&K&)^1;?LQJfhxaM1z}vcR_-1
z>odxbPT;mk>(gbF6W#{LuzY!W`TqF$_)-uAbDZ-h>UZ~gU35zSPbuZ+YPI^QSS)_n
z+1dH74WNu^8sLJ*;70tlwY7C2#7l3$B@Dy28yg$1RJDeTuxFzUo&xtlR##WomA79&
zzuDPYnNFu=DwUFBV`Du(XHQN}SfNnh`Fx%q92{`qQM2%Fb92)eP@@cR!DDc-xVWe|
zQ#t4}KR;hvSXihMQ`ytw+UVWg-3|8k_IzMc20hATG6k3n$^huYT>}}fPfScKK?8VP
zfmifkAsVz-X^scugC5YQ_4-=4^-yROPJm;0kw_%wpizYiR@m>?a@~xr^>|vZAmEz@
z2;%XE!zNIR^f7#?LMPPIHpn8i9-}wVI%}Fqp1-J>ba~!Pmr$MVLZe!oasVE0n*puI
z(|QGBY4bc4^DPVZ0{f4Ch7gVnA2B&&o?NhAyya3078?*ZJa=qEJnnez;<sy@g}Xu~
zDr~U#<Ax`_PK6Eiro9TDCwHy9!+xB_49}v@8Qh#TBSI%`cqdETVbNPm4f1q9j0NG{
zz~8{%z~8{f0#7A-;wq6WJSwGjMc|#OLLQNdYor=f`DOAe!=N>Kv|j1Tm{DQVmOm_)
z%U_`3`1p7z2NR=5>y@t1ft`UX=9_7@v$L}-e3{SZ#Sk`XOzZKqUOV0AT(DHuwsv%M
z^bs1f*{sN9G9!Z|hw(uV)V1DPl=p=rY)r1CmdoXS%*@PekB*K$-{0R)6pKZkPN%Dr
zlarxIQ}h_)T!o5I9uEK<(s-w*r`w>{Yt2=*J#kE~5}%yFpoA9i^lc@{m6es(3ijC$
z7VP`2t*tkzT2k@{!e2>6i%EP*NLFHahTx3>x3n}2n4X?aO-)TbRYp8aCX)|@5O;co
z4a4wvsZ{!=pua+>93CDP5cpp$I7ce~uh(;U`=l;(sx7b#7|~+BGkxs*O4M^(qHw5c
zF_2{~7~J#;@dBn&+;+AMhY+5L1Oe`Q?&}@<9a19<s92t^SRQXlb9a@Ww`L*G-~xdQ
z$0<MRb#EX-WI(84tCqK&`T4GHMi69x4Dzi!;$`4*2pQ0-*Pi?Dcr)TMz&64sz!{N7
ziQ213%Lv!SL)UjwuEY~%hz)(&t4zuW8@TJ+K+1q?a}Vn|GH6%#2E3v5y8ic|slCtt
w`snh2aiR7W-hTbxhRAtF0rX{S{ZD`a0Knm-6_tb>A^-pY07*qoM6N<$f{XA!Jpcdz

literal 0
HcmV?d00001

diff --git a/java/res/drawable-mdpi/keyboard_key_feedback_more_background.9.png b/java/res/drawable-mdpi/keyboard_key_feedback_more_background.9.png
new file mode 100755
index 0000000000000000000000000000000000000000..29aa285bd5446fa30710c24efe602ec948b44ea4
GIT binary patch
literal 1385
zcmV-v1(y1WP)<h;3K|Lk000e1NJLTq001ul001!v1^@s6O8f9f0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU%3rR#lRCwC#TER<WM;L!InU~m5v<F>5
z5Nte%g=ke4${rN<BIpXWUOWlyNl*O~O8<mC>8T5zJgq%!0(vNTS$a{dfr<ySEZ%As
z8nJ0iUgmYabY}T7nR)N&Go}RxKHelV`M%%xn{VdLd=ujPz7wYqLYfMM9^yQ3AsD;>
z653z;Oy!f~cA=9CT~yUAPE+(Tj6pvTyahNh)JaHtl;Vff{UG29GqV6EhNoU9mVQxz
z<0lqJtG77;c)<Y{z&0@m)t*6)gaOxuYfs%7qC3PwfMc+9d3pKs{{H?KuIoOdlzt@`
zcoKKg2?qb*oc~&{*WZ>(r8m2~yYHj}*cqb(&6r1FqqD3ev9Yo7k}>vOr&kcq^M2ag
z-27ft8_0>a(P-jE;7!02AnWVvF9qA*Lcf`r8J^8%c_x$LeSLj?T(ISGnG}mfS|}9g
z;o%_#JYp1HZEbBS2O1^^Y~V3)wz#+`aAuC7&;0y+V_{*Tt|^MWTr0czeBRyL+e-i@
z;n0`4T&@U%VR8WaP@5vf`rzQ;3upkw1@M|w<{_nV<)c2(4|c$ww40DZwMC)jC1VPk
zCiBT;@)<OWP{9WMdk%G9>6UgJX_pzm6CFI!98%z2F-f1omm+jLH1j)ExU}O)yDkDx
zTVK$`w=u7Vi-}GH&?qJ+?*QX%BOvWK(k??-tjuEvS|;o*_8<2dLijy|nYYHgal$&?
zEq9u**nw_?r<QF<8}p9g?b^*kZ6OmBHkkcxgEz8n3LDd#_P@Zqao0*i_T!|>;7QOq
zgQ_!VK<IQEycJ8g!y;Zxb>q~3pA*7)1pf&B5&R?gu7EdXup*a>iwjmRms|8+US1|Z
zw5$Pzz7h8JRxB(aM|kT4$icxu&&kP2N}NCa)z#H&I2E0rpS$^dJ`L^SfL$3K9jycK
zot>ReYqc7gn3%Yko13dfIGD8Iqyee8W~xDy4=TSB2EJ4(HQ5DFS65e5v5rRop3nw;
z@NaM)$NAUr2SdK5#UUCpOuSmH{ss+#!O(-r?CflHXlTd-Hiw6Yn+NHssi~Whk&!wG
z)Zsg5gFes~euH%=JJK$<g%0ctm}RIwrrEBquaDB{^z%ZYz^13CYeAtjFfh<qSy}lD
zf0s(7{H3L(ir&`}Dg^961?(EqebxzU%Gx&0&dz>;#-pPnmdoXOI=Om)ey{^|X}1x?
zKC^@kS4p7b<Ky>}lasG|dwajx-``J)7^T^4wk{@~r_vNLbCpzt3KNXG036bIVotmU
zyIQWYZN*W!N_=txhmul&=}&~D*Vfj45MaOV^x7?)`FVSL`$tiQQ2QIgAJzaVD)Gf3
zS&6|D1YS9ilG1cwe0)4JHa7NLI58pS!556N&*FmhJnzp+rSiJ~eFC9!dU{$!z;C4B
z94VKHRv%}Hsm8u51v}6qMSbU@lw87g$~P<qDje!k6v(O+3|#f`@C4Scb$mn26AchY
zMsGCW3CDiDqrXEM1_x>y(+aR@(ngxFL@Lo)t0Caba>@^S-75w?<ba1jD+!#iEW|*=
zu=Y3P?`m2e@h;$T2&tIHj9Y;_0f|%|5Kf*J<5WvfMY#>+20~0?y^{)J9y_3qgbDOr
zuQE+e=zt?Juapwa0fLlJY2YF6VSU@K*Ty_?+AnYka^@j#z-`<0|M!0n;{NO7w(U_4
rIDzdgc;o)x200#C(S2p<{t;jRaYXaV8UYj(00000NkvXXu0mjfEPjx}

literal 0
HcmV?d00001

diff --git a/java/res/drawable/keyboard_key_feedback.xml b/java/res/drawable/keyboard_key_feedback.xml
new file mode 100644
index 0000000000..159ba86868
--- /dev/null
+++ b/java/res/drawable/keyboard_key_feedback.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_long_pressable="true"
+            android:drawable="@drawable/keyboard_key_feedback_more_background" />
+
+    <item android:drawable="@drawable/keyboard_key_feedback_background" />
+</selector>
diff --git a/java/res/layout/input.xml b/java/res/layout/input.xml
index 1d7c6f7469..039fdd8df6 100755
--- a/java/res/layout/input.xml
+++ b/java/res/layout/input.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/keyboard_background"
-        android:keyBackground="@drawable/btn_keyboard_key"
+
+        latin:keyBackground="@drawable/btn_keyboard_key"
         />
diff --git a/java/res/layout/input2.xml b/java/res/layout/input2.xml
index 2e90c2c6bf..3c9ec2fdf2 100755
--- a/java/res/layout/input2.xml
+++ b/java/res/layout/input2.xml
@@ -20,10 +20,13 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key3"
         android:background="@android:color/black"
+
+        latin:keyBackground="@drawable/btn_keyboard_key3"
         />
diff --git a/java/res/layout/input3.xml b/java/res/layout/input3.xml
index a27d09a5ab..a4295f7f47 100755
--- a/java/res/layout/input3.xml
+++ b/java/res/layout/input3.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key2"
         android:background="@drawable/keyboard_background_4"
+
+        latin:keyBackground="@drawable/btn_keyboard_key2"
         />
diff --git a/java/res/layout/input4.xml b/java/res/layout/input4.xml
index 58dd51e3cb..b5da9d48f6 100755
--- a/java/res/layout/input4.xml
+++ b/java/res/layout/input4.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key3"
         android:background="@drawable/keyboard_background_4"
+
+        latin:keyBackground="@drawable/btn_keyboard_key3"
         />
diff --git a/java/res/layout/input5.xml b/java/res/layout/input5.xml
index 5cd0b8d027..2de11dfffa 100755
--- a/java/res/layout/input5.xml
+++ b/java/res/layout/input5.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key2"
         android:background="@drawable/keyboard_background_5"
+
+        latin:keyBackground="@drawable/btn_keyboard_key2"
         />
diff --git a/java/res/layout/input6.xml b/java/res/layout/input6.xml
index 19197e1e4a..54f31044fa 100755
--- a/java/res/layout/input6.xml
+++ b/java/res/layout/input6.xml
@@ -20,10 +20,12 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:keyBackground="@drawable/btn_keyboard_key3"
         android:background="@drawable/keyboard_background_5"
+
+        latin:keyBackground="@drawable/btn_keyboard_key3"
         />
diff --git a/java/res/layout/input7.xml b/java/res/layout/input7.xml
index 6279f5d08b..1290eb8ca1 100755
--- a/java/res/layout/input7.xml
+++ b/java/res/layout/input7.xml
@@ -20,14 +20,16 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
-        android:id="@android:id/keyboardView"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+        android:id="@+id/LatinkeyboardBaseView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/keyboard_background"
-        android:keyBackground="@drawable/btn_keyboard_key_ginger"
-        android:keyTextSize="22dip"
-        android:keyTextColor="@color/latinkeyboard_key_color_black"
-        android:shadowColor="@color/latinkeyboard_key_color_white"
-        android:popupLayout="@layout/input7_popup"
+
+        latin:keyBackground="@drawable/btn_keyboard_key_ginger"
+        latin:keyTextSize="22dip"
+        latin:keyTextColor="@color/latinkeyboard_key_color_black"
+        latin:shadowColor="@color/latinkeyboard_key_color_white"
+        latin:popupLayout="@layout/input7_popup"
         />
diff --git a/java/res/layout/input7_popup.xml b/java/res/layout/input7_popup.xml
index d1261b8cc4..2056757fa9 100755
--- a/java/res/layout/input7_popup.xml
+++ b/java/res/layout/input7_popup.xml
@@ -25,18 +25,20 @@
         android:orientation="horizontal"
         android:background="@drawable/keyboard_popup_panel_background"
         >
-    <android.inputmethodservice.KeyboardView
+    <com.android.inputmethod.latin.LatinKeyboardView
             xmlns:android="http://schemas.android.com/apk/res/android"
+            xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
             android:id="@android:id/keyboardView"
             android:layout_alignParentBottom="true"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:keyBackground="@drawable/btn_keyboard_key_ginger"
             android:background="@drawable/keyboard_background"
-            android:keyTextColor="@color/latinkeyboard_key_color_black"
-            android:shadowColor="@color/latinkeyboard_key_color_white"
-            android:keyTextSize="22dip"
-            android:popupLayout="@layout/input7_popup"
+
+            latin:keyBackground="@drawable/btn_keyboard_key_ginger"
+            latin:keyTextColor="@color/latinkeyboard_key_color_black"
+            latin:shadowColor="@color/latinkeyboard_key_color_white"
+            latin:keyTextSize="22dip"
+            latin:popupLayout="@layout/input7_popup"
         />
     <ImageButton android:id="@android:id/closeButton"
         android:background="@android:color/transparent"
diff --git a/java/res/layout/input_trans.xml b/java/res/layout/input_trans.xml
index f66e8cd5c1..ee5f85ea16 100755
--- a/java/res/layout/input_trans.xml
+++ b/java/res/layout/input_trans.xml
@@ -20,11 +20,13 @@
 
 <com.android.inputmethod.latin.LatinKeyboardView
         xmlns:android="http://schemas.android.com/apk/res/android"
+        xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
         android:id="@android:id/keyboardView"
         android:layout_alignParentBottom="true"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@color/latinkeyboard_extension_background"
         android:verticalCorrection="0dip"
-        android:keyBackground="@drawable/btn_keyboard_key_fulltrans"
+
+        latin:keyBackground="@drawable/btn_keyboard_key_fulltrans"
         />
diff --git a/java/res/layout/keyboard_key_preview.xml b/java/res/layout/keyboard_key_preview.xml
new file mode 100644
index 0000000000..64eaa65795
--- /dev/null
+++ b/java/res/layout/keyboard_key_preview.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="80sp"
+    android:textSize="40sp"
+    android:textColor="?android:attr/textColorPrimaryInverse"
+    android:minWidth="32dip"
+    android:gravity="center"
+    android:background="@drawable/keyboard_key_feedback"
+    />
diff --git a/java/res/layout/keyboard_popup_keyboard.xml b/java/res/layout/keyboard_popup_keyboard.xml
new file mode 100644
index 0000000000..e6b3a411fd
--- /dev/null
+++ b/java/res/layout/keyboard_popup_keyboard.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+**
+** Copyright 2010, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<LinearLayout
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:background="@drawable/keyboard_popup_panel_background"
+        >
+    <com.android.inputmethod.latin.LatinKeyboardBaseView
+            xmlns:latin="http://schemas.android.com/apk/res/com.google.android.inputmethod.latin"
+            android:id="@+id/LatinKeyboardBaseView"
+            android:layout_alignParentBottom="true"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@android:color/transparent"
+
+            latin:keyPreviewLayout="@layout/keyboard_key_preview"
+            latin:keyTextSize="22sp"
+            latin:popupLayout="@layout/keyboard_popup_keyboard"
+            />
+    <ImageButton android:id="@+id/closeButton"
+        android:background="@android:color/transparent"
+        android:src="@drawable/btn_close"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginLeft="8dp"
+        android:clickable="true"
+        />
+</LinearLayout>
\ No newline at end of file
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
new file mode 100644
index 0000000000..2468e9df0a
--- /dev/null
+++ b/java/res/values/attrs.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+
+    <declare-styleable name="LatinKeyboardBaseView">
+        <!-- Default KeyboardView style. -->
+        <attr name="keyboardViewStyle" format="reference" />
+
+        <!-- Image for the key. This image needs to be a StateListDrawable, with the following
+             possible states: normal, pressed, checkable, checkable+pressed, checkable+checked,
+             checkable+checked+pressed. -->
+        <attr name="keyBackground" format="reference" />
+
+        <!-- Size of the text for character keys. -->
+        <attr name="keyTextSize" format="dimension" />
+
+        <!-- Size of the text for custom keys with some text and no icon. -->
+        <attr name="labelTextSize" format="dimension" />
+
+        <!-- Color to use for the label in a key. -->
+        <attr name="keyTextColor" format="color" />
+
+        <!-- Layout resource for key press feedback.-->
+        <attr name="keyPreviewLayout" format="reference" />
+
+        <!-- Vertical offset of the key press feedback from the key. -->
+        <attr name="keyPreviewOffset" format="dimension" />
+
+        <!-- Height of the key press feedback popup. -->
+        <attr name="keyPreviewHeight" format="dimension" />
+
+        <!-- Amount to offset the touch Y coordinate by, for bias correction. -->
+        <attr name="verticalCorrection" format="dimension" />
+
+        <!-- Layout resource for popup keyboards. -->
+        <attr name="popupLayout" format="reference" />
+
+        <attr name="shadowColor" format="color" />
+        <attr name="shadowRadius" format="float" />
+        <attr name="backgroundDimAmount" format="float" />
+    </declare-styleable>
+
+</resources>
diff --git a/java/res/values/bools.xml b/java/res/values/bools.xml
index ebe2f04e52..a0cebbb940 100644
--- a/java/res/values/bools.xml
+++ b/java/res/values/bools.xml
@@ -25,4 +25,5 @@
     <bool name="im_is_default">false</bool>
     <!-- Whether or not voice input is enabled by default. -->
     <bool name="voice_input_default">true</bool>
+    <bool name="config_swipeDisambiguation">true</bool>
 </resources>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
new file mode 100644
index 0000000000..a59a15083e
--- /dev/null
+++ b/java/res/values/styles.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <style name="LatinKeyboardBaseView">
+        <item name="android:background">@drawable/keyboard_background</item>
+
+        <item name="keyBackground">@drawable/btn_keyboard_key</item>
+        <item name="keyTextSize">22sp</item>
+        <item name="keyTextColor">#FFFFFFFF</item>
+        <item name="keyPreviewLayout">@layout/keyboard_key_preview</item>
+        <item name="keyPreviewOffset">-12dip</item>
+        <item name="keyPreviewHeight">80dip</item>
+        <item name="labelTextSize">14sp</item>
+        <item name="popupLayout">@layout/keyboard_popup_keyboard</item>
+        <item name="verticalCorrection">-10dip</item>
+        <item name="shadowColor">#BB000000</item>
+        <item name="shadowRadius">2.75</item>
+        <item name="backgroundDimAmount">0.5</item>
+    </style>
+</resources>
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 8186154a50..5b10e2ce77 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -32,7 +32,6 @@ import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.inputmethodservice.InputMethodService;
 import android.inputmethodservice.Keyboard;
-import android.inputmethodservice.KeyboardView;
 import android.media.AudioManager;
 import android.os.Debug;
 import android.os.Handler;
@@ -74,7 +73,7 @@ import java.util.Map;
  * Input method implementation for Qwerty'ish keyboard.
  */
 public class LatinIME extends InputMethodService
-        implements KeyboardView.OnKeyboardActionListener,
+        implements LatinKeyboardBaseView.OnKeyboardActionListener,
         VoiceInput.UiListener,
         SharedPreferences.OnSharedPreferenceChangeListener {
     private static final String TAG = "LatinIME";
diff --git a/temp/KeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
similarity index 87%
rename from temp/KeyboardView.java
rename to java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
index 4b484092d0..64299b626b 100644
--- a/temp/KeyboardView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardBaseView.java
@@ -1,20 +1,20 @@
 /*
- * Copyright (C) 2008-2009 Google Inc.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
-package android.inputmethodservice;
+package com.android.inputmethod.latin;
 
 import android.content.Context;
 import android.content.res.TypedArray;
@@ -27,6 +27,7 @@ import android.graphics.Typeface;
 import android.graphics.Paint.Align;
 import android.graphics.Region.Op;
 import android.graphics.drawable.Drawable;
+import android.inputmethodservice.Keyboard;
 import android.inputmethodservice.Keyboard.Key;
 import android.os.Handler;
 import android.os.Message;
@@ -42,81 +43,91 @@ import android.view.ViewGroup.LayoutParams;
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
-import com.android.internal.R;
-
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
 /**
- * A view that renders a virtual {@link Keyboard}. It handles rendering of keys and
+ * A view that renders a virtual {@link LatinKeyboard}. It handles rendering of keys and
  * detecting key presses and touch movements.
- * 
- * @attr ref android.R.styleable#KeyboardView_keyBackground
- * @attr ref android.R.styleable#KeyboardView_keyPreviewLayout
- * @attr ref android.R.styleable#KeyboardView_keyPreviewOffset
- * @attr ref android.R.styleable#KeyboardView_labelTextSize
- * @attr ref android.R.styleable#KeyboardView_keyTextSize
- * @attr ref android.R.styleable#KeyboardView_keyTextColor
- * @attr ref android.R.styleable#KeyboardView_verticalCorrection
- * @attr ref android.R.styleable#KeyboardView_popupLayout
+ *
+ * @attr ref R.styleable#LatinKeyboardBaseView_keyBackground
+ * @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewLayout
+ * @attr ref R.styleable#LatinKeyboardBaseView_keyPreviewOffset
+ * @attr ref R.styleable#LatinKeyboardBaseView_labelTextSize
+ * @attr ref R.styleable#LatinKeyboardBaseView_keyTextSize
+ * @attr ref R.styleable#LatinKeyboardBaseView_keyTextColor
+ * @attr ref R.styleable#LatinKeyboardBaseView_verticalCorrection
+ * @attr ref R.styleable#LatinKeyboardBaseView_popupLayout
  */
-public class KeyboardView extends View implements View.OnClickListener {
+public class LatinKeyboardBaseView extends View implements View.OnClickListener {
 
-    /**
-     * Listener for virtual keyboard events.
-     */
     public interface OnKeyboardActionListener {
-        
+
         /**
-         * Called when the user presses a key. This is sent before the {@link #onKey} is called.
-         * For keys that repeat, this is only called once.
-         * @param primaryCode the unicode of the key being pressed. If the touch is not on a valid
-         * key, the value will be zero.
+         * Called when the user presses a key. This is sent before the
+         * {@link #onKey} is called. For keys that repeat, this is only
+         * called once.
+         *
+         * @param primaryCode
+         *            the unicode of the key being pressed. If the touch is
+         *            not on a valid key, the value will be zero.
          */
         void onPress(int primaryCode);
-        
+
         /**
-         * Called when the user releases a key. This is sent after the {@link #onKey} is called.
-         * For keys that repeat, this is only called once.
-         * @param primaryCode the code of the key that was released
+         * Called when the user releases a key. This is sent after the
+         * {@link #onKey} is called. For keys that repeat, this is only
+         * called once.
+         *
+         * @param primaryCode
+         *            the code of the key that was released
          */
         void onRelease(int primaryCode);
 
         /**
          * Send a key press to the listener.
-         * @param primaryCode this is the key that was pressed
-         * @param keyCodes the codes for all the possible alternative keys
-         * with the primary code being the first. If the primary key code is
-         * a single character such as an alphabet or number or symbol, the alternatives
-         * will include other characters that may be on the same key or adjacent keys.
-         * These codes are useful to correct for accidental presses of a key adjacent to
-         * the intended key.
+         *
+         * @param primaryCode
+         *            this is the key that was pressed
+         * @param keyCodes
+         *            the codes for all the possible alternative keys with
+         *            the primary code being the first. If the primary key
+         *            code is a single character such as an alphabet or
+         *            number or symbol, the alternatives will include other
+         *            characters that may be on the same key or adjacent
+         *            keys. These codes are useful to correct for
+         *            accidental presses of a key adjacent to the intended
+         *            key.
          */
         void onKey(int primaryCode, int[] keyCodes);
 
         /**
          * Sends a sequence of characters to the listener.
-         * @param text the sequence of characters to be displayed.
+         *
+         * @param text
+         *            the sequence of characters to be displayed.
          */
         void onText(CharSequence text);
-        
+
         /**
-         * Called when the user quickly moves the finger from right to left.
+         * Called when the user quickly moves the finger from right to
+         * left.
          */
         void swipeLeft();
-        
+
         /**
-         * Called when the user quickly moves the finger from left to right.
+         * Called when the user quickly moves the finger from left to
+         * right.
          */
         void swipeRight();
-        
+
         /**
          * Called when the user quickly moves the finger from up to down.
          */
         void swipeDown();
-        
+
         /**
          * Called when the user quickly moves the finger from down to up.
          */
@@ -126,8 +137,8 @@ public class KeyboardView extends View implements View.OnClickListener {
     private static final boolean DEBUG = false;
     private static final int NOT_A_KEY = -1;
     private static final int[] KEY_DELETE = { Keyboard.KEYCODE_DELETE };
-    private static final int[] LONG_PRESSABLE_STATE_SET = { R.attr.state_long_pressable };   
-    
+    private static final int[] LONG_PRESSABLE_STATE_SET = { android.R.attr.state_long_pressable };
+
     private Keyboard mKeyboard;
     private int mCurrentKeyIndex = NOT_A_KEY;
     private int mLabelTextSize;
@@ -136,7 +147,7 @@ public class KeyboardView extends View implements View.OnClickListener {
     private float mShadowRadius;
     private int mShadowColor;
     private float mBackgroundDimAmount;
-    
+
     private TextView mPreviewText;
     private PopupWindow mPreviewPopup;
     private int mPreviewTextSizeLarge;
@@ -146,7 +157,7 @@ public class KeyboardView extends View implements View.OnClickListener {
 
     private PopupWindow mPopupKeyboard;
     private View mMiniKeyboardContainer;
-    private KeyboardView mMiniKeyboard;
+    private LatinKeyboardBaseView mMiniKeyboard;
     private boolean mMiniKeyboardOnScreen;
     private View mPopupParent;
     private int mMiniKeyboardOffsetX;
@@ -157,7 +168,7 @@ public class KeyboardView extends View implements View.OnClickListener {
 
     /** Listener for {@link OnKeyboardActionListener}. */
     private OnKeyboardActionListener mKeyboardActionListener;
-    
+
     private static final int MSG_SHOW_PREVIEW = 1;
     private static final int MSG_REMOVE_PREVIEW = 2;
     private static final int MSG_REPEAT = 3;
@@ -166,7 +177,7 @@ public class KeyboardView extends View implements View.OnClickListener {
     private static final int DELAY_BEFORE_PREVIEW = 0;
     private static final int DELAY_AFTER_PREVIEW = 70;
     private static final int DEBOUNCE_TIME = 70;
-    
+
     private int mVerticalCorrection;
     private int mProximityThreshold;
 
@@ -183,10 +194,10 @@ public class KeyboardView extends View implements View.OnClickListener {
     private int mStartY;
 
     private boolean mProximityCorrectOn;
-    
+
     private Paint mPaint;
     private Rect mPadding;
-    
+
     private long mDownTime;
     private long mLastMoveTime;
     private int mLastKey;
@@ -242,7 +253,7 @@ public class KeyboardView extends View implements View.OnClickListener {
     private boolean mKeyboardChanged;
     /** The canvas for the above mutable keyboard bitmap */
     private Canvas mCanvas;
-    
+
     Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
@@ -256,7 +267,7 @@ public class KeyboardView extends View implements View.OnClickListener {
                 case MSG_REPEAT:
                     if (repeatKey()) {
                         Message repeat = Message.obtain(this, MSG_REPEAT);
-                        sendMessageDelayed(repeat, REPEAT_INTERVAL);                        
+                        sendMessageDelayed(repeat, REPEAT_INTERVAL);
                     }
                     break;
                 case MSG_LONGPRESS:
@@ -266,69 +277,65 @@ public class KeyboardView extends View implements View.OnClickListener {
         }
     };
 
-    public KeyboardView(Context context, AttributeSet attrs) {
-        this(context, attrs, com.android.internal.R.attr.keyboardViewStyle);
+    public LatinKeyboardBaseView(Context context, AttributeSet attrs) {
+        this(context, attrs, R.attr.keyboardViewStyle);
     }
 
-    public KeyboardView(Context context, AttributeSet attrs, int defStyle) {
+    public LatinKeyboardBaseView(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
 
-        TypedArray a =
-            context.obtainStyledAttributes(
-                attrs, android.R.styleable.KeyboardView, defStyle, 0);
-
+        TypedArray a = context.obtainStyledAttributes(
+                attrs, R.styleable.LatinKeyboardBaseView, defStyle, R.style.LatinKeyboardBaseView);
         LayoutInflater inflate =
-                (LayoutInflater) context
-                        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
+                (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         int previewLayout = 0;
         int keyTextSize = 0;
 
         int n = a.getIndexCount();
-        
+
         for (int i = 0; i < n; i++) {
             int attr = a.getIndex(i);
 
             switch (attr) {
-            case com.android.internal.R.styleable.KeyboardView_keyBackground:
+            case R.styleable.LatinKeyboardBaseView_keyBackground:
                 mKeyBackground = a.getDrawable(attr);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_verticalCorrection:
+            case R.styleable.LatinKeyboardBaseView_verticalCorrection:
                 mVerticalCorrection = a.getDimensionPixelOffset(attr, 0);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_keyPreviewLayout:
+            case R.styleable.LatinKeyboardBaseView_keyPreviewLayout:
                 previewLayout = a.getResourceId(attr, 0);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_keyPreviewOffset:
+            case R.styleable.LatinKeyboardBaseView_keyPreviewOffset:
                 mPreviewOffset = a.getDimensionPixelOffset(attr, 0);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_keyPreviewHeight:
+            case R.styleable.LatinKeyboardBaseView_keyPreviewHeight:
                 mPreviewHeight = a.getDimensionPixelSize(attr, 80);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_keyTextSize:
+            case R.styleable.LatinKeyboardBaseView_keyTextSize:
                 mKeyTextSize = a.getDimensionPixelSize(attr, 18);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_keyTextColor:
+            case R.styleable.LatinKeyboardBaseView_keyTextColor:
                 mKeyTextColor = a.getColor(attr, 0xFF000000);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_labelTextSize:
+            case R.styleable.LatinKeyboardBaseView_labelTextSize:
                 mLabelTextSize = a.getDimensionPixelSize(attr, 14);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_popupLayout:
+            case R.styleable.LatinKeyboardBaseView_popupLayout:
                 mPopupLayout = a.getResourceId(attr, 0);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_shadowColor:
+            case R.styleable.LatinKeyboardBaseView_shadowColor:
                 mShadowColor = a.getColor(attr, 0);
                 break;
-            case com.android.internal.R.styleable.KeyboardView_shadowRadius:
+            case R.styleable.LatinKeyboardBaseView_shadowRadius:
                 mShadowRadius = a.getFloat(attr, 0f);
                 break;
+            // TODO: Use Theme (android.R.styleable.Theme_backgroundDimAmount)
+            case R.styleable.LatinKeyboardBaseView_backgroundDimAmount:
+                mBackgroundDimAmount = a.getFloat(attr, 0.5f);
+                break;
             }
         }
-        
-        a = mContext.obtainStyledAttributes(
-                com.android.internal.R.styleable.Theme);
-        mBackgroundDimAmount = a.getFloat(android.R.styleable.Theme_backgroundDimAmount, 0.5f);
 
         mPreviewPopup = new PopupWindow(context);
         if (previewLayout != 0) {
@@ -339,16 +346,16 @@ public class KeyboardView extends View implements View.OnClickListener {
         } else {
             mShowPreview = false;
         }
-        
+
         mPreviewPopup.setTouchable(false);
-        
+
         mPopupKeyboard = new PopupWindow(context);
         mPopupKeyboard.setBackgroundDrawable(null);
         //mPopupKeyboard.setClippingEnabled(false);
-        
+
         mPopupParent = this;
         //mPredicting = true;
-        
+
         mPaint = new Paint();
         mPaint.setAntiAlias(true);
         mPaint.setTextSize(keyTextSize);
@@ -360,16 +367,17 @@ public class KeyboardView extends View implements View.OnClickListener {
         mKeyBackground.getPadding(mPadding);
 
         mSwipeThreshold = (int) (500 * getResources().getDisplayMetrics().density);
-        mDisambiguateSwipe = getResources().getBoolean(
-                com.android.internal.R.bool.config_swipeDisambiguation);
+        // TODO: Refer frameworks/base/core/res/res/values/config.xml
+        mDisambiguateSwipe = getResources().getBoolean(R.bool.config_swipeDisambiguation);
         resetMultiTap();
         initGestureDetector();
     }
 
     private void initGestureDetector() {
-        mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
+        mGestureDetector = new GestureDetector(
+                getContext(), new GestureDetector.SimpleOnGestureListener() {
             @Override
-            public boolean onFling(MotionEvent me1, MotionEvent me2, 
+            public boolean onFling(MotionEvent me1, MotionEvent me2,
                     float velocityX, float velocityY) {
                 if (mPossiblePoly) return false;
                 final float absX = Math.abs(velocityX);
@@ -455,7 +463,8 @@ public class KeyboardView extends View implements View.OnClickListener {
         mKeyboardChanged = true;
         invalidateAllKeys();
         computeProximityThreshold(keyboard);
-        mMiniKeyboardCache.clear(); // Not really necessary to do every time, but will free up views
+        mMiniKeyboardCache.clear();
+        // Not really necessary to do every time, but will free up views
         // Switching to a different keyboard should abort any pending keys so that the key up
         // doesn't get delivered to the old or new keyboard
         mAbortKey = true; // Until the next ACTION_DOWN
@@ -469,12 +478,11 @@ public class KeyboardView extends View implements View.OnClickListener {
     public Keyboard getKeyboard() {
         return mKeyboard;
     }
-    
+
     /**
      * Sets the state of the shift key of the keyboard, if any.
      * @param shifted whether or not to enable the state of the shift key
      * @return true if the shift key state changed, false if there was no change
-     * @see KeyboardView#isShifted()
      */
     public boolean setShifted(boolean shifted) {
         if (mKeyboard != null) {
@@ -491,7 +499,6 @@ public class KeyboardView extends View implements View.OnClickListener {
      * Returns the state of the shift key of the keyboard, if any.
      * @return true if the shift is in a pressed state, false otherwise. If there is
      * no shift key on the keyboard or there is no keyboard attached, it returns false.
-     * @see KeyboardView#setShifted(boolean)
      */
     public boolean isShifted() {
         if (mKeyboard != null) {
@@ -502,7 +509,7 @@ public class KeyboardView extends View implements View.OnClickListener {
 
     /**
      * Enables or disables the key feedback popup. This is a popup that shows a magnified
-     * version of the depressed key. By default the preview is enabled. 
+     * version of the depressed key. By default the preview is enabled.
      * @param previewEnabled whether or not to enable the key feedback popup
      * @see #isPreviewEnabled()
      */
@@ -518,14 +525,14 @@ public class KeyboardView extends View implements View.OnClickListener {
     public boolean isPreviewEnabled() {
         return mShowPreview;
     }
-    
+
     public void setVerticalCorrection(int verticalOffset) {
-        
     }
+
     public void setPopupParent(View v) {
         mPopupParent = v;
     }
-    
+
     public void setPopupOffset(int x, int y) {
         mMiniKeyboardOffsetX = x;
         mMiniKeyboardOffsetY = y;
@@ -551,9 +558,9 @@ public class KeyboardView extends View implements View.OnClickListener {
         return mProximityCorrectOn;
     }
 
-    /** 
+    /**
      * Popup keyboard close button clicked.
-     * @hide 
+     * @hide
      */
     public void onClick(View v) {
         dismissPopupKeyboard();
@@ -571,13 +578,15 @@ public class KeyboardView extends View implements View.OnClickListener {
     public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         // Round up a little
         if (mKeyboard == null) {
-            setMeasuredDimension(mPaddingLeft + mPaddingRight, mPaddingTop + mPaddingBottom);
+            setMeasuredDimension(
+                    getPaddingLeft() + getPaddingRight(), getPaddingTop() + getPaddingBottom());
         } else {
-            int width = mKeyboard.getMinWidth() + mPaddingLeft + mPaddingRight;
+            int width = mKeyboard.getMinWidth() + getPaddingLeft() + getPaddingRight();
             if (MeasureSpec.getSize(widthMeasureSpec) < width + 10) {
                 width = MeasureSpec.getSize(widthMeasureSpec);
             }
-            setMeasuredDimension(width, mKeyboard.getHeight() + mPaddingTop + mPaddingBottom);
+            setMeasuredDimension(
+                    width, mKeyboard.getHeight() + getPaddingTop() + getPaddingBottom());
         }
     }
 
@@ -633,15 +642,15 @@ public class KeyboardView extends View implements View.OnClickListener {
         }
         final Canvas canvas = mCanvas;
         canvas.clipRect(mDirtyRect, Op.REPLACE);
-        
+
         if (mKeyboard == null) return;
-        
+
         final Paint paint = mPaint;
         final Drawable keyBackground = mKeyBackground;
         final Rect clipRegion = mClipRegion;
         final Rect padding = mPadding;
-        final int kbdPaddingLeft = mPaddingLeft;
-        final int kbdPaddingTop = mPaddingTop;
+        final int kbdPaddingLeft = getPaddingLeft();
+        final int kbdPaddingTop = getPaddingTop();
         final Key[] keys = mKeys;
         final Key invalidKey = mInvalidatedKey;
 
@@ -668,15 +677,15 @@ public class KeyboardView extends View implements View.OnClickListener {
 
             // Switch the character to uppercase if shift is pressed
             String label = key.label == null? null : adjustCase(key.label).toString();
-            
+
             final Rect bounds = keyBackground.getBounds();
-            if (key.width != bounds.right || 
+            if (key.width != bounds.right ||
                     key.height != bounds.bottom) {
                 keyBackground.setBounds(0, 0, key.width, key.height);
             }
             canvas.translate(key.x + kbdPaddingLeft, key.y + kbdPaddingTop);
             keyBackground.draw(canvas);
-            
+
             if (label != null) {
                 // For characters, use large font. For labels like "Done", use small font.
                 if (label.length() > 1 && key.codes.length < 2) {
@@ -698,12 +707,12 @@ public class KeyboardView extends View implements View.OnClickListener {
                 // Turn off drop shadow
                 paint.setShadowLayer(0, 0, 0, 0);
             } else if (key.icon != null) {
-                final int drawableX = (key.width - padding.left - padding.right 
+                final int drawableX = (key.width - padding.left - padding.right
                                 - key.icon.getIntrinsicWidth()) / 2 + padding.left;
-                final int drawableY = (key.height - padding.top - padding.bottom 
+                final int drawableY = (key.height - padding.top - padding.bottom
                         - key.icon.getIntrinsicHeight()) / 2 + padding.top;
                 canvas.translate(drawableX, drawableY);
-                key.icon.setBounds(0, 0, 
+                key.icon.setBounds(0, 0,
                         key.icon.getIntrinsicWidth(), key.icon.getIntrinsicHeight());
                 key.icon.draw(canvas);
                 canvas.translate(-drawableX, -drawableY);
@@ -717,17 +726,19 @@ public class KeyboardView extends View implements View.OnClickListener {
             canvas.drawRect(0, 0, getWidth(), getHeight(), paint);
         }
 
-        if (DEBUG && mShowTouchPoints) {
-            paint.setAlpha(128);
-            paint.setColor(0xFFFF0000);
-            canvas.drawCircle(mStartX, mStartY, 3, paint);
-            canvas.drawLine(mStartX, mStartY, mLastX, mLastY, paint);
-            paint.setColor(0xFF0000FF);
-            canvas.drawCircle(mLastX, mLastY, 3, paint);
-            paint.setColor(0xFF00FF00);
-            canvas.drawCircle((mStartX + mLastX) / 2, (mStartY + mLastY) / 2, 2, paint);
+        if (DEBUG) {
+            if (mShowTouchPoints) {
+                paint.setAlpha(128);
+                paint.setColor(0xFFFF0000);
+                canvas.drawCircle(mStartX, mStartY, 3, paint);
+                canvas.drawLine(mStartX, mStartY, mLastX, mLastY, paint);
+                paint.setColor(0xFF0000FF);
+                canvas.drawCircle(mLastX, mLastY, 3, paint);
+                paint.setColor(0xFF00FF00);
+                canvas.drawCircle((mStartX + mLastX) / 2, (mStartY + mLastY) / 2, 2, paint);
+            }
         }
-        
+
         mDrawPending = false;
         mDirtyRect.setEmpty();
     }
@@ -748,8 +759,8 @@ public class KeyboardView extends View implements View.OnClickListener {
                 primaryIndex = nearestKeyIndices[i];
             }
 
-            if (((mProximityCorrectOn 
-                    && (dist = key.squaredDistanceFrom(x, y)) < mProximityThreshold) 
+            if (((mProximityCorrectOn
+                    && (dist = key.squaredDistanceFrom(x, y)) < mProximityThreshold)
                     || isInside)
                     && key.codes[0] > 32) {
                 // Find insertion point
@@ -758,9 +769,9 @@ public class KeyboardView extends View implements View.OnClickListener {
                     closestKeyDist = dist;
                     closestKey = nearestKeyIndices[i];
                 }
-                
+
                 if (allKeys == null) continue;
-                
+
                 for (int j = 0; j < mDistances.length; j++) {
                     if (mDistances[j] > dist) {
                         // Make space for nCodes codes
@@ -825,11 +836,11 @@ public class KeyboardView extends View implements View.OnClickListener {
             return adjustCase(key.label);
         }
     }
-    
+
     private void showPreview(int keyIndex) {
         int oldKeyIndex = mCurrentKeyIndex;
         final PopupWindow previewPopup = mPreviewPopup;
-        
+
         mCurrentKeyIndex = keyIndex;
         // Release the old key and press the new key
         final Key[] keys = mKeys;
@@ -849,7 +860,7 @@ public class KeyboardView extends View implements View.OnClickListener {
             if (previewPopup.isShowing()) {
                 if (keyIndex == NOT_A_KEY) {
                     mHandler.sendMessageDelayed(mHandler
-                            .obtainMessage(MSG_REMOVE_PREVIEW), 
+                            .obtainMessage(MSG_REMOVE_PREVIEW),
                             DELAY_AFTER_PREVIEW);
                 }
             }
@@ -859,20 +870,20 @@ public class KeyboardView extends View implements View.OnClickListener {
                     showKey(keyIndex);
                 } else {
                     mHandler.sendMessageDelayed(
-                            mHandler.obtainMessage(MSG_SHOW_PREVIEW, keyIndex, 0), 
+                            mHandler.obtainMessage(MSG_SHOW_PREVIEW, keyIndex, 0),
                             DELAY_BEFORE_PREVIEW);
                 }
             }
         }
     }
-    
+
     private void showKey(final int keyIndex) {
         final PopupWindow previewPopup = mPreviewPopup;
         final Key[] keys = mKeys;
         if (keyIndex < 0 || keyIndex >= mKeys.length) return;
         Key key = keys[keyIndex];
         if (key.icon != null) {
-            mPreviewText.setCompoundDrawables(null, null, null, 
+            mPreviewText.setCompoundDrawables(null, null, null,
                     key.iconPreview != null ? key.iconPreview : key.icon);
             mPreviewText.setText(null);
         } else {
@@ -886,9 +897,9 @@ public class KeyboardView extends View implements View.OnClickListener {
                 mPreviewText.setTypeface(Typeface.DEFAULT);
             }
         }
-        mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 
+        mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
                 MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
-        int popupWidth = Math.max(mPreviewText.getMeasuredWidth(), key.width 
+        int popupWidth = Math.max(mPreviewText.getMeasuredWidth(), key.width
                 + mPreviewText.getPaddingLeft() + mPreviewText.getPaddingRight());
         final int popupHeight = mPreviewHeight;
         LayoutParams lp = mPreviewText.getLayoutParams();
@@ -897,7 +908,7 @@ public class KeyboardView extends View implements View.OnClickListener {
             lp.height = popupHeight;
         }
         if (!mPreviewCentered) {
-            mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + mPaddingLeft;
+            mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + getPaddingLeft();
             mPopupPreviewY = key.y - popupHeight + mPreviewOffset;
         } else {
             // TODO: Fix this if centering is brought back
@@ -938,7 +949,7 @@ public class KeyboardView extends View implements View.OnClickListener {
         } else {
             previewPopup.setWidth(popupWidth);
             previewPopup.setHeight(popupHeight);
-            previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY, 
+            previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY,
                     mPopupPreviewX, mPopupPreviewY);
         }
         mPreviewText.setVisibility(VISIBLE);
@@ -946,7 +957,7 @@ public class KeyboardView extends View implements View.OnClickListener {
 
     /**
      * Requests a redraw of the entire keyboard. Calling {@link #invalidate} is not sufficient
-     * because the keyboard renders the keys to an off-screen buffer and an invalidate() only 
+     * because the keyboard renders the keys to an off-screen buffer and an invalidate() only
      * draws the cached buffer.
      * @see #invalidateKey(int)
      */
@@ -970,11 +981,11 @@ public class KeyboardView extends View implements View.OnClickListener {
         }
         final Key key = mKeys[keyIndex];
         mInvalidatedKey = key;
-        mDirtyRect.union(key.x + mPaddingLeft, key.y + mPaddingTop, 
-                key.x + key.width + mPaddingLeft, key.y + key.height + mPaddingTop);
+        mDirtyRect.union(key.x + getPaddingLeft(), key.y + getPaddingTop(),
+                key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop());
         onBufferDraw();
-        invalidate(key.x + mPaddingLeft, key.y + mPaddingTop, 
-                key.x + key.width + mPaddingLeft, key.y + key.height + mPaddingTop);
+        invalidate(key.x + getPaddingLeft(), key.y + getPaddingTop(),
+                key.x + key.width + getPaddingLeft(), key.y + key.height + getPaddingTop());
     }
 
     private boolean openPopupIfRequired(MotionEvent me) {
@@ -986,7 +997,7 @@ public class KeyboardView extends View implements View.OnClickListener {
             return false;
         }
 
-        Key popupKey = mKeys[mCurrentKey];        
+        Key popupKey = mKeys[mCurrentKey];
         boolean result = onLongPress(popupKey);
         if (result) {
             mAbortKey = true;
@@ -1011,22 +1022,22 @@ public class KeyboardView extends View implements View.OnClickListener {
                 LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(
                         Context.LAYOUT_INFLATER_SERVICE);
                 mMiniKeyboardContainer = inflater.inflate(mPopupLayout, null);
-                mMiniKeyboard = (KeyboardView) mMiniKeyboardContainer.findViewById(
-                        com.android.internal.R.id.keyboardView);
+                mMiniKeyboard = (LatinKeyboardBaseView) mMiniKeyboardContainer.findViewById(
+                       R.id.LatinKeyboardBaseView);
                 View closeButton = mMiniKeyboardContainer.findViewById(
-                        com.android.internal.R.id.closeButton);
+                        R.id.closeButton);
                 if (closeButton != null) closeButton.setOnClickListener(this);
                 mMiniKeyboard.setOnKeyboardActionListener(new OnKeyboardActionListener() {
                     public void onKey(int primaryCode, int[] keyCodes) {
                         mKeyboardActionListener.onKey(primaryCode, keyCodes);
                         dismissPopupKeyboard();
                     }
-                    
+
                     public void onText(CharSequence text) {
                         mKeyboardActionListener.onText(text);
                         dismissPopupKeyboard();
                     }
-                    
+
                     public void swipeLeft() { }
                     public void swipeRight() { }
                     public void swipeUp() { }
@@ -1041,7 +1052,7 @@ public class KeyboardView extends View implements View.OnClickListener {
                 //mInputView.setSuggest(mSuggest);
                 Keyboard keyboard;
                 if (popupKey.popupCharacters != null) {
-                    keyboard = new Keyboard(getContext(), popupKeyboardId, 
+                    keyboard = new Keyboard(getContext(), popupKeyboardId,
                             popupKey.popupCharacters, -1, getPaddingLeft() + getPaddingRight());
                 } else {
                     keyboard = new Keyboard(getContext(), popupKeyboardId);
@@ -1049,20 +1060,20 @@ public class KeyboardView extends View implements View.OnClickListener {
                 mMiniKeyboard.setKeyboard(keyboard);
                 mMiniKeyboard.setPopupParent(this);
                 mMiniKeyboardContainer.measure(
-                        MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), 
+                        MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
                         MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST));
-                
+
                 mMiniKeyboardCache.put(popupKey, mMiniKeyboardContainer);
             } else {
-                mMiniKeyboard = (KeyboardView) mMiniKeyboardContainer.findViewById(
-                        com.android.internal.R.id.keyboardView);
+                mMiniKeyboard = (LatinKeyboardBaseView) mMiniKeyboardContainer.findViewById(
+                        R.id.LatinKeyboardBaseView);
             }
             if (mWindowOffset == null) {
                 mWindowOffset = new int[2];
                 getLocationInWindow(mWindowOffset);
             }
-            mPopupX = popupKey.x + mPaddingLeft;
-            mPopupY = popupKey.y + mPaddingTop;
+            mPopupX = popupKey.x + getPaddingLeft();
+            mPopupY = popupKey.y + getPaddingTop();
             mPopupX = mPopupX + popupKey.width - mMiniKeyboardContainer.getMeasuredWidth();
             mPopupY = mPopupY - mMiniKeyboardContainer.getMeasuredHeight();
             final int x = mPopupX + mMiniKeyboardContainer.getPaddingRight() + mWindowOffset[0];
@@ -1081,12 +1092,9 @@ public class KeyboardView extends View implements View.OnClickListener {
         return false;
     }
 
-    private long mOldEventTime;
-    private boolean mUsedVelocity;
-
     @Override
     public boolean onTouchEvent(MotionEvent me) {
-        // Convert multi-pointer up/down events to single up/down events to 
+        // Convert multi-pointer up/down events to single up/down events to
         // deal with the typical multi-pointer behavior of two-thumb typing
         final int pointerCount = me.getPointerCount();
         final int action = me.getAction();
@@ -1127,11 +1135,10 @@ public class KeyboardView extends View implements View.OnClickListener {
     }
 
     private boolean onModifiedTouchEvent(MotionEvent me, boolean possiblePoly) {
-        int touchX = (int) me.getX() - mPaddingLeft;
-        int touchY = (int) me.getY() + mVerticalCorrection - mPaddingTop;
+        int touchX = (int) me.getX() - getPaddingLeft();
+        int touchY = (int) me.getY() + mVerticalCorrection - getPaddingTop();
         final int action = me.getAction();
         final long eventTime = me.getEventTime();
-        mOldEventTime = eventTime;
         int keyIndex = getKeyIndices(touchX, touchY, null);
         mPossiblePoly = possiblePoly;
 
@@ -1151,7 +1158,7 @@ public class KeyboardView extends View implements View.OnClickListener {
             mHandler.removeMessages(MSG_LONGPRESS);
             return true;
         }
-        
+
         // Needs to be called after the gesture detector gets a turn, as it may have
         // displayed the mini keyboard
         if (mMiniKeyboardOnScreen && action != MotionEvent.ACTION_CANCEL) {
@@ -1173,7 +1180,7 @@ public class KeyboardView extends View implements View.OnClickListener {
                 mDownTime = me.getEventTime();
                 mLastMoveTime = mDownTime;
                 checkMultiTap(eventTime, keyIndex);
-                mKeyboardActionListener.onPress(keyIndex != NOT_A_KEY ? 
+                mKeyboardActionListener.onPress(keyIndex != NOT_A_KEY ?
                         mKeys[keyIndex].codes[0] : 0);
                 if (mCurrentKey >= 0 && mKeys[mCurrentKey].repeatable) {
                     mRepeatKeyIndex = mCurrentKey;
@@ -1272,11 +1279,11 @@ public class KeyboardView extends View implements View.OnClickListener {
         detectAndSendKey(mCurrentKey, key.x, key.y, mLastTapTime);
         return true;
     }
-    
+
     protected void swipeRight() {
         mKeyboardActionListener.swipeRight();
     }
-    
+
     protected void swipeLeft() {
         mKeyboardActionListener.swipeLeft();
     }
@@ -1294,7 +1301,7 @@ public class KeyboardView extends View implements View.OnClickListener {
             mPreviewPopup.dismiss();
         }
         removeMessages();
-        
+
         dismissPopupKeyboard();
         mBuffer = null;
         mCanvas = null;
@@ -1335,7 +1342,7 @@ public class KeyboardView extends View implements View.OnClickListener {
         mLastTapTime = -1;
         mInMultiTap = false;
     }
-    
+
     private void checkMultiTap(long eventTime, int keyIndex) {
         if (keyIndex == NOT_A_KEY) return;
         Key key = mKeys[keyIndex];
diff --git a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
index e99977d213..bfa26f6689 100644
--- a/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
+++ b/java/src/com/android/inputmethod/latin/LatinKeyboardView.java
@@ -22,7 +22,6 @@ import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.inputmethodservice.Keyboard;
-import android.inputmethodservice.KeyboardView;
 import android.inputmethodservice.Keyboard.Key;
 import android.os.Handler;
 import android.os.Message;
@@ -32,7 +31,7 @@ import android.view.LayoutInflater;
 import android.view.MotionEvent;
 import android.widget.PopupWindow;
 
-public class LatinKeyboardView extends KeyboardView {
+public class LatinKeyboardView extends LatinKeyboardBaseView {
 
     static final int KEYCODE_OPTIONS = -100;
     static final int KEYCODE_SHIFT_LONGPRESS = -101;
-- 
GitLab