From 858f8eaac75bcd1b296b41837caf3dae82d1d72a Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Fri, 19 Aug 2011 14:50:34 -0700 Subject: [PATCH] Fix 5021968: Add input method switcher button to lock screen. This adds an IME switcher button to lock screen. It is only shown if the user has more than one applicable and enabled IME installed. Change-Id: I5f9503a205c2edb27170825539ba4a6ef25418ed --- .../res/drawable-hdpi/ic_lockscreen_ime.png | Bin 0 -> 202 bytes .../res/drawable-mdpi/ic_lockscreen_ime.png | Bin 0 -> 157 bytes .../res/drawable-xhdpi/ic_lockscreen_ime.png | Bin 0 -> 217 bytes .../keyguard_screen_password_landscape.xml | 16 +++- .../keyguard_screen_password_portrait.xml | 45 +++++++---- .../policy/impl/PasswordUnlockScreen.java | 70 +++++++++++++++++- 6 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 core/res/res/drawable-hdpi/ic_lockscreen_ime.png create mode 100644 core/res/res/drawable-mdpi/ic_lockscreen_ime.png create mode 100644 core/res/res/drawable-xhdpi/ic_lockscreen_ime.png diff --git a/core/res/res/drawable-hdpi/ic_lockscreen_ime.png b/core/res/res/drawable-hdpi/ic_lockscreen_ime.png new file mode 100644 index 0000000000000000000000000000000000000000..29a7989372fc4b33e22060675ff403da4e15bea7 GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^x**KK1|+Sd9?b$$6FprVLn02py`jk0U?AXfG4gEd zhYXwJ4>V+$`;QeXeo5kRbnJSu?O}h;r6;O)1*410uZl7AN||I_Sm3ySLA2-MC29w@ zde2hHUHQV2qo$pI<%^{ao-Z85`^`4L-n2X2nmv|vmXg~7;~th5RTo7J&42yd6aU#j zY{6@{;3NAN?=IfhdrBqq>3wFffz52PbD1BxNNk&ScGWwe;}|?${an^LB{Ts5z@kwY literal 0 HcmV?d00001 diff --git a/core/res/res/drawable-mdpi/ic_lockscreen_ime.png b/core/res/res/drawable-mdpi/ic_lockscreen_ime.png new file mode 100644 index 0000000000000000000000000000000000000000..b27e059260ceed0ffc33dceeeb852c76ff6f1459 GIT binary patch literal 157 zcmeAS@N?(olHy`uVBq!ia0vp^azHH0!3HGvF1f=4q*6Rx978;gC;$2X-~O-z!?D0_ zcU?I_vFi*QEvLS<$=%(`c^);teE!k#7Vy! zO|v5!RA;o$IC|Kw?{;HE`>AR7*dOh=*mhvW(ZynySr{0K=5IePb6-*wXdi>8tDnm{ Hr-UW|5pz5R literal 0 HcmV?d00001 diff --git a/core/res/res/drawable-xhdpi/ic_lockscreen_ime.png b/core/res/res/drawable-xhdpi/ic_lockscreen_ime.png new file mode 100644 index 0000000000000000000000000000000000000000..a40ddebf87c05a5c6041aaf5f15387690d7943b6 GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^HXzKw1|+Ti+$;i83p`yMLo)8Yy=lnB4+GY7`=QqOOufe3H)Q5vt(EG%2k&iOv|41b#eOP zmhTOF7q8CxD_V2&=Cyf^jg9x4C)?EAxa+)^nVDHz_rbw12?>daOh#sZ{yM$s_36%$ uj3DuZ2g*&;XT7{)^w{ui0E!KDQ>BmWYn&0=bZ#Zktqh*7elF{r5}E*$R! + + diff --git a/core/res/res/layout/keyguard_screen_password_portrait.xml b/core/res/res/layout/keyguard_screen_password_portrait.xml index 1d0ea54791e9f..994c4399d8472 100644 --- a/core/res/res/layout/keyguard_screen_password_portrait.xml +++ b/core/res/res/layout/keyguard_screen_password_portrait.xml @@ -95,22 +95,39 @@ /> - + android:layout_marginRight="16dip"> + + + + + + enabledImis = imm.getEnabledInputMethodList(); + + // Number of the filtered IMEs + int filteredImisCount = 0; + + for (InputMethodInfo imi : enabledImis) { + // We can return true immediately after we find two or more filtered IMEs. + if (filteredImisCount > 1) return true; + final List subtypes = + imm.getEnabledInputMethodSubtypeList(imi, true); + // IMEs that have no subtypes should be counted. + if (subtypes.isEmpty()) { + ++filteredImisCount; + continue; + } + + int auxCount = 0; + for (InputMethodSubtype subtype : subtypes) { + if (subtype.isAuxiliary()) { + ++auxCount; + } + } + final int nonAuxCount = subtypes.size() - auxCount; + + // IMEs that have one or more non-auxiliary subtypes should be counted. + // If shouldIncludeAuxiliarySubtypes is true, IMEs that have two or more auxiliary + // subtypes should be counted as well. + if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) { + ++filteredImisCount; + continue; + } + } + + return filteredImisCount > 1 + // imm.getEnabledInputMethodSubtypeList(null, false) will return the current IME's enabled + // input method subtype (The current IME should be LatinIME.) + || imm.getEnabledInputMethodSubtypeList(null, false).size() > 1; } @Override