tweak the way files are deleted
This commit is contained in:
parent
6e6ea3a257
commit
bf952f71cf
|
@ -200,6 +200,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
|
||||
Thread({
|
||||
if (!file.delete()) {
|
||||
if (needsPermissions) {
|
||||
val document = getFileDocument(file.absolutePath, config.treeUri)
|
||||
|
||||
|
@ -209,8 +210,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
if (uri.endsWith(filename)) {
|
||||
document.delete()
|
||||
}
|
||||
} else {
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
|
|
|
@ -237,6 +237,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
var hadSuccess = false
|
||||
files.filter { it.exists() && it.isImageVideoGif() }
|
||||
.forEach {
|
||||
if (!it.delete()) {
|
||||
if (needsPermissions) {
|
||||
val document = getFileDocument(it.absolutePath, config.treeUri)
|
||||
|
||||
|
@ -248,9 +249,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
hadSuccess = true
|
||||
}
|
||||
} else {
|
||||
if (it.delete())
|
||||
hadSuccess = true
|
||||
}
|
||||
}
|
||||
deleteFromMediaStore(it)
|
||||
}
|
||||
if (!hadSuccess)
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.graphics.BitmapFactory
|
|||
import android.graphics.Matrix
|
||||
import android.media.ExifInterface
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.support.v4.view.ViewPager
|
||||
|
@ -286,7 +287,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
return (floatD + floatM / 60 + floatS / 3600).toFloat()
|
||||
}
|
||||
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||
if (requestCode == REQUEST_EDIT_IMAGE) {
|
||||
if (resultCode == Activity.RESULT_OK && resultData != null) {
|
||||
|
@ -314,7 +314,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
return
|
||||
}
|
||||
|
||||
Thread({
|
||||
Thread {
|
||||
if (!file.delete()) {
|
||||
if (needsPermissions) {
|
||||
val document = getFileDocument(file.absolutePath, config.treeUri)
|
||||
|
||||
|
@ -329,8 +330,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
return@Thread
|
||||
}
|
||||
} else {
|
||||
file.delete()
|
||||
}
|
||||
}
|
||||
|
||||
if (deleteFromMediaStore(file)) {
|
||||
|
@ -340,7 +340,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
reloadViewPager()
|
||||
}
|
||||
}
|
||||
}).start()
|
||||
}.start()
|
||||
}
|
||||
|
||||
private fun isDirEmpty(): Boolean {
|
||||
|
|
Loading…
Reference in New Issue