Cleanup KeyboardId's hasCode method
Change-Id: I5fd8f6ac0f42152fb0e2aaaedc6092f6d82fe677
This commit is contained in:
parent
8b1b8aae9c
commit
601e411c13
1 changed files with 36 additions and 30 deletions
|
@ -104,23 +104,45 @@ public class KeyboardId {
|
||||||
|
|
||||||
this.mEditorInfo = editorInfo;
|
this.mEditorInfo = editorInfo;
|
||||||
|
|
||||||
this.mHashCode = Arrays.hashCode(new Object[] {
|
this.mHashCode = hashCode(this);
|
||||||
locale,
|
}
|
||||||
orientation,
|
|
||||||
width,
|
private static int hashCode(KeyboardId id) {
|
||||||
mode,
|
return Arrays.hashCode(new Object[] {
|
||||||
xmlId,
|
id.mOrientation,
|
||||||
elementState,
|
id.mElementState,
|
||||||
mNavigateAction,
|
id.mMode,
|
||||||
mPasswordInput,
|
id.mWidth,
|
||||||
mSettingsKeyEnabled,
|
id.mXmlId,
|
||||||
mClobberSettingsKey,
|
id.mNavigateAction,
|
||||||
shortcutKeyEnabled,
|
id.mPasswordInput,
|
||||||
hasShortcutKey,
|
id.mSettingsKeyEnabled,
|
||||||
mImeAction,
|
id.mClobberSettingsKey,
|
||||||
|
id.mShortcutKeyEnabled,
|
||||||
|
id.mHasShortcutKey,
|
||||||
|
id.mImeAction,
|
||||||
|
id.mLocale,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean equals(KeyboardId other) {
|
||||||
|
if (other == this)
|
||||||
|
return true;
|
||||||
|
return other.mOrientation == this.mOrientation
|
||||||
|
&& other.mElementState == this.mElementState
|
||||||
|
&& other.mMode == this.mMode
|
||||||
|
&& other.mWidth == this.mWidth
|
||||||
|
&& other.mXmlId == this.mXmlId
|
||||||
|
&& other.mNavigateAction == this.mNavigateAction
|
||||||
|
&& other.mPasswordInput == this.mPasswordInput
|
||||||
|
&& other.mSettingsKeyEnabled == this.mSettingsKeyEnabled
|
||||||
|
&& other.mClobberSettingsKey == this.mClobberSettingsKey
|
||||||
|
&& other.mShortcutKeyEnabled == this.mShortcutKeyEnabled
|
||||||
|
&& other.mHasShortcutKey == this.mHasShortcutKey
|
||||||
|
&& other.mImeAction == this.mImeAction
|
||||||
|
&& other.mLocale.equals(this.mLocale);
|
||||||
|
}
|
||||||
|
|
||||||
public KeyboardId cloneWithNewXml(int xmlId) {
|
public KeyboardId cloneWithNewXml(int xmlId) {
|
||||||
return new KeyboardId(xmlId, mElementState, mLocale, mOrientation, mWidth, mMode,
|
return new KeyboardId(xmlId, mElementState, mLocale, mOrientation, mWidth, mMode,
|
||||||
mEditorInfo, false, false, false, false);
|
mEditorInfo, false, false, false, false);
|
||||||
|
@ -171,22 +193,6 @@ public class KeyboardId {
|
||||||
return other instanceof KeyboardId && equals((KeyboardId) other);
|
return other instanceof KeyboardId && equals((KeyboardId) other);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean equals(KeyboardId other) {
|
|
||||||
return other.mLocale.equals(this.mLocale)
|
|
||||||
&& other.mOrientation == this.mOrientation
|
|
||||||
&& other.mWidth == this.mWidth
|
|
||||||
&& other.mMode == this.mMode
|
|
||||||
&& other.mXmlId == this.mXmlId
|
|
||||||
&& other.mElementState == this.mElementState
|
|
||||||
&& other.mNavigateAction == this.mNavigateAction
|
|
||||||
&& other.mPasswordInput == this.mPasswordInput
|
|
||||||
&& other.mSettingsKeyEnabled == this.mSettingsKeyEnabled
|
|
||||||
&& other.mClobberSettingsKey == this.mClobberSettingsKey
|
|
||||||
&& other.mShortcutKeyEnabled == this.mShortcutKeyEnabled
|
|
||||||
&& other.mHasShortcutKey == this.mHasShortcutKey
|
|
||||||
&& other.mImeAction == this.mImeAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return mHashCode;
|
return mHashCode;
|
||||||
|
|
Loading…
Reference in a new issue