use of run.wallet.iota.ui.adapter.NodeInfoListAdapter in project run-wallet-android by runplay.
the class NetworkNodeInfoFragment method setAdapter.
private void setAdapter() {
NodeInfoResponse nir = Store.getNodeInfo();
Activity activity = getActivity();
if (activity != null && nir != null) {
swipeRefreshLayout.setRefreshing(false);
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.getDefault());
nodeInfos = new ArrayList<>();
nodeInfos.add(new NodeInfo(activity.getString(R.string.info_app_name), nir.getAppName()));
nodeInfos.add(new NodeInfo(getString(R.string.info_app_version), nir.getAppVersion()));
nodeInfos.add(new NodeInfo(getString(R.string.info_jre_version), nir.getJreVersion()));
nodeInfos.add(new NodeInfo(getString(R.string.info_max_processors), nir.getJreAvailableProcessors() + ""));
nodeInfos.add(new NodeInfo(getString(R.string.info_free_memory), Formatter.formatShortFileSize(getActivity(), nir.getJreFreeMemory())));
nodeInfos.add(new NodeInfo(getString(R.string.info_max_memory), Formatter.formatShortFileSize(getActivity(), nir.getJreMaxMemory())));
nodeInfos.add(new NodeInfo(getString(R.string.info_total_memory), Formatter.formatShortFileSize(getActivity(), nir.getJreTotalMemory())));
nodeInfos.add(new NodeInfo(getString(R.string.info_latest_milestone), nir.getLatestMilestone()));
nodeInfos.add(new NodeInfo(getString(R.string.info_latest_milestone_index), nir.getLatestMilestoneIndex()));
nodeInfos.add(new NodeInfo(getString(R.string.info_latest_milestone_solid_subtangle), nir.getLatestSolidSubtangleMilestone()));
nodeInfos.add(new NodeInfo(getString(R.string.info_latest_milestone_solid_subtangle_index), nir.getLatestSolidSubtangleMilestoneIndex()));
nodeInfos.add(new NodeInfo(getString(R.string.info_neighbors), nir.getNeighbors()));
nodeInfos.add(new NodeInfo(getString(R.string.info_packets_queue_size), nir.getPacketsQueueSize()));
nodeInfos.add(new NodeInfo(getString(R.string.info_time), df.format(new Date(nir.getTime()))));
nodeInfos.add(new NodeInfo(getString(R.string.info_tips), nir.getTips()));
nodeInfos.add(new NodeInfo(getString(R.string.info_transactions_to_request), nir.getTransactionsToRequest()));
updateChart(nir.getTips(), nir.getTransactionsToRequest());
NodeInfoListAdapter nodeInfoListAdapter = new NodeInfoListAdapter(getActivity(), R.layout.item_node_info, nodeInfos);
Utils.fixListView(list, swipeRefreshLayout);
list.setAdapter(nodeInfoListAdapter);
nodeAddress.setText(Store.getNode().getName());
if (nir.isSyncOk()) {
nodeActive.setImageResource(R.drawable.node_tick_grey);
} else {
nodeActive.setImageResource(R.drawable.indicator_offline);
}
}
}
Aggregations