Add global search progress bar (closes #3727)
This commit is contained in:
parent
2154e3aa2d
commit
38bc8ec6b4
@ -8,6 +8,7 @@ import android.view.MenuItem
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -194,6 +195,14 @@ open class GlobalSearchController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
adapter?.updateDataSet(searchResult)
|
adapter?.updateDataSet(searchResult)
|
||||||
|
|
||||||
|
val progress = searchResult.mapNotNull { it.results }.count().toDouble() / searchResult.size
|
||||||
|
if (progress < 1) {
|
||||||
|
binding.progressBar.isVisible = true
|
||||||
|
binding.progressBar.progress = (progress * 100).toInt()
|
||||||
|
} else {
|
||||||
|
binding.progressBar.isVisible = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,6 +13,16 @@
|
|||||||
android:paddingBottom="4dp"
|
android:paddingBottom="4dp"
|
||||||
tools:listitem="@layout/global_search_controller_card" />
|
tools:listitem="@layout/global_search_controller_card" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/progress_bar"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="2dp"
|
||||||
|
android:max="100"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:progress="50"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/progress"
|
android:id="@+id/progress"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user