Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a28e8b94 authored by tibbi's avatar tibbi
Browse files

remove a redundant context extension

parent cb7475a1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.12.12'
        propVersionName = '3.12.13'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+2 −2
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ open class BaseSimpleActivity : AppCompatActivity() {
    fun startCustomizationActivity() = startActivity(Intent(this, CustomizationActivity::class.java))

    fun handleSAFDialog(path: String, callback: () -> Unit): Boolean {
        return if (!isPathOnOTG(path) && isShowingSAFDialog(path, baseConfig.treeUri, OPEN_DOCUMENT_TREE)) {
        return if (!path.startsWith(OTG_PATH) && isShowingSAFDialog(path, baseConfig.treeUri, OPEN_DOCUMENT_TREE)) {
            funAfterSAFPermission = callback
            true
        } else {
@@ -206,7 +206,7 @@ open class BaseSimpleActivity : AppCompatActivity() {
            if (isCopyOperation) {
                startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden)
            } else {
                if (isPathOnOTG(source) || isPathOnOTG(destination) || isPathOnSD(source) || isPathOnSD(destination) || fileDirItems.first().isDirectory || isNougatPlus()) {
                if (source.startsWith(OTG_PATH) || destination.startsWith(OTG_PATH) || isPathOnSD(source) || isPathOnSD(destination) || fileDirItems.first().isDirectory || isNougatPlus()) {
                    handleSAFDialog(source) {
                        startCopyMove(fileDirItems, destination, isCopyOperation, copyPhotoVideoOnly, copyHidden)
                    }
+2 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.commons.R
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.OTG_PATH
import com.simplemobiletools.commons.models.FileDirItem
import com.simplemobiletools.commons.views.MyRecyclerView
import kotlinx.android.synthetic.main.filepicker_list_item.view.*
@@ -88,7 +89,7 @@ class FilepickerItemsAdapter(activity: BaseSimpleActivity, val fileDirItems: Lis
                }

                if (!activity.isActivityDestroyed()) {
                    if (hasOTGConnected && itemToLoad is String && activity.isPathOnOTG(itemToLoad)) {
                    if (hasOTGConnected && itemToLoad is String && itemToLoad.startsWith(OTG_PATH)) {
                        itemToLoad = itemToLoad.getOTGPublicPath(activity)
                    }
                    Glide.with(activity).load(itemToLoad).transition(withCrossFade()).apply(options).into(list_item_icon)
+3 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.CONFLICT_OVERWRITE
import com.simplemobiletools.commons.helpers.CONFLICT_SKIP
import com.simplemobiletools.commons.helpers.OTG_PATH
import com.simplemobiletools.commons.interfaces.CopyMoveListener
import com.simplemobiletools.commons.models.FileDirItem
import java.io.File
@@ -64,7 +65,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal
                file.size = file.getProperSize(activity, copyHidden)
            }
            val newPath = "${pair.second}/${file.name}"
            val fileExists = if (activity.isPathOnOTG(newPath)) activity.getFastDocumentFile(newPath)?.exists()
            val fileExists = if (newPath.startsWith(OTG_PATH)) activity.getFastDocumentFile(newPath)?.exists()
                    ?: false else File(newPath).exists()
            if (getConflictResolution(newPath) != CONFLICT_SKIP || !fileExists) {
                mMaxSize += (file.size / 1000).toInt()
@@ -174,7 +175,7 @@ class CopyMoveTask(val activity: BaseSimpleActivity, val copyOnly: Boolean = fal
            return
        }

        if (activity.isPathOnOTG(source.path)) {
        if (source.path.startsWith(OTG_PATH)) {
            val children = activity.getDocumentFile(source.path)?.listFiles() ?: return
            for (child in children) {
                val newPath = "$destinationPath/${child.name}"
+2 −2
Original line number Diff line number Diff line
@@ -415,7 +415,7 @@ fun BaseSimpleActivity.deleteFile(fileDirItem: FileDirItem, allowDeleteFolder: B
fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder: Boolean = false, callback: ((wasSuccess: Boolean) -> Unit)? = null) {
    val path = fileDirItem.path
    val file = File(path)
    var fileDeleted = !isPathOnOTG(path) && (!file.exists() || file.delete())
    var fileDeleted = !path.startsWith(OTG_PATH) && (!file.exists() || file.delete())
    if (fileDeleted) {
        rescanDeletedPath(path) {
            callback?.invoke(true)
@@ -430,7 +430,7 @@ fun BaseSimpleActivity.deleteFileBg(fileDirItem: FileDirItem, allowDeleteFolder:
                handleSAFDialog(path) {
                    trySAFFileDelete(fileDirItem, allowDeleteFolder, callback)
                }
            } else if (isPathOnOTG(path)) {
            } else if (path.startsWith(OTG_PATH)) {
                trySAFFileDelete(fileDirItem, allowDeleteFolder, callback)
            }
        }
Loading