Merge branch 'show_search_progress' of https://github.com/sdex/Simple-File-Manager

This commit is contained in:
tibbi 2022-05-21 16:04:27 +02:00
commit f82a84770c
2 changed files with 21 additions and 5 deletions

View file

@ -8,10 +8,7 @@ import androidx.recyclerview.widget.GridLayoutManager
import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.StoragePickerDialog
import com.simplemobiletools.commons.extensions.*
import com.simplemobiletools.commons.helpers.SORT_BY_SIZE
import com.simplemobiletools.commons.helpers.VIEW_TYPE_GRID
import com.simplemobiletools.commons.helpers.VIEW_TYPE_LIST
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.commons.models.FileDirItem
import com.simplemobiletools.commons.views.Breadcrumbs
import com.simplemobiletools.commons.views.MyGridLayoutManager
@ -59,7 +56,10 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
initDrawables()
}
items_fastscroller.updateColors(context!!.getProperPrimaryColor())
val properPrimaryColor = context!!.getProperPrimaryColor()
items_fastscroller.updateColors(properPrimaryColor)
search_progress.setIndicatorColor(properPrimaryColor)
search_progress.trackColor = properPrimaryColor.adjustAlpha(LOWER_ALPHA)
if (currentPath != "") {
breadcrumbs.updateColor(textColor)
@ -293,13 +293,16 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
getRecyclerAdapter()?.updateItems(storedItems)
items_placeholder.beGone()
items_placeholder_2.beGone()
search_progress.hide()
}
searchText.length == 1 -> {
items_fastscroller.beGone()
items_placeholder.beVisible()
items_placeholder_2.beVisible()
search_progress.hide()
}
else -> {
search_progress.show()
ensureBackgroundThread {
val files = searchFiles(searchText, currentPath)
files.sortBy { it.getParentPath() }
@ -335,6 +338,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
items_fastscroller.beVisibleIf(listItems.isNotEmpty())
items_placeholder.beVisibleIf(listItems.isEmpty())
items_placeholder_2.beGone()
search_progress.hide()
}
}
}
@ -395,6 +399,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
items_fastscroller.beVisible()
items_placeholder.beGone()
items_placeholder_2.beGone()
search_progress.hide()
}
private fun createNewItem() {

View file

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.filemanager.pro.fragments.ItemsFragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/items_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent">
@ -25,6 +26,16 @@
android:paddingEnd="@dimen/small_margin"
android:paddingBottom="@dimen/small_margin" />
<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/search_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:indeterminate="true"
android:visibility="gone"
app:showDelay="250"
tools:visibility="visible" />
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/items_placeholder"
android:layout_width="match_parent"