Skip to content

Commit

Permalink
avoid showing invalid files at Recents
Browse files Browse the repository at this point in the history
  • Loading branch information
tibbi committed May 19, 2021
1 parent 2150ad1 commit ef91621
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import android.provider.MediaStore
import android.util.AttributeSet
import androidx.recyclerview.widget.GridLayoutManager
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getDoesFilePathExist
import com.simplemobiletools.commons.extensions.getLongValue
import com.simplemobiletools.commons.extensions.getStringValue
import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID
Expand Down Expand Up @@ -125,7 +126,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
val size = cursor.getLongValue(MediaStore.Files.FileColumns.SIZE)
val modified = cursor.getLongValue(MediaStore.Files.FileColumns.DATE_MODIFIED) * 1000
val fileDirItem = ListItem(path, name, false, 0, size, modified, false)
if (showHidden || !name.startsWith(".")) {
if ((showHidden || !name.startsWith(".")) && activity?.getDoesFilePathExist(path) == true) {
listItems.add(fileDirItem)
}
} while (cursor.moveToNext())
Expand Down

0 comments on commit ef91621

Please sign in to comment.