From ec3fd617561d32cf369bd2ca7cf91752bd592a56 Mon Sep 17 00:00:00 2001 From: lotherk Date: Wed, 28 Oct 2026 13:48:16 +0000 Subject: [PATCH] KidsTube: offline iOS-look kids player for local videos Scaffold and first working build of an Android app that reproduces the iOS YouTube Kids interface over a local folder: shelves of 16:9 rounded thumbnails, fullscreen player, bottom bar, search grid and a parent gate. - minSdk 21, AGP 8.13.2 / Gradle 8.13 / Kotlin 2.1.20, compileSdk 35 - library from Movies/KidsTube via MediaStore, or a SAF tree the parent picks - no INTERNET permission: verified against the built APK with aapt2 - thumbnails decoded once into filesDir and cached, never on the bind path - player: VideoView, immersive, chrome auto-hides, tap_catcher restores it Verified on the AGS2-W09 (API 30): shelves with real frames, playback, search filtering, parent gate, back navigation. --- .gitignore | 11 + AGENTS.md | 106 +++++++ app/build.gradle.kts | 48 ++++ app/src/main/AndroidManifest.xml | 35 +++ .../java/dev/lotherk/kidstube/data/Library.kt | 201 ++++++++++++++ .../dev/lotherk/kidstube/data/MediaItem.kt | 11 + .../dev/lotherk/kidstube/media/ThumbCache.kt | 141 ++++++++++ .../dev/lotherk/kidstube/ui/MainActivity.kt | 217 +++++++++++++++ .../dev/lotherk/kidstube/ui/PlayerActivity.kt | 124 +++++++++ .../dev/lotherk/kidstube/ui/SectionAdapter.kt | 71 +++++ .../java/dev/lotherk/kidstube/ui/ThumbView.kt | 106 +++++++ .../dev/lotherk/kidstube/ui/VideoAdapter.kt | 68 +++++ app/src/main/res/drawable/bg_avatar.xml | 5 + app/src/main/res/drawable/bg_button.xml | 6 + app/src/main/res/drawable/bg_scrim_circle.xml | 5 + app/src/main/res/drawable/ic_back.xml | 9 + app/src/main/res/drawable/ic_home.xml | 9 + app/src/main/res/drawable/ic_person.xml | 9 + app/src/main/res/drawable/ic_search.xml | 9 + app/src/main/res/layout/activity_main.xml | 261 ++++++++++++++++++ app/src/main/res/layout/activity_player.xml | 76 +++++ app/src/main/res/layout/item_hero.xml | 30 ++ app/src/main/res/layout/item_section.xml | 28 ++ app/src/main/res/layout/item_video.xml | 29 ++ app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 1118 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 678 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 1634 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 2548 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 3482 bytes app/src/main/res/values/colors.xml | 13 + app/src/main/res/values/strings.xml | 27 ++ app/src/main/res/values/themes.xml | 22 ++ build.gradle.kts | 4 + gradle.properties | 3 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43705 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 251 +++++++++++++++++ gradlew.bat | 94 +++++++ settings.gradle.kts | 18 ++ 39 files changed, 2054 insertions(+) create mode 100644 .gitignore create mode 100644 AGENTS.md create mode 100644 app/build.gradle.kts create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/dev/lotherk/kidstube/data/Library.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/data/MediaItem.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/media/ThumbCache.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/ui/MainActivity.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/ui/PlayerActivity.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/ui/SectionAdapter.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/ui/ThumbView.kt create mode 100644 app/src/main/java/dev/lotherk/kidstube/ui/VideoAdapter.kt create mode 100644 app/src/main/res/drawable/bg_avatar.xml create mode 100644 app/src/main/res/drawable/bg_button.xml create mode 100644 app/src/main/res/drawable/bg_scrim_circle.xml create mode 100644 app/src/main/res/drawable/ic_back.xml create mode 100644 app/src/main/res/drawable/ic_home.xml create mode 100644 app/src/main/res/drawable/ic_person.xml create mode 100644 app/src/main/res/drawable/ic_search.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/layout/activity_player.xml create mode 100644 app/src/main/res/layout/item_hero.xml create mode 100644 app/src/main/res/layout/item_section.xml create mode 100644 app/src/main/res/layout/item_video.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle.kts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8ee9a35 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +*.iml +.gradle/ +/local.properties +/.idea/ +.DS_Store +/build +/app/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d1bc814 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,106 @@ +# KidsTube + +Android app that reproduces the **iOS** YouTube Kids interface — thumbnail +shelves, fullscreen player, bottom bar — while playing video from a **local +folder only**. No network, no account, no recommendations. It exists because the +son accepts the iOS kids UI and rejects the Android one, so this is a convincing +shell around local files. Floor: Android 5.0 / API 21. App name: KidsTube. + +State 2026-10-28: builds, installs and plays on the target tablet; shelves, +search, player and the parent gate were verified on the device. + +## Non-negotiables + +- No network. The APK must carry no `INTERNET` permission and no HTTP client: + `unzip -p app/build/outputs/apk/debug/app-debug.apk AndroidManifest.xml | strings | grep -ci internet` + must print `0`, and + `/home/lotherk/android-sdk/build-tools/35.0.0/aapt2 dump permissions app/build/outputs/apk/debug/app-debug.apk` + must list only the two storage permissions. +- `minSdk` stays 21. Check any new AAR's `minSdk` before adding it — much of + current androidx sits at 23+. +- When the choice is "Material default" vs "the iOS app's proportions", take iOS. + +## Environment (this machine, verified) + +- JDK 21 (`/usr/lib/jvm/java-21-openjdk-amd64`); no JDK 8 or 17 installed. +- SDK lives in `/home/lotherk/android-sdk` (user-local). The distro's + `/usr/lib/android-sdk` has no `platforms/` or `build-tools/`, and its bundled + `sdkmanager`/`apkanalyzer` die on JDK 21 with `NoClassDefFoundError: + javax/xml/bind/annotation/XmlSchema` (JAXB removed in JDK 11) — do not use it. +- `gradle` is not on PATH; the standalone distribution is + `/home/lotherk/android-tools/gradle-8.13`. The wrapper is pinned to 8.13 and + `local.properties` points at the SDK. +- AGP 8.13.2, Kotlin 2.1.20, compileSdk 35, build-tools 35.0.0. AGP 8.13 requires + Gradle >= 8.13, Build-Tools >= 35.0.0, JDK >= 17. + +## Build, install, run + + export JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 + export ANDROID_HOME=/home/lotherk/android-sdk + + ./gradlew :app:assembleDebug # apk -> app/build/outputs/apk/debug/ + ./gradlew :app:lintDebug # must stay green; abortOnError = true + adb install -r app/build/outputs/apk/debug/app-debug.apk + adb shell pm grant dev.lotherk.kidstube android.permission.READ_EXTERNAL_STORAGE + adb shell am start -n dev.lotherk.kidstube/.ui.MainActivity + adb exec-out screencap -p > /tmp/kt.png + adb logcat -d | grep -E 'kidstube|AndroidRuntime' + +Target device: Huawei AGS2-W09, LineageOS 18.1 (`18.1-20220523-UNOFFICIAL-prague`), +Android 11 / API 30, arm64-v8a, 1200x1920 at 480 dpi = 400dp wide. API 21 cannot +be exercised here — that needs an emulator image and none is installed. + +## Content + +The library is `Movies/KidsTube` (`/storage/emulated/0/Movies/KidsTube`), scanned +through MediaStore; a SAF tree picked from the Profile screen takes precedence. +Copy files with + + adb push video.mp4 /sdcard/Movies/KidsTube/ + adb shell am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/Movies/KidsTube/video.mp4 + +The broadcast is not optional: a pushed file stays invisible until MediaStore +indexes it, and from API 29 scoped storage forbids directory listing (the app uid +gets `EACCES`), so there is no fallback route. + +## Layout and conventions + +- `data/` — `Library` (SAF tree, else MediaStore; folder grouping; `MediaItem` + carries a sha1 `key`), `MediaItem`. +- `media/ThumbCache` — decode via `MediaMetadataRetriever`, write JPEGs to + `filesDir/thumbs`, `LruCache` in memory, 3-thread pool, tag-guarded binds. +- `ui/` — `MainActivity` (shelves, search grid, parent gate), `SectionAdapter` + (vertical shelves, each a horizontal RecyclerView), `VideoAdapter` (modes HERO / + CAROUSEL / GRID), `PlayerActivity` (VideoView, immersive, auto-hiding chrome), + `ThumbView`. +- `ThumbView` owns the two numbers the look depends on — 16:9 and 12dp corner + radius — plus the duration pill. Never re-implement them per layout. +- Kotlin + Views + AppCompat, single `:app` module, viewBinding, no Compose. + Every dimension in dp/sp, designed against 400dp width. + +## Pitfalls + +- `reload()` must treat "no SAF tree, storage permission granted" as a valid + source. Gating on the tree alone silently shows an empty home screen. +- `VideoView` swallows touches, so its `OnClickListener` never fires; the player + uses a transparent `tap_catcher` view above it to bring the chrome back. +- Tint AppCompat widgets with `app:tint`, never `android:tint` — lint fails the + build on `UseAppTint`, and the vector drawables are white by default, so a + missing tint makes an icon invisible rather than obviously wrong. +- The system "Viewing full screen" confirmation appears on first launch and holds + focus — dismiss it before trusting any UI dump. +- `uiautomator dump` takes seconds here, longer than the 4s chrome timeout, so a + dump right after a tap shows stale state. Screenshot instead. +- adbd on the device crash-loops (`Could not install *smartsocket* listener`); a + dropped `adb` connection is the device, not the app. Reconnect and check + `sys.boot_completed`. +- The tablet randomly brings up the camera app between commands. Force-stop + `com.android.camera2` and restart the activity if the focus looks wrong. +- File paths: `/storage/emulated/0` is the real mount; `/sdcard` works for `ls` + but not for `df`. + +## Repo + +Initialised locally (one commit), no remote yet; Konrad's convention is `origin` += hiddenbox when one is added. Short imperative commit subjects, no +conventional-commit prefixes. diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..21da632 --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,48 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") +} + +android { + namespace = "dev.lotherk.kidstube" + compileSdk = 35 + + defaultConfig { + applicationId = "dev.lotherk.kidstube" + minSdk = 21 + targetSdk = 35 + versionCode = 1 + versionName = "0.1" + } + + buildTypes { + release { + isMinifyEnabled = false + } + } + + buildFeatures { + viewBinding = true + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + lint { + // Hard floor check: an API-24 call must fail here, not on the tablet. + abortOnError = true + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("androidx.recyclerview:recyclerview:1.3.2") + implementation("androidx.documentfile:documentfile:1.0.1") +} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..bf841e1 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/java/dev/lotherk/kidstube/data/Library.kt b/app/src/main/java/dev/lotherk/kidstube/data/Library.kt new file mode 100644 index 0000000..a806289 --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/data/Library.kt @@ -0,0 +1,201 @@ +package dev.lotherk.kidstube.data + +import android.Manifest +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.net.Uri +import android.os.Build +import android.os.Environment +import android.provider.MediaStore +import android.util.Log +import androidx.core.content.ContextCompat +import androidx.documentfile.provider.DocumentFile +import java.io.File +import java.security.MessageDigest + +/** + * Video sources, in order of precedence: + * 1. a SAF tree the parent picked (any folder, no permission needed), + * 2. the default folder Movies/KidsTube via MediaStore. + * + * Nothing else: no network, no cloud, no second app. + */ +object Library { + + const val PREFS = "kidstube" + const val DEFAULT_FOLDER = "KidsTube" + private const val KEY_TREE = "tree_uri" + + fun treeUri(context: Context): Uri? = + prefs(context).getString(KEY_TREE, null)?.let(Uri::parse) + + fun setTree(context: Context, uri: Uri) { + try { + context.contentResolver.takePersistableUriPermission( + uri, + Intent.FLAG_GRANT_READ_URI_PERMISSION + ) + } catch (e: SecurityException) { + // Already persisted or the provider refuses; remember the URI anyway. + } + prefs(context).edit().putString(KEY_TREE, uri.toString()).apply() + } + + fun folderName(context: Context): String? = + treeUri(context)?.let { DocumentFile.fromTreeUri(context, it)?.name } + ?: defaultFolderPath() + + /** The runtime permission that applies to this API level. */ + fun readPermission(): String = + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + Manifest.permission.READ_MEDIA_VIDEO + } else { + Manifest.permission.READ_EXTERNAL_STORAGE + } + + fun hasReadPermission(context: Context): Boolean = + ContextCompat.checkSelfPermission(context, readPermission()) == + PackageManager.PERMISSION_GRANTED + + fun scan(context: Context): List { + val tree = treeUri(context) + Log.d("kidstube", "scan tree=" + (tree != null) + " perm=" + hasReadPermission(context)) + val items = if (tree != null) scanTree(context, tree) else scanDefaultFolder(context) + return items.sortedWith(compareBy({ it.folder.lowercase() }, { it.title.lowercase() })) + } + + fun defaultFolderPath(): String = + Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES) + .absolutePath + "/" + DEFAULT_FOLDER + + // --- SAF tree ----------------------------------------------------------- + + private fun scanTree(context: Context, tree: Uri): List { + val root = DocumentFile.fromTreeUri(context, tree) ?: return emptyList() + val out = ArrayList() + walk(root, root.name ?: "", out, 0) + return out + } + + private fun walk(dir: DocumentFile, folder: String, out: MutableList, depth: Int) { + if (depth > 6) return + for (child in dir.listFiles()) { + if (child.isDirectory) { + walk(child, child.name ?: folder, out, depth + 1) + } else if (child.isFile) { + addFile(child.name ?: continue, child.uri, folder, out) + } + } + } + + // --- default folder via MediaStore ------------------------------------- + + private fun scanDefaultFolder(context: Context): List { + if (!hasReadPermission(context)) return emptyList() + val out = ArrayList() + val prefix = Environment.DIRECTORY_MOVIES + "/" + DEFAULT_FOLDER + val collection = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + MediaStore.Video.Media.getContentUri(MediaStore.VOLUME_EXTERNAL) + } else { + MediaStore.Video.Media.EXTERNAL_CONTENT_URI + } + + val projection: Array + val selection: String? + val args: Array? + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { + projection = arrayOf( + MediaStore.Video.Media._ID, + MediaStore.Video.Media.DISPLAY_NAME, + MediaStore.Video.Media.RELATIVE_PATH + ) + selection = "${MediaStore.Video.Media.RELATIVE_PATH} LIKE ?" + args = arrayOf("$prefix%") + } else { + projection = arrayOf( + MediaStore.Video.Media._ID, + MediaStore.Video.Media.DISPLAY_NAME, + MediaStore.Video.Media.DATA + ) + selection = "${MediaStore.Video.Media.DATA} LIKE ?" + args = arrayOf("%/$prefix/%") + } + + try { + context.contentResolver.query(collection, projection, selection, args, null) + ?.use { cursor -> + val idIndex = cursor.getColumnIndex(MediaStore.Video.Media._ID) + val nameIndex = cursor.getColumnIndex(MediaStore.Video.Media.DISPLAY_NAME) + val pathIndex = cursor.getColumnIndex(projection[2]) + while (cursor.moveToNext()) { + val id = cursor.getLong(idIndex) + val name = cursor.getString(nameIndex) ?: continue + val path = cursor.getString(pathIndex).orEmpty() + val folder = folderOf(path, prefix) + val uri = Uri.withAppendedPath(collection, id.toString()) + addFile(name, uri, folder, out) + } + } + } catch (t: Throwable) { + Log.w("kidstube", "mediastore query failed", t) + return emptyList() + } + Log.d("kidstube", "mediastore rows=" + out.size + " pathIndex=" + projection[2]) + // Below API 29 the raw file path is readable and catches files that were + // never indexed. From 29 on scoped storage forbids directory listing + // (verified: the app uid gets EACCES on this folder), so MediaStore is + // the only route and a non-indexed file is simply invisible until the + // media scanner sees it. + if (out.isEmpty() && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { + return scanDefaultByFile() + } + return out + } + + private fun scanDefaultByFile(): List { + val root = File(defaultFolderPath()) + if (!root.isDirectory) return emptyList() + val out = ArrayList() + walkFiles(root, DEFAULT_FOLDER, out, 0) + return out + } + + private fun walkFiles(dir: File, folder: String, out: MutableList, depth: Int) { + if (depth > 6) return + val children = dir.listFiles() ?: return + for (child in children) { + if (child.isDirectory) { + walkFiles(child, child.name, out, depth + 1) + } else if (child.isFile) { + addFile(child.name, Uri.fromFile(child), folder, out) + } + } + } + + /** "Movies/KidsTube/Tiere/" -> "Tiere", the folder itself -> "KidsTube". */ + private fun folderOf(path: String, prefix: String): String { + val tail = path.removePrefix(prefix).trim('/') + return tail.substringBefore('/').ifEmpty { DEFAULT_FOLDER } + } + + private fun addFile(name: String, uri: Uri, folder: String, out: MutableList) { + val ext = name.substringAfterLast('.', "").lowercase() + if (ext !in VIDEO_EXT) return + out.add(MediaItem(uri = uri, title = titleOf(name), folder = folder, key = sha1(uri.toString()))) + } + + private val VIDEO_EXT = setOf("mp4", "m4v", "webm", "mkv", "3gp", "ts") + + private fun titleOf(fileName: String): String = + fileName.substringBeforeLast('.').replace('_', ' ').trim().ifEmpty { fileName } + + private fun sha1(value: String): String { + val digest = MessageDigest.getInstance("SHA-1").digest(value.toByteArray()) + val sb = StringBuilder(digest.size * 2) + for (b in digest) sb.append(String.format("%02x", b)) + return sb.toString() + } + + fun prefs(context: Context) = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE) +} diff --git a/app/src/main/java/dev/lotherk/kidstube/data/MediaItem.kt b/app/src/main/java/dev/lotherk/kidstube/data/MediaItem.kt new file mode 100644 index 0000000..e28e3ca --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/data/MediaItem.kt @@ -0,0 +1,11 @@ +package dev.lotherk.kidstube.data + +import android.net.Uri + +/** One video found under the chosen folder. */ +data class MediaItem( + val uri: Uri, + val title: String, + val folder: String, + val key: String +) diff --git a/app/src/main/java/dev/lotherk/kidstube/media/ThumbCache.kt b/app/src/main/java/dev/lotherk/kidstube/media/ThumbCache.kt new file mode 100644 index 0000000..ceecb57 --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/media/ThumbCache.kt @@ -0,0 +1,141 @@ +package dev.lotherk.kidstube.media + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.media.MediaMetadataRetriever +import android.os.Handler +import android.os.Looper +import android.util.LruCache +import dev.lotherk.kidstube.data.Library +import dev.lotherk.kidstube.data.MediaItem +import dev.lotherk.kidstube.ui.ThumbView +import java.io.File +import java.util.Locale +import java.util.concurrent.Executors + +/** + * Thumbnails are decoded once, written to filesDir and read back from disk while + * scrolling. Decoding on the bind path stutters on this tablet. + */ +object ThumbCache { + + private const val THUMB_WIDTH = 640 + private val pool = Executors.newFixedThreadPool(3) + private val main = Handler(Looper.getMainLooper()) + + private val memory = object : LruCache( + (Runtime.getRuntime().maxMemory() / 1024 / 8).toInt() + ) { + override fun sizeOf(key: String, value: Bitmap): Int = value.byteCount / 1024 + } + + fun label(context: Context, item: MediaItem): String? { + val ms = Library.prefs(context).getLong("dur_" + item.key, 0L) + return if (ms > 0) formatDuration(ms) else null + } + + fun load(context: Context, item: MediaItem, view: ThumbView) { + val key = item.key + view.tag = key + + memory.get(key)?.let { + view.setThumb(it, label(context, item)) + return + } + + val fromDisk = readDisk(context, item) + if (fromDisk != null) { + memory.put(key, fromDisk) + view.setThumb(fromDisk, label(context, item)) + return + } + + view.setThumb(null, label(context, item)) + val app = context.applicationContext + pool.execute { + val data = generateThumb(app, item) + main.post { + if (data.bitmap != null) memory.put(key, data.bitmap) + if (view.tag == key) view.setThumb(data.bitmap, data.label) + } + } + } + + private class ThumbData(val bitmap: Bitmap?, val label: String?) + + private fun generateThumb(context: Context, item: MediaItem): ThumbData { + val retriever = MediaMetadataRetriever() + try { + val path = item.uri.path + if (item.uri.scheme == "file" && path != null) { + retriever.setDataSource(path) + } else { + retriever.setDataSource(context, item.uri) + } + val durationMs = retriever + .extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION) + ?.toLongOrNull() ?: 0L + val frame = retriever.getFrameAtTime( + if (durationMs > 3000) 1_000_000L else 0L, + MediaMetadataRetriever.OPTION_CLOSEST_SYNC + ) + val scaled = frame?.let { scaleToWidth(it, THUMB_WIDTH) } + if (scaled != null) writeDisk(context, item, scaled) + if (durationMs > 0) { + Library.prefs(context).edit().putLong("dur_" + item.key, durationMs).apply() + } + return ThumbData(scaled, if (durationMs > 0) formatDuration(durationMs) else null) + } catch (t: Throwable) { + return ThumbData(null, null) + } finally { + try { + retriever.release() + } catch (ignored: Throwable) { + } + } + } + + private fun scaleToWidth(source: Bitmap, width: Int): Bitmap { + if (source.width <= width) return source + val height = (source.height.toFloat() * width / source.width).toInt().coerceAtLeast(1) + return Bitmap.createScaledBitmap(source, width, height, true) + } + + private fun fileFor(context: Context, item: MediaItem): File = + File(File(context.filesDir, "thumbs"), item.key + ".jpg") + + private fun readDisk(context: Context, item: MediaItem): Bitmap? { + val file = fileFor(context, item) + if (!file.exists()) return null + return try { + BitmapFactory.decodeFile(file.absolutePath) + } catch (t: Throwable) { + null + } + } + + private fun writeDisk(context: Context, item: MediaItem, bitmap: Bitmap) { + try { + val dir = File(context.filesDir, "thumbs") + if (!dir.exists()) dir.mkdirs() + fileFor(context, item).outputStream().use { out -> + bitmap.compress(Bitmap.CompressFormat.JPEG, 82, out) + } + } catch (t: Throwable) { + // A missing cache file only costs a later re-decode. + } + } + + fun formatDuration(ms: Long): String { + val totalSeconds = ms / 1000 + val hours = totalSeconds / 3600 + val minutes = (totalSeconds % 3600) / 60 + val seconds = totalSeconds % 60 + return if (hours > 0) { + String.format(Locale.US, "%d:%02d:%02d", hours, minutes, seconds) + } else { + String.format(Locale.US, "%d:%02d", minutes, seconds) + } + } +} diff --git a/app/src/main/java/dev/lotherk/kidstube/ui/MainActivity.kt b/app/src/main/java/dev/lotherk/kidstube/ui/MainActivity.kt new file mode 100644 index 0000000..f2b71e2 --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/ui/MainActivity.kt @@ -0,0 +1,217 @@ +package dev.lotherk.kidstube.ui + +import android.content.Intent +import android.content.res.ColorStateList +import android.os.Bundle +import android.text.Editable +import android.text.InputType +import android.text.TextWatcher +import android.view.View +import android.widget.EditText +import androidx.activity.result.contract.ActivityResultContracts +import androidx.appcompat.app.AlertDialog +import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat +import androidx.recyclerview.widget.GridLayoutManager +import androidx.recyclerview.widget.LinearLayoutManager +import dev.lotherk.kidstube.R +import dev.lotherk.kidstube.data.Library +import dev.lotherk.kidstube.data.MediaItem +import dev.lotherk.kidstube.databinding.ActivityMainBinding +import java.util.concurrent.Executors +import kotlin.random.Random + +class MainActivity : AppCompatActivity() { + + private lateinit var binding: ActivityMainBinding + private val sectionAdapter = SectionAdapter { openPlayer(it) } + private val executor = Executors.newSingleThreadExecutor() + + private lateinit var resultsAdapter: VideoAdapter + private var all: List = emptyList() + private var scanning = false + private var activeTab = 0 + + private val openFolder = + registerForActivityResult(ActivityResultContracts.OpenDocumentTree()) { uri -> + if (uri != null) { + Library.setTree(this, uri) + reload() + } + } + + private val permission = + registerForActivityResult(ActivityResultContracts.RequestPermission()) { reload() } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityMainBinding.inflate(layoutInflater) + setContentView(binding.root) + + binding.rows.layoutManager = LinearLayoutManager(this) + binding.rows.adapter = sectionAdapter + + resultsAdapter = VideoAdapter(VideoAdapter.Mode.GRID) { openPlayer(it) } + binding.results.layoutManager = GridLayoutManager(this, 2) + binding.results.adapter = resultsAdapter + + binding.btnPick.setOnClickListener { pickFolder() } + binding.btnTopSearch.setOnClickListener { selectTab(1) } + binding.avatar.setOnClickListener { parentGate() } + binding.tabHome.setOnClickListener { selectTab(0) } + binding.tabSearch.setOnClickListener { selectTab(1) } + binding.tabProfile.setOnClickListener { parentGate() } + binding.btnSearchClose.setOnClickListener { selectTab(0) } + + binding.searchInput.addTextChangedListener(object : TextWatcher { + override fun beforeTextChanged(s: CharSequence?, a: Int, b: Int, c: Int) = Unit + override fun onTextChanged(s: CharSequence?, a: Int, b: Int, c: Int) = Unit + override fun afterTextChanged(s: Editable?) = applyFilter(s?.toString().orEmpty()) + }) + + selectTab(0) + start() + } + + /** Default folder needs a read permission once; a picked SAF tree does not. */ + private fun start() { + if (Library.treeUri(this) == null && !Library.hasReadPermission(this)) { + permission.launch(Library.readPermission()) + return + } + reload() + } + + override fun onResume() { + super.onResume() + if (!scanning) reload() + } + + private fun reload() { + if (scanning) return + val hasSource = Library.treeUri(this) != null || Library.hasReadPermission(this) + if (!hasSource) { + all = emptyList() + sectionAdapter.submit(emptyList()) + refreshEmptyState() + return + } + scanning = true + executor.execute { + val items = Library.scan(this) + runOnUiThread { + scanning = false + all = items + buildSections(items) + applyFilter(binding.searchInput.text?.toString().orEmpty()) + refreshEmptyState() + } + } + } + + private fun buildSections(items: List) { + if (items.isEmpty()) { + sectionAdapter.submit(emptyList()) + return + } + val sections = ArrayList() + sections.add(SectionAdapter.Section(getString(R.string.shelf_recent), items.take(8), true)) + for ((folder, list) in items.groupBy { it.folder }) { + if (list.size < 2 || sections.size >= 5) continue + sections.add(SectionAdapter.Section(folder, list.take(20), false)) + } + sections.add(SectionAdapter.Section(getString(R.string.shelf_all), items.take(30), false)) + sectionAdapter.submit(sections) + } + + private fun applyFilter(query: String) { + val q = query.trim().lowercase() + val list = if (q.isEmpty()) all else all.filter { + it.title.lowercase().contains(q) || it.folder.lowercase().contains(q) + } + resultsAdapter.submit(list) + } + + private fun selectTab(index: Int) { + activeTab = index + val active = ContextCompat.getColor(this, R.color.kt_red) + val idle = ContextCompat.getColor(this, R.color.kt_tab_idle) + + binding.tabHomeIcon.imageTintList = ColorStateList.valueOf(if (index == 0) active else idle) + binding.tabHomeLabel.setTextColor(if (index == 0) active else idle) + binding.tabSearchIcon.imageTintList = ColorStateList.valueOf(if (index == 1) active else idle) + binding.tabSearchLabel.setTextColor(if (index == 1) active else idle) + binding.tabProfileIcon.imageTintList = ColorStateList.valueOf(idle) + + binding.searchBar.visibility = if (index == 1) View.VISIBLE else View.GONE + binding.results.visibility = if (index == 1) View.VISIBLE else View.GONE + binding.rows.visibility = if (index == 0) View.VISIBLE else View.GONE + + if (index == 1) { + binding.searchInput.requestFocus() + } else { + binding.searchInput.setText("") + } + refreshEmptyState() + } + + private fun refreshEmptyState() { + val show = all.isEmpty() && activeTab == 0 + binding.empty.visibility = if (show) View.VISIBLE else View.GONE + } + + private fun pickFolder() { + openFolder.launch(Library.treeUri(this)) + } + + /** Same idea as the iOS kids app: a small multiplication gate for parents. */ + private fun parentGate() { + val a = Random.nextInt(3, 10) + val b = Random.nextInt(3, 10) + val input = EditText(this).apply { + inputType = InputType.TYPE_CLASS_NUMBER + hint = "?" + setPadding(48, 24, 48, 24) + } + val dialog = AlertDialog.Builder(this) + .setTitle(R.string.parent_gate_title) + .setMessage("${getString(R.string.parent_gate_body)}: $a x $b = ?") + .setView(input) + .setPositiveButton(R.string.ok, null) + .setNegativeButton(R.string.cancel, null) + .create() + dialog.setOnShowListener { + dialog.getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener { + if (input.text.toString().trim().toIntOrNull() == a * b) { + dialog.dismiss() + showFolderInfo() + } else { + input.error = getString(R.string.parent_wrong) + } + } + } + dialog.show() + } + + private fun showFolderInfo() { + val name = Library.folderName(this) ?: getString(R.string.folder_label) + val message = "$name\n\n${getString(R.string.video_count, all.size)}" + AlertDialog.Builder(this) + .setTitle(R.string.folder_label) + .setMessage(message) + .setPositiveButton(R.string.change_folder) { d, _ -> + d.dismiss() + pickFolder() + } + .setNegativeButton(R.string.ok, null) + .show() + } + + private fun openPlayer(item: MediaItem) { + startActivity( + Intent(this, PlayerActivity::class.java) + .putExtra(PlayerActivity.EXTRA_URI, item.uri.toString()) + .putExtra(PlayerActivity.EXTRA_TITLE, item.title) + ) + } +} diff --git a/app/src/main/java/dev/lotherk/kidstube/ui/PlayerActivity.kt b/app/src/main/java/dev/lotherk/kidstube/ui/PlayerActivity.kt new file mode 100644 index 0000000..4187de6 --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/ui/PlayerActivity.kt @@ -0,0 +1,124 @@ +package dev.lotherk.kidstube.ui + +import android.net.Uri +import android.os.Build +import android.os.Bundle +import android.os.Handler +import android.os.Looper +import android.view.View +import android.view.WindowInsets +import android.view.WindowInsetsController +import android.view.WindowManager +import android.widget.SeekBar +import android.widget.Toast +import androidx.appcompat.app.AppCompatActivity +import dev.lotherk.kidstube.R +import dev.lotherk.kidstube.databinding.ActivityPlayerBinding + +/** Fullscreen local playback. No pre-roll, no controls until a tap. */ +class PlayerActivity : AppCompatActivity() { + + companion object { + const val EXTRA_URI = "uri" + const val EXTRA_TITLE = "title" + } + + private lateinit var binding: ActivityPlayerBinding + private val handler = Handler(Looper.getMainLooper()) + private var chromeVisible = true + + private val hideChrome = Runnable { setChrome(false) } + private val ticker = object : Runnable { + override fun run() { + binding.seek.progress = binding.video.currentPosition + handler.postDelayed(this, 500) + } + } + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + binding = ActivityPlayerBinding.inflate(layoutInflater) + setContentView(binding.root) + + val rawUri = intent.getStringExtra(EXTRA_URI) + if (rawUri == null) { + finish() + return + } + + window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) + binding.title.text = intent.getStringExtra(EXTRA_TITLE).orEmpty() + binding.btnBack.setOnClickListener { finish() } + binding.tapCatcher.setOnClickListener { setChrome(!chromeVisible) } + binding.chrome.setOnClickListener { setChrome(!chromeVisible) } + + binding.seek.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { + override fun onProgressChanged(bar: SeekBar?, progress: Int, fromUser: Boolean) { + if (fromUser) binding.video.seekTo(progress) + } + + override fun onStartTrackingTouch(bar: SeekBar?) { + handler.removeCallbacks(hideChrome) + } + + override fun onStopTrackingTouch(bar: SeekBar?) { + handler.removeCallbacks(hideChrome) + handler.postDelayed(hideChrome, 3000) + } + }) + + binding.video.setVideoURI(Uri.parse(rawUri)) + binding.video.setOnPreparedListener { player -> + binding.spinner.visibility = View.GONE + player.isLooping = true + binding.seek.max = if (player.duration > 0) player.duration else 1 + binding.video.start() + handler.post(ticker) + setChrome(true) + } + binding.video.setOnErrorListener { _, _, _ -> + binding.spinner.visibility = View.GONE + Toast.makeText(this, R.string.error_play, Toast.LENGTH_LONG).show() + true + } + } + + override fun onWindowFocusChanged(hasFocus: Boolean) { + super.onWindowFocusChanged(hasFocus) + if (hasFocus) immersive() + } + + override fun onDestroy() { + handler.removeCallbacksAndMessages(null) + binding.video.stopPlayback() + super.onDestroy() + } + + private fun setChrome(visible: Boolean) { + chromeVisible = visible + binding.chrome.visibility = if (visible) View.VISIBLE else View.INVISIBLE + handler.removeCallbacks(hideChrome) + if (visible) handler.postDelayed(hideChrome, 4000) + } + + private fun immersive() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + window.setDecorFitsSystemWindows(false) + window.insetsController?.let { + it.hide(WindowInsets.Type.systemBars()) + it.systemBarsBehavior = + WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE + } + } else { + @Suppress("DEPRECATION") + window.decorView.systemUiVisibility = ( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + or View.SYSTEM_UI_FLAG_FULLSCREEN + or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ) + } + } +} diff --git a/app/src/main/java/dev/lotherk/kidstube/ui/SectionAdapter.kt b/app/src/main/java/dev/lotherk/kidstube/ui/SectionAdapter.kt new file mode 100644 index 0000000..960c8cd --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/ui/SectionAdapter.kt @@ -0,0 +1,71 @@ +package dev.lotherk.kidstube.ui + +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.recyclerview.widget.LinearLayoutManager +import androidx.recyclerview.widget.LinearSnapHelper +import androidx.recyclerview.widget.RecyclerView +import dev.lotherk.kidstube.data.MediaItem +import dev.lotherk.kidstube.databinding.ItemSectionBinding + +/** Vertical list of shelves; each shelf is its own horizontal RecyclerView. */ +class SectionAdapter( + private val onTap: (MediaItem) -> Unit +) : RecyclerView.Adapter() { + + class Section(val title: String, val items: List, val hero: Boolean) + + private val sections = ArrayList
() + + fun submit(list: List
) { + sections.clear() + sections.addAll(list) + notifyDataSetChanged() + } + + class Holder(val binding: ItemSectionBinding) : RecyclerView.ViewHolder(binding.root) { + var snap: LinearSnapHelper? = null + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder { + val binding = ItemSectionBinding.inflate( + LayoutInflater.from(parent.context), parent, false + ) + return Holder(binding) + } + + override fun onBindViewHolder(holder: Holder, position: Int) { + val section = sections[position] + val binding = holder.binding + binding.sectionTitle.text = section.title + + val row = binding.row + val context = row.context + if (row.layoutManager == null) { + row.layoutManager = LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false) + } + val adapter = VideoAdapter( + if (section.hero) VideoAdapter.Mode.HERO else VideoAdapter.Mode.CAROUSEL, + onTap + ) + row.adapter = adapter + adapter.submit(section.items) + + // The wide top shelf snaps page by page like the iOS carousel; the + // smaller shelves scroll freely. + if (section.hero && holder.snap == null) { + holder.snap = LinearSnapHelper().apply { attachToRecyclerView(row) } + } else if (!section.hero && holder.snap != null) { + holder.snap?.attachToRecyclerView(null) + holder.snap = null + } + } + + override fun onViewRecycled(holder: Holder) { + holder.snap?.attachToRecyclerView(null) + holder.snap = null + super.onViewRecycled(holder) + } + + override fun getItemCount(): Int = sections.size +} diff --git a/app/src/main/java/dev/lotherk/kidstube/ui/ThumbView.kt b/app/src/main/java/dev/lotherk/kidstube/ui/ThumbView.kt new file mode 100644 index 0000000..e804337 --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/ui/ThumbView.kt @@ -0,0 +1,106 @@ +package dev.lotherk.kidstube.ui + +import android.content.Context +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.Color +import android.graphics.Matrix +import android.graphics.Paint +import android.graphics.Path +import android.graphics.Typeface +import android.util.AttributeSet +import android.view.View +import androidx.core.content.ContextCompat +import dev.lotherk.kidstube.R +import kotlin.math.max +import kotlin.math.roundToInt + +/** + * 16:9 thumbnail with 12dp rounded corners and an optional duration pill. + * + * Keeps the aspect ratio and the corner radius in one place: the iOS kids app + * is judged on exactly these two numbers, so they must not drift per layout. + */ +class ThumbView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyle: Int = 0 +) : View(context, attrs, defStyle) { + + private val density = resources.displayMetrics.density + private val radiusPx = 12f * density + private val pillMargin = 6f * density + private val pillPadH = 5f * density + private val pillPadV = 2f * density + + private val bitmapPaint = Paint(Paint.ANTI_ALIAS_FLAG or Paint.FILTER_BITMAP_FLAG) + private val fillPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + color = ContextCompat.getColor(context, R.color.kt_placeholder) + } + private val pillPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + color = ContextCompat.getColor(context, R.color.kt_pill) + } + private val labelPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply { + color = Color.WHITE + textSize = 11f * resources.displayMetrics.scaledDensity + typeface = Typeface.DEFAULT_BOLD + } + + private val clip = Path() + private val scaleMatrix = Matrix() + + private var thumb: Bitmap? = null + private var pillText: String? = null + + fun setThumb(bitmap: Bitmap?, label: String?) { + thumb = bitmap + pillText = label + invalidate() + } + + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { + val width = MeasureSpec.getSize(widthMeasureSpec) + val height = if (width > 0) (width * 9f / 16f).roundToInt() else 0 + setMeasuredDimension(width, height) + } + + override fun onDraw(canvas: Canvas) { + val w = width.toFloat() + val h = height.toFloat() + if (w <= 0f || h <= 0f) return + + clip.reset() + clip.addRoundRect(0f, 0f, w, h, radiusPx, radiusPx, Path.Direction.CW) + canvas.save() + canvas.clipPath(clip) + + val bmp = thumb + if (bmp == null || bmp.isRecycled) { + canvas.drawRect(0f, 0f, w, h, fillPaint) + } else { + val scale = max(w / bmp.width, h / bmp.height) + scaleMatrix.reset() + scaleMatrix.setScale(scale, scale) + scaleMatrix.postTranslate((w - bmp.width * scale) / 2f, (h - bmp.height * scale) / 2f) + canvas.drawBitmap(bmp, scaleMatrix, bitmapPaint) + } + canvas.restore() + + val label = pillText + if (label != null) drawPill(canvas, label, w, h) + } + + private fun drawPill(canvas: Canvas, label: String, w: Float, h: Float) { + val textWidth = labelPaint.measureText(label) + val pillH = labelPaint.textSize + 2 * pillPadV + val pillW = textWidth + 2 * pillPadH + val right = w - pillMargin + val bottom = h - pillMargin + val left = right - pillW + val top = bottom - pillH + val r = pillH / 2f + canvas.drawRoundRect(left, top, right, bottom, r, r, pillPaint) + val baseline = top + pillH / 2f - (labelPaint.descent() + labelPaint.ascent()) / 2f + canvas.drawText(label, left + pillPadH, baseline, labelPaint) + } +} diff --git a/app/src/main/java/dev/lotherk/kidstube/ui/VideoAdapter.kt b/app/src/main/java/dev/lotherk/kidstube/ui/VideoAdapter.kt new file mode 100644 index 0000000..85c71b4 --- /dev/null +++ b/app/src/main/java/dev/lotherk/kidstube/ui/VideoAdapter.kt @@ -0,0 +1,68 @@ +package dev.lotherk.kidstube.ui + +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.TextView +import androidx.recyclerview.widget.RecyclerView +import dev.lotherk.kidstube.R +import dev.lotherk.kidstube.data.MediaItem +import dev.lotherk.kidstube.media.ThumbCache +import kotlin.math.roundToInt + +/** + * One tile row. HERO is the wide top shelf, CAROUSEL the smaller ones, GRID the + * two-column search result list. + */ +class VideoAdapter( + private val mode: Mode, + private val onTap: (MediaItem) -> Unit +) : RecyclerView.Adapter() { + + enum class Mode { HERO, CAROUSEL, GRID } + + private val items = ArrayList() + + fun submit(list: List) { + items.clear() + items.addAll(list) + notifyDataSetChanged() + } + + class Holder(view: View) : RecyclerView.ViewHolder(view) { + val thumb: ThumbView = view.findViewById(R.id.thumb) + val title: TextView = view.findViewById(R.id.title) + val meta: TextView = view.findViewById(R.id.meta) + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder { + val layout = if (mode == Mode.HERO) R.layout.item_hero else R.layout.item_video + val view = LayoutInflater.from(parent.context).inflate(layout, parent, false) + val density = parent.resources.displayMetrics.density + val params = view.layoutParams as RecyclerView.LayoutParams + when (mode) { + Mode.HERO -> + params.width = parent.resources.displayMetrics.widthPixels - + (56 * density).roundToInt() + Mode.CAROUSEL -> params.width = (210 * density).roundToInt() + Mode.GRID -> params.width = ViewGroup.LayoutParams.MATCH_PARENT + } + params.marginEnd = (12 * density).roundToInt() + params.bottomMargin = if (mode == Mode.GRID) (16 * density).roundToInt() else 0 + view.layoutParams = params + return Holder(view) + } + + override fun onBindViewHolder(holder: Holder, position: Int) { + val item = items[position] + holder.title.text = item.title + holder.meta.text = item.folder + ThumbCache.load(holder.itemView.context, item, holder.thumb) + holder.itemView.setOnClickListener { + val current = holder.bindingAdapterPosition + if (current != RecyclerView.NO_POSITION && current < items.size) onTap(items[current]) + } + } + + override fun getItemCount(): Int = items.size +} diff --git a/app/src/main/res/drawable/bg_avatar.xml b/app/src/main/res/drawable/bg_avatar.xml new file mode 100644 index 0000000..3aef3cf --- /dev/null +++ b/app/src/main/res/drawable/bg_avatar.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/bg_button.xml b/app/src/main/res/drawable/bg_button.xml new file mode 100644 index 0000000..8081e60 --- /dev/null +++ b/app/src/main/res/drawable/bg_button.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/app/src/main/res/drawable/bg_scrim_circle.xml b/app/src/main/res/drawable/bg_scrim_circle.xml new file mode 100644 index 0000000..e18ac63 --- /dev/null +++ b/app/src/main/res/drawable/bg_scrim_circle.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable/ic_back.xml b/app/src/main/res/drawable/ic_back.xml new file mode 100644 index 0000000..bc04ed6 --- /dev/null +++ b/app/src/main/res/drawable/ic_back.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_home.xml b/app/src/main/res/drawable/ic_home.xml new file mode 100644 index 0000000..eb75d71 --- /dev/null +++ b/app/src/main/res/drawable/ic_home.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_person.xml b/app/src/main/res/drawable/ic_person.xml new file mode 100644 index 0000000..412294a --- /dev/null +++ b/app/src/main/res/drawable/ic_person.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml new file mode 100644 index 0000000..3a2d17b --- /dev/null +++ b/app/src/main/res/drawable/ic_search.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..1f8ac55 --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +