mirror of
https://codeberg.org/r4v3r23/mysu.git
synced 2024-11-09 23:50:02 +00:00
add null check and display custom nodes first
This commit is contained in:
parent
4657132067
commit
e197cc038d
1 changed files with 6 additions and 4 deletions
|
@ -58,21 +58,23 @@ public class NodeSelectionBottomSheetDialog extends BottomSheetDialogFragment im
|
|||
dismiss();
|
||||
});
|
||||
|
||||
for(DefaultNodes defaultNode : DefaultNodes.values()) {
|
||||
nodes.add(Node.fromString(defaultNode.getUri()));
|
||||
}
|
||||
try {
|
||||
String nodesArray = PrefService.getInstance().getString(Constants.PREF_CUSTOM_NODES, "[]");
|
||||
JSONArray jsonArray = new JSONArray(nodesArray);
|
||||
for(int i = 0; i < jsonArray.length(); i++) {
|
||||
String nodeString = jsonArray.getString(i);
|
||||
Node node = Node.fromString(nodeString);
|
||||
nodes.add(node);
|
||||
if(node != null) {
|
||||
nodes.add(node);
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for(DefaultNodes defaultNode : DefaultNodes.values()) {
|
||||
nodes.add(Node.fromString(defaultNode.getUri()));
|
||||
}
|
||||
adapter.submitList(nodes);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue