本文整理汇总了Java中android.view.accessibility.AccessibilityEvent.getItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityEvent.getItemCount方法的具体用法?Java AccessibilityEvent.getItemCount怎么用?Java AccessibilityEvent.getItemCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.accessibility.AccessibilityEvent
的用法示例。
在下文中一共展示了AccessibilityEvent.getItemCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: robNewRedMoney
import android.view.accessibility.AccessibilityEvent; //导入方法依赖的package包/类
/**
* 抢新发的红包
*
* @param event
*/
private void robNewRedMoney(AccessibilityEvent event) {
AccessibilityNodeInfo root = getRootInActiveWindow();
if (root == null) {
return;
}
if (WechatVersionUtils.canFindViewById(context) && WechatVersionUtils.canRobWechatVersion(context)) {
List<AccessibilityNodeInfo> exitNodeInfos = root.findAccessibilityNodeInfosByViewId(WechatVersionUtils.getWechatExitId(context));
if (exitNodeInfos != null && exitNodeInfos.size() > 0) {
// 是聊天界面
List<AccessibilityNodeInfo> wechatList = root.findAccessibilityNodeInfosByViewId(WechatVersionUtils.getWechatListId(context));
if (wechatList != null && wechatList.size() > 0) {
AccessibilityNodeInfo accessibilityNodeInfo = wechatList.get(0);
int itemCount = event.getItemCount();
int oldCount = sharedPerferenceUtil.getInteger(Constant.WECHAT_UI_LIST_COUNT, itemCount);
S(itemCount+" "+oldCount);
sharedPerferenceUtil.putInteger(Constant.WECHAT_UI_LIST_COUNT, itemCount);
int i = itemCount - oldCount;
if (i <= 0) {
return;
}
S("走到这里咯啊吗?11111");
AccessibilityNodeInfo nodeInfo = accessibilityNodeInfo.getChild(accessibilityNodeInfo.getChildCount() - 3);
if (nodeInfo == null) {
return;
}
S("走到这里咯啊吗?2222");
List<AccessibilityNodeInfo> getRedMoneyList = nodeInfo.findAccessibilityNodeInfosByViewId(WechatVersionUtils.getWechatGetRedMoneyId(context));
if (getRedMoneyList != null && getRedMoneyList.size() > 0) {
try {
isNotDO = false;
S("走到这里咯啊吗?3333");
WeChatUIRobRedMoney(root);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}