fix opening videos in the recycle bin directly

This commit is contained in:
tibbi 2022-02-13 11:59:54 +01:00
parent 3e3fb0c580
commit a1589b60f1
3 changed files with 6 additions and 5 deletions

View file

@ -810,6 +810,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
if (isVideo) { if (isVideo) {
val extras = HashMap<String, Boolean>() val extras = HashMap<String, Boolean>()
extras[SHOW_FAVORITES] = mPath == FAVORITES extras[SHOW_FAVORITES] = mPath == FAVORITES
if (path.startsWith(recycleBinPath)) {
extras[IS_IN_RECYCLE_BIN] = true
}
if (shouldSkipAuthentication()) { if (shouldSkipAuthentication()) {
extras[SKIP_AUTHENTICATION] = true extras[SKIP_AUTHENTICATION] = true

View file

@ -11,10 +11,7 @@ import android.view.MenuItem
import android.view.View import android.view.View
import com.simplemobiletools.commons.dialogs.PropertiesDialog import com.simplemobiletools.commons.dialogs.PropertiesDialog
import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.IS_FROM_GALLERY import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
import com.simplemobiletools.commons.helpers.isRPlus
import com.simplemobiletools.gallery.pro.BuildConfig import com.simplemobiletools.gallery.pro.BuildConfig
import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.extensions.* import com.simplemobiletools.gallery.pro.extensions.*
@ -81,7 +78,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
mUri = intent.data ?: return mUri = intent.data ?: return
val uri = mUri.toString() val uri = mUri.toString()
if (uri.startsWith("content:/") && uri.contains("/storage/")) { if (uri.startsWith("content:/") && uri.contains("/storage/") && !intent.getBooleanExtra(IS_IN_RECYCLE_BIN, false)) {
val guessedPath = uri.substring(uri.indexOf("/storage/")) val guessedPath = uri.substring(uri.indexOf("/storage/"))
if (getDoesFilePathExist(guessedPath)) { if (getDoesFilePathExist(guessedPath)) {
val extras = intent.extras ?: Bundle() val extras = intent.extras ?: Bundle()

View file

@ -112,6 +112,7 @@ const val SLIDESHOW_ANIMATION_FADE = 2
const val RECYCLE_BIN = "recycle_bin" const val RECYCLE_BIN = "recycle_bin"
const val SHOW_FAVORITES = "show_favorites" const val SHOW_FAVORITES = "show_favorites"
const val SHOW_RECYCLE_BIN = "show_recycle_bin" const val SHOW_RECYCLE_BIN = "show_recycle_bin"
const val IS_IN_RECYCLE_BIN = "is_in_recycle_bin"
const val SHOW_NEXT_ITEM = "show_next_item" const val SHOW_NEXT_ITEM = "show_next_item"
const val SHOW_PREV_ITEM = "show_prev_item" const val SHOW_PREV_ITEM = "show_prev_item"
const val GO_TO_NEXT_ITEM = "go_to_next_item" const val GO_TO_NEXT_ITEM = "go_to_next_item"