Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

Photo Prints: tested on the KD-65X82L; no repeats in a set, no caption

Shivam Singh1775ac5aa74b
diff --git a/addons/README.md b/addons/README.md
index 1e989f826..451a1dbca 100644
--- a/addons/README.md
+++ b/addons/README.md
@@ -12,7 +12,7 @@ the core bigger or change how it behaves. You install an add-on only if you want
| [Frigate Glance](frigate-glance/) | Frigate camera pop-ups over whatever is playing | NickLD | TCL 65Q650G | overlay, accessibility (card keys), network, foreground service |
| [Capacity Stats](capacity-stats/) | Available/total and used/total RAM; available/total storage | [lionlev21](https://github.com/lionlev21) | Android TV 12 (model private) | None |
| [Weather](weather/) | The weather for one city: now, US air quality and the next three days, from Open-Meteo (no key) | [@Sumyabazar1](https://github.com/Sumyabazar1) | Hisense SmartTV 4K FFM (lushan), Google TV 12 | `INTERNET` |
-| [Photo Prints](photo-screensaver/) | Your own photos as a screensaver: dated prints dealt in on a time-of-day sky, and a card that starts the slideshow | [@shivamsingh262](https://github.com/shivamsingh262) | Sony BRAVIA KD-65X82L (Google TV 12), test pending | None |
+| [Photo Prints](photo-screensaver/) | Your own photos as a screensaver: dated prints dealt in on a time-of-day sky, and a card that starts the slideshow | [@shivamsingh262](https://github.com/shivamsingh262) | Sony BRAVIA KD-65X82L (Google TV 12) | None |
A widget, an info tile, a storage or smart-home card: if it can live as its own small app, it can live
here. See the rules below.
diff --git a/addons/photo-screensaver/README.md b/addons/photo-screensaver/README.md
index a94f5a4c4..06ccae9d0 100644
--- a/addons/photo-screensaver/README.md
+++ b/addons/photo-screensaver/README.md
@@ -10,7 +10,7 @@ once, and Back to leave.
- Package: `io.github.shivamsingh262.photoprints`
- Author: [@shivamsingh262](https://github.com/shivamsingh262)
-- Tested on: Sony BRAVIA KD-65X82L (Google TV 12), test pending
+- Tested on: Sony BRAVIA KD-65X82L (Google TV 12)
## Permissions
diff --git a/addons/photo-screensaver/app/src/main/java/io/github/shivamsingh262/photoprints/Prints.java b/addons/photo-screensaver/app/src/main/java/io/github/shivamsingh262/photoprints/Prints.java
index b75ee061a..3cb791fd3 100644
--- a/addons/photo-screensaver/app/src/main/java/io/github/shivamsingh262/photoprints/Prints.java
+++ b/addons/photo-screensaver/app/src/main/java/io/github/shivamsingh262/photoprints/Prints.java
@@ -18,8 +18,10 @@ import android.widget.TextView;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Random;
+import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -123,9 +125,10 @@ final class Prints {
if (l == null) return;
l.execute(() -> {
Print[] batch = new Print[PRINTS];
+ Set<File> used = new HashSet<>();
for (int i = 0; i < PRINTS; i++) {
try {
- batch[i] = nextPrint();
+ batch[i] = nextPrint(used);
} catch (OutOfMemoryError e) {
batch[i] = null;
}
@@ -141,15 +144,20 @@ final class Prints {
});
}
- /** Loader thread only (it owns the queue): the next photo in a shuffled round, decoded near its print size. */
- private Print nextPrint() {
+ /**
+ * Loader thread only (it owns the queue): the next photo in a shuffled round, decoded near its print size. A
+ * photo already in this set ({@code used}) is not dealt twice, so with fewer photos than prints some stay empty.
+ */
+ private Print nextPrint(Set<File> used) {
for (int tries = 0; tries < 4; tries++) {
if (queue.isEmpty()) {
queue.addAll(Photos.list(context));
+ queue.removeAll(used);
Collections.shuffle(queue, random);
}
if (queue.isEmpty()) return null;
File file = queue.remove(0);
+ if (!used.add(file)) continue;
int[] size = Photos.size(file);
if (size == null) continue;
int w, h;
diff --git a/addons/photo-screensaver/app/src/main/res/layout/print.xml b/addons/photo-screensaver/app/src/main/res/layout/print.xml
index 05fde4ff9..c094478cc 100644
--- a/addons/photo-screensaver/app/src/main/res/layout/print.xml
+++ b/addons/photo-screensaver/app/src/main/res/layout/print.xml
@@ -15,7 +15,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/print_card"
- android:elevation="16dp">
+ android:elevation="12dp">
<ImageView
android:id="@+id/printPhoto"
diff --git a/addons/photo-screensaver/app/src/main/res/values/dimens.xml b/addons/photo-screensaver/app/src/main/res/values/dimens.xml
index 4bcd74818..66fbedcee 100644
--- a/addons/photo-screensaver/app/src/main/res/values/dimens.xml
+++ b/addons/photo-screensaver/app/src/main/res/values/dimens.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- The clear margin around each print that its shadow is drawn into (print.xml). -->
- <dimen name="print_shadow_room">28dp</dimen>
+ <dimen name="print_shadow_room">56dp</dimen>
</resources>
diff --git a/addons/photo-screensaver/app/src/main/res/xml/module_card.xml b/addons/photo-screensaver/app/src/main/res/xml/module_card.xml
index 1b8d80614..e0336a787 100644
--- a/addons/photo-screensaver/app/src/main/res/xml/module_card.xml
+++ b/addons/photo-screensaver/app/src/main/res/xml/module_card.xml
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
-<card spec="1" label="Photo Prints" caption="Your photos" accent="#E8A33D" />
+<card spec="1" label="Photo Prints" accent="#E8A33D" />