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:
parent
f1c8faad21
commit
c4e32e3ddc
@ -134,23 +134,24 @@ public class SimpleSSHD extends Activity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void update_startstop() {
|
private static void run_on_ui(Runnable r) {
|
||||||
Thread t = new Thread() {
|
|
||||||
public void run() {
|
|
||||||
synchronized (lock) {
|
|
||||||
if (curr != null) {
|
|
||||||
curr.update_startstop_prime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (curr != null) {
|
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) {
|
public void startstop_clicked(View v) {
|
||||||
boolean already_started = SimpleSSHDService.is_started();
|
boolean already_started = SimpleSSHDService.is_started();
|
||||||
Intent i = new Intent(this, SimpleSSHDService.class);
|
Intent i = new Intent(this, SimpleSSHDService.class);
|
||||||
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user