From a775d48644ec0569e44a7d2dcd8064cfd989ab97 Mon Sep 17 00:00:00 2001 From: Mysochenko Yuriy Date: Fri, 20 May 2022 12:02:18 +0300 Subject: [PATCH 1/4] display search progress bar --- .../filemanager/pro/fragments/ItemsFragment.kt | 4 ++++ app/src/main/res/layout/items_fragment.xml | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index 2d7c85fd..c09d4858 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -293,13 +293,16 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF getRecyclerAdapter()?.updateItems(storedItems) items_placeholder.beGone() items_placeholder_2.beGone() + search_progress.beGone() } searchText.length == 1 -> { items_fastscroller.beGone() items_placeholder.beVisible() items_placeholder_2.beVisible() + search_progress.beGone() } else -> { + search_progress.beVisible() 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.beGone() } } } diff --git a/app/src/main/res/layout/items_fragment.xml b/app/src/main/res/layout/items_fragment.xml index 98e5fa47..d3a66b76 100644 --- a/app/src/main/res/layout/items_fragment.xml +++ b/app/src/main/res/layout/items_fragment.xml @@ -1,6 +1,7 @@ @@ -25,6 +26,16 @@ android:paddingEnd="@dimen/small_margin" android:paddingBottom="@dimen/small_margin" /> + + Date: Fri, 20 May 2022 15:13:17 +0300 Subject: [PATCH 2/4] use LinearProgressIndicator instead of ProgressBar to avoid padding --- app/src/main/res/layout/items_fragment.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/main/res/layout/items_fragment.xml b/app/src/main/res/layout/items_fragment.xml index d3a66b76..c5a8ced6 100644 --- a/app/src/main/res/layout/items_fragment.xml +++ b/app/src/main/res/layout/items_fragment.xml @@ -26,9 +26,8 @@ android:paddingEnd="@dimen/small_margin" android:paddingBottom="@dimen/small_margin" /> - Date: Fri, 20 May 2022 15:13:34 +0300 Subject: [PATCH 3/4] hide search progress when search is cancelled --- .../simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index c09d4858..c6a433b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -399,6 +399,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF items_fastscroller.beVisible() items_placeholder.beGone() items_placeholder_2.beGone() + search_progress.beGone() } private fun createNewItem() { From de42e5483c5cc08efffc35e4b174fde6a62285bb Mon Sep 17 00:00:00 2001 From: Mysochenko Yuriy Date: Fri, 20 May 2022 17:03:17 +0300 Subject: [PATCH 4/4] fix progress bar color for black/white theme --- .../pro/fragments/ItemsFragment.kt | 20 +++++++++---------- app/src/main/res/layout/items_fragment.xml | 1 + 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index c6a433b3..d4c37892 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -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,16 +293,16 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF getRecyclerAdapter()?.updateItems(storedItems) items_placeholder.beGone() items_placeholder_2.beGone() - search_progress.beGone() + search_progress.hide() } searchText.length == 1 -> { items_fastscroller.beGone() items_placeholder.beVisible() items_placeholder_2.beVisible() - search_progress.beGone() + search_progress.hide() } else -> { - search_progress.beVisible() + search_progress.show() ensureBackgroundThread { val files = searchFiles(searchText, currentPath) files.sortBy { it.getParentPath() } @@ -338,7 +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.beGone() + search_progress.hide() } } } @@ -399,7 +399,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF items_fastscroller.beVisible() items_placeholder.beGone() items_placeholder_2.beGone() - search_progress.beGone() + search_progress.hide() } private fun createNewItem() { diff --git a/app/src/main/res/layout/items_fragment.xml b/app/src/main/res/layout/items_fragment.xml index c5a8ced6..d30b35cc 100644 --- a/app/src/main/res/layout/items_fragment.xml +++ b/app/src/main/res/layout/items_fragment.xml @@ -33,6 +33,7 @@ android:layout_alignParentTop="true" android:indeterminate="true" android:visibility="gone" + app:showDelay="250" tools:visibility="visible" />