@@ -2,7 +2,6 @@ package com.simplemobiletools.filemanager.pro.fragments
22
33import android.os.Bundle
44import android.os.Parcelable
5- import android.provider.MediaStore
65import android.view.LayoutInflater
76import android.view.View
87import android.view.ViewGroup
@@ -12,6 +11,7 @@ import com.simplemobiletools.commons.dialogs.StoragePickerDialog
1211import com.simplemobiletools.commons.extensions.*
1312import com.simplemobiletools.commons.helpers.SORT_BY_SIZE
1413import com.simplemobiletools.commons.helpers.ensureBackgroundThread
14+ import com.simplemobiletools.commons.helpers.isRPlus
1515import com.simplemobiletools.commons.models.FileDirItem
1616import com.simplemobiletools.commons.views.Breadcrumbs
1717import com.simplemobiletools.commons.views.MyLinearLayoutManager
@@ -218,7 +218,7 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
218218 return
219219 }
220220
221- val lastModifieds = getFolderLastModifieds(path)
221+ val lastModifieds = if (isRPlus()) context !! . getFolderLastModifieds(path) else HashMap ( )
222222 val isSortingBySize = context!! .config.getFolderSorting(currentPath) and SORT_BY_SIZE != 0
223223 if (files != null ) {
224224 for (file in files) {
@@ -268,36 +268,6 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb
268268 return listItems
269269 }
270270
271- private fun getFolderLastModifieds (folder : String ): HashMap <String , Long > {
272- val lastModifieds = HashMap <String , Long >()
273- val projection = arrayOf(
274- MediaStore .Images .Media .DISPLAY_NAME ,
275- MediaStore .Images .Media .DATE_MODIFIED
276- )
277-
278- val uri = MediaStore .Files .getContentUri(" external" )
279- val selection = " ${MediaStore .Images .Media .DATA } LIKE ? AND ${MediaStore .Images .Media .DATA } NOT LIKE ?"
280- val selectionArgs = arrayOf(" $folder /%" , " $folder /%/%" )
281-
282- val cursor = context!! .contentResolver.query(uri, projection, selection, selectionArgs, null )
283- cursor?.use {
284- if (cursor.moveToFirst()) {
285- do {
286- try {
287- val lastModified = cursor.getLongValue(MediaStore .Images .Media .DATE_MODIFIED ) * 1000
288- if (lastModified != 0L ) {
289- val name = cursor.getStringValue(MediaStore .Images .Media .DISPLAY_NAME )
290- lastModifieds[" $folder /$name " ] = lastModified
291- }
292- } catch (e: Exception ) {
293- }
294- } while (cursor.moveToNext())
295- }
296- }
297-
298- return lastModifieds
299- }
300-
301271 private fun itemClicked (item : FileDirItem ) {
302272 if (item.isDirectory) {
303273 (activity as ? MainActivity )?.apply {
0 commit comments