use of run.wallet.iota.model.NodeInfo 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);
}
}
}
use of run.wallet.iota.model.NodeInfo in project run-wallet-android by runplay.
the class NodeInfoListAdapter method getView.
@NonNull
@Override
public View getView(int position, View view, @NonNull ViewGroup parent) {
ViewHolderItem viewHolder;
if (view == null) {
view = inflator.inflate(R.layout.item_node_info, parent, false);
viewHolder = new ViewHolderItem(view);
view.setTag(viewHolder);
} else {
viewHolder = (ViewHolderItem) view.getTag();
}
NodeInfo nodeInfo = getItem(position);
if (nodeInfo != null) {
if (viewHolder.label != null) {
viewHolder.label.setText(nodeInfo.getParam());
}
if (viewHolder.value != null) {
if (nodeInfo.getValue() != null)
viewHolder.value.setText(nodeInfo.getValue());
else
viewHolder.value.setText(String.valueOf(nodeInfo.getIndex()));
}
}
return view;
}
Aggregations