KidsTube: mixed "All" pill, example clips removed

- The "All" pill shows a shuffled mix across folders instead of walking through
  one series after another; a folder pill still keeps its numeric order.
- The five generated example clips (kinderlied, rennauto, traktor, elefant,
  giraffe) are gone from the device, their MediaStore rows with them, and the
  now-empty Autos/Tiere folders were removed.

Two lessons paid for during the cleanup, now in AGENTS.md:
- content delete on a media row deletes the file too. A broad name pattern took
  seven real videos; they were restored from the host copies, renamed to ASCII
  (fullwidth | and : prevented indexing even though the scan broadcast reported
  success) and re-indexed.
- The tablet's USB link drops every minute or two, so the session now runs over
  adb tcpip 5555 / adb connect <ip>:5555.

Verified on the device: 287 media rows (292 minus the five examples), no example
names left, first grid row mixes six different folders.
This commit is contained in:
lotherk committed 2026-10-28 18:20:08 +00:00
1 parent c4b29e5053
commit cab9c9b1e2
2 files changed
+18 -2

No files matched your search

+11 -1
View File
@@ -75,7 +75,8 @@ Mandatory: from API 29 scoped storage forbids directory listing (the app uid get
`filesDir/thumbs`, `LruCache` in memory, 3 threads, tag-guarded callback.
- `ui/TileView` — one view draws the whole tile: rounded 16:9 bitmap, duration
pill top-right, two-line title over a bottom scrim, heart when liked.
- `ui/MainActivity` — pills, grid, tabs, parent gate. `ui/TileSpacing` centres a
- `ui/MainActivity` — pills, grid, tabs, parent gate. The "All" pill shows a
shuffled mix across folders; a folder pill keeps that series in numeric order. `ui/TileSpacing` centres a
tile in its cell. Tiles are sized from the **home grid** height, one value
shared by both lists.
- `ui/PlayerActivity` — VideoView, immersive, chrome auto-hides; four suggestions,
@@ -87,6 +88,15 @@ Mandatory: from API 29 scoped storage forbids directory listing (the app uid get
- Never size tiles from whichever list is visible: the search tab is shorter
(56dp bar) and shrank the tiles for every tab.
- `content delete --uri content://media/external/video/media/<id>` deletes the
media **file** as well, not just the row. Only use it for rows whose file is
already gone; a broad `WHERE name LIKE ...` pattern once took seven real videos
with it (recoverable only because the originals were still on the host).
- Filenames must be ASCII. Fullwidth `|`/`:` or emoji in the name make
`MEDIA_SCANNER_SCAN_FILE` succeed with nothing indexed, so the video stays
invisible; renaming to ASCII and broadcasting again indexes it.
- The tablet's USB link dies every minute or two. `adb tcpip 5555` +
`adb connect <ip>:5555` keeps the session alive (`adb -s <ip>:5555 …`).
- The search `TextWatcher` must not run on other tabs. `selectTab` clears the
field, that fires `afterTextChanged`, and an unguarded `applyFilter("")` refills
the result list with the whole library — which is why "Your stuff" showed every
@@ -39,6 +39,9 @@ class MainActivity : AppCompatActivity() {
private var activeTab = 0
private var currentTileWidth = 0
/** "All" is a mix across folders, not one series after another. */
private var mixed: List<MediaItem> = emptyList()
private val openFolder =
registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri ->
if (uri != null) {
@@ -150,6 +153,7 @@ class MainActivity : AppCompatActivity() {
runOnUiThread {
scanning = false
all = items
mixed = items.shuffled()
buildChips(items)
applyFolderFilter()
if (activeTab == 1) applyFilter(binding.searchInput.text?.toString().orEmpty())
@@ -180,7 +184,9 @@ class MainActivity : AppCompatActivity() {
private fun applyFolderFilter() {
val folder = selectedFolder
val list = if (folder == null) all else all.filter { it.folder == folder }
// A single folder keeps its series order; "All" is shuffled so the child
// does not walk through one series after the other.
val list = if (folder == null) mixed else all.filter { it.folder == folder }
gridAdapter.submit(list, stats.likedKeys())
refreshEmptyState()
}