@Override public void onBindViewHolder(final PeerViewHolder holder, final int position) { final Peer peer = getItem(position); final VersionMessage versionMessage = peer.getPeerVersionMessage(); final boolean isDownloading = peer.isDownloadData(); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); holder.ipView.setText(hostname != null ? hostname : address.getHostAddress()); final long bestHeight = peer.getBestHeight(); holder.heightView.setText(bestHeight > 0 ? bestHeight + " blocks" : null); holder.heightView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); holder.versionView.setText(versionMessage.subVer); holder.versionView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); holder.protocolView.setText("protocol: " + versionMessage.clientVersion); holder.protocolView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final long pingTime = peer.getPingTime(); holder.pingView .setText(pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); holder.pingView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); }
@Override public void onBindViewHolder(final PeerViewHolder holder, final int position) { final Peer peer = getItem(position); final VersionMessage versionMessage = peer.getPeerVersionMessage(); final boolean isDownloading = peer.getDownloadData(); final InetAddress address = peer.getAddress().getAddr(); final String hostname = hostnames.get(address); holder.ipView.setText(hostname != null ? hostname : address.getHostAddress()); final long bestHeight = peer.getBestHeight(); holder.heightView.setText(bestHeight > 0 ? bestHeight + " blocks" : null); holder.heightView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); holder.versionView.setText(versionMessage.subVer); holder.versionView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); holder.protocolView.setText("protocol: " + versionMessage.clientVersion); holder.protocolView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); final long pingTime = peer.getPingTime(); holder.pingView.setText(pingTime < Long.MAX_VALUE ? getString(R.string.peer_list_row_ping_time, pingTime) : null); holder.pingView.setTypeface(isDownloading ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); }
@Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.preference_about); findPreference(KEY_ABOUT_VERSION).setSummary(application.packageInfo().versionName); Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(Constants.MARKET_APP_URL, activity.getPackageName()))); if (packageManager.resolveActivity(marketIntent, 0) == null) marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(String.format(Constants.WEBMARKET_APP_URL, activity.getPackageName()))); findPreference(KEY_ABOUT_MARKET_APP).setIntent(marketIntent); findPreference(KEY_ABOUT_CREDITS_BITCOINJ).setTitle(getString(R.string.about_credits_bitcoinj_title, VersionMessage.BITCOINJ_VERSION)); }
public static String httpUserAgent(final String versionName) { final VersionMessage versionMessage = new VersionMessage(Constants.NETWORK_PARAMETERS, 0); versionMessage.appendToSubVer(Constants.USER_AGENT, versionName, null); return versionMessage.subVer; }