diff options
author | 2012-09-12 11:52:44 +0900 | |
---|---|---|
committer | 2012-09-12 11:52:44 +0900 | |
commit | 64c65ce6d780175fe606fdd7ee694a3b5af4e37f (patch) | |
tree | 63049bcbb3f459e8450095318371df045cd86a81 /java/src | |
parent | 655be140a0df4eaeee6789a0a14b765881c46748 (diff) | |
download | latinime-64c65ce6d780175fe606fdd7ee694a3b5af4e37f.tar.gz latinime-64c65ce6d780175fe606fdd7ee694a3b5af4e37f.tar.xz latinime-64c65ce6d780175fe606fdd7ee694a3b5af4e37f.zip |
Add missing MoreKeySpec.hashCode
Bug: 7149235
Change-Id: I14ba1017dffccc690e24289052a3ad7265a5f5f7
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java b/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java index 5da26543f..550391b49 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java +++ b/java/src/com/android/inputmethod/keyboard/internal/MoreKeySpec.java @@ -16,12 +16,14 @@ package com.android.inputmethod.keyboard.internal; +import android.text.TextUtils; + import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.latin.StringUtils; import java.util.Locale; -public class MoreKeySpec { +public final class MoreKeySpec { public final int mCode; public final String mLabel; public final String mOutputText; @@ -47,6 +49,29 @@ public class MoreKeySpec { } @Override + public int hashCode() { + int hashCode = 1; + hashCode = 31 + mCode; + hashCode = hashCode * 31 + mIconId; + hashCode = hashCode * 31 + (mLabel == null ? 0 : mLabel.hashCode()); + hashCode = hashCode * 31 + (mOutputText == null ? 0 : mOutputText.hashCode()); + return hashCode; + } + + @Override + public boolean equals(final Object o) { + if (this == o) return true; + if (o instanceof MoreKeySpec) { + final MoreKeySpec other = (MoreKeySpec)o; + return mCode == other.mCode + && mIconId == other.mIconId + && TextUtils.equals(mLabel, other.mLabel) + && TextUtils.equals(mOutputText, other.mOutputText); + } + return false; + } + + @Override public String toString() { final String label = (mIconId == KeyboardIconsSet.ICON_UNDEFINED ? mLabel : KeySpecParser.PREFIX_ICON + KeyboardIconsSet.getIconName(mIconId)); |