diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-22 11:11:41 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-22 11:11:41 +0200 |
| commit | c222cb8e784d65f17ac29433fe51cd4c56e1b261 (patch) | |
| tree | 3bb8e0133dc6757bed1a42f65a0110a67592f9c4 /app/src/main/java/mygram/droid/Playlist.java | |
| parent | 324b600f5795735c74eae81a27beb4953f40653e (diff) | |
| download | mygram-droid-c222cb8e784d65f17ac29433fe51cd4c56e1b261.tar.gz mygram-droid-c222cb8e784d65f17ac29433fe51cd4c56e1b261.zip | |
Add Foldergram API client, likes set and playlist hand-off
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'app/src/main/java/mygram/droid/Playlist.java')
| -rw-r--r-- | app/src/main/java/mygram/droid/Playlist.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/app/src/main/java/mygram/droid/Playlist.java b/app/src/main/java/mygram/droid/Playlist.java new file mode 100644 index 0000000..98379fb --- /dev/null +++ b/app/src/main/java/mygram/droid/Playlist.java @@ -0,0 +1,49 @@ +/* + * mygram-droid: Android TV client for Foldergram. + * Copyright (C) 2026 Danilo M. <danix@danix.xyz> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + */ + +package mygram.droid; + +import android.content.Context; +import android.content.Intent; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; + +/** Hands a post list to ViewerActivity; intents cannot carry hundreds of posts. */ +final class Playlist { + static List<Post> posts = new ArrayList<>(); + static int start; + /** Non-zero while the viewer plays endless Reels and pages for more. */ + static int reelsSeed; + static int reelsPage; + + private Playlist() { + } + + static void open(Context c, List<Post> list, int startIndex) { + posts = new ArrayList<>(list); + start = startIndex; + reelsSeed = 0; + c.startActivity(new Intent(c, ViewerActivity.class)); + } + + static void openReels(Context c) { + posts = new ArrayList<>(); + start = 0; + reelsSeed = 1 + ThreadLocalRandom.current().nextInt(1_000_000); + reelsPage = 0; + c.startActivity(new Intent(c, ViewerActivity.class)); + } +} |
