暫定実装
This commit is contained in:
parent
ac29832038
commit
efec0512d2
|
@ -30,8 +30,6 @@ public class RewardDataImpl implements RewardData {
|
|||
|
||||
@Override
|
||||
public CompletableFuture<Integer> getTotalReward(String childId) {
|
||||
return CompletableFuture.supplyAsync(() -> {
|
||||
return ksActions.syncHistory(childId).join().stream().mapToInt(HistoryModel::getReward).sum();
|
||||
});
|
||||
return CompletableFuture.supplyAsync(() -> ksActions.syncHistory(childId).join().stream().mapToInt(HistoryModel::getReward).sum());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,10 +64,17 @@ public class WalletContentFragment extends Fragment {
|
|||
|
||||
private void updateTotalReward() {
|
||||
rewardData.getTotalReward(childId).thenAccept(totalReward -> {
|
||||
logger.debug("Total reward: " + totalReward);
|
||||
totalRewardTextView.setText(String.valueOf(totalReward));
|
||||
}).exceptionally(throwable -> {
|
||||
logger.error("Failed to get total reward: " + throwable.getMessage());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateTotalReward();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user