diff --git a/src/android/com/unprompted/tildefriends/MainActivity.java b/src/android/com/unprompted/tildefriends/MainActivity.java
index 3174c36f..c5376989 100644
--- a/src/android/com/unprompted/tildefriends/MainActivity.java
+++ b/src/android/com/unprompted/tildefriends/MainActivity.java
@@ -20,6 +20,7 @@ import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
+import android.widget.TextView;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
@@ -54,11 +55,14 @@ public class MainActivity extends Activity {
setContentView(R.layout.activity_main);
web_view = (WebView)findViewById(R.id.web);
+ set_status("Extracting executable...");
Log.w("tildefriends", String.format("getFilesDir() is %s", getFilesDir().toString()));
Log.w("tildefriends", String.format("getPackageResourcePath() is %s", getPackageResourcePath().toString()));
if (!extract_executable()) {
Log.w("tildefriends", "Failed to extract a compatible executable.");
+ set_status("No compatible ABI found.");
+ return;
}
String port_file_path = getFilesDir().toString() + "/port.txt";
@@ -84,9 +88,14 @@ public class MainActivity extends Activity {
if (port >= 0) {
base_url = "http://127.0.0.1:" + String.valueOf(port) + "/";
activity.runOnUiThread(() -> {
+ activity.hide_status();
web_view.loadUrl(base_url);
});
break;
+ } else {
+ activity.runOnUiThread(() -> {
+ activity.set_status("Waiting to connect...");
+ });
}
}
}
@@ -104,6 +113,7 @@ public class MainActivity extends Activity {
});
thread.start();
+ set_status("Starting server...");
String exe = getFilesDir().toString() + "/tildefriends";
ProcessBuilder builder = new ProcessBuilder(exe, "run", "-z", getPackageResourcePath().toString(), "-a", "out_http_port_file=" + port_file_path, "-p", "0");
Log.w("tildefriends", "files = " + getFilesDir().toString());
@@ -261,4 +271,17 @@ public class MainActivity extends Activity {
}
return -1;
}
+
+ private void set_status(String text) {
+ TextView text_view = (TextView)findViewById(R.id.text);
+ web_view.setVisibility(View.GONE);
+ text_view.setVisibility(View.VISIBLE);
+ text_view.setText(text);
+ }
+
+ private void hide_status() {
+ TextView text_view = (TextView)findViewById(R.id.text);
+ web_view.setVisibility(View.VISIBLE);
+ text_view.setVisibility(View.GONE);
+ }
}
diff --git a/src/android/res/layout/activity_main.xml b/src/android/res/layout/activity_main.xml
index d4251cc9..d1eb6b73 100644
--- a/src/android/res/layout/activity_main.xml
+++ b/src/android/res/layout/activity_main.xml
@@ -5,10 +5,14 @@
android:layout_height="match_parent"
android:orientation="vertical">
+
-
+ android:gravity="center_horizontal|center_vertical"/>