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


Java AccessibilityNodeInfo.getClassName方法代码示例

本文整理汇总了Java中android.view.accessibility.AccessibilityNodeInfo.getClassName方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityNodeInfo.getClassName方法的具体用法?Java AccessibilityNodeInfo.getClassName怎么用?Java AccessibilityNodeInfo.getClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.accessibility.AccessibilityNodeInfo的用法示例。


在下文中一共展示了AccessibilityNodeInfo.getClassName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findChildViews

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/**
 * Traverses the node structure and finds edit texts, adding them to the edit text node list
 * @param parentView
 */
private void findChildViews(AccessibilityNodeInfo parentView) {
    if (parentView != null) {
        // Get number of children of a node
        int childCount = parentView.getChildCount();

        if (parentView.getClassName() == null) {
            return;
        }
        // Get node class name
        String classname = parentView.getClassName().toString();
        if (childCount == 0 && (classname.contentEquals("android.widget.EditText"))) {
            // If the node is an end node and it is an edit text, add it to the list
            editTextNodes.add(parentView);
        } else {
            // Otherwise loop through any child nodes and try on them
            for (int i = 0; i < childCount; i++) {
                findChildViews(parentView.getChild(i));
            }
        }
    }
}
 
开发者ID:jthomperoo,项目名称:Forge,代码行数:26,代码来源:AccessibilityAutofillService.java

示例2: serialize

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static SerializedAccessibilityNodeInfo serialize(AccessibilityNodeInfo node){
    SerializedAccessibilityNodeInfo serializedNode = new SerializedAccessibilityNodeInfo();
    Rect boundsInScreen = new Rect(), boundsInParent = new Rect();
    if(node == null){
        return null;
    }
    if(node.getClassName() != null)
        serializedNode.className = node.getClassName().toString();
    node.getBoundsInScreen(boundsInScreen);
    node.getBoundsInParent(boundsInParent);

    serializedNode.boundsInScreen = boundsInScreen.flattenToString();
    serializedNode.boundsInParent = boundsInParent.flattenToString();

    if(node.getContentDescription() != null)
        serializedNode.contentDescription = node.getContentDescription().toString();

    if(node.getText() != null){
        serializedNode.text = node.getText().toString();
    }

    if(node.getViewIdResourceName() != null)
        serializedNode.viewId = node.getViewIdResourceName();

    int childCount = node.getChildCount();
    for(int i = 0; i < childCount; i ++){
        if(node.getChild(i) != null){
            serializedNode.children.add(serialize(node.getChild(i)));
        }
    }

    return serializedNode;
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:34,代码来源:AccessibilityUtils.java

示例3: check

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@Override
public boolean check(AccessibilityNodeInfo n) {
    //it seems like n.Editable is not a good check as this is false for some fields which are actually editable, at least in tests with Chrome.
    return (n.getClassName() != null) && (n.getClassName().toString().toLowerCase().contains("edittext"));
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:6,代码来源:AutoFillService.java


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