1
0
mirror of http://galexander.org/git/simplesshd.git synced 2024-12-28 17:08:08 +00:00

runOnUiThread() wants a Runnable, not a Thread, but i don't think it

matters.  anyways, re-factored while i was there.
This commit is contained in:
Greg Alexander 2018-05-19 18:33:47 -04:00
parent f1c8faad21
commit c4e32e3ddc

View File

@ -134,23 +134,24 @@ public class SimpleSSHD extends Activity
}
}
public static void update_startstop() {
Thread t = new Thread() {
public void run() {
synchronized (lock) {
if (curr != null) {
curr.update_startstop_prime();
}
}
}
};
private static void run_on_ui(Runnable r) {
synchronized (lock) {
if (curr != null) {
curr.runOnUiThread(t);
curr.runOnUiThread(r);
}
}
}
public static void update_startstop() {
run_on_ui(new Runnable() { public void run() {
synchronized (lock) {
if (curr != null) {
curr.update_startstop_prime();
}
}
} });
}
public void startstop_clicked(View v) {
boolean already_started = SimpleSSHDService.is_started();
Intent i = new Intent(this, SimpleSSHDService.class);
@ -199,20 +200,13 @@ public class SimpleSSHD extends Activity
}
public static void update_log() {
Thread t = new Thread() {
public void run() {
synchronized (lock) {
if (curr != null) {
curr.update_log_prime();
}
run_on_ui(new Runnable() { public void run() {
synchronized (lock) {
if (curr != null) {
curr.update_log_prime();
}
}
};
synchronized (lock) {
if (curr != null) {
curr.runOnUiThread(t);
}
}
} });
}
public static String get_ip(boolean pretty) {