From 899b1d9812c61a33554b67e3026850684e686ce1 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 22 Oct 2026 12:27:34 +0200 Subject: Splash gates the app while Foldergram indexes Foldergram is unusably slow during a scan, so the splash (renamed from LockActivity) now shows on every start and return to the app: PIN if set, then it polls /api/scan-progress every 5 s and stays on "Library is indexing" until the scan ends. Home connects only after the splash. Builds and deploys; the indexing path is not yet tested on the TV. Co-Authored-By: Claude Opus 5.5 --- app/src/main/java/mygram/droid/MainActivity.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'app/src/main/java/mygram/droid/MainActivity.java') diff --git a/app/src/main/java/mygram/droid/MainActivity.java b/app/src/main/java/mygram/droid/MainActivity.java index 877f180..7c7f194 100644 --- a/app/src/main/java/mygram/droid/MainActivity.java +++ b/app/src/main/java/mygram/droid/MainActivity.java @@ -59,7 +59,7 @@ public final class MainActivity extends Activity { private RecyclerView homeList; private HomeRows homeRows; private int tab = HOME; - private boolean ready, resumed, homeLoading; + private boolean ready, resumed, homeLoading, connecting; private LinearLayout homeButton, likedButton, foldersButton; @Override @@ -90,7 +90,7 @@ public final class MainActivity extends Activity { column.addView(content, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1)); root.addView(column, FILL); setContentView(root); - connect(); + // connect() runs from onResume once the splash has let the user in. } /** [logo] [Reels] [Liked] [Folders] [Settings]; the current view is marked. */ @@ -114,13 +114,17 @@ public final class MainActivity extends Activity { } private void connect() { + if (connecting) + return; message("Connecting…"); + connecting = true; Api.async(() -> { if (!Prefs.password().isEmpty()) Api.login(Prefs.server(), Prefs.password()); Likes.load(); return Api.randomFeed(); }, posts -> { + connecting = false; if (isDestroyed()) return; ready = true; @@ -129,6 +133,7 @@ public final class MainActivity extends Activity { rotateBackground(); show(tab); }, e -> { + connecting = false; if (!isDestroyed()) failed(e); }); @@ -205,8 +210,11 @@ public final class MainActivity extends Activity { protected void onResume() { super.onResume(); resumed = true; - if (!ready) + if (!ready) { + if (!connecting && !App.locked) + connect(); // also retries after an error, e.g. back from Settings return; + } handler.removeCallbacks(rotate); handler.postDelayed(rotate, Prefs.backgroundSeconds() * 1000L); if (tab == LIKED) -- cgit v1.2.3