don't include "IP: " in notification string

sigsegv_dump
Greg Alexander 8 years ago
parent 4134decdc3
commit bf8c204a8c

@ -49,7 +49,7 @@ public class SimpleSSHD extends Activity
update_startstop_prime(); update_startstop_prime();
updater = new UpdaterThread(); updater = new UpdaterThread();
updater.start(); updater.start();
ip_view.setText(get_ip()); ip_view.setText(get_ip(true));
if (Prefs.get_onopen() && !SimpleSSHDService.is_started()) { if (Prefs.get_onopen() && !SimpleSSHDService.is_started()) {
startService(new Intent(this, SimpleSSHDService.class)); startService(new Intent(this, SimpleSSHDService.class));
@ -195,7 +195,7 @@ public class SimpleSSHD extends Activity
} }
} }
public static String get_ip() { public static String get_ip(boolean pretty) {
String ret = ""; String ret = "";
try { try {
List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces()); List<NetworkInterface> interfaces = Collections.list(NetworkInterface.getNetworkInterfaces());
@ -209,10 +209,14 @@ public class SimpleSSHD extends Activity
if (i != -1) { if (i != -1) {
ip = ip.substring(0,i); ip = ip.substring(0,i);
} }
if (!ret.equals("")) { if (pretty) {
ret += "\n"; if (!ret.equals("")) {
ret += "\n";
}
ret += "IP: "+ ip;
} else {
return ip;
} }
ret += "IP: "+ ip;
} }
} }
} }

@ -74,8 +74,9 @@ public class SimpleSSHDService extends Service {
n.contentView.setImageViewResource(R.id.n_icon, n.contentView.setImageViewResource(R.id.n_icon,
R.drawable.icon); R.drawable.icon);
n.contentView.setTextViewText(R.id.n_text, n.contentView.setTextViewText(R.id.n_text,
"SimpleSSHD listening on "+SimpleSSHD.get_ip()+ "SimpleSSHD listening on " +
":"+Prefs.get_port()); SimpleSSHD.get_ip(false) +
":" + Prefs.get_port());
startForeground(1, n); startForeground(1, n);
} }

Loading…
Cancel
Save