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


Java AccessibilityNodeInfo.recycle方法代码示例

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


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

示例1: onNewText

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void onNewText(CharSequence text, AccessibilityEvent event) {
    AccessibilityNodeInfo src = event.getSource();
    int hashCode = -1;
    if (src != null) {
        hashCode = src.hashCode();
        src.recycle();
    }

    if (this.mEvent != null
            && this.mEvent.sourceHashCode == hashCode) {
        this.mEvent.text = text.toString();
    }
    else{
        beginEvent(String.valueOf(event.getPackageName()), hashCode, text);
    }
}
 
开发者ID:PrivacyStreams,项目名称:PrivacyStreams,代码行数:17,代码来源:TextEntryProvider.java

示例2: onAccessibilityEvent

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public void onAccessibilityEvent(AccessibilityEvent event) {
	
	if (sSettingsComponentName == null || !isSettings(event)) {
		return;
	}

	AccessibilityNodeInfo source = event.getSource();
	if (source == null) {
		return;
	}
	
	LogUtils.LOGD(TAG, "source : " + source.getClassName() + ", " + source.getText());

	try {
		if (isAppDetail(event)) {
			handleAppDetail(source);
		} else if (isAlertDialog(event)) {
			handleAlertDialog(source);
		}
	} finally {
		source.recycle();
	}
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:24,代码来源:AppDetailsAutomatorManager.java

示例3: getRootAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static AccessibilityNodeInfo getRootAccessibilityNodeInfo(@NonNull AccessibilityNodeInfo accessibilityNodeInfo) throws MyException {
    if (null == accessibilityNodeInfo) {
        throw new NullPointerException("accessibilityNodeInfo");
    }
    AccessibilityNodeInfo current = null;
    try {
        current = accessibilityNodeInfo;
        while (true) {
            AccessibilityNodeInfo parent = current.getParent();
            if (null == parent) {
                return current;
            }
            current = parent;
        }
    } catch (Exception e) {
        if (null != current) {
            current.recycle();
        }
        throw new MyException(e);
    }
}
 
开发者ID:littleRich,项目名称:AutoInteraction-Library,代码行数:22,代码来源:UiTree.java

示例4: onAccessibilityEvent

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
    int eventType = event.getEventType();
    CharSequence packageName = event.getPackageName();
    switch (eventType) {
        case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
            AccessibilityNodeInfo rootNode = getRootInActiveWindow();
            if (rootNode != null) {

                if (packageName.equals("com.android.settings")) {
                    AccessibilityNodeInfo settingNode = AceHelper.findNodeByText(rootNode,"WLAN");
                    AceHelper.performClick(settingNode);
                    rootNode.recycle();
                } else if (packageName.equals("com.android.wifisettings")) {
                    AccessibilityNodeInfo wifiNode = AceHelper.findNodeByText(rootNode, "TP-LINK_F770");
                    AccessibilityNodeInfo wifiNodeParent = wifiNode.getParent();
                    AccessibilityNodeInfo iconNode = AceHelper.findNodeById(wifiNodeParent, "com.android.wifisettings:id/advance_layout");
                    AceHelper.performClick(iconNode);
                }
            }
            break;
        case AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED:
            Toast.makeText(this, "Notify", Toast.LENGTH_SHORT).show();
            event.getSource().recycle();
            break;
        case AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED:
            break;
        default:
            break;
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:33,代码来源:WifiProxyAccessibilityService.java

示例5: recycleList

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public static void recycleList(AccessibilityNodeInfo root, List<AccessibilityNodeInfo> list) {
    for (AccessibilityNodeInfo nodeInfo : list) {
        if (nodeInfo != root && nodeInfo != null) {
            //// FIXME: 2017/5/1 Issue #180
            nodeInfo.recycle();
        }
    }
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:9,代码来源:AccessibilityNodeInfoAllocator.java

示例6: onAccessibilityEvent

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
@Override
public void onAccessibilityEvent(AccessibilityService service, AccessibilityEvent event, StringBuilder sb) {
    AccessibilityNodeInfo source = event.getSource();
    if (source == null)
        return;
    String bounds = NodeInfo.boundsToString(AccessibilityNodeInfoHelper.getBoundsInScreen(source));
    source.recycle();
    onAccessibilityEvent(event, bounds, sb);
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:10,代码来源:AccessibilityActionConverter.java

示例7: getActionList

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private List<AccessibilityAction> getActionList() {
    if (mIcon == null || !(mIcon.getTag() instanceof ItemInfo)) {
        return Collections.EMPTY_LIST;
    }

    AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain();
    mDelegate.addSupportedActions(mIcon, info, true);
    List<AccessibilityAction> result = new ArrayList<>(info.getActionList());
    info.recycle();
    return result;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:12,代码来源:CustomActionsPopup.java

示例8: handleAlertDialog

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void handleAlertDialog(AccessibilityNodeInfo source) {
	AccessibilityNodeInfo okNodeInfo = null;
	okNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, OK_STRING_RES_NAME);
	if (okNodeInfo == null) {
		okNodeInfo = AppDetailsAutomatorUtil.findAccessibilityNodeInfo(source, mDlgOk);
	}
	if (okNodeInfo != null) {
		AppDetailsAutomatorUtil.checkVisibleToUserTimeOut(okNodeInfo);
		AppDetailsAutomatorUtil.performClickAction(okNodeInfo);
		AppDetailsAutomatorUtil.checkInvisibleToUserTimeOut(okNodeInfo);
		okNodeInfo.recycle();
	}
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:14,代码来源:AppDetailsAutomatorManager.java

示例9: handleAppDetail

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
private void handleAppDetail(AccessibilityNodeInfo source) {
	AccessibilityNodeInfo forceStopNodeInfo = null;
	forceStopNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, FORCE_STOP_STRING_RES_NAME);
	if (forceStopNodeInfo == null) {
		if (Utils.hasLollipop()) {
			forceStopNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, FORCE_STOP_STRING_RIGHT_BOTTON);
		} else {
			forceStopNodeInfo = AppDetailsAutomatorUtil.getAccessibilityNodeInfo(source, FORCE_STOP_STRING_LEFT_BOTTON);
		}
	}
	if (forceStopNodeInfo == null) {
		forceStopNodeInfo = AppDetailsAutomatorUtil.findAccessibilityNodeInfo(source, mForceStop);
	}
	if (forceStopNodeInfo == null) {
		forceStopNodeInfo = AppDetailsAutomatorUtil.findAccessibilityNodeInfo(source, mFinishApplication);
	}
	boolean performClick = false;
	if (forceStopNodeInfo != null) {
		AppDetailsAutomatorUtil.checkVisibleToUserTimeOut(forceStopNodeInfo);
		if (AppDetailsAutomatorUtil.isVisibleToUser(forceStopNodeInfo)) {
			AppDetailsAutomatorUtil.performClickAction(forceStopNodeInfo);
			performClick = true;
		}
		forceStopNodeInfo.recycle();
	}
	
	if (!performClick) {
		if (mPackageNames.isEmpty()) {
			source.performAction(AccessibilityService.GLOBAL_ACTION_BACK);
		}
		mHandler.sendEmptyMessage(MSG_PERFORM_STOP);
	}
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:34,代码来源:AppDetailsAutomatorManager.java

示例10: findAccessibilityNodeInfo

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
/***
 * Find a matched node by tracing the tree of nodes.
 * @param source
 * @param text
 * @return
 */
public static AccessibilityNodeInfo findAccessibilityNodeInfo(AccessibilityNodeInfo source, String text) {
	AccessibilityNodeInfo accessibilityNodeInfo = null;
	if (TextUtils.isEmpty(text)) {
		return accessibilityNodeInfo;
	}
	
	for (int i = 0; i < source.getChildCount(); i++) {
		AccessibilityNodeInfo compareNode = source.getChild(i);
		if (compareNode != null && compareNode.getText() != null) {

			LogUtils.LOGD(TAG, "(findAccessibilityNodeInfo) completeNode : " + compareNode.getClassName() + ", " + compareNode.getText());

			if (text.equals(compareNode.getText())) {
				LogUtils.LOGD(TAG, "(findAccessibilityNodeInfo) Find node : " + compareNode.getClassName() + ", " + compareNode.getText());
				accessibilityNodeInfo = compareNode;
			}
			if (accessibilityNodeInfo == null) {
				accessibilityNodeInfo = findAccessibilityNodeInfo(compareNode, text);
			}
			if (accessibilityNodeInfo == null) {
				compareNode.recycle();
			} else {
				break;
			}
		}
	}
	
	return accessibilityNodeInfo;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:36,代码来源:AppDetailsAutomatorUtil.java

示例11: recycle

import android.view.accessibility.AccessibilityNodeInfo; //导入方法依赖的package包/类
public void recycle(AccessibilityNodeInfo nodeInfo) {
    nodeInfo.recycle();
    mAccessibilityNodeInfoList.remove(nodeInfo);
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:5,代码来源:AccessibilityNodeInfoAllocator.java


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