mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	make sure the activity is alive at getting the items
This commit is contained in:
		| @@ -169,14 +169,12 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum | |||||||
|  |  | ||||||
|     private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) { |     private fun getItems(path: String, callback: (items: ArrayList<FileDirItem>) -> Unit) { | ||||||
|         Thread { |         Thread { | ||||||
|             if (activity?.isActivityDestroyed() == true) { |             if (activity?.isActivityDestroyed() == false) { | ||||||
|                 return@Thread |                 if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) { | ||||||
|             } |                     getRegularItemsOf(path, callback) | ||||||
|  |                 } else { | ||||||
|             if (!context!!.config.enableRootAccess || !context!!.isPathOnRoot(path)) { |                     RootHelpers().getFiles(activity as SimpleActivity, path, callback) | ||||||
|                 getRegularItemsOf(path, callback) |                 } | ||||||
|             } else { |  | ||||||
|                 RootHelpers().getFiles(activity as SimpleActivity, path, callback) |  | ||||||
|             } |             } | ||||||
|         }.start() |         }.start() | ||||||
|     } |     } | ||||||
| @@ -192,7 +190,7 @@ class ItemsFragment : Fragment(), ItemsAdapter.ItemOperationsListener, Breadcrum | |||||||
|                     continue |                     continue | ||||||
|  |  | ||||||
|                 val children = getChildrenCount(file) |                 val children = getChildrenCount(file) | ||||||
|                 val size = if (file.isDirectory && context!!.config.sorting == SORT_BY_SIZE) getDirectorySize(file) else file.length() |                 val size = if (file.isDirectory && context?.config?.sorting == SORT_BY_SIZE) getDirectorySize(file) else file.length() | ||||||
|                 val fileDirItem = FileDirItem(curPath, curName, file.isDirectory, children, size) |                 val fileDirItem = FileDirItem(curPath, curName, file.isDirectory, children, size) | ||||||
|                 items.add(fileDirItem) |                 items.add(fileDirItem) | ||||||
|             } |             } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user