files: add system trash support
- Commit
da85ebbced5e4f43a2e02a7e50a713cd7ab865b9- Author
- vayun-mathur <[email protected]>
- When
- 2026-09-29 20:07 UTC (2 months ago)
- Parents
2e7356a
Diff
files/src/main/java/com/vayunmathur/files/Navigation.kt
diff --git a/files/src/main/java/com/vayunmathur/files/Navigation.kt b/files/src/main/java/com/vayunmathur/files/Navigation.ktindex 0326da4f95..fc842ab3b7 100644--- a/files/src/main/java/com/vayunmathur/files/Navigation.kt+++ b/files/src/main/java/com/vayunmathur/files/Navigation.kt@@ -7,6 +7,7 @@ import com.vayunmathur.files.platform.FilesViewModel import com.vayunmathur.files.ui.DirectoryPage import com.vayunmathur.files.ui.FilesShell import com.vayunmathur.files.ui.HomeScreenBinder+import com.vayunmathur.files.ui.TrashPage import com.vayunmathur.files.ui.filesNavActions import com.vayunmathur.library.util.MainNavigation import com.vayunmathur.library.util.rememberNavBackStack@@ -59,6 +60,15 @@ fun Navigation(viewModel: FilesViewModel) { } DirectoryPage(viewModel, actions, isCurrent, openDrawer) }+ // The system trash is a flat listing like a category: nowhere to go "up" to, so it+ // always sits directly on Home rather than on the folder it was opened from.+ entry<Route.Trash> {+ val isCurrent = backStack.last() == Route.Trash+ LaunchedEffect(isCurrent) {+ if (isCurrent) viewModel.showTrash()+ }+ TrashPage(viewModel, actions, isCurrent, openDrawer)+ } } } }
files/src/main/java/com/vayunmathur/files/Route.kt
diff --git a/files/src/main/java/com/vayunmathur/files/Route.kt b/files/src/main/java/com/vayunmathur/files/Route.ktindex ecc7becdd2..8fda21a733 100644--- a/files/src/main/java/com/vayunmathur/files/Route.kt+++ b/files/src/main/java/com/vayunmathur/files/Route.kt@@ -29,6 +29,13 @@ sealed interface Route : NavKey { @Serializable data class Category(val category: FileCategory) : Route + /**+ * The system trash. Like [Category], a flat listing with no parent folder, so it always+ * sits directly on top of [Home].+ */+ @Serializable+ data object Trash : Route+ /** * Inside an archive. [internalPath] is empty at the archive root and gains one entry per folder * within it, so Back walks out of the archive the same way it walks up a directory.
files/src/main/java/com/vayunmathur/files/platform/FilesApkInstall.kt
diff --git a/files/src/main/java/com/vayunmathur/files/platform/FilesApkInstall.kt b/files/src/main/java/com/vayunmathur/files/platform/FilesApkInstall.ktnew file mode 100644index 0000000000..b79cc3c077--- /dev/null+++ b/files/src/main/java/com/vayunmathur/files/platform/FilesApkInstall.kt@@ -0,0 +1,59 @@+package com.vayunmathur.files.platform++import android.app.Application+import android.content.Intent+import androidx.core.content.FileProvider+import androidx.lifecycle.viewModelScope+import com.vayunmathur.files.R+import kotlinx.coroutines.launch+import java.io.File++/**+ * The APK "install unknown apps" permission flow behind [FilesViewModel], as `internal`+ * extensions so FilesViewModel.kt stays under the FileLength limit. State+ * ([FilesViewModel.pendingApkInstall], [FilesViewModel.installPermissionRequests]) stays on+ * the ViewModel; only the method bodies live here.+ */++internal fun FilesViewModel.installApkFile(item: FileBrowserItem) {+ val ctx = getApplication<Application>()+ if (isZipMode()) {+ emit(ctx.getString(R.string.zip_browse_only))+ return+ }+ val file = item.realFile ?: return+ if (ctx.packageManager.canRequestPackageInstalls()) {+ launchApkInstallFile(file)+ } else {+ pendingApkInstall = file+ emit(ctx.getString(R.string.install_permission_needed))+ _installPermissionRequests.tryEmit(Unit)+ }+}++/** Called by the UI after returning from the "install unknown apps" settings screen. */+internal fun FilesViewModel.onApkInstallPermissionResult() {+ val ctx = getApplication<Application>()+ val file = pendingApkInstall ?: return+ pendingApkInstall = null+ if (ctx.packageManager.canRequestPackageInstalls()) {+ launchApkInstallFile(file)+ } else {+ emit(ctx.getString(R.string.install_permission_denied))+ }+}++private fun FilesViewModel.launchApkInstallFile(file: File) {+ val ctx = getApplication<Application>()+ val uri = try {+ FileProvider.getUriForFile(ctx, "${ctx.packageName}.fileprovider", file)+ } catch (e: Exception) {+ emitMoveFailed(e)+ return+ }+ val intent = Intent(Intent.ACTION_VIEW).apply {+ setDataAndType(uri, "application/vnd.android.package-archive")+ flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION+ }+ viewModelScope.launch { _intents.emit(intent) }+}
files/src/main/java/com/vayunmathur/files/platform/FilesClipboard.kt
diff --git a/files/src/main/java/com/vayunmathur/files/platform/FilesClipboard.kt b/files/src/main/java/com/vayunmathur/files/platform/FilesClipboard.ktindex bd985e91fe..9e5f41d09d 100644--- a/files/src/main/java/com/vayunmathur/files/platform/FilesClipboard.kt+++ b/files/src/main/java/com/vayunmathur/files/platform/FilesClipboard.kt@@ -1,7 +1,10 @@ package com.vayunmathur.files.platform import android.app.Application+import android.content.Context import android.content.Intent+import android.net.Uri+import android.provider.OpenableColumns import android.webkit.MimeTypeMap import androidx.core.content.FileProvider import androidx.lifecycle.viewModelScope@@ -119,3 +122,44 @@ internal fun FilesViewModel.archiveSelection(archiveName: String) { clearSelection() emit(ctx.getString(R.string.archiving_started)) }++internal fun FilesViewModel.saveSharedUrisHere() {+ if (isZipMode()) return+ val ctx = getApplication<Application>()+ val uris = _incomingUris.value ?: return+ val target = _currentDirectory.value+ viewModelScope.launch(Dispatchers.IO) {+ var lastError: Exception? = null+ uris.forEach { uri ->+ try {+ saveUriToPath(ctx, uri, target)+ } catch (e: Exception) {+ lastError = e+ }+ }+ clearIncomingUris()+ loadDirectory()+ lastError?.let { emitMoveFailed(it) }+ ?: viewModelScope.launch { _snackbarMessages.emit(ctx.getString(R.string.files_saved)) }+ }+}++private fun saveUriToPath(context: Context, uri: Uri, targetDir: File) {+ val name = getSharedFileName(context, uri) ?: "shared_file_${System.currentTimeMillis()}"+ val targetFile = File(targetDir, name)+ context.contentResolver.openInputStream(uri)?.use { input ->+ targetFile.outputStream().use { out -> input.copyTo(out) }+ }+}++private fun getSharedFileName(context: Context, uri: Uri): String? {+ if (uri.scheme == "content") {+ context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->+ if (cursor.moveToFirst()) {+ val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)+ if (nameIndex != -1) return cursor.getString(nameIndex)+ }+ }+ }+ return uri.path?.substringAfterLast('/')+}
files/src/main/java/com/vayunmathur/files/platform/FilesTrash.kt
diff --git a/files/src/main/java/com/vayunmathur/files/platform/FilesTrash.kt b/files/src/main/java/com/vayunmathur/files/platform/FilesTrash.ktnew file mode 100644index 0000000000..2360b122f7--- /dev/null+++ b/files/src/main/java/com/vayunmathur/files/platform/FilesTrash.kt@@ -0,0 +1,197 @@+package com.vayunmathur.files.platform++import android.app.Application+import android.app.PendingIntent+import android.content.ContentResolver+import android.content.ContentUris+import android.content.Context+import android.net.Uri+import android.os.Bundle+import android.provider.MediaStore+import androidx.lifecycle.viewModelScope+import com.vayunmathur.files.R+import kotlinx.coroutines.Dispatchers+import kotlinx.coroutines.launch+import java.io.File++/**+ * System-trash (MediaStore) helpers behind [FilesViewModel]'s trash-first delete.+ *+ * This is the platform trash, not an app-owned `.trash` folder: trashed items live in the+ * shared MediaStore trash with 30-day auto-delete, restore, and per-batch user-consent dialogs.+ * Only MediaStore-indexed files resolve to trashable Uris; directories and unindexed files+ * cannot be trashed and fall back to a permanent-delete confirmation.+ *+ * Split out like `FilesClipboard.kt` so FilesViewModel.kt stays under the FileLength limit.+ */++/** MediaStore Uris for the subset of [files] that the platform can trash. */+internal fun resolveTrashableUris(context: Context, files: List<File>): Map<File, Uri> {+ if (files.isEmpty()) return emptyMap()+ val collection = MediaStore.Files.getContentUri("external")+ val out = mutableMapOf<File, Uri>()+ for (file in files) {+ if (file.isDirectory) continue+ try {+ context.contentResolver.query(+ collection,+ arrayOf(MediaStore.MediaColumns._ID),+ "${MediaStore.MediaColumns.DATA}=?",+ arrayOf(file.absolutePath),+ null,+ )?.use { c ->+ if (c.moveToFirst()) {+ out[file] = ContentUris.withAppendedId(collection, c.getLong(0))+ }+ }+ } catch (_: Exception) {+ }+ }+ return out+}++/** All items currently in the system trash, newest first. Files only โ the platform trash. */+internal fun queryTrashedItems(context: Context, limit: Int = 2000): List<FileBrowserItem> {+ val collection = MediaStore.Files.getContentUri("external")+ val projection = arrayOf(+ MediaStore.MediaColumns._ID,+ MediaStore.MediaColumns.DISPLAY_NAME,+ MediaStore.MediaColumns.DATA,+ MediaStore.MediaColumns.SIZE,+ MediaStore.MediaColumns.DATE_MODIFIED,+ )+ val queryArgs = Bundle().apply {+ putInt(MediaStore.QUERY_ARG_MATCH_TRASHED, MediaStore.MATCH_ONLY)+ putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, "${MediaStore.MediaColumns.DATE_MODIFIED} DESC")+ putInt(ContentResolver.QUERY_ARG_LIMIT, limit)+ }+ val out = mutableListOf<FileBrowserItem>()+ try {+ context.contentResolver.query(collection, projection, queryArgs, null)?.use { c ->+ val idIdx = c.getColumnIndexOrThrow(MediaStore.MediaColumns._ID)+ val nameIdx = c.getColumnIndexOrThrow(MediaStore.MediaColumns.DISPLAY_NAME)+ val dataIdx = c.getColumnIndexOrThrow(MediaStore.MediaColumns.DATA)+ val sizeIdx = c.getColumnIndexOrThrow(MediaStore.MediaColumns.SIZE)+ val dateIdx = c.getColumnIndexOrThrow(MediaStore.MediaColumns.DATE_MODIFIED)+ while (c.moveToNext()) {+ val data = c.getString(dataIdx) ?: continue+ val file = File(data)+ val displayName = c.getString(nameIdx) ?: file.name+ out.add(+ FileBrowserItem(+ name = displayName,+ isDirectory = false,+ size = c.getLong(sizeIdx).takeIf { !c.isNull(sizeIdx) },+ realFile = file,+ zipInnerPath = null,+ key = "trash:${c.getLong(idIdx)}",+ lastModified = c.getLong(dateIdx).takeIf { !c.isNull(dateIdx) }?.times(1000) ?: 0L,+ mediaUri = ContentUris.withAppendedId(collection, c.getLong(idIdx)),+ ),+ )+ }+ }+ } catch (_: Exception) {+ }+ return out+}++/** Consent-gated request to move [uris] to (or restore from) the system trash. */+internal fun trashPendingIntent(context: Context, uris: List<Uri>, trash: Boolean): PendingIntent =+ MediaStore.createTrashRequest(context.contentResolver, uris, trash)++/** Consent-gated request to permanently delete [uris] from the system trash. */+internal fun deleteForeverPendingIntent(context: Context, uris: List<Uri>): PendingIntent =+ MediaStore.createDeleteRequest(context.contentResolver, uris)++internal fun FilesViewModel.trashSelection() {+ val selection = _selectedPaths.value.toList()+ if (selection.isEmpty()) return+ viewModelScope.launch(Dispatchers.IO) {+ val ctx = getApplication<Application>()+ val trashable = resolveTrashableUris(ctx, selection.mapNotNull { it.realFile })+ val untrashable = selection.filter { it.realFile !in trashable }+ if (trashable.isNotEmpty()) {+ clearSelection()+ loadDirectory()+ _pendingTrashMessage = ctx.getString(R.string.moved_to_trash, trashable.size)+ _trashConsentRequests.emit(trashPendingIntent(ctx, trashable.values.toList(), true))+ }+ if (untrashable.isNotEmpty()) {+ _pendingPermanentDelete.value = untrashable+ }+ }+}++/**+ * Permanently deletes the items the system trash cannot take. Shown only after the user+ * confirms, and only reachable for folders / files with no MediaStore entry.+ */+internal fun FilesViewModel.confirmPendingPermanentDelete() {+ val pending = _pendingPermanentDelete.value ?: return+ _pendingPermanentDelete.value = null+ viewModelScope.launch(Dispatchers.IO) {+ pending.mapNotNull { it.realFile }.forEach { it.deleteRecursively() }+ clearSelection()+ loadDirectory()+ }+}++/** Reloads the system-trash listing. Called by the navigation layer for a `Route.Trash`. */+internal fun FilesViewModel.loadTrash() {+ _trashSelection.value = emptySet()+ viewModelScope.launch(Dispatchers.IO) {+ _trashedItems.value = queryTrashedItems(getApplication())+ }+}++internal fun FilesViewModel.restoreTrashed() {+ val selection = _trashSelection.value.toList()+ if (selection.isEmpty()) return+ viewModelScope.launch(Dispatchers.IO) {+ val ctx = getApplication<Application>()+ val uris = selection.mapNotNull { it.mediaUri ?: it.realFile?.let { f -> resolveTrashableUris(ctx, listOf(f))[f] } }+ if (uris.isEmpty()) return@launch+ _trashSelection.value = emptySet()+ _pendingTrashMessage = ctx.getString(R.string.restored_n, uris.size)+ _trashConsentRequests.emit(trashPendingIntent(ctx, uris, false))+ }+}++internal fun FilesViewModel.deleteTrashedForever() {+ val selection = _trashSelection.value.toList()+ if (selection.isEmpty()) return+ viewModelScope.launch(Dispatchers.IO) {+ val ctx = getApplication<Application>()+ val uris = selection.mapNotNull { it.mediaUri ?: it.realFile?.let { f -> resolveTrashableUris(ctx, listOf(f))[f] } }+ if (uris.isEmpty()) return@launch+ _trashSelection.value = emptySet()+ _pendingTrashMessage = ctx.getString(R.string.deleted_forever_n, uris.size)+ _trashConsentRequests.emit(deleteForeverPendingIntent(ctx, uris))+ }+}++internal fun FilesViewModel.emptySystemTrash() {+ viewModelScope.launch(Dispatchers.IO) {+ val ctx = getApplication<Application>()+ val items = queryTrashedItems(ctx)+ if (items.isEmpty()) return@launch+ val uris = items.mapNotNull { it.mediaUri }+ if (uris.isEmpty()) return@launch+ _trashSelection.value = emptySet()+ _pendingTrashMessage = ctx.getString(R.string.deleted_forever_n, uris.size)+ _trashConsentRequests.emit(deleteForeverPendingIntent(ctx, uris))+ }+}++/** Called after a trash/restore/delete consent dialog resolves; refreshes both listings. */+internal fun FilesViewModel.onTrashConsentResolved(granted: Boolean) {+ loadDirectory()+ viewModelScope.launch(Dispatchers.IO) {+ _trashedItems.value = queryTrashedItems(getApplication())+ }+ if (granted) {+ _pendingTrashMessage?.let { emit(it) }+ }+ _pendingTrashMessage = null+}
files/src/main/java/com/vayunmathur/files/platform/FilesUiContract.kt
diff --git a/files/src/main/java/com/vayunmathur/files/platform/FilesUiContract.kt b/files/src/main/java/com/vayunmathur/files/platform/FilesUiContract.ktindex 442ced6383..82953e28dc 100644--- a/files/src/main/java/com/vayunmathur/files/platform/FilesUiContract.kt+++ b/files/src/main/java/com/vayunmathur/files/platform/FilesUiContract.kt@@ -85,6 +85,10 @@ interface FilesActions { fun rename(item: FileBrowserItem, newName: String) {} fun deleteSelection() {}+ /** Confirms permanent deletion of items the system trash cannot take (folders, unindexed). */+ fun confirmPermanentDelete() {}+ /** Dismisses the permanent-delete confirmation without deleting. */+ fun dismissPermanentDelete() {} fun moveInto(sources: List<File>, target: File) {} fun moveToBreadcrumb(sources: List<File>, target: File) {} @@ -126,6 +130,14 @@ interface FilesActions { fun addBookmark(item: FileBrowserItem) {} fun removeBookmark(path: File) {} + // ---- System trash ----+ fun openTrash() {}+ fun toggleTrashSelection(item: FileBrowserItem) {}+ fun clearTrashSelection() {}+ fun restoreTrashSelection() {}+ fun deleteForeverTrashSelection() {}+ fun emptyTrash() {}+ companion object { val Noop: FilesActions = object : FilesActions {} }
files/src/main/java/com/vayunmathur/files/platform/FilesViewModel.kt
diff --git a/files/src/main/java/com/vayunmathur/files/platform/FilesViewModel.kt b/files/src/main/java/com/vayunmathur/files/platform/FilesViewModel.ktindex c8b066dec0..92b6c9e000 100644--- a/files/src/main/java/com/vayunmathur/files/platform/FilesViewModel.kt+++ b/files/src/main/java/com/vayunmathur/files/platform/FilesViewModel.kt@@ -1,13 +1,13 @@ package com.vayunmathur.files.platform import android.app.Application+import android.app.PendingIntent import android.content.Context import android.content.Intent import android.net.Uri import android.os.Environment import android.os.FileObserver import android.os.StatFs-import android.provider.OpenableColumns import android.text.format.Formatter import android.webkit.MimeTypeMap import androidx.core.content.FileProvider@@ -44,6 +44,11 @@ data class FileBrowserItem( val zipInnerPath: String?, val key: String, val lastModified: Long = 0L,+ /**+ * MediaStore content URI, set only for items listed from the system trash. Lets the+ * trash screen restore / delete them without re-resolving the path.+ */+ val mediaUri: Uri? = null, ) class FilesViewModel(application: Application) : AndroidViewModel(application), FilesActions {@@ -285,6 +290,8 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), _zipPath.value = null _zipInternalPath.value = "" clearSelection()+ _trashSelection.value = emptySet()+ _pendingPermanentDelete.value = null observerJob?.cancel() loadHome() }@@ -382,14 +389,14 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), com.vayunmathur.files.platform.uniqueDestination(dir, name) // ---- Share URIs ----- private val _incomingUris = MutableStateFlow<List<Uri>?>(null)+ internal val _incomingUris = MutableStateFlow<List<Uri>?>(null) val incomingUris: StateFlow<List<Uri>?> = _incomingUris.asStateFlow() fun setIncomingUris(uris: List<Uri>) { _incomingUris.value = uris } fun clearIncomingUris() { _incomingUris.value = null } // ---- Events ----- private val _snackbarMessages = MutableSharedFlow<String>(extraBufferCapacity = 8)+ internal val _snackbarMessages = MutableSharedFlow<String>(extraBufferCapacity = 8) val snackbarMessages: SharedFlow<String> = _snackbarMessages.asSharedFlow() internal val _intents = MutableSharedFlow<Intent>(extraBufferCapacity = 4)@@ -465,6 +472,8 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), _currentDirectory.value = path applyDirDefaults(path) clearSelection()+ _trashSelection.value = emptySet()+ _pendingPermanentDelete.value = null loadDirectory() restartObserver() }@@ -521,14 +530,50 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), override fun deleteSelection() { if (isZipMode()) return- val selection = _selectedPaths.value.mapNotNull { it.realFile }- viewModelScope.launch(Dispatchers.IO) {- selection.forEach { it.deleteRecursively() }- clearSelection()- loadDirectory()+ trashSelection()+ }++ override fun confirmPermanentDelete() {+ if (isZipMode()) return+ confirmPendingPermanentDelete()+ }++ override fun dismissPermanentDelete() {+ _pendingPermanentDelete.value = null+ }++ /** Reloads the system-trash listing. Called by the navigation layer for a `Route.Trash`. */+ fun showTrash() {+ _categoryTitle.value = null+ _zipPath.value = null+ _zipInternalPath.value = ""+ clearSelection()+ observerJob?.cancel()+ loadTrash()+ }++ override fun toggleTrashSelection(item: FileBrowserItem) {+ val current = _trashSelection.value+ _trashSelection.value = if (current.any { it.key == item.key }) {+ current.filterNot { it.key == item.key }.toSet()+ } else {+ current + item } } + override fun clearTrashSelection() {+ if (_trashSelection.value.isNotEmpty()) _trashSelection.value = emptySet()+ }++ override fun restoreTrashSelection() = restoreTrashed()++ override fun deleteForeverTrashSelection() = deleteTrashedForever()++ override fun emptyTrash() = emptySystemTrash()++ /** Called after a trash/restore/delete consent dialog resolves; refreshes both listings. */+ fun onTrashConsentResult(granted: Boolean) = onTrashConsentResolved(granted)+ override fun moveInto(sources: List<File>, target: File) { if (isZipMode()) return if (!target.isDirectory) return@@ -630,26 +675,7 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), } } - override fun saveIncomingUris() {- if (isZipMode()) return- val ctx = getApplication<Application>()- val uris = _incomingUris.value ?: return- val target = _currentDirectory.value- viewModelScope.launch(Dispatchers.IO) {- var lastError: Exception? = null- uris.forEach { uri ->- try {- saveUriToPath(ctx, uri, target)- } catch (e: Exception) {- lastError = e- }- }- clearIncomingUris()- loadDirectory()- lastError?.let { emitMoveFailed(it) }- ?: viewModelScope.launch { _snackbarMessages.emit(ctx.getString(R.string.files_saved)) }- }- }+ override fun saveIncomingUris() = saveSharedUrisHere() override fun openFile(item: FileBrowserItem) { val ctx = getApplication<Application>()@@ -675,54 +701,37 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), // ---- APK install ---- /** The APK waiting to be installed once the user grants the "install unknown apps" permission. */- private var pendingApkInstall: File? = null+ internal var pendingApkInstall: File? = null - private val _installPermissionRequests = MutableSharedFlow<Unit>(extraBufferCapacity = 1)+ internal val _installPermissionRequests = MutableSharedFlow<Unit>(extraBufferCapacity = 1) /** Emitted when an APK was tapped but Files lacks permission to install; UI opens settings. */ val installPermissionRequests: SharedFlow<Unit> = _installPermissionRequests.asSharedFlow() - override fun installApk(item: FileBrowserItem) {- val ctx = getApplication<Application>()- if (isZipMode()) {- emit(ctx.getString(R.string.zip_browse_only))- return- }- val file = item.realFile ?: return- if (ctx.packageManager.canRequestPackageInstalls()) {- launchApkInstall(file)- } else {- pendingApkInstall = file- emit(ctx.getString(R.string.install_permission_needed))- _installPermissionRequests.tryEmit(Unit)- }- }+ // ---- System trash ----+ internal val _trashedItems = MutableStateFlow<List<FileBrowserItem>>(emptyList())+ val trashedItems: StateFlow<List<FileBrowserItem>> = _trashedItems.asStateFlow() - /** Called by the UI after returning from the "install unknown apps" settings screen. */- fun onInstallPermissionResult() {- val ctx = getApplication<Application>()- val file = pendingApkInstall ?: return- pendingApkInstall = null- if (ctx.packageManager.canRequestPackageInstalls()) {- launchApkInstall(file)- } else {- emit(ctx.getString(R.string.install_permission_denied))- }- }+ internal val _trashSelection = MutableStateFlow<Set<FileBrowserItem>>(emptySet())+ val trashSelection: StateFlow<Set<FileBrowserItem>> = _trashSelection.asStateFlow() - private fun launchApkInstall(file: File) {- val ctx = getApplication<Application>()- val uri = try {- FileProvider.getUriForFile(ctx, "${ctx.packageName}.fileprovider", file)- } catch (e: Exception) {- emitMoveFailed(e)- return- }- val intent = Intent(Intent.ACTION_VIEW).apply {- setDataAndType(uri, "application/vnd.android.package-archive")- flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION- }- viewModelScope.launch { _intents.emit(intent) }- }+ internal val _pendingPermanentDelete = MutableStateFlow<List<FileBrowserItem>?>(null)+ val pendingPermanentDelete: StateFlow<List<FileBrowserItem>?> = _pendingPermanentDelete.asStateFlow()++ /**+ * System trash/restore/delete consent requests. Every MediaStore trash mutation needs a+ * user-confirmed PendingIntent, so the UI fires these via StartIntentSenderForResult โ+ * same shape as [installPermissionRequests].+ */+ internal val _trashConsentRequests = MutableSharedFlow<PendingIntent>(extraBufferCapacity = 4)+ val trashConsentRequests: SharedFlow<PendingIntent> = _trashConsentRequests.asSharedFlow()++ /** Snackbar for the operation whose consent dialog just resolved. Set before emitting. */+ internal var _pendingTrashMessage: String? = null++ override fun installApk(item: FileBrowserItem) = installApkFile(item)++ /** Called by the UI after returning from the "install unknown apps" settings screen. */+ fun onInstallPermissionResult() = onApkInstallPermissionResult() fun showMessage(message: String) { emit(message) } internal fun emit(message: String) { viewModelScope.launch { _snackbarMessages.emit(message) } }@@ -730,26 +739,6 @@ class FilesViewModel(application: Application) : AndroidViewModel(application), emit(getApplication<Application>().getString(R.string.move_failed, e.localizedMessage)) } - private fun saveUriToPath(context: Context, uri: Uri, targetDir: File) {- val name = getFileName(context, uri) ?: "shared_file_${System.currentTimeMillis()}"- val targetFile = File(targetDir, name)- context.contentResolver.openInputStream(uri)?.use { input ->- targetFile.outputStream().use { out -> input.copyTo(out) }- }- }-- private fun getFileName(context: Context, uri: Uri): String? {- if (uri.scheme == "content") {- context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->- if (cursor.moveToFirst()) {- val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)- if (nameIndex != -1) return cursor.getString(nameIndex)- }- }- }- return uri.path?.substringAfterLast('/')- }- private fun listRealDir(dir: File): Pair<List<FileBrowserItem>, List<FileBrowserItem>> = listRealDirItems(dir, _showHidden.value)
files/src/main/java/com/vayunmathur/files/platform/TrashUiContract.kt
diff --git a/files/src/main/java/com/vayunmathur/files/platform/TrashUiContract.kt b/files/src/main/java/com/vayunmathur/files/platform/TrashUiContract.ktnew file mode 100644index 0000000000..0942382b7d--- /dev/null+++ b/files/src/main/java/com/vayunmathur/files/platform/TrashUiContract.kt@@ -0,0 +1,13 @@+package com.vayunmathur.files.platform++/**+ * The UI contract for the system-trash screen.+ *+ * Mirrors [FilesUiState]: the screen takes this state plus the shared [FilesActions] rather+ * than the ViewModel itself, so it can be rendered by a `@Preview`.+ */+data class TrashUiState(+ /** Items currently in the system trash, newest first. */+ val items: List<FileBrowserItem> = emptyList(),+ val selectedItems: Set<FileBrowserItem> = emptySet(),+)
files/src/main/java/com/vayunmathur/files/ui/DirectoryDialogs.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/DirectoryDialogs.kt b/files/src/main/java/com/vayunmathur/files/ui/DirectoryDialogs.ktindex d8cb8e4fe4..2248d65df8 100644--- a/files/src/main/java/com/vayunmathur/files/ui/DirectoryDialogs.kt+++ b/files/src/main/java/com/vayunmathur/files/ui/DirectoryDialogs.kt@@ -72,3 +72,27 @@ internal fun SectionHeader(text: String) { modifier = Modifier.padding(start = 16.dp, top = 16.dp, bottom = 4.dp), ) }++/**+ * Confirms permanent deletion of items the system trash cannot take (folders, files with no+ * MediaStore entry). Shared between the directory flow and the trash screen's empty-trash+ * path, so it lives here next to [NameDialog].+ */+@Composable+internal fun PermanentDeleteDialog(+ count: Int,+ onConfirm: () -> Unit,+ onDismiss: () -> Unit,+) {+ AlertDialog(+ onDismissRequest = onDismiss,+ title = { Text(stringResource(R.string.delete_permanently_title, count)) },+ text = { Text(stringResource(R.string.delete_permanently_message)) },+ confirmButton = {+ TextButton(onClick = onConfirm) { Text(stringResource(R.string.delete)) }+ },+ dismissButton = {+ TextButton(onClick = onDismiss) { Text(stringResource(UiR.string.cancel)) }+ },+ )+}
files/src/main/java/com/vayunmathur/files/ui/FilesNavActions.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/FilesNavActions.kt b/files/src/main/java/com/vayunmathur/files/ui/FilesNavActions.ktindex adfebda2ea..c3704ccb82 100644--- a/files/src/main/java/com/vayunmathur/files/ui/FilesNavActions.kt+++ b/files/src/main/java/com/vayunmathur/files/ui/FilesNavActions.kt@@ -47,6 +47,10 @@ internal fun filesNavActions( } } + override fun openTrash() {+ backStack.reset(Route.Home, Route.Trash)+ }+ /** * Serves both descending into a child folder and tapping an ancestor in the breadcrumb bar. A * target already on the stack is popped back to, so jumping up does not stack a second copy of a
files/src/main/java/com/vayunmathur/files/ui/FilesShell.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/FilesShell.kt b/files/src/main/java/com/vayunmathur/files/ui/FilesShell.ktindex 2944d00384..e6765f3fc2 100644--- a/files/src/main/java/com/vayunmathur/files/ui/FilesShell.kt+++ b/files/src/main/java/com/vayunmathur/files/ui/FilesShell.kt@@ -112,8 +112,38 @@ fun FilesShell( } } else { val bookmarks by viewModel.bookmarks.collectAsState()+ val pendingPermanentDelete by viewModel.pendingPermanentDelete.collectAsState() val drawerState = rememberDrawerState(DrawerValue.Closed) val scope = rememberCoroutineScope()++ // Exactly one collector for the system trash-consent dialogs, above the nav host:+ // both the directory delete flow and the trash screen emit into the same flow.+ val trashConsentLauncher =+ rememberLauncherForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result ->+ viewModel.onTrashConsentResult(result.resultCode == android.app.Activity.RESULT_OK)+ }+ LaunchedEffect(Unit) {+ viewModel.trashConsentRequests.collect { pendingIntent ->+ try {+ trashConsentLauncher.launch(+ androidx.activity.result.IntentSenderRequest.Builder(pendingIntent.intentSender).build(),+ )+ } catch (_: Exception) {+ viewModel.showMessage(context.getString(R.string.trash_request_failed))+ }+ }+ }++ // Permanent-delete confirmation for items the system trash cannot take (folders,+ // unindexed files). Shared by the directory and trash flows, so it sits above both.+ pendingPermanentDelete?.let { pending ->+ PermanentDeleteDialog(+ count = pending.size,+ onConfirm = { actions.confirmPermanentDelete() },+ onDismiss = { actions.dismissPermanentDelete() },+ )+ }+ ModalNavigationDrawer( drawerState = drawerState, drawerContent = {@@ -189,6 +219,12 @@ private fun FilesDrawer( selected = false, onClick = { go { actions.openCategory(FileCategory.DOWNLOADS) } }, )+ NavigationDrawerItem(+ label = { Text(stringResource(R.string.trash)) },+ icon = { IconDelete() },+ selected = false,+ onClick = { go { actions.openTrash() } },+ ) if (bookmarks.isNotEmpty()) { HomeSectionHeader(stringResource(R.string.bookmarks)) bookmarks.forEach { bm ->
files/src/main/java/com/vayunmathur/files/ui/HomeScreen.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/HomeScreen.kt b/files/src/main/java/com/vayunmathur/files/ui/HomeScreen.ktindex 6d3d6ab011..7e0c29fcab 100644--- a/files/src/main/java/com/vayunmathur/files/ui/HomeScreen.kt+++ b/files/src/main/java/com/vayunmathur/files/ui/HomeScreen.kt@@ -52,6 +52,15 @@ fun HomeScreen( ) } + item {+ HomeRow(+ leading = { IconDelete(tint = MaterialTheme.colorScheme.outline) },+ title = stringResource(R.string.trash),+ subtitle = stringResource(R.string.trash_auto_delete_note),+ onClick = { actions.openTrash() },+ )+ }+ item { HomeSectionHeader(stringResource(R.string.categories)) } item { Row(
files/src/main/java/com/vayunmathur/files/ui/TrashPage.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/TrashPage.kt b/files/src/main/java/com/vayunmathur/files/ui/TrashPage.ktnew file mode 100644index 0000000000..1200ca12e9--- /dev/null+++ b/files/src/main/java/com/vayunmathur/files/ui/TrashPage.kt@@ -0,0 +1,57 @@+package com.vayunmathur.files.ui++import androidx.activity.compose.rememberLauncherForActivityResult+import androidx.activity.result.contract.ActivityResultContracts+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.SideEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import com.vayunmathur.files.platform.FilesActions+import com.vayunmathur.files.platform.FilesViewModel+import com.vayunmathur.files.platform.TrashUiState+import com.vayunmathur.library.ui.SnackbarHostState++/**+ * Binds [FilesViewModel] to the stateless [TrashScreen].+ *+ * Same shape as [DirectoryPage]: collects flows and freezes the outgoing screen with the+ * `lastShown` pattern while it animates away. The system trash-consent launcher and the+ * permanent-delete dialog live in [FilesShell], above the nav host, so there is exactly one+ * collector no matter which screen initiated the trash operation.+ */+@Composable+fun TrashPage(+ viewModel: FilesViewModel,+ actions: FilesActions,+ isCurrent: Boolean,+ onOpenDrawer: () -> Unit = {},+) {+ val snackbarHostState = remember { SnackbarHostState() }++ val trashedItems by viewModel.trashedItems.collectAsState()+ val trashSelection by viewModel.trashSelection.collectAsState()++ LaunchedEffect(snackbarHostState) {+ viewModel.snackbarMessages.collect { message ->+ snackbarHostState.showSnackbar(message)+ }+ }++ val liveState = TrashUiState(+ items = trashedItems,+ selectedItems = trashSelection,+ )+ var lastShown by remember { mutableStateOf(liveState) }+ if (isCurrent) SideEffect { lastShown = liveState }++ TrashScreen(+ state = if (isCurrent) liveState else lastShown,+ actions = actions,+ snackbarHostState = snackbarHostState,+ onOpenDrawer = onOpenDrawer,+ )+}
files/src/main/java/com/vayunmathur/files/ui/TrashScreen.kt
diff --git a/files/src/main/java/com/vayunmathur/files/ui/TrashScreen.kt b/files/src/main/java/com/vayunmathur/files/ui/TrashScreen.ktnew file mode 100644index 0000000000..05185717ca--- /dev/null+++ b/files/src/main/java/com/vayunmathur/files/ui/TrashScreen.kt@@ -0,0 +1,183 @@+package com.vayunmathur.files.ui++import android.text.format.Formatter+import androidx.activity.compose.BackHandler+import androidx.compose.foundation.background+import androidx.compose.foundation.combinedClickable+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import com.vayunmathur.files.R+import com.vayunmathur.files.platform.FileBrowserItem+import com.vayunmathur.files.platform.FilesActions+import com.vayunmathur.files.platform.TrashUiState+import com.vayunmathur.library.ui.AlertDialog+import com.vayunmathur.library.ui.AppScaffold+import com.vayunmathur.library.ui.HorizontalDivider+import com.vayunmathur.library.ui.IconButton+import com.vayunmathur.library.ui.IconClose+import com.vayunmathur.library.ui.IconDeleteForever+import com.vayunmathur.library.ui.IconMenu+import com.vayunmathur.library.ui.IconMoreVert+import com.vayunmathur.library.ui.IconRestore+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.ListItemDefaults+import com.vayunmathur.library.ui.DropdownMenu+import com.vayunmathur.library.ui.DropdownMenuItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.SnackbarHost+import com.vayunmathur.library.ui.SnackbarHostState+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.TextButton+import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.library.ui.R as UiR++/**+ * The system-trash browser, with no dependency on the ViewModel so it can be rendered from a+ * `@Preview` โ same split as [DirectoryScreen].+ */+@Composable+fun TrashScreen(+ state: TrashUiState,+ actions: FilesActions,+ snackbarHostState: SnackbarHostState = remember { SnackbarHostState() },+ onOpenDrawer: () -> Unit = {},+) {+ var showEmptyConfirm by remember { mutableStateOf(false) }+ var showOverflow by remember { mutableStateOf(false) }++ if (showEmptyConfirm) {+ AlertDialog(+ onDismissRequest = { showEmptyConfirm = false },+ title = { Text(stringResource(R.string.empty_trash)) },+ text = { Text(stringResource(R.string.delete_permanently_message)) },+ confirmButton = {+ TextButton(+ onClick = {+ actions.emptyTrash()+ showEmptyConfirm = false+ },+ ) { Text(stringResource(R.string.delete_forever)) }+ },+ dismissButton = {+ TextButton(onClick = { showEmptyConfirm = false }) {+ Text(stringResource(UiR.string.cancel))+ }+ },+ )+ }++ BackHandler(state.selectedItems.isNotEmpty()) {+ actions.clearTrashSelection()+ }++ AppScaffold(+ snackbarHost = { SnackbarHost(snackbarHostState) },+ navigationIcon = {+ if (state.selectedItems.isEmpty()) {+ IconButton(onClick = onOpenDrawer) { IconMenu() }+ }+ },+ title = { Text(stringResource(R.string.trash)) },+ actions = {+ if (state.selectedItems.isNotEmpty()) {+ IconButton(onClick = { actions.clearTrashSelection() }) { IconClose() }+ IconButton(onClick = { actions.restoreTrashSelection() }) { IconRestore() }+ IconButton(onClick = { actions.deleteForeverTrashSelection() }) { IconDeleteForever() }+ } else if (state.items.isNotEmpty()) {+ IconButton(onClick = { showOverflow = true }) { IconMoreVert() }+ DropdownMenu(+ expanded = showOverflow,+ onDismissRequest = { showOverflow = false },+ ) {+ DropdownMenuItem(+ text = { Text(stringResource(R.string.empty_trash)) },+ leadingIcon = { IconDeleteForever() },+ onClick = { showOverflow = false; showEmptyConfirm = true },+ )+ }+ }+ },+ scrollBehavior = appBarScrollBehavior(),+ ) { padding ->+ Column(Modifier.fillMaxSize().padding(padding)) {+ Text(+ stringResource(R.string.trash_auto_delete_note),+ style = MaterialTheme.typography.bodySmall,+ color = MaterialTheme.colorScheme.outline,+ modifier = Modifier.padding(horizontal = 16.dp, vertical = 8.dp),+ )+ if (state.items.isEmpty()) {+ Box(+ Modifier.weight(1f).fillMaxWidth(),+ contentAlignment = Alignment.Center,+ ) {+ Text(+ stringResource(R.string.trash_empty),+ color = MaterialTheme.colorScheme.outline,+ )+ }+ } else {+ LazyColumn(Modifier.weight(1f)) {+ items(state.items, key = { it.key }) { item ->+ val isSelected = state.selectedItems.any { it.key == item.key }+ TrashRow(+ item = item,+ isSelected = isSelected,+ onClick = {+ if (state.selectedItems.isNotEmpty()) actions.toggleTrashSelection(item)+ },+ onLongClick = { actions.toggleTrashSelection(item) },+ )+ HorizontalDivider(+ thickness = 0.5.dp, color = MaterialTheme.colorScheme.outlineVariant,+ )+ }+ }+ }+ }+ }+}++@Composable+private fun TrashRow(+ item: FileBrowserItem,+ isSelected: Boolean,+ onClick: () -> Unit,+ onLongClick: () -> Unit,+) {+ val context = LocalContext.current+ Box(+ modifier = Modifier+ .fillMaxWidth()+ .background(+ if (isSelected) MaterialTheme.colorScheme.surfaceVariant+ else Color.Transparent,+ )+ .combinedClickable(onClick = onClick, onLongClick = onLongClick),+ ) {+ ListItem(+ content = { Text(item.name.ifEmpty { "/" }) },+ leadingContent = { FileLeading(item, isSelected, 40.dp) },+ supportingContent = {+ item.size?.let { size -> Text(Formatter.formatShortFileSize(context, size)) }+ },+ colors = ListItemDefaults.colors(containerColor = Color.Transparent),+ )+ }+}
files/src/main/res/values/strings.xml
diff --git a/files/src/main/res/values/strings.xml b/files/src/main/res/values/strings.xmlindex a2a55b76bb..242172824e 100644--- a/files/src/main/res/values/strings.xml+++ b/files/src/main/res/values/strings.xml@@ -151,4 +151,31 @@ <string name="saf_save">Save</string> <!-- Button confirming a multi-file selection. %1$d = number selected --> <string name="saf_select_count">Select (<xliff:g id="count" example="3">%1$d</xliff:g>)</string>++ <!-- Navigation drawer + Home entry for the system trash -->+ <string name="trash">Trash</string>+ <!-- Trash screen: empty-state placeholder -->+ <string name="trash_empty">Trash is empty</string>+ <!-- Trash screen: caption explaining the system trash auto-deletes. Noun phrase -->+ <string name="trash_auto_delete_note">Items are permanently deleted after 30 days</string>+ <!-- Selection action: restore trashed items to their original location -->+ <string name="restore">Restore</string>+ <!-- Selection action: permanently delete trashed items -->+ <string name="delete_forever">Delete forever</string>+ <!-- Trash screen action: permanently delete everything in the trash -->+ <string name="empty_trash">Empty trash</string>+ <!-- Permanent-delete confirmation dialog title. %1$d = item count -->+ <string name="delete_permanently_title">Delete <xliff:g id="count" example="3">%1$d</xliff:g> item(s) permanently?</string>+ <!-- Permanent-delete confirmation dialog body: folders cannot use the system trash -->+ <string name="delete_permanently_message">This cannot be undone. Folders and some files cannot be moved to the trash.</string>+ <!-- Generic verb. Confirm permanent deletion -->+ <string name="delete">Delete</string>+ <!-- Snackbar after moving items to the system trash. %1$d = item count -->+ <string name="moved_to_trash"><xliff:g id="count" example="3">%1$d</xliff:g> item(s) moved to trash</string>+ <!-- Snackbar after restoring trashed items. %1$d = item count -->+ <string name="restored_n">Restored <xliff:g id="count" example="3">%1$d</xliff:g> item(s)</string>+ <!-- Snackbar after permanently deleting trashed items. %1$d = item count -->+ <string name="deleted_forever_n">Deleted <xliff:g id="count" example="3">%1$d</xliff:g> item(s) permanently</string>+ <!-- Snackbar when the system trash-consent dialog cannot be shown -->+ <string name="trash_request_failed">Could not open the trash request</string> </resources>
files/src/screenshotTest/kotlin/com/vayunmathur/files/MetadataPreviews.kt
diff --git a/files/src/screenshotTest/kotlin/com/vayunmathur/files/MetadataPreviews.kt b/files/src/screenshotTest/kotlin/com/vayunmathur/files/MetadataPreviews.ktindex c15a2de6d2..699c9d2bec 100644--- a/files/src/screenshotTest/kotlin/com/vayunmathur/files/MetadataPreviews.kt+++ b/files/src/screenshotTest/kotlin/com/vayunmathur/files/MetadataPreviews.kt@@ -6,6 +6,9 @@ import com.android.tools.screenshot.PreviewTest import com.vayunmathur.files.platform.FileBrowserItem import com.vayunmathur.files.platform.FilesActions import com.vayunmathur.files.platform.FilesUiState+import com.vayunmathur.files.platform.TrashUiState+import com.vayunmathur.files.ui.DirectoryScreen+import com.vayunmathur.files.ui.TrashScreen import com.vayunmathur.library.ui.DynamicTheme import java.io.File @@ -142,4 +145,21 @@ class MetadataPreviews { ) } }++ @PreviewTest+ @Preview(name = "4-trash", device = PHONE, showSystemUi = true)+ @Composable+ fun Preview4Trash() {+ DynamicTheme(darkTheme = true) {+ TrashScreen(+ state = TrashUiState(+ items = listOf(+ file("$ROOT/Download/receipts-june.pdf", 184_320),+ file("$ROOT/DCIM/IMG_2481.jpg", 3_145_728),+ ),+ ),+ actions = FilesActions.Noop,+ )+ }+ } }
library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt
diff --git a/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt b/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.ktindex 2c1c0e61a6..9206469d52 100644--- a/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt+++ b/library/ui/src/main/java/com/vayunmathur/library/ui/Icons.kt@@ -1382,6 +1382,11 @@ fun IconBluetooth(modifier: Modifier = Modifier, tint: Color = LocalContentColor fun IconUninstall(modifier: Modifier = Modifier, tint: Color = LocalContentColor.current) = AppIcon(Icons.Filled.DeleteForever, "Uninstall", modifier, tint) +/** Permanently deleting a trashed file, as opposed to [IconDelete], which moves it to trash. */+@Composable+fun IconDeleteForever(modifier: Modifier = Modifier, tint: Color = LocalContentColor.current) =+ AppIcon(Icons.Filled.DeleteForever, "Delete forever", modifier, tint)+ // --- Email composer rich formatting --- @Composable fun IconFormatQuote(modifier: Modifier = Modifier, tint: Color = LocalContentColor.current) =
metadata_data/photos/files/1.png
diff --git a/metadata_data/photos/files/1.png b/metadata_data/photos/files/1.pngindex e0f4a20536..e59b164ab3 100644Binary files a/metadata_data/photos/files/1.png and b/metadata_data/photos/files/1.png differ
metadata_data/photos/files/2.png
diff --git a/metadata_data/photos/files/2.png b/metadata_data/photos/files/2.pngindex bf154fe178..339ec0f448 100644Binary files a/metadata_data/photos/files/2.png and b/metadata_data/photos/files/2.png differ
metadata_data/photos/files/3.png
diff --git a/metadata_data/photos/files/3.png b/metadata_data/photos/files/3.pngindex 17f0b25e6a..3c1d0ba085 100644Binary files a/metadata_data/photos/files/3.png and b/metadata_data/photos/files/3.png differ
metadata_data/photos/files/4.png
diff --git a/metadata_data/photos/files/4.png b/metadata_data/photos/files/4.pngnew file mode 100644index 0000000000..e75ed4a15fBinary files /dev/null and b/metadata_data/photos/files/4.png differ