diff --git a/app/build.gradle b/app/build.gradle index 5070f9a3e..770b779f8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -77,7 +77,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:38f1c0331c' + implementation 'com.github.SimpleMobileTools:Simple-Commons:69ac8d3f2f' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt index 9b11e1738..251978cbb 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt @@ -28,6 +28,7 @@ import com.bumptech.glide.request.target.Target import com.simplemobiletools.commons.dialogs.ColorPickerDialog import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.isNougatPlus @@ -101,7 +102,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener return } - initEditActivity() + handlePermission(PERMISSION_WRITE_STORAGE){ + if (!it) { + toast(R.string.no_storage_permissions) + finish() + } + initEditActivity() + } } override fun onResume() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt index 06a80e232..a207e0421 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/PickDirectoryDialog.kt @@ -112,7 +112,7 @@ class PickDirectoryDialog( activity.toast(R.string.source_and_destination_same) return@DirectoryAdapter } else if (isRPlus() && path.isBasePath(activity)) { - activity.toast(R.string.copy_to_restricted_folder_message) + activity.toast(R.string.system_folder_restriction) return@DirectoryAdapter } else { activity.handleLockedFolderOpening(path) { success -> diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt index 71915fcf7..d0ccf7c6a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/SaveAsDialog.kt @@ -5,7 +5,9 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.dialogs.FilePickerDialog import com.simplemobiletools.commons.extensions.* +import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.gallery.pro.R +import java.io.File import kotlinx.android.synthetic.main.dialog_save_as.view.* class SaveAsDialog( @@ -15,6 +17,9 @@ class SaveAsDialog( init { var realPath = path.getParentPath() + if (activity.isRestrictedWithSAFSdk30(realPath) && !activity.isInDownloadDir(realPath)) { + realPath = activity.getPicturesDirectoryPath(realPath) + } val view = activity.layoutInflater.inflate(R.layout.dialog_save_as, null).apply { save_as_path.text = "${activity.humanizePath(realPath).trimEnd('/')}/" @@ -74,15 +79,36 @@ class SaveAsDialog( if (activity.getDoesFilePathExist(newPath)) { val title = String.format(activity.getString(R.string.file_already_exists_overwrite), newFilename) ConfirmationDialog(activity, title) { - callback(newPath) - dismiss() + val newFile = File(newPath) + val isInDownloadDir = activity.isInDownloadDir(newPath) + val isInSubFolderInDownloadDir = activity.isInSubFolderInDownloadDir(newPath) + if (isRPlus() && isInDownloadDir && !isInSubFolderInDownloadDir && !newFile.canWrite()) { + val fileDirItem = arrayListOf(File(newPath).toFileDirItem(activity)) + val fileUris = activity.getFileUrisFromFileDirItems(fileDirItem).second + activity.updateSDK30Uris(fileUris) { success -> + if (success) { + selectPath(this, newPath) + } + } + } else { + selectPath(this, newPath) + } } } else { - callback(newPath) - dismiss() + selectPath(this, newPath) } } } } } + + private fun selectPath(alertDialog: AlertDialog, newPath: String) { + activity.handleSAFDialogSdk30(newPath) { + if (!it) { + return@handleSAFDialogSdk30 + } + callback(newPath) + alertDialog.dismiss() + } + } } diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index 4d48c14f3..ccf734a33 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -39,7 +39,6 @@ تعيين كمجلد افتراضي إلغاء التعيين كمجلد افتراضي إعادة ترتيب المجلدات عن طريق السحب - The system does not allow copying to this folder. فلترة الوسائط diff --git a/app/src/main/res/values-az/strings.xml b/app/src/main/res/values-az/strings.xml index b76450467..193d8abc1 100644 --- a/app/src/main/res/values-az/strings.xml +++ b/app/src/main/res/values-az/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filter media diff --git a/app/src/main/res/values-bn/strings.xml b/app/src/main/res/values-bn/strings.xml index e05dfec7f..df015b5ee 100644 --- a/app/src/main/res/values-bn/strings.xml +++ b/app/src/main/res/values-bn/strings.xml @@ -33,7 +33,6 @@ ডিফল্ট ফোল্ডার হিশেবে সেট করুন ডিফল্ট ফোল্ডার হিশেবে আর রাখবেন না Reorder folders by dragging - The system does not allow copying to this folder. মিডিয়া ফিল্টার করুন diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 5905e7c11..0143f7b1b 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filtr médií diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 9594febca..fbf944f33 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -33,7 +33,6 @@ Vælg som standardmappe Fravælg som standardmappe Omorganiser mapper ved at trække - The system does not allow copying to this folder. Filtrer medier diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 5d9d47f99..dc06aaae2 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -39,7 +39,6 @@ Als Standardordner festlegen Nicht mehr als Standardordner festlegen Neuordnung von Ordnern durch Ziehen - Das System lässt das Kopieren in diesen Ordner nicht zu. Medien filtern Bilder diff --git a/app/src/main/res/values-eo/strings.xml b/app/src/main/res/values-eo/strings.xml index 6063deed2..6ef72ba43 100644 --- a/app/src/main/res/values-eo/strings.xml +++ b/app/src/main/res/values-eo/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filter media Bildoj diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 1c8a7e6c9..17fbe1bf7 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -33,7 +33,6 @@ Poner como carpeta predeterminada Quitar como carpeta predeterminada Reordenar carpetas arrastrándolas - The system does not allow copying to this folder. Filtro de medios diff --git a/app/src/main/res/values-et/strings.xml b/app/src/main/res/values-et/strings.xml index 20c488c3f..6abe6f3b7 100644 --- a/app/src/main/res/values-et/strings.xml +++ b/app/src/main/res/values-et/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filter media diff --git a/app/src/main/res/values-eu/strings.xml b/app/src/main/res/values-eu/strings.xml index b2ef49e7b..63da7b83f 100644 --- a/app/src/main/res/values-eu/strings.xml +++ b/app/src/main/res/values-eu/strings.xml @@ -33,7 +33,6 @@ Ezarri lehenetsitako karpeta gisa Kendu karpeta lehenetsitako karpeta gisa Berrordenatu karpetak arrastatuz - The system does not allow copying to this folder. Iragazi multimedia diff --git a/app/src/main/res/values-fa/strings.xml b/app/src/main/res/values-fa/strings.xml index fe17c994f..0c07381ba 100644 --- a/app/src/main/res/values-fa/strings.xml +++ b/app/src/main/res/values-fa/strings.xml @@ -33,7 +33,6 @@ تنظیم به عنوان شاخهٔ پیش‌گزیده برداشتن تنظیم به عنوان شاخهٔ پیش‌گزیده مرتب‌سازی مجدد شاخه‌ها با کشیدن - The system does not allow copying to this folder. پالایش رسانه diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index a85d13d2d..522afec47 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -39,7 +39,6 @@ Aseta oletushakemistoksi Älä käytä oletushakemistona Järjestä kansiot uudelleen vetämällä - The system does not allow copying to this folder. Suodata media diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index a41b4f747..509977471 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -33,7 +33,6 @@ Dossier par défaut Oublier le dossier Réordonner par glisser - Le système ne permet pas de copier dans ce dossier. Filtrer les médias Images diff --git a/app/src/main/res/values-gl/strings.xml b/app/src/main/res/values-gl/strings.xml index 63275b4ff..919261eea 100644 --- a/app/src/main/res/values-gl/strings.xml +++ b/app/src/main/res/values-gl/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filtrar medios Imaxes diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml index 602372a5b..ed620986c 100644 --- a/app/src/main/res/values-hr/strings.xml +++ b/app/src/main/res/values-hr/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filtriranje medija Slike @@ -420,4 +419,4 @@ Haven't found some strings? There's more at https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res --> - \ No newline at end of file + diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index 5be8c2978..551af46a6 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -39,7 +39,6 @@ Beállítás alapértelmezett mappaként Eltávolítás mint alapértelmezett mappa Mappák átrendezése húzással - The system does not allow copying to this folder. Médiafájlok szűrése diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index cc5fd711f..ef5eb54da 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filter media diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a9261b0e2..509096c0c 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -33,7 +33,6 @@ Imposta come cartella predefinita Non impostare come cartella predefinita Riordina cartelle trascinandole - Il sistema non permette di copiare in questa cartella. Filtra i file Immagini diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index e4f9613fd..df84ed5a3 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -33,7 +33,6 @@ デフォルトのフォルダとして設定 デフォルトのフォルダから外す Reorder folders by dragging - The system does not allow copying to this folder. 表示する形式 diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 6202d4ac7..dff518238 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. 필터 설정 diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml index 0602adfb1..79671dc62 100644 --- a/app/src/main/res/values-lt/strings.xml +++ b/app/src/main/res/values-lt/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filtruoti mediją diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index 332c83b36..618c3a99b 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -33,7 +33,6 @@ Sett som standardmappe Ikke lenger sett som standardmappe Endre mapperekkefølge ved å dra - The system does not allow copying to this folder. Filtrer media diff --git a/app/src/main/res/values-ne/strings.xml b/app/src/main/res/values-ne/strings.xml index 3b93230f7..3f1185114 100644 --- a/app/src/main/res/values-ne/strings.xml +++ b/app/src/main/res/values-ne/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filter media diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 063dff715..4842c3ad9 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -39,7 +39,6 @@ Definir como pasta padrão Indefinir como pasta padrão Reordenar as pastas ao arrastar - The system does not allow copying to this folder. Filtrar mídia diff --git a/app/src/main/res/values-pt/strings.xml b/app/src/main/res/values-pt/strings.xml index ce568e780..0379d0c3f 100644 --- a/app/src/main/res/values-pt/strings.xml +++ b/app/src/main/res/values-pt/strings.xml @@ -39,7 +39,6 @@ Utilizar como pasta padrão Deixar de utilizar como pasta padrão Organizar pasta por arrasto - The system does not allow copying to this folder. Filtrar multimédia diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index db0e7f08c..b02b78ed0 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -33,7 +33,6 @@ Setază ca dosar implicit Dezactivează ca dosar implicit Reordonează dosarele prin tragere - Sistemul nu permite copierea în acest dosar. Filtrează elementele media Imagini diff --git a/app/src/main/res/values-sl/strings.xml b/app/src/main/res/values-sl/strings.xml index 69d2394cf..48de3381c 100644 --- a/app/src/main/res/values-sl/strings.xml +++ b/app/src/main/res/values-sl/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filtriranje datotek diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index c060ac7c8..402a55197 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Филтрирај медију diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index dfad20785..36263301c 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filtrera media Bilder diff --git a/app/src/main/res/values-ta/strings.xml b/app/src/main/res/values-ta/strings.xml index a7aa2e37c..7fc7338d9 100644 --- a/app/src/main/res/values-ta/strings.xml +++ b/app/src/main/res/values-ta/strings.xml @@ -39,7 +39,6 @@ இயல்புநிலை அடைவாக அமை இயல்புநிலை அடைவாக அமைக்காதே பிடித்திழுத்து அடைவுகளை மறுசீரமை - The system does not allow copying to this folder. ஊடகத்தை வடிகட்டு படங்கள் diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 3d1291e0c..5564782e1 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -33,7 +33,6 @@ Встановити теку за замовчуванням Відмінити встановлення теки за замовчуванням Сортувати папки шляхом переміщення - The system does not allow copying to this folder. Фільтр мультимедійних файлів diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index ef1f97bfd..744272def 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Lọc diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 2ea02b586..92f076531 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. 篩選媒體檔案 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eb4d5412d..351dea3f9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -33,7 +33,6 @@ Set as default folder Unset as default folder Reorder folders by dragging - The system does not allow copying to this folder. Filter media diff --git a/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewPhotoEditActivity.kt b/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewPhotoEditActivity.kt index f40c61d48..d89571df6 100644 --- a/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewPhotoEditActivity.kt +++ b/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewPhotoEditActivity.kt @@ -13,6 +13,7 @@ import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.isNougatPlus +import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.dialogs.SaveAsDialog @@ -207,7 +208,7 @@ class NewPhotoEditActivity : SimpleActivity() { // In case the user wants to overwrite the original file and it is on an SD card, delete it manually first. Else the system just appends (1) private fun handleFileOverwriting(path: String, callback: () -> Unit) { - if (getDoesFilePathExist(path) && isPathOnSD(path)) { + if (!isRPlus() && getDoesFilePathExist(path) && isPathOnSD(path)) { val fileDirItem = FileDirItem(path, path.getFilenameFromPath()) tryDeleteFileDirItem(fileDirItem, false, true) { success -> if (success) { diff --git a/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewVideoEditActivity.kt b/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewVideoEditActivity.kt index c48d6ecc8..11f7fa814 100644 --- a/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewVideoEditActivity.kt +++ b/app/src/proprietary/kotlin/com/simplemobiletools/gallery/pro/activities/NewVideoEditActivity.kt @@ -13,6 +13,7 @@ import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REAL_FILE_PATH import com.simplemobiletools.commons.helpers.ensureBackgroundThread import com.simplemobiletools.commons.helpers.isNougatPlus +import com.simplemobiletools.commons.helpers.isRPlus import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.dialogs.SaveAsDialog @@ -198,7 +199,7 @@ class NewVideoEditActivity : SimpleActivity() { // In case the user wants to overwrite the original file and it is on an SD card, delete it manually first. Else the system just appends (1) private fun handleFileOverwriting(path: String, callback: () -> Unit) { - if (getDoesFilePathExist(path) && isPathOnSD(path)) { + if (!isRPlus() && getDoesFilePathExist(path) && isPathOnSD(path)) { val fileDirItem = FileDirItem(path, path.getFilenameFromPath()) tryDeleteFileDirItem(fileDirItem, false, true) { success -> if (success) {