本文整理汇总了Java中android.text.method.MetaKeyKeyListener.getMetaState方法的典型用法代码示例。如果您正苦于以下问题:Java MetaKeyKeyListener.getMetaState方法的具体用法?Java MetaKeyKeyListener.getMetaState怎么用?Java MetaKeyKeyListener.getMetaState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.text.method.MetaKeyKeyListener
的用法示例。
在下文中一共展示了MetaKeyKeyListener.getMetaState方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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);
}
}
}
示例3: 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);
}
}
}
示例4: 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);
}
}
}
示例5: 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);
}
}
}
示例6: 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);
}
}
}
示例7: afterTextChanged
import android.text.method.MetaKeyKeyListener; //导入方法依赖的package包/类
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);
}
}
示例8: doFunction
import android.text.method.MetaKeyKeyListener; //导入方法依赖的package包/类
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;
}
示例9: volup
import android.text.method.MetaKeyKeyListener; //导入方法依赖的package包/类
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;
}
}
示例10: voldown
import android.text.method.MetaKeyKeyListener; //导入方法依赖的package包/类
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;
}
}
示例11: getMetaStateSelecting
import android.text.method.MetaKeyKeyListener; //导入方法依赖的package包/类
public static final int getMetaStateSelecting(CharSequence text) {
return MetaKeyKeyListener.getMetaState(text, META_SELECTING);
}