DO NOT MERGE. Follow up change to I8b38e280

Add visual indicator that long press / or @ on F1 key will bring up Settings

bug: 3084022
Change-Id: If925b546829ca8e8806e1f8f89eaf72fc8c220da
This commit is contained in:
Ken Wakasa 2010-10-16 02:15:04 +09:00
parent 0ccc4bfe38
commit 1cbfc6c968
21 changed files with 214 additions and 92 deletions

View file

@ -209,7 +209,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -241,7 +241,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -385,7 +385,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -422,7 +422,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -202,7 +202,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -229,7 +229,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -350,7 +350,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -381,7 +381,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -188,7 +188,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -220,7 +220,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -364,7 +364,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -401,7 +401,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -189,7 +189,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -221,7 +221,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -365,7 +365,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -402,7 +402,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -182,7 +182,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -209,7 +209,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -330,7 +330,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -361,7 +361,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -147,7 +147,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -179,7 +179,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -323,7 +323,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -360,7 +360,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -140,7 +140,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -167,7 +167,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -288,7 +288,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -319,7 +319,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -209,7 +209,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -241,7 +241,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -385,7 +385,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -422,7 +422,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -202,7 +202,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -229,7 +229,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -350,7 +350,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -381,7 +381,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -187,7 +187,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -219,7 +219,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -363,7 +363,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -400,7 +400,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -180,7 +180,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -207,7 +207,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -328,7 +328,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -359,7 +359,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -180,7 +180,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -212,7 +212,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -356,7 +356,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -393,7 +393,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -173,7 +173,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -200,7 +200,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -321,7 +321,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -352,7 +352,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -210,7 +210,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -242,7 +242,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -386,7 +386,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -423,7 +423,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -204,7 +204,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -231,7 +231,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -352,7 +352,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -383,7 +383,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

View file

@ -186,7 +186,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -217,7 +217,7 @@
android:isModifier="true"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -357,7 +357,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="/"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"
@ -393,7 +393,7 @@
android:iconPreview="@drawable/sym_keyboard_feedback_settings"
android:isModifier="true" />
<Key
android:keyLabel="\@"
android:codes="@integer/key_f1"
android:isModifier="true" />
<Key
android:codes="@integer/key_space"

View file

@ -179,7 +179,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -205,7 +205,7 @@
android:keyWidth="20%p"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -322,7 +322,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="/" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"
@ -352,7 +352,7 @@
android:keyIcon="@drawable/sym_bkeyboard_settings"
android:iconPreview="@drawable/sym_keyboard_feedback_settings" />
<Key
android:keyLabel="\@" />
android:codes="@integer/key_f1" />
<Key
android:codes="@integer/key_space"
android:keyIcon="@drawable/sym_bkeyboard_space"

39
java/res/xml/popup_at.xml Normal file
View file

@ -0,0 +1,39 @@
<?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.
*/
-->
<Keyboard
xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="@dimen/popup_key_height"
>
<Row
android:rowEdgeFlags="top|bottom"
>
<Key
android:codes="@integer/key_settings"
android:keyIcon="@drawable/sym_keyboard_settings"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="\@"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View file

@ -0,0 +1,39 @@
<?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.
*/
-->
<Keyboard
xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="10%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="@dimen/popup_key_height"
>
<Row
android:rowEdgeFlags="top|bottom"
>
<Key
android:codes="@integer/key_settings"
android:keyIcon="@drawable/sym_keyboard_settings"
android:keyEdgeFlags="left" />
<Key
android:keyLabel="/"
android:keyEdgeFlags="right" />
</Row>
</Keyboard>

View file

@ -74,6 +74,7 @@ public class LatinKeyboard extends Keyboard {
private LanguageSwitcher mLanguageSwitcher;
private final Resources mRes;
private final Context mContext;
private int mMode;
// Whether this keyboard has voice icon on it
private boolean mHasVoiceButton;
// Whether voice icon is enabled at all
@ -122,6 +123,7 @@ public class LatinKeyboard extends Keyboard {
super(context, xmlLayoutResId, mode);
final Resources res = context.getResources();
mContext = context;
mMode = mode;
mRes = res;
mShiftLockIcon = res.getDrawable(R.drawable.sym_keyboard_shift_locked);
mShiftLockPreviewIcon = res.getDrawable(R.drawable.sym_keyboard_feedback_shift_locked);
@ -202,6 +204,7 @@ public class LatinKeyboard extends Keyboard {
}
void setImeOptions(Resources res, int mode, int options) {
mMode = mode;
// TODO should clean up this method
if (mEnterKey != null) {
// Reset some of the rarely used attributes.
@ -354,6 +357,11 @@ public class LatinKeyboard extends Keyboard {
}
private void updateDynamicKeys() {
update123Key();
updateF1Key();
}
private void update123Key() {
// Update KEYCODE_MODE_CHANGE key only on alphabet mode, not on symbol mode.
if (m123Key != null && mIsAlphaKeyboard) {
if (mVoiceEnabled && !mHasVoiceButton) {
@ -366,30 +374,65 @@ public class LatinKeyboard extends Keyboard {
m123Key.label = m123Label;
}
}
}
// Update KEYCODE_F1 key. Please note that some keyboard layout has no F1 key.
if (mF1Key != null) {
if (mHasVoiceButton && mVoiceEnabled) {
mF1Key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
mF1Key.label = null;
// HACK: draw mMicIcon and mF1HintIcon at the same time
mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
mF1Key.width, mF1Key.height + mVerticalGap, mMicIcon, mF1HintIcon));
mF1Key.iconPreview = mMicPreviewIcon;
mF1Key.popupResId = R.xml.popup_mic;
private void updateF1Key() {
// Update KEYCODE_F1 key. Please note that some keyboard layouts have no F1 key.
if (mF1Key == null)
return;
if (mIsAlphaKeyboard) {
if (mMode == KeyboardSwitcher.MODE_URL) {
setNonMicF1Key(mF1Key, "/", R.xml.popup_slash);
} else if (mMode == KeyboardSwitcher.MODE_EMAIL) {
setNonMicF1Key(mF1Key, "@", R.xml.popup_at);
} else {
mF1Key.label = ",";
mF1Key.codes = new int[] { ',' };
// HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to
// the above synthesized icon
mF1Key.icon = new BitmapDrawable(mRes, drawSynthesizedSettingsHintImage(
mF1Key.width, mF1Key.height + mVerticalGap, null, mF1HintIcon));
mF1Key.iconPreview = null;
mF1Key.popupResId = R.xml.popup_comma;
if (mVoiceEnabled && mHasVoiceButton) {
setMicF1Key(mF1Key);
} else {
setNonMicF1Key(mF1Key, ",", R.xml.popup_comma);
}
}
} else { // Symbols keyboard
if (mVoiceEnabled && mHasVoiceButton) {
setMicF1Key(mF1Key);
} else {
setNonMicF1Key(mF1Key, ",", R.xml.popup_comma);
}
}
}
private void setMicF1Key(Key key) {
// HACK: draw mMicIcon and mF1HintIcon at the same time
final Drawable micWithSettingsHintDrawable = new BitmapDrawable(mRes,
drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap,
mMicIcon, mF1HintIcon));
key.label = null;
key.codes = new int[] { LatinKeyboardView.KEYCODE_VOICE };
key.popupResId = R.xml.popup_mic;
key.icon = micWithSettingsHintDrawable;
key.iconPreview = mMicPreviewIcon;
}
private void setNonMicF1Key(Key key, String label, int popupResId) {
// HACK: draw only mF1HintIcon on offscreen buffer to adjust position of '...' to
// the mic+hint synthesized icon
final Drawable onlySettingsHintDrawable = new BitmapDrawable(mRes,
drawSynthesizedSettingsHintImage(key.width, key.height + mVerticalGap,
null, mF1HintIcon));
key.label = label;
key.codes = new int[] { label.charAt(0) };
key.popupResId = popupResId;
key.icon = onlySettingsHintDrawable;
key.iconPreview = null;
}
public boolean isF1Key(Key key) {
return key == mF1Key;
}
/**
* @return a key which should be invalidated.
*/

View file

@ -850,7 +850,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
// Usually don't draw icon if label is not null, but we draw icon for the number
// hint.
shouldDrawIcon = isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key);
shouldDrawIcon = isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(key);
}
if (key.icon != null && shouldDrawIcon) {
// Special handing for the upper-right number hint icons
@ -943,7 +943,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
if (key == null)
return;
// Should not draw number hint icons
if (key.icon != null && !isCommaKeyLabelOrNumberAtEdgeOfPopupChars(key)) {
if (key.icon != null && !isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(key)) {
mPreviewText.setCompoundDrawables(null, null, null,
key.iconPreview != null ? key.iconPreview : key.icon);
mPreviewText.setText(null);
@ -1226,12 +1226,13 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
return false;
}
private static boolean isCommaKeyLabelOrNumberAtEdgeOfPopupChars(Key key) {
return isNumberAtEdgeOfPopupChars(key) || isCommaKeyLabel(key);
private boolean isNonMicLatinF1KeyOrNumberAtEdgeOfPopupChars(Key key) {
return isNumberAtEdgeOfPopupChars(key) || isNonMicLatinF1Key(key);
}
private static boolean isCommaKeyLabel(Key key) {
return ",".equals(key.label);
private boolean isNonMicLatinF1Key(Key key) {
return (mKeyboard instanceof LatinKeyboard)
&& ((LatinKeyboard)mKeyboard).isF1Key(key) && key.label != null;
}
private static boolean isNumberAtEdgeOfPopupChars(Key key) {