diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 8f86aaa43..abf1ae8fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -817,7 +817,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { val deletingItems = resources.getQuantityString(R.plurals.deleting_items, filtered.size, filtered.size) toast(deletingItems) - if (config.useRecycleBin && !filtered.first().path.startsWith(filesDir.toString())) { + if (config.useRecycleBin && !filtered.first().path.startsWith(filesDir.absolutePath)) { movePathsInRecycleBin(filtered.map { it.path } as ArrayList) { if (it) { deleteFilteredFiles(filtered) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 5a88de033..866d6271e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -302,7 +302,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 findItem(R.id.menu_add_to_favorites).isVisible = !currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 findItem(R.id.menu_remove_from_favorites).isVisible = currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 - findItem(R.id.menu_restore_file).isVisible = currentMedium.path.startsWith(filesDir.toString()) + findItem(R.id.menu_restore_file).isVisible = currentMedium.path.startsWith(filesDir.absolutePath) findItem(R.id.menu_change_orientation).isVisible = mRotationDegrees == 0 && visibleBottomActions and BOTTOM_ACTION_CHANGE_ORIENTATION == 0 findItem(R.id.menu_change_orientation).icon = resources.getDrawable(getChangeOrientationIcon()) findItem(R.id.menu_rotate).setShowAsAction( @@ -587,7 +587,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - val tmpPath = "$filesDir/.tmp_${newPath.getFilenameFromPath()}" + val tmpPath = "${filesDir.absolutePath}/.tmp_${newPath.getFilenameFromPath()}" val tmpFileDirItem = FileDirItem(tmpPath, tmpPath.getFilenameFromPath()) try { getFileOutputStream(tmpFileDirItem) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 01928ec04..94b93fb71 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -109,7 +109,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList 0 - findItem(R.id.cab_restore_recycle_bin_files).isVisible = getSelectedPaths().all { it.startsWith(activity.filesDir.toString()) } + findItem(R.id.cab_restore_recycle_bin_files).isVisible = getSelectedPaths().all { it.startsWith(activity.filesDir.absolutePath) } checkHideBtnVisibility(this) checkFavoriteBtnVisibility(this) @@ -289,7 +289,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, callback val mediumDao = galleryDB.MediumDao() paths.forEach { val source = it - val destination = it.removePrefix(filesDir.toString()) + val destination = it.removePrefix(filesDir.absolutePath) var inputStream: InputStream? = null var out: OutputStream? = null diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt index ced21949a..74c98a74a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/Context.kt @@ -365,7 +365,7 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag val grouped = mediaFetcher.groupMedia(media, pathToUse) callback(grouped.clone() as ArrayList) - val recycleBinPath = filesDir.toString() + val recycleBinPath = filesDir.absolutePath media.filter { !getDoesFilePathExist(it.path) }.forEach { if (it.path.startsWith(recycleBinPath)) { mediumDao.deleteMediumPath(it.path.removePrefix(recycleBinPath))