Remove orientation member from KeyboardId

Change-Id: I2c16134a24088dbc30b74ae7c5bc578a9d84a960
This commit is contained in:
Tadashi G. Takaoka 2013-08-07 16:03:57 +09:00
parent 0f47d5163d
commit 15c42454c0
4 changed files with 9 additions and 21 deletions

View File

@ -58,8 +58,6 @@ public final class KeyboardId {
public final InputMethodSubtype mSubtype;
public final Locale mLocale;
// TODO: Remove this member. It is used only for logging purpose.
public final int mOrientation;
public final int mWidth;
public final int mHeight;
public final int mMode;
@ -77,7 +75,6 @@ public final class KeyboardId {
public KeyboardId(final int elementId, final KeyboardLayoutSet.Params params) {
mSubtype = params.mSubtype;
mLocale = SubtypeLocaleUtils.getSubtypeLocale(mSubtype);
mOrientation = params.mOrientation;
mWidth = params.mKeyboardWidth;
mHeight = params.mKeyboardHeight;
mMode = params.mMode;
@ -101,7 +98,6 @@ public final class KeyboardId {
private static int computeHashCode(final KeyboardId id) {
return Arrays.hashCode(new Object[] {
id.mOrientation,
id.mElementId,
id.mMode,
id.mWidth,
@ -123,8 +119,7 @@ public final class KeyboardId {
private boolean equals(final KeyboardId other) {
if (other == this)
return true;
return other.mOrientation == mOrientation
&& other.mElementId == mElementId
return other.mElementId == mElementId
&& other.mMode == mMode
&& other.mWidth == mWidth
&& other.mHeight == mHeight
@ -185,13 +180,10 @@ public final class KeyboardId {
@Override
public String toString() {
final String orientation = (mOrientation == Configuration.ORIENTATION_PORTRAIT)
? "port" : "land";
return String.format(Locale.ROOT, "[%s %s:%s %s:%dx%d %s %s %s%s%s%s%s%s%s%s%s]",
return String.format(Locale.ROOT, "[%s %s:%s %dx%d %s %s %s%s%s%s%s%s%s%s%s]",
elementIdToName(mElementId),
mLocale,
mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
orientation, mWidth, mHeight,
mLocale, mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
mWidth, mHeight,
modeName(mMode),
imeAction(),
(navigateNext() ? "navigateNext" : ""),

View File

@ -119,7 +119,6 @@ public final class KeyboardLayoutSet {
boolean mLanguageSwitchKeyEnabled;
InputMethodSubtype mSubtype;
boolean mIsSpellChecker;
int mOrientation;
int mKeyboardWidth;
int mKeyboardHeight;
// Sparse array of KeyboardLayoutSet element parameters indexed by element's id.
@ -242,9 +241,6 @@ public final class KeyboardLayoutSet {
}
public Builder setScreenGeometry(final int widthPixels, final int heightPixels) {
final Params params = mParams;
params.mOrientation = (heightPixels > widthPixels)
? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
setDefaultKeyboardSize(widthPixels, heightPixels);
return this;
}
@ -317,8 +313,6 @@ public final class KeyboardLayoutSet {
}
public KeyboardLayoutSet build() {
if (mParams.mOrientation == Configuration.ORIENTATION_UNDEFINED)
throw new RuntimeException("Screen geometry is not specified");
if (mParams.mSubtype == null)
throw new RuntimeException("KeyboardLayoutSet subtype is not specified");
final String packageName = mResources.getResourcePackageName(

View File

@ -615,7 +615,8 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
final int keyHeight = keyboard.mMostCommonKeyHeight - keyboard.mVerticalGap;
mSpacebarTextSize = keyHeight * mSpacebarTextRatio;
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
ResearchLogger.mainKeyboardView_setKeyboard(keyboard);
final int orientation = getContext().getResources().getConfiguration().orientation;
ResearchLogger.mainKeyboardView_setKeyboard(keyboard, orientation);
}
// This always needs to be set since the accessibility state can

View File

@ -1414,7 +1414,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
"navigatePrevious", "clobberSettingsKey", "passwordInput", "shortcutKeyEnabled",
"hasShortcutKey", "languageSwitchKeyEnabled", "isMultiLine", "tw", "th",
"keys");
public static void mainKeyboardView_setKeyboard(final Keyboard keyboard) {
public static void mainKeyboardView_setKeyboard(final Keyboard keyboard,
final int orientation) {
final KeyboardId kid = keyboard.mId;
final boolean isPasswordView = kid.passwordInput();
final ResearchLogger researchLogger = getInstance();
@ -1422,7 +1423,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
researchLogger.enqueueEvent(LOGSTATEMENT_MAINKEYBOARDVIEW_SETKEYBOARD,
KeyboardId.elementIdToName(kid.mElementId),
kid.mLocale + ":" + kid.mSubtype.getExtraValueOf(KEYBOARD_LAYOUT_SET),
kid.mOrientation, kid.mWidth, KeyboardId.modeName(kid.mMode), kid.imeAction(),
orientation, kid.mWidth, KeyboardId.modeName(kid.mMode), kid.imeAction(),
kid.navigateNext(), kid.navigatePrevious(), kid.mClobberSettingsKey,
isPasswordView, kid.mShortcutKeyEnabled, kid.mHasShortcutKey,
kid.mLanguageSwitchKeyEnabled, kid.isMultiLine(), keyboard.mOccupiedWidth,