Skip to content

Commit

Permalink
修改hasMore逻辑,当助收不为0时再收取一次
Browse files Browse the repository at this point in the history
  • Loading branch information
pansong291 committed May 25, 2019
1 parent c7818ef commit e416970
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('/storage/emulated/0/AppLibrarys/xposed_api_82_dis.jar')
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public static void autoGetCanCollectUserIdList(final ClassLoader loader, String
return;
}/**/
// 开始解析好友信息,循环把所有有能量的好友信息都解析完
boolean isSucc = parseFrienRankPageDataResponse(response);
if (isSucc)
boolean hasMore = parseFrienRankPageDataResponse(response);
if (hasMore)
{
showDialog("开始获取可以收取能量的好友信息...", "");
new Thread(new Runnable() {
Expand All @@ -54,7 +54,6 @@ public void run()
}).start();
} else
{
pageCount = 0;
Log.i(TAG, "friendsRankUseridList " + friendsRankUseridList);
//如果发现已经解析完成了,如果有好友能量收取,就开始收取
if (friendsRankUseridList.size() > 0)
Expand All @@ -66,10 +65,15 @@ public void run()
rpcCall_CanCollectEnergy(loader, userId);
}
showDialog("共偷取能量【" + collectedEnergy + "克】,共帮收能量【" + helpCollectedEnergy + "克】\n", "");
Log.i(TAG, "能量收取结束");
friendsRankUseridList.clear();
pageCount = 0;
collectedEnergy = 0;
helpCollectedEnergy = 0;
Log.i(TAG, "能量收取结束");
if(helpCollectedEnergy != 0)
{
helpCollectedEnergy = 0;
autoGetCanCollectUserIdList(loader, null);
}
}else
{
showDialog("暂时没有可收取的能量\n", "");
Expand Down Expand Up @@ -155,11 +159,9 @@ private static boolean parseFrienRankPageDataResponse(String response)
{
try
{
JSONArray optJSONArray = new JSONObject(response).optJSONArray("friendRanking");
if (optJSONArray == null || optJSONArray.length() == 0)
{
return false;
} else
JSONObject jo = new JSONObject(response);
JSONArray optJSONArray = jo.optJSONArray("friendRanking");
if (optJSONArray != null)
{
for (int i = 0; i < optJSONArray.length(); i++)
{
Expand All @@ -172,6 +174,9 @@ private static boolean parseFrienRankPageDataResponse(String response)
friendsRankUseridList.add(userId);
}
}
if(optJSONArray.length() == 0)
return false;
return jo.optBoolean("hasMore");
}
} catch (Exception e)
{
Expand Down

0 comments on commit e416970

Please sign in to comment.