当前位置: 首页>>代码示例>>Java>>正文


Java MetaKeyKeyListener.getMetaState方法代码示例

本文整理汇总了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);
            }
        }
    }
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:27,代码来源:ArrowKeyMovementMethod.java

示例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);
            }
        }
    }
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:27,代码来源:ArrowKeyMovementMethod.java

示例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);
        }
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:23,代码来源:ArrowKeyMovementMethod.java

示例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);
        }
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:23,代码来源:ArrowKeyMovementMethod.java

示例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);
        }
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:25,代码来源:ArrowKeyMovementMethod.java

示例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);
        }
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:25,代码来源:ArrowKeyMovementMethod.java

示例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);
    }
}
 
开发者ID:AungThiha,项目名称:Tada,代码行数:9,代码来源:TextView.java

示例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;
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:34,代码来源:ArrowKeyMovementMethod.java

示例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;
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:13,代码来源:ArrowKeyMovementMethod.java

示例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;
    }
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:13,代码来源:ArrowKeyMovementMethod.java

示例11: getMetaStateSelecting

import android.text.method.MetaKeyKeyListener; //导入方法依赖的package包/类
public static final int getMetaStateSelecting(CharSequence text) {
    return MetaKeyKeyListener.getMetaState(text, META_SELECTING);
}
 
开发者ID:jiro-aqua,项目名称:JotaTextEditor,代码行数:4,代码来源:JotaTextKeyListener.java


注:本文中的android.text.method.MetaKeyKeyListener.getMetaState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。