Move a debug utility function to EditorInfoCompatUtils

- imeOptionName

Change-Id: I7a7ea9bee410cedc0ef9b3d2aa4df8260d7f6a35
main
satok 2011-03-25 12:40:57 -07:00
parent e9957752bc
commit f1a81f5eb3
3 changed files with 44 additions and 24 deletions

View File

@ -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;
}
}
}

View File

@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.compat.InputTypeCompatUtils;
import com.android.inputmethod.latin.R;
@ -140,7 +141,7 @@ public class KeyboardId {
mLocale,
(mOrientation == 1 ? "port" : "land"),
modeName(mMode),
imeOptionsName(mImeAction),
EditorInfoCompatUtils.imeOptionsName(mImeAction),
(mPasswordInput ? " passwordInput" : ""),
(mHasSettingsKey ? " hasSettingsKey" : ""),
(mVoiceKeyEnabled ? " voiceKeyEnabled" : ""),
@ -170,26 +171,4 @@ public class KeyboardId {
}
return null;
}
public static String imeOptionsName(int imeOptions) {
if (imeOptions == -1) return null;
final int actionNo = imeOptions & EditorInfo.IME_MASK_ACTION;
final String action;
switch (actionNo) {
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;
case EditorInfo.IME_ACTION_PREVIOUS: action = "actionPrevious"; break;
default: action = "actionUnknown(" + actionNo + ")"; break;
}
if ((imeOptions & EditorInfo.IME_FLAG_NO_ENTER_ACTION) != 0) {
return "flagNoEnterAction|" + action;
} else {
return action;
}
}
}

View File

@ -16,6 +16,7 @@
package com.android.inputmethod.keyboard;
import com.android.inputmethod.compat.EditorInfoCompatUtils;
import com.android.inputmethod.latin.R;
import org.xmlpull.v1.XmlPullParser;
@ -453,7 +454,7 @@ public class KeyboardParser {
booleanAttr(a, R.styleable.Keyboard_Case_hasSettingsKey, "hasSettingsKey"),
booleanAttr(a, R.styleable.Keyboard_Case_voiceKeyEnabled, "voiceKeyEnabled"),
booleanAttr(a, R.styleable.Keyboard_Case_hasVoiceKey, "hasVoiceKey"),
textAttr(KeyboardId.imeOptionsName(
textAttr(EditorInfoCompatUtils.imeOptionsName(
a.getInt(R.styleable.Keyboard_Case_imeAction, -1)), "imeAction"),
textAttr(a.getString(R.styleable.Keyboard_Case_languageCode), "languageCode"),
textAttr(a.getString(R.styleable.Keyboard_Case_countryCode), "countryCode"),