Merge "Follow up change of I4c6df819"

main
Tadashi G. Takaoka 2010-10-12 08:03:11 -07:00 committed by Android (Google) Code Review
commit 323971b51e
1 changed files with 14 additions and 24 deletions

View File

@ -158,46 +158,36 @@ public class LatinKeyboard extends BaseKeyboard {
return key; return key;
} }
private static void resetKeyAttributes(Key key, CharSequence label) {
key.popupCharacters = null;
key.popupResId = 0;
key.text = null;
key.iconPreview = null;
key.icon = null;
key.label = label;
}
public void setImeOptions(Resources res, int mode, int options) { public void setImeOptions(Resources res, int mode, int options) {
if (mEnterKey != null) { if (mEnterKey != null) {
// Reset some of the rarely used attributes.
mEnterKey.popupCharacters = null;
mEnterKey.popupResId = 0;
mEnterKey.text = null;
switch (options & (EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) { switch (options & (EditorInfo.IME_MASK_ACTION|EditorInfo.IME_FLAG_NO_ENTER_ACTION)) {
case EditorInfo.IME_ACTION_GO: case EditorInfo.IME_ACTION_GO:
mEnterKey.iconPreview = null; resetKeyAttributes(mEnterKey, res.getText(R.string.label_go_key));
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_go_key);
break; break;
case EditorInfo.IME_ACTION_NEXT: case EditorInfo.IME_ACTION_NEXT:
mEnterKey.iconPreview = null; resetKeyAttributes(mEnterKey, res.getText(R.string.label_next_key));
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_next_key);
break; break;
case EditorInfo.IME_ACTION_DONE: case EditorInfo.IME_ACTION_DONE:
mEnterKey.iconPreview = null; resetKeyAttributes(mEnterKey, res.getText(R.string.label_done_key));
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_done_key);
break; break;
case EditorInfo.IME_ACTION_SEARCH: case EditorInfo.IME_ACTION_SEARCH:
resetKeyAttributes(mEnterKey, null);
mEnterKey.iconPreview = res.getDrawable( mEnterKey.iconPreview = res.getDrawable(
R.drawable.sym_keyboard_feedback_search); R.drawable.sym_keyboard_feedback_search);
mEnterKey.icon = res.getDrawable(mIsBlackSym ? mEnterKey.icon = res.getDrawable(mIsBlackSym ?
R.drawable.sym_bkeyboard_search : R.drawable.sym_keyboard_search); R.drawable.sym_bkeyboard_search : R.drawable.sym_keyboard_search);
mEnterKey.label = null;
break; break;
case EditorInfo.IME_ACTION_SEND: case EditorInfo.IME_ACTION_SEND:
mEnterKey.iconPreview = null; resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key));
mEnterKey.icon = null;
mEnterKey.label = res.getText(R.string.label_send_key);
break;
default:
mEnterKey.iconPreview = res.getDrawable(
R.drawable.sym_keyboard_feedback_return);
mEnterKey.icon = res.getDrawable(mIsBlackSym ?
R.drawable.sym_bkeyboard_return : R.drawable.sym_keyboard_return);
mEnterKey.label = null;
break; break;
} }
// Set the initial size of the preview icon // Set the initial size of the preview icon