Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Merge with Github stable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhongyi Tong committed Jan 16, 2016
1 parent 1ef6e67 commit 26b8f90
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions app/src/main/java/com/miui/hongbao/HongbaoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@


public class HongbaoService extends AccessibilityService {
private List<AccessibilityNodeInfo> mReceiveNode;
private AccessibilityNodeInfo mUnpackNode;
private AccessibilityNodeInfo mReceiveNode, mUnpackNode;

private boolean mLuckyMoneyPicked, mLuckyMoneyReceived, mNeedUnpack, mNeedBack;

Expand Down Expand Up @@ -75,25 +74,22 @@ public void onAccessibilityEvent(AccessibilityEvent event) {

/* 如果已经接收到红包并且还没有戳开 */
if (mLuckyMoneyReceived && !mLuckyMoneyPicked && (mReceiveNode != null)) {
int size = mReceiveNode.size();
if (size > 0) {
String id = getHongbaoText(mReceiveNode.get(size - 1));
String id = getHongbaoText(mReceiveNode);

long now = System.currentTimeMillis();
long now = System.currentTimeMillis();

if (this.shouldReturn(id, now - lastFetchedTime))
return;
if (this.shouldReturn(id, now - lastFetchedTime))
return;

mCycle = true;
mCycle = true;

lastFetchedHongbaoId = id;
lastFetchedTime = now;
lastFetchedHongbaoId = id;
lastFetchedTime = now;

AccessibilityNodeInfo cellNode = mReceiveNode.get(size - 1);
cellNode.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK);
mLuckyMoneyReceived = false;
mLuckyMoneyPicked = true;
}
AccessibilityNodeInfo cellNode = mReceiveNode;
cellNode.getParent().performAction(AccessibilityNodeInfo.ACTION_CLICK);
mLuckyMoneyReceived = false;
mLuckyMoneyPicked = true;
}
/* 如果戳开但还未领取 */
if (mNeedUnpack && (mUnpackNode != null)) {
Expand Down Expand Up @@ -130,7 +126,7 @@ private void checkNodeInfo() {
String nodeId = Integer.toHexString(System.identityHashCode(this.rootNodeInfo));
if (!nodeId.equals(lastFetchedHongbaoId)) {
mLuckyMoneyReceived = true;
mReceiveNode = nodes1;
mReceiveNode = nodes1.get(nodes1.size() - 1);
}
return;
}
Expand Down

0 comments on commit 26b8f90

Please sign in to comment.