本文整理汇总了Java中android.text.method.MetaKeyKeyListener类的典型用法代码示例。如果您正苦于以下问题:Java MetaKeyKeyListener类的具体用法?Java MetaKeyKeyListener怎么用?Java MetaKeyKeyListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetaKeyKeyListener类属于android.text.method包,在下文中一共展示了MetaKeyKeyListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyUp
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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);
}
示例2: onFocusChanged
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
@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);
}
示例3: onKeyDown
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
@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;
}
示例4: up
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
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);
}
}
}
示例5: down
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
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);
}
}
}
示例6: left
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
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);
}
}
}
示例7: right
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
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);
}
}
}
示例8: movehome
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
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);
}
}
}
示例9: moveend
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
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);
}
}
}
示例10: onKeyUp
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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);
}
示例11: translateKeyDown
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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;
}
示例12: translateKeyDown
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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;
}
示例13: translateKeyDown
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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;
}
示例14: onKeyUp
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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);
}
示例15: onKeyUp
import android.text.method.MetaKeyKeyListener; //导入依赖的package包/类
/**
* 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);
}