Package com.unitech.api.keymap
Class KeymappingCtrl
java.lang.Object
com.unitech.api.keymap.KeymappingCtrl
This controller is used to manage the Programmable Key API.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic android.content.Intentstatic Integer -
Method Summary
Modifier and TypeMethodDescriptionandroid.os.BundleaddKeyMappings(String keyName, String keyCode, boolean wakeup, String broadcastDownAction, android.os.Bundle[] broadcastDownParams, String broadcastUpAction, android.os.Bundle[] broadcastUpParams, android.os.Bundle[] startActivityParams) Add a key mapping into the Programmable Key listandroid.os.BundleenableKeyMapping(boolean enabled) Enable or disable the Programmable Key serviceandroid.os.BundleexportKeyMappings(String folderPath) Export the settings of the key mappings to the folderandroid.os.BundlegetDefaultKeyCode(String keyName) Get selected keyName default KeyCodestatic KeymappingCtrlgetInstance(android.content.Context context) Get an instance of the KeymappingCtrlandroid.os.BundlegetKeyMapping(String keyName) Get selected keyName mapping valueandroid.os.BundleCheck if the Programmable Key service is enabledandroid.os.BundleimportKeyMappings(String folderPath) Import the settings of the key mappings to the folderandroid.os.BundleresetKeyMapping(String keyName) Reset selected keyName to default settingsandroid.os.BundleReset all of the key mappings from the Programmable Key service
-
Field Details
-
KEY_PROGRAMMABLE_KEYS_SET
- See Also:
-
KEY_PROGRAMMABLE_KEY
- See Also:
-
KEY_PROGRAMMABLE_KEY_NAME
- See Also:
-
KEY_PROGRAMMABLE_KEY_CODE
- See Also:
-
KEY_PROGRAMMABLE_WAKEUP
- See Also:
-
KEY_PROGRAMMABLE_BROADCAST_DOWN
- See Also:
-
KEY_PROGRAMMABLE_BROADCAST_UP
- See Also:
-
KEY_PROGRAMMABLE_DOWN_PARAMS
- See Also:
-
KEY_PROGRAMMABLE_UP_PARAMS
- See Also:
-
KEY_PROGRAMMABLE_PARAMS_KEY
- See Also:
-
KEY_PROGRAMMABLE_PARAMS_VALUE
- See Also:
-
KEY_PROGRAMMABLE_DOWN_KEY
- See Also:
-
KEY_PROGRAMMABLE_UP_KEY
- See Also:
-
KEY_PROGRAMMABLE_DOWN_VALUE
- See Also:
-
KEY_PROGRAMMABLE_UP_VALUE
- See Also:
-
KEY_PROGRAMMABLE_START_ACTIVITY_PARAMS
- See Also:
-
KEY_PROGRAMMABLE_START_ACTIVITY_PARAM
- See Also:
-
KEY_PROGRAMMABLE_START_ACTIVITY_KEY
- See Also:
-
KEY_PROGRAMMABLE_START_ACTIVITY_VALUE
- See Also:
-
KEY_IMPORT_PROGRAMMABLE_KEYS
- See Also:
-
KEY_IMPORT_PROGRAMMABLE_KEYS_ENABLE
- See Also:
-
KEY_IMPORT_PROGRAMMABLE_KEYS_FILE_PATH
- See Also:
-
KEY_EXPORT_PROGRAMMABLE_KEYS
- See Also:
-
KEY_EXPORT_PROGRAMMABLE_KEYS_ENABLE
- See Also:
-
KEY_EXPORT_PROGRAMMABLE_KEYS_FILE_PATH
- See Also:
-
KEY_RESET_PROGRAMMABLE_KEYS
- See Also:
-
TAG_ENABLED
- See Also:
-
TAG_KEY
- See Also:
-
TAG_KEY_NAME
- See Also:
-
TAG_KEY_CODE
- See Also:
-
TAG_WAKEUP
- See Also:
-
TAG_BROADCAST_KEY_DOWN
- See Also:
-
TAG_ACTION
- See Also:
-
TAG_ACTION_PARAMS
- See Also:
-
TAG_PARAM
- See Also:
-
TAG_VALUE
- See Also:
-
TAG_BROADCAST_KEY_UP
- See Also:
-
TAG_START_ACTIVITY_PARAMS
- See Also:
-
BUNDLE_ERROR_CODE
- See Also:
-
BUNDLE_ERROR_MSG
- See Also:
-
REQUEST_CODE_IMPORT
public static final int REQUEST_CODE_IMPORT- See Also:
-
REQUEST_CODE_EXPORT
public static final int REQUEST_CODE_EXPORT- See Also:
-
RESULT_CODE_ERROR
public static final int RESULT_CODE_ERROR- See Also:
-
RESULT_CODE_SUCCESS
public static final int RESULT_CODE_SUCCESS- See Also:
-
INTENT_RESULT_MESSAGE
- See Also:
-
ACTION_KEY_EXPORT
- See Also:
-
ACTION_KEY_IMPORT
- See Also:
-
tmpIntent
public static volatile android.content.Intent tmpIntent -
tmpResultCode
-
-
Method Details
-
getInstance
Get an instance of the KeymappingCtrl- Parameters:
context- The context which will use this controller instance- Returns:
- A KeymappingCtrl instance
-
getKeyMappingEnabled
public android.os.Bundle getKeyMappingEnabled()Check if the Programmable Key service is enabled- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
int enabled = bundle.getInt("status");
-
enableKeyMapping
public android.os.Bundle enableKeyMapping(boolean enabled) Enable or disable the Programmable Key service- Parameters:
enabled- true: Enable, false: Disable- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
addKeyMappings
public android.os.Bundle addKeyMappings(String keyName, String keyCode, boolean wakeup, String broadcastDownAction, android.os.Bundle[] broadcastDownParams, String broadcastUpAction, android.os.Bundle[] broadcastUpParams, android.os.Bundle[] startActivityParams) Add a key mapping into the Programmable Key list- Parameters:
keyName- The key name what you want to remap. e.g. "VOLUME_UP"keyCode- The key code that you want to remap to. e.g. "25" (VOLUME_DOWN) or "com.unitech.keyremap" (target activity)wakeup- Set that pressing the key will wake the screen up or not.broadcastDownAction- Set the broadcast action if you want system to send a broadcast while pressing the key down.broadcastDownParams- Set the broadcast extras if you want system to send a broadcast while pressing the key down.
A bundle contains 2 string extras: "Key" and "Value" (use "," to separate key and value, use ";" to separate pairs)broadcastUpAction- Set the broadcast action if you want system to send a broadcast while releasing the key.broadcastUpParams- Set the broadcast extras if you want system to send a broadcast while releasing the key.
A bundle contains 2 string extras: "Key" and "Value" (use "," to separate key and value, use ";" to separate pairs)startActivityParams- Set the extras of the activity intent if the key code is set to start an activity
A bundle contains 2 string extras: "Key" and "Value" (use "," to separate key and value, use ";" to separate pairs)- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
resetKeyMappings
public android.os.Bundle resetKeyMappings()Reset all of the key mappings from the Programmable Key service- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
importKeyMappings
Import the settings of the key mappings to the folder- Parameters:
folderPath- The folder path of settings. e.g. "/sdcard/progkey/"- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
exportKeyMappings
Export the settings of the key mappings to the folder- Parameters:
folderPath- The folder path of settings. e.g. "/sdcard/progkey/"- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg = bundle.getString("errorMsg");
-
getKeyMapping
Get selected keyName mapping value- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
Other key set include keyCode, keyName, wakeup, broadcastDown(Up)Action.
broadcastDown(Up)Params, startActivityParams
-
getDefaultKeyCode
Get selected keyName default KeyCode- Returns:
- A bundle contains the error code and message
int errorCode = bundle.getInt("errorCode"), (error:1, success=0)
String errorMsg=bundle.getString("errorMsg");
String DefaultKeyCode = bundle.getString("DefaultKeyCode");
-
resetKeyMapping
Reset selected keyName to default settings- Returns:
- Bundle should include the following values:
"errorCode" - int:
0: Succeed
1: Failed
"errorMsg" - String:
"Error reason"
-