diff options
author | Jean Chalard <jchalard@google.com> | 2013-03-04 18:43:48 -0800 |
---|---|---|
committer | Jean Chalard <jchalard@google.com> | 2013-03-04 18:43:48 -0800 |
commit | f9bd5f69e2b540bbd3187fe1d7c7ca33f77f0cd9 (patch) | |
tree | 48fcf24876e99f3cf7512d557f044e0baff2cffa /core/java/android/text/method | |
parent | 8df79da5d1d65618439eb4dec80bf74e4e9dad0d (diff) | |
download | frameworks_base-f9bd5f69e2b540bbd3187fe1d7c7ca33f77f0cd9.zip frameworks_base-f9bd5f69e2b540bbd3187fe1d7c7ca33f77f0cd9.tar.gz frameworks_base-f9bd5f69e2b540bbd3187fe1d7c7ca33f77f0cd9.tar.bz2 |
Preparatory cleanups in MetaKeyKeyListener
This cleans up a comment mentioning a private API and
declares constants for the return value of some public
functions.
Bug: 8303489
Change-Id: If06cc64952a572c506961e8125d0874428b5580c
Diffstat (limited to 'core/java/android/text/method')
-rw-r--r-- | core/java/android/text/method/MetaKeyKeyListener.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/core/java/android/text/method/MetaKeyKeyListener.java b/core/java/android/text/method/MetaKeyKeyListener.java index 0a097f9..5ebb957 100644 --- a/core/java/android/text/method/MetaKeyKeyListener.java +++ b/core/java/android/text/method/MetaKeyKeyListener.java @@ -135,6 +135,9 @@ public abstract class MetaKeyKeyListener { private static final Object SYM = new NoCopySpan.Concrete(); private static final Object SELECTING = new NoCopySpan.Concrete(); + private static final int PRESSED_RETURN_VALUE = 1; + private static final int LOCKED_RETURN_VALUE = 2; + /** * Resets all meta state to inactive. */ @@ -160,10 +163,12 @@ public abstract class MetaKeyKeyListener { getActive(text, SELECTING, META_SELECTING, META_SELECTING); } + // As META_SELECTING is @hide we should not mention it in public comments, hence the + // omission in @param meta /** * Gets the state of a particular meta key. * - * @param meta META_SHIFT_ON, META_ALT_ON, META_SYM_ON, or META_SELECTING + * @param meta META_SHIFT_ON, META_ALT_ON, META_SYM_ON * @param text the buffer in which the meta key would have been pressed. * * @return 0 if inactive, 1 if active, 2 if locked. @@ -171,16 +176,16 @@ public abstract class MetaKeyKeyListener { public static final int getMetaState(CharSequence text, int meta) { switch (meta) { case META_SHIFT_ON: - return getActive(text, CAP, 1, 2); + return getActive(text, CAP, PRESSED_RETURN_VALUE, LOCKED_RETURN_VALUE); case META_ALT_ON: - return getActive(text, ALT, 1, 2); + return getActive(text, ALT, PRESSED_RETURN_VALUE, LOCKED_RETURN_VALUE); case META_SYM_ON: - return getActive(text, SYM, 1, 2); + return getActive(text, SYM, PRESSED_RETURN_VALUE, LOCKED_RETURN_VALUE); case META_SELECTING: - return getActive(text, SELECTING, 1, 2); + return getActive(text, SELECTING, PRESSED_RETURN_VALUE, LOCKED_RETURN_VALUE); default: return 0; @@ -430,18 +435,18 @@ public abstract class MetaKeyKeyListener { public static final int getMetaState(long state, int meta) { switch (meta) { case META_SHIFT_ON: - if ((state & META_CAP_LOCKED) != 0) return 2; - if ((state & META_SHIFT_ON) != 0) return 1; + if ((state & META_CAP_LOCKED) != 0) return LOCKED_RETURN_VALUE; + if ((state & META_SHIFT_ON) != 0) return PRESSED_RETURN_VALUE; return 0; case META_ALT_ON: - if ((state & META_ALT_LOCKED) != 0) return 2; - if ((state & META_ALT_ON) != 0) return 1; + if ((state & META_ALT_LOCKED) != 0) return LOCKED_RETURN_VALUE; + if ((state & META_ALT_ON) != 0) return PRESSED_RETURN_VALUE; return 0; case META_SYM_ON: - if ((state & META_SYM_LOCKED) != 0) return 2; - if ((state & META_SYM_ON) != 0) return 1; + if ((state & META_SYM_LOCKED) != 0) return LOCKED_RETURN_VALUE; + if ((state & META_SYM_ON) != 0) return PRESSED_RETURN_VALUE; return 0; default: @@ -599,4 +604,3 @@ public abstract class MetaKeyKeyListener { private static final int LOCKED = Spannable.SPAN_MARK_MARK | (4 << Spannable.SPAN_USER_SHIFT); } - |