get Recents file name from its path, if not filled in

This commit is contained in:
tibbi 2021-05-20 11:09:21 +02:00
parent 9f15dc39d4
commit a48300e713

View file

@ -122,7 +122,7 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
context?.queryCursor(uri, projection, sortOrder = sortOrder, showErrors = true) { cursor -> context?.queryCursor(uri, projection, sortOrder = sortOrder, showErrors = true) { cursor ->
val path = cursor.getStringValue(FileColumns.DATA) val path = cursor.getStringValue(FileColumns.DATA)
val name = cursor.getStringValue(FileColumns.DISPLAY_NAME) val name = cursor.getStringValue(FileColumns.DISPLAY_NAME) ?: path.getFilenameFromPath()
val size = cursor.getLongValue(FileColumns.SIZE) val size = cursor.getLongValue(FileColumns.SIZE)
val modified = cursor.getLongValue(FileColumns.DATE_MODIFIED) * 1000 val modified = cursor.getLongValue(FileColumns.DATE_MODIFIED) * 1000
val fileDirItem = ListItem(path, name, false, 0, size, modified, false) val fileDirItem = ListItem(path, name, false, 0, size, modified, false)