setNode blocks => call it async (#604)

This commit is contained in:
m2049r 2019-06-18 08:49:51 +02:00 committed by GitHub
parent f7cef24a83
commit 4349907627
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -439,18 +439,20 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
}
Collections.sort(nodesToTest, NodeInfo.BestNodeComparator);
NodeInfo bestNode = nodesToTest.get(0);
if (bestNode.isValid())
if (bestNode.isValid()) {
activityCallback.setNode(bestNode);
return bestNode;
else
} else {
activityCallback.setNode(null);
return null;
}
}
@Override
protected void onPostExecute(NodeInfo result) {
if (!isAdded()) return;
pbNode.setVisibility(View.INVISIBLE);
llNode.setVisibility(View.VISIBLE);
activityCallback.setNode(result);
if (result != null) {
Timber.d("found a good node %s", result.toString());
showNode(result);