Save default enter key attributes and restore these if needed

Bug: 3103016
Change-Id: Id8128d5b685ac040afd2c248e1ad17e9aaf1fdf0
main
Tadashi G. Takaoka 2010-10-17 14:19:39 +09:00
parent cd7b7d3e8f
commit a2de8f0f83
1 changed files with 21 additions and 0 deletions

View File

@ -83,6 +83,12 @@ public class LatinKeyboard extends BaseKeyboard {
private int mPrefLetterY; private int mPrefLetterY;
private int mPrefDistance; private int mPrefDistance;
// Default Enter key attributes
private final Drawable mDefaultEnterIcon;
private final Drawable mDefaultEnterPreview;
private final CharSequence mDefaultEnterLabel;
private final CharSequence mDefaultEnterText;
// TODO: generalize for any keyboardId // TODO: generalize for any keyboardId
private boolean mIsBlackSym; private boolean mIsBlackSym;
@ -139,6 +145,15 @@ public class LatinKeyboard extends BaseKeyboard {
mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE); mSpaceKeyIndex = indexOf(LatinIME.KEYCODE_SPACE);
// TODO remove this initialization after cleanup // TODO remove this initialization after cleanup
mVerticalGap = super.getVerticalGap(); mVerticalGap = super.getVerticalGap();
if (mEnterKey != null) {
mDefaultEnterIcon = mEnterKey.icon;
mDefaultEnterPreview = mEnterKey.iconPreview;
mDefaultEnterLabel = mEnterKey.label;
mDefaultEnterText = mEnterKey.text;
} else {
mDefaultEnterIcon = mDefaultEnterPreview = null;
mDefaultEnterLabel = mDefaultEnterText = null;
}
} }
@Override @Override
@ -195,6 +210,12 @@ public class LatinKeyboard extends BaseKeyboard {
case EditorInfo.IME_ACTION_SEND: case EditorInfo.IME_ACTION_SEND:
resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key)); resetKeyAttributes(mEnterKey, res.getText(R.string.label_send_key));
break; break;
default:
resetKeyAttributes(mEnterKey, mDefaultEnterLabel);
mEnterKey.text = mDefaultEnterText;
mEnterKey.icon = mDefaultEnterIcon;
mEnterKey.iconPreview = mDefaultEnterPreview;
break;
} }
// Set the initial size of the preview icon // Set the initial size of the preview icon
setDefaultBounds(mEnterKey.iconPreview); setDefaultBounds(mEnterKey.iconPreview);