diff options
Diffstat (limited to 'srcs/juloo.keyboard2/KeyValue.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index c9ecd66..f63f558 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -3,7 +3,7 @@ package juloo.keyboard2; import android.view.KeyEvent; import java.util.HashMap; -public final class KeyValue +public final class KeyValue implements Comparable<KeyValue> { public static enum Event { @@ -224,6 +224,18 @@ public final class KeyValue return sameKey((KeyValue)obj); } + public int compareTo(KeyValue snd) + { + // Compare the kind and value first, then the flags. + int d = (_code & ~FLAGS_BITS) - (snd._code & ~FLAGS_BITS); + if (d != 0) + return d; + d = _code - snd._code; + if (d != 0) + return d; + return _symbol.compareTo(snd._symbol); + } + /** Type-safe alternative to [equals]. */ public boolean sameKey(KeyValue snd) { |
