From 1e159b20e6e6f1b69ebdde5e993fa3b695779073 Mon Sep 17 00:00:00 2001 From: Daniel C Date: Thu, 31 Oct 2024 23:10:21 -0400 Subject: [PATCH] Fix gallery intent https://stackoverflow.com/questions/2954594/launching-intent-action-view-intent-not-working-on-saved-image-file --- android/app/src/main/java/dev/danielc/fujiapp/Backend.java | 1 + .../app/src/main/java/dev/danielc/fujiapp/FileThumbAdapter.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/dev/danielc/fujiapp/Backend.java b/android/app/src/main/java/dev/danielc/fujiapp/Backend.java index 2019585..bd1425a 100644 --- a/android/app/src/main/java/dev/danielc/fujiapp/Backend.java +++ b/android/app/src/main/java/dev/danielc/fujiapp/Backend.java @@ -105,6 +105,7 @@ public static void init() { static Thread discoveryThread = null; public static void discoveryThread(Context ctx) { + // Not the greatest thread safety here if (discoveryThread != null) { Log.d("backend", "Discovery thread already running"); return; diff --git a/android/app/src/main/java/dev/danielc/fujiapp/FileThumbAdapter.java b/android/app/src/main/java/dev/danielc/fujiapp/FileThumbAdapter.java index 8ddb4c7..d539fee 100644 --- a/android/app/src/main/java/dev/danielc/fujiapp/FileThumbAdapter.java +++ b/android/app/src/main/java/dev/danielc/fujiapp/FileThumbAdapter.java @@ -24,7 +24,7 @@ public FileThumbAdapter(Context context, String directory) { public void imageClickHandler(ImageViewHolder holder) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); - intent.setDataAndType(Uri.parse(holder.filename), "image/*"); + intent.setDataAndType(Uri.parse("file://" + holder.filename), "image/*"); holder.image.getContext().startActivity(intent); }