Android wechat red envelope plug-in
•
Java
Here is the programming house jb51 CC collects and arranges code fragments through the network.
Programming house Xiaobian now shares it with you and gives you a reference.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN) private void handleWindowChange(AccessibilityNodeInfo nodeInfo) { switch (Stage.getInstance().getCurrentStage()) { case Stage.opening_STAGE: // 调试信息,打印TTL // Log.d("TTL",String.valueOf(ttl)); /* 如果打开红包失败且还没到达最大尝试次数,重试 */ if (openHongbao(nodeInfo) == -1 && ttl < MAX_TTL) return; ttl = 0; Stage.getInstance().entering(Stage.FETCHED_STAGE); performMyGlobalAction(GLOBAL_ACTION_BACK); if (nodesToFetch.size() == 0) handleWindowChange(nodeInfo); break; case Stage.OPENED_STAGE: ListsuccessNodes = nodeInfo.findAccessibilityNodeInfosByText("红包详情"); if (successNodes.isEmpty() && ttl < MAX_TTL) { ttl += 1; return; } ttl = 0; Stage.getInstance().entering(Stage.FETCHED_STAGE); performMyGlobalAction(GLOBAL_ACTION_BACK); break; case Stage.FETCHED_STAGE: /* 先消灭待抢红包队列中的红包 */ if (nodesToFetch.size() > 0) { /* 从最下面的红包开始戳 */ AccessibilityNodeInfo node = nodesToFetch.remove(nodesToFetch.size() - 1); if (node.getParent() != null) { String id = getHongbaoHash(node); if (id == null) return; fetchedIdentifiers.add(id); // 调试信息,在每次打开红包后打印出已经获取的红包 // Log.d("fetched",Arrays.toString(fetchedIdentifiers.toArray())); Stage.getInstance().entering(Stage.opening_STAGE); node.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK); } return; } Stage.getInstance().entering(Stage.FETCHING_STAGE); fetchHongbao(nodeInfo); Stage.getInstance().entering(Stage.FETCHED_STAGE); break; } }
The above is all the code content collected by the programming home (jb51. CC). I hope this article can help you solve the program development problems you encounter.
If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码