adding file sorting
This commit is contained in:
parent
12d234d0d5
commit
2f4119faac
|
@ -32,7 +32,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.simplemobiletools:commons:2.13.5'
|
||||
compile 'com.simplemobiletools:commons:2.13.6'
|
||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||
}
|
||||
|
|
|
@ -140,7 +140,11 @@ class MainActivity : SimpleActivity(), ItemsFragment.ItemInteractionListener, Br
|
|||
|
||||
private fun showSortingDialog() {
|
||||
ChangeSortingDialog(this, currentPath) {
|
||||
|
||||
if (latestFragment != null) {
|
||||
latestFragment!!.fillItems()
|
||||
} else {
|
||||
openPath(currentPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,25 +72,26 @@ class ItemsFragment : android.support.v4.app.Fragment(), ItemsAdapter.ItemOperat
|
|||
mStoredTextColor = context.config.textColor
|
||||
}
|
||||
|
||||
private fun fillItems() {
|
||||
fun fillItems() {
|
||||
mPath = arguments.getString(PATH)
|
||||
getItems(mPath) {
|
||||
val newItems = it
|
||||
Collections.sort(newItems)
|
||||
FileDirItem.sorting = mConfig.getFolderSorting(mPath)
|
||||
newItems.sort()
|
||||
|
||||
fragmentView.apply {
|
||||
items_swipe_refresh.isRefreshing = false
|
||||
if (newItems.hashCode() == mItems.hashCode()) {
|
||||
return@getItems
|
||||
}
|
||||
|
||||
mItems = newItems
|
||||
|
||||
val adapter = ItemsAdapter(activity as SimpleActivity, mItems, this@ItemsFragment) {
|
||||
itemClicked(it)
|
||||
}
|
||||
|
||||
activity.runOnUiThread {
|
||||
items_swipe_refresh.isRefreshing = false
|
||||
if (newItems.hashCode() == mItems.hashCode()) {
|
||||
return@runOnUiThread
|
||||
}
|
||||
|
||||
mItems = newItems
|
||||
|
||||
val adapter = ItemsAdapter(activity as SimpleActivity, mItems, this@ItemsFragment) {
|
||||
itemClicked(it)
|
||||
}
|
||||
|
||||
val currAdapter = items_list.adapter
|
||||
if (currAdapter == null) {
|
||||
items_list.apply {
|
||||
|
|
Loading…
Reference in New Issue