From f1a81f5eb37df4170de2cf6327c860e3d64dc2f8 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 25 Mar 2011 12:40:57 -0700 Subject: Move a debug utility function to EditorInfoCompatUtils - imeOptionName Change-Id: I7a7ea9bee410cedc0ef9b3d2aa4df8260d7f6a35 --- .../inputmethod/compat/EditorInfoCompatUtils.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java') diff --git a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java index 9d83b5463..f6f4f7a59 100644 --- a/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java +++ b/java/src/com/android/inputmethod/compat/EditorInfoCompatUtils.java @@ -56,4 +56,44 @@ public class EditorInfoCompatUtils { return; ic.performEditorAction(OBJ_IME_ACTION_PREVIOUS); } + + public static String imeOptionsName(int imeOptions) { + if (imeOptions == -1) + return null; + final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION; + final String action; + switch (actionId) { + case EditorInfo.IME_ACTION_UNSPECIFIED: + action = "actionUnspecified"; + break; + case EditorInfo.IME_ACTION_NONE: + action = "actionNone"; + break; + case EditorInfo.IME_ACTION_GO: + action = "actionGo"; + break; + case EditorInfo.IME_ACTION_SEARCH: + action = "actionSearch"; + break; + case EditorInfo.IME_ACTION_SEND: + action = "actionSend"; + break; + case EditorInfo.IME_ACTION_DONE: + action = "actionDone"; + break; + default: { + if (OBJ_IME_ACTION_PREVIOUS != null && actionId == OBJ_IME_ACTION_PREVIOUS) { + action = "actionPrevious"; + } else { + action = "actionUnknown(" + actionId + ")"; + } + break; + } + } + if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) { + return "flagNoEnterAction|" + action; + } else { + return action; + } + } } -- cgit v1.2.3-83-g751a