1
0
mirror of http://galexander.org/git/simplesshd.git synced 2024-12-29 01:18: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,21 +134,22 @@ public class SimpleSSHD extends Activity
} }
} }
private static void run_on_ui(Runnable r) {
synchronized (lock) {
if (curr != null) {
curr.runOnUiThread(r);
}
}
}
public static void update_startstop() { public static void update_startstop() {
Thread t = new Thread() { run_on_ui(new Runnable() { public void run() {
public void run() {
synchronized (lock) { synchronized (lock) {
if (curr != null) { if (curr != null) {
curr.update_startstop_prime(); curr.update_startstop_prime();
} }
} }
} } });
};
synchronized (lock) {
if (curr != null) {
curr.runOnUiThread(t);
}
}
} }
public void startstop_clicked(View v) { public void startstop_clicked(View v) {
@ -199,20 +200,13 @@ public class SimpleSSHD extends Activity
} }
public static void update_log() { public static void update_log() {
Thread t = new Thread() { run_on_ui(new Runnable() { public void run() {
public void run() {
synchronized (lock) { synchronized (lock) {
if (curr != null) { if (curr != null) {
curr.update_log_prime(); curr.update_log_prime();
} }
} }
} } });
};
synchronized (lock) {
if (curr != null) {
curr.runOnUiThread(t);
}
}
} }
public static String get_ip(boolean pretty) { public static String get_ip(boolean pretty) {