Java 类android.text.method.MetaKeyKeyListener 实例源码
项目:javaide
文件:TerminalKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// Log.v("SpartacusRex","SOFT : onKeyUp "+keyCode +" "+event.getMetaState());
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:Tada
文件:TextView.java
@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
if (mTemporaryDetach) {
// If we are temporarily in the detach state, then do nothing.
super.onFocusChanged(focused, direction, previouslyFocusedRect);
return;
}
if (mEditor != null) mEditor.onFocusChanged(focused, direction);
if (focused) {
if (mText instanceof Spannable) {
Spannable sp = (Spannable) mText;
MetaKeyKeyListener.resetMetaState(sp);
}
}
startStopMarquee(focused);
if (mTransformation != null) {
mTransformation.onFocusChanged(this, mText, focused, direction, previouslyFocusedRect);
}
super.onFocusChanged(focused, direction, previouslyFocusedRect);
}
项目:uds
文件:QtActivity.java
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if (!m_started)
return false;
m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState));
int lc=c;
m_metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(m_metaState);
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0)
{
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
int composed = KeyEvent.getDeadChar(m_lastChar, c);
c = composed;
}
m_lastChar = lc;
// if (keyCode != KeyEvent.KEYCODE_BACK)
QtApplication.keyDown(keyCode, c, event.getMetaState());
return true;
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean up(TextView widget, Spannable buffer) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
boolean alt = MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_ALT_ON) == 1;
Layout layout = widget.getLayout();
if (cap) {
if (alt) {
// Selection.extendSelection(buffer, 0);
widget.movePage(true,true);
return true;
} else {
return Selection.extendUp(buffer, layout);
}
} else {
if (alt) {
// Selection.setSelection(buffer, 0);
widget.movePage(true,false);
return true;
} else {
return Selection.moveUp(buffer, layout);
}
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean down(TextView widget, Spannable buffer) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
boolean alt = MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_ALT_ON) == 1;
Layout layout = widget.getLayout();
if (cap) {
if (alt) {
// Selection.extendSelection(buffer, buffer.length());
widget.movePage(false,true);
return true;
} else {
return Selection.extendDown(buffer, layout);
}
} else {
if (alt) {
// Selection.setSelection(buffer, buffer.length());
widget.movePage(false,false);
return true;
} else {
return Selection.moveDown(buffer, layout);
}
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean left(TextView widget, Spannable buffer) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
boolean alt = MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_ALT_ON) == 1;
Layout layout = widget.getLayout();
if (cap) {
if (alt) {
return Selection.extendToLeftEdge(buffer, layout);
} else {
return Selection.extendLeft(buffer, layout);
}
} else {
if (alt) {
return Selection.moveToLeftEdge(buffer, layout);
} else {
return Selection.moveLeft(buffer, layout);
}
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean right(TextView widget, Spannable buffer) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
boolean alt = MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_ALT_ON) == 1;
Layout layout = widget.getLayout();
if (cap) {
if (alt) {
return Selection.extendToRightEdge(buffer, layout);
} else {
return Selection.extendRight(buffer, layout);
}
} else {
if (alt) {
return Selection.moveToRightEdge(buffer, layout);
} else {
return Selection.moveRight(buffer, layout);
}
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean movehome(TextView widget, Spannable buffer, KeyEvent event) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
Layout layout = widget.getLayout();
boolean ctrl = (event.getMetaState() & mShortcutCtrlKey)!=0;
if ( ctrl ){
if (cap) {
Selection.extendSelection(buffer, 0);
return true;
} else {
Selection.setSelection(buffer, 0);
return true;
}
}else{
if (cap) {
return Selection.extendToLeftEdge(buffer, layout);
} else {
return Selection.moveToLeftEdge(buffer, layout);
}
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean moveend(TextView widget, Spannable buffer, KeyEvent event) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
Layout layout = widget.getLayout();
boolean ctrl = (event.getMetaState() & mShortcutCtrlKey)!=0;
if ( ctrl ){
if (cap) {
Selection.extendSelection(buffer, buffer.length());
return true;
} else {
Selection.setSelection(buffer, buffer.length());
return true;
}
}else{
if (cap) {
return Selection.extendToRightEdge(buffer, layout);
} else {
return Selection.moveToRightEdge(buffer, layout);
}
}
}
项目:ZShaolin
文件:TerminalKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
// Log.v("SpartacusRex","SOFT : onKeyUp "+keyCode +" "+event.getMetaState());
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:behe-keyboard
文件:PCKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:javaide
文件:TerminalKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
// Log.v("SpartacusRex","SOFT : translateKeyDown "+keyCode);
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() - 1);
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length() - 1);
}
}
onKey(c, null);
return true;
}
项目:tibetan-keyboard
文件:SoftKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:tibetan-keyboard
文件:SoftKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:accentype-android
文件:SoftKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:accentype-android
文件:SoftKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:literatim
文件:SoftKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:literatim
文件:SoftKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:Tada
文件:TextView.java
public void afterTextChanged(Editable buffer) {
if (DEBUG_EXTRACT) Log.v(LOG_TAG, "afterTextChanged: " + buffer);
TextView.this.sendAfterTextChanged(buffer);
if (MetaKeyKeyListener.getMetaState(buffer, MetaKeyKeyListener.META_SELECTING) != 0) {
MetaKeyKeyListener.stopSelecting(TextView.this, buffer);
}
}
项目:uds
文件:QtActivity.java
@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
if (!m_started)
return false;
m_metaState = MetaKeyKeyListener.handleKeyUp(m_metaState, keyCode, event);
QtApplication.keyUp(keyCode, event.getUnicodeChar(), event.getMetaState());
return true;
}
项目:accentype-android
文件:SoftKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:accentype-android
文件:SoftKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:JotaTextEditor
文件:TextView.java
public void afterTextChanged(Editable buffer) {
if (DEBUG_EXTRACT) Log.v(TAG, "afterTextChanged: " + buffer);
TextView.this.sendAfterTextChanged(buffer);
if (JotaTextKeyListener.getMetaStateSelecting(buffer) != 0) {
MetaKeyKeyListener.stopSelecting(TextView.this, buffer);
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
public boolean doFunction(TextView widget, Spannable buffer, int function)
{
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
Log.d("=========================>","cap="+cap);
switch( function )
{
case TextView.FUNCTION_CURSOR_LEFT:
return moveLeft(widget, buffer, cap);
case TextView.FUNCTION_CURSOR_RIGHT:
return moveRight(widget, buffer, cap);
case TextView.FUNCTION_CURSOR_UP:
return moveUp(widget, buffer, cap);
case TextView.FUNCTION_CURSOR_DOWN:
return moveDown(widget, buffer, cap);
case TextView.FUNCTION_PAGE_UP:
return movePageUp(widget, buffer, cap);
case TextView.FUNCTION_PAGE_DOWN:
return movePageDown(widget, buffer, cap);
case TextView.FUNCTION_HOME:
return moveHome(widget, buffer, cap);
case TextView.FUNCTION_END:
return moveEnd(widget, buffer, cap);
case TextView.FUNCTION_TOP:
return moveTop(widget, buffer, cap);
case TextView.FUNCTION_BOTTOM:
return moveBottom(widget, buffer, cap);
}
return false;
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean volup(TextView widget, Spannable buffer) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
if (cap) {
widget.movePage(true,true);
return true;
} else {
widget.movePage(true,false);
return true;
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean voldown(TextView widget, Spannable buffer) {
boolean cap = (MetaKeyKeyListener.getMetaState(buffer,
KeyEvent.META_SHIFT_ON) == 1) ||
(JotaTextKeyListener.getMetaStateSelecting(buffer) != 0);
if (cap) {
widget.movePage(false,true);
return true;
} else {
widget.movePage(false,false);
return true;
}
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
public boolean onKeyDown(TextView widget, Spannable buffer, int keyCode, KeyEvent event) {
if (executeDown(widget, buffer, keyCode,event)) {
MetaKeyKeyListener.adjustMetaAfterKeypress(buffer);
resetLockedMeta(buffer);
return true;
}
return false;
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
public static MovementMethod getInstance() {
if (sInstance == null)
sInstance = new ArrowKeyMovementMethod();
try{
Class<?> c = MetaKeyKeyListener.class;
sMethod = c.getDeclaredMethod("resetLockedMeta", new Class[]{ Spannable.class });
sMethod.setAccessible(true);
}catch(Exception e){
}
return sInstance;
}
项目:ZShaolin
文件:TerminalKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
// Log.v("SpartacusRex","SOFT : translateKeyDown "+keyCode);
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:animal
文件:AnimalKeyboard.java
/**
* This translates incoming hard key events in to edit operations on an
* InputConnection. It is only needed when using the
* PROCESS_HARD_KEYS option.
*/
private boolean translateKeyDown(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
boolean dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (mComposing.length() > 0) {
char accent = mComposing.charAt(mComposing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
mComposing.setLength(mComposing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:animal
文件:AnimalKeyboard.java
/**
* Use this to monitor key events being delivered to the application.
* We get first crack at them, and can either resume them or let them
* continue to the app.
*/
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
// If we want to do transformations on text being entered with a hard
// keyboard, we need to process the up events to update the meta key
// state we are tracking.
if (PROCESS_HARD_KEYS) {
if (mPredictionOn) {
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState,
keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:BAGO_TS
文件:KeyboardService.java
private boolean translateKeyDown(int keyCode, KeyEvent event) {
MetaState = MetaKeyKeyListener.handleKeyDown(MetaState,
keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(MetaState));
MetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(MetaState);
InputConnection ic = getCurrentInputConnection();
if (c == 0 || ic == null) {
return false;
}
dead = false;
if ((c & KeyCharacterMap.COMBINING_ACCENT) != 0) {
dead = true;
c = c & KeyCharacterMap.COMBINING_ACCENT_MASK;
}
if (Composing.length() > 0) {
char accent = Composing.charAt(Composing.length() -1 );
int composed = KeyEvent.getDeadChar(accent, c);
if (composed != 0) {
c = composed;
Composing.setLength(Composing.length()-1);
}
}
onKey(c, null);
return true;
}
项目:BAGO_TS
文件:KeyboardService.java
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (PROCESS_HARD_KEYS) {
if (PredictionOn) {
MetaState = MetaKeyKeyListener.handleKeyUp(MetaState, keyCode, event);
}
}
return super.onKeyUp(keyCode, event);
}
项目:android-unicode
文件:Utf7ImeService.java
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// Log.d(TAG, String.format("onKeyUp (%x)", keyCode));
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState, keyCode, event);
return super.onKeyUp(keyCode, event);
}
项目:android-unicode
文件:Utf7ImeService.java
private int getUnicodeChar(int keyCode, KeyEvent event) {
mMetaState = MetaKeyKeyListener.handleKeyDown(mMetaState, keyCode, event);
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(mMetaState));
mMetaState = MetaKeyKeyListener.adjustMetaAfterKeypress(mMetaState);
return c;
}
项目:JotaTextEditor
文件:ArrowKeyMovementMethod.java
private boolean executeDown(TextView widget, Spannable buffer, int keyCode , KeyEvent event) {
boolean handled = false;
if ( keyCode == KEYCODE_PAGE_UP ){
handled |= volup(widget, buffer);
}else if ( keyCode == KEYCODE_PAGE_DOWN){
handled |= voldown(widget, buffer);
}else if ( keyCode == KEYCODE_MOVE_HOME){
handled |= movehome(widget, buffer ,event);
}else if ( keyCode == KEYCODE_MOVE_END){
handled |= moveend(widget, buffer , event);
}else{
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_UP:
handled |= up(widget, buffer);
break;
case KeyEvent.KEYCODE_DPAD_DOWN:
handled |= down(widget, buffer);
break;
case KeyEvent.KEYCODE_DPAD_LEFT:
handled |= left(widget, buffer);
break;
case KeyEvent.KEYCODE_DPAD_RIGHT:
handled |= right(widget, buffer);
break;
case KeyEvent.KEYCODE_DPAD_CENTER:
if (JotaTextKeyListener.getMetaStateSelecting(buffer) != 0) {
if (widget.showContextMenu()) {
handled = true;
}
}
break;
case KeyEvent.KEYCODE_VOLUME_UP:
if ( sUseVolumeKey ){
handled |= volup(widget, buffer);
}
break;
case KeyEvent.KEYCODE_VOLUME_DOWN:
if ( sUseVolumeKey ){
handled |= voldown(widget, buffer);
}
break;
}
}
if (handled) {
MetaKeyKeyListener.adjustMetaAfterKeypress(buffer);
resetLockedMeta(buffer);
}
return handled;
}
项目:JotaTextEditor
文件:JotaTextKeyListener.java
public static final int getMetaStateSelecting(CharSequence text) {
return MetaKeyKeyListener.getMetaState(text, META_SELECTING);
}
项目:io.appium.android.ime
文件:UnicodeIME.java
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
Log.i(TAG, "onKeyUp (keyCode='" + keyCode + "', event.keyCode='" + event.getKeyCode() + "', metaState='" + event.getMetaState() + "')");
metaState = MetaKeyKeyListener.handleKeyUp(metaState, keyCode, event);
return super.onKeyUp(keyCode, event);
}
项目:io.appium.android.ime
文件:UnicodeIME.java
private int getUnicodeChar(int keyCode, KeyEvent event) {
metaState = MetaKeyKeyListener.handleKeyDown(metaState, keyCode, event);
int c = event.getUnicodeChar(event.getMetaState());
metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(metaState);
return c;
}
项目:uiautomator-unicode-input-helper
文件:Utf7ImeService.java
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
// Log.d(TAG, String.format("onKeyUp (%x)", keyCode));
mMetaState = MetaKeyKeyListener.handleKeyUp(mMetaState, keyCode, event);
return super.onKeyUp(keyCode, event);
}