forked from cory/tildefriends
A little more paranoia around the file watcher.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4427 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
e223d35252
commit
060f1980f5
@ -105,10 +105,13 @@ public class MainActivity extends Activity {
|
|||||||
for (WatchEvent event : key.pollEvents()) {
|
for (WatchEvent event : key.pollEvents()) {
|
||||||
if (event.context().toString().equals("port.txt")) {
|
if (event.context().toString().equals("port.txt")) {
|
||||||
Log.w("tildefriends", "Observed file write: " + event.context().toString());
|
Log.w("tildefriends", "Observed file write: " + event.context().toString());
|
||||||
base_url = "http://127.0.0.1:" + String.valueOf(read_port(port_file_path)) + "/";
|
int port = read_port(port_file_path);
|
||||||
activity.runOnUiThread(() -> {
|
if (port >= 0) {
|
||||||
web_view.loadUrl(base_url);
|
base_url = "http://127.0.0.1:" + String.valueOf(port) + "/";
|
||||||
});
|
activity.runOnUiThread(() -> {
|
||||||
|
web_view.loadUrl(base_url);
|
||||||
|
});
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user