mirror of
				https://github.com/SimpleMobileTools/Simple-File-Manager.git
				synced 2025-06-05 22:09:15 +02:00 
			
		
		
		
	adding file sorting
This commit is contained in:
		| @@ -32,7 +32,7 @@ android { | |||||||
| } | } | ||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     compile 'com.simplemobiletools:commons:2.13.5' |     compile 'com.simplemobiletools:commons:2.13.6' | ||||||
|     compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' |     compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' | ||||||
|     compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" |     compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||||||
| } | } | ||||||
|   | |||||||
| @@ -140,7 +140,11 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br | |||||||
|  |  | ||||||
|     private fun showSortingDialog() { |     private fun showSortingDialog() { | ||||||
|         ChangeSortingDialog(this, currentPath) { |         ChangeSortingDialog(this, currentPath) { | ||||||
|  |             if (latestFragment != null) { | ||||||
|  |                 latestFragment!!.fillItems() | ||||||
|  |             } else { | ||||||
|  |                 openPath(currentPath) | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -72,16 +72,18 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat | |||||||
|         mStoredTextColor = context.config.textColor |         mStoredTextColor = context.config.textColor | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private fun fillItems() { |     fun fillItems() { | ||||||
|         mPath = arguments.getString(PATH) |         mPath = arguments.getString(PATH) | ||||||
|         getItems(mPath) { |         getItems(mPath) { | ||||||
|             val newItems = it |             val newItems = it | ||||||
|             Collections.sort(newItems) |             FileDirItem.sorting = mConfig.getFolderSorting(mPath) | ||||||
|  |             newItems.sort() | ||||||
|  |  | ||||||
|             fragmentView.apply { |             fragmentView.apply { | ||||||
|  |                 activity.runOnUiThread { | ||||||
|                     items_swipe_refresh.isRefreshing = false |                     items_swipe_refresh.isRefreshing = false | ||||||
|                     if (newItems.hashCode() == mItems.hashCode()) { |                     if (newItems.hashCode() == mItems.hashCode()) { | ||||||
|                     return@getItems |                         return@runOnUiThread | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                     mItems = newItems |                     mItems = newItems | ||||||
| @@ -90,7 +92,6 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat | |||||||
|                         itemClicked(it) |                         itemClicked(it) | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                 activity.runOnUiThread { |  | ||||||
|                     val currAdapter = items_list.adapter |                     val currAdapter = items_list.adapter | ||||||
|                     if (currAdapter == null) { |                     if (currAdapter == null) { | ||||||
|                         items_list.apply { |                         items_list.apply { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user