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,10 +439,13 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
} }
Collections.sort(nodesToTest, NodeInfo.BestNodeComparator); Collections.sort(nodesToTest, NodeInfo.BestNodeComparator);
NodeInfo bestNode = nodesToTest.get(0); NodeInfo bestNode = nodesToTest.get(0);
if (bestNode.isValid()) if (bestNode.isValid()) {
activityCallback.setNode(bestNode);
return bestNode; return bestNode;
else } else {
activityCallback.setNode(null);
return null; return null;
}
} }
@Override @Override
@ -450,7 +453,6 @@ public class LoginFragment extends Fragment implements WalletInfoAdapter.OnInter
if (!isAdded()) return; if (!isAdded()) return;
pbNode.setVisibility(View.INVISIBLE); pbNode.setVisibility(View.INVISIBLE);
llNode.setVisibility(View.VISIBLE); llNode.setVisibility(View.VISIBLE);
activityCallback.setNode(result);
if (result != null) { if (result != null) {
Timber.d("found a good node %s", result.toString()); Timber.d("found a good node %s", result.toString());
showNode(result); showNode(result);