From 208747492f80030ef0fa9d6d4efe20bf91985ed1 Mon Sep 17 00:00:00 2001 From: LagradOst Date: Mon, 26 Jul 2021 00:33:02 +0200 Subject: [PATCH] soled append problem and small text fix --- .../cloudstream3/ui/search/SearchFragment.kt | 2 +- .../cloudstream3/utils/VideoDownloadManager.kt | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt index 117110d1..94a425bc 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchFragment.kt @@ -105,7 +105,7 @@ class SearchFragment : Fragment() { } } builder.setTitle("Search Providers") - builder.setNegativeButton("Cancel") { _, _ -> } + builder.setNegativeButton("Ok") { _, _ -> } builder.show() } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt index 988aab21..10a07e66 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/VideoDownloadManager.kt @@ -448,7 +448,11 @@ object VideoDownloadManager { } } - val newFileUri = if (resume && currentExistingFile != null) currentExistingFile else { + var appendFile = false + val newFileUri = if (resume && currentExistingFile != null) { + appendFile = true + currentExistingFile + } else { val contentUri = MediaStore.Downloads.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY) // USE INSTEAD OF MediaStore.Downloads.EXTERNAL_CONTENT_URI @@ -456,10 +460,7 @@ object VideoDownloadManager { put(MediaStore.MediaColumns.DISPLAY_NAME, displayName) put(MediaStore.MediaColumns.TITLE, name) put(MediaStore.MediaColumns.MIME_TYPE, "video/mp4") - put( - MediaStore.MediaColumns.RELATIVE_PATH, - relativePath - ) + put(MediaStore.MediaColumns.RELATIVE_PATH, relativePath) } cr.insert( @@ -468,7 +469,7 @@ object VideoDownloadManager { ) ?: return ERROR_MEDIA_STORE_URI_CANT_BE_CREATED } - fileStream = cr.openOutputStream(newFileUri, "w") + fileStream = cr.openOutputStream(newFileUri, "w" + (if (appendFile) "a" else "")) ?: return ERROR_CONTENT_RESOLVER_CANT_OPEN_STREAM } else { // NORMAL NON SCOPED STORAGE FILE CREATION