reset search results more reliably on close
This commit is contained in:
parent
53334fa8b0
commit
98c70fa49f
|
@ -64,7 +64,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:4cfef38454'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:7f3e880dc5'
|
||||||
implementation 'com.github.tibbi:AndroidPdfViewer:da57ff410e'
|
implementation 'com.github.tibbi:AndroidPdfViewer:da57ff410e'
|
||||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||||
implementation 'com.github.Stericson:RootShell:1.6'
|
implementation 'com.github.Stericson:RootShell:1.6'
|
||||||
|
|
|
@ -396,11 +396,7 @@ class MainActivity : SimpleActivity() {
|
||||||
main_view_pager.offscreenPageLimit = 2
|
main_view_pager.offscreenPageLimit = 2
|
||||||
|
|
||||||
main_view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
main_view_pager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
|
||||||
override fun onPageScrollStateChanged(state: Int) {
|
override fun onPageScrollStateChanged(state: Int) {}
|
||||||
if (state == ViewPager.SCROLL_STATE_SETTLING) {
|
|
||||||
closeSearch()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
private var zoomListener: MyRecyclerView.MyZoomListener? = null
|
private var zoomListener: MyRecyclerView.MyZoomListener? = null
|
||||||
|
|
||||||
private var storedItems = ArrayList<ListItem>()
|
private var storedItems = ArrayList<ListItem>()
|
||||||
|
private var itemsIgnoringSearch = ArrayList<ListItem>()
|
||||||
|
|
||||||
override fun setupFragment(activity: SimpleActivity) {
|
override fun setupFragment(activity: SimpleActivity) {
|
||||||
if (this.activity == null) {
|
if (this.activity == null) {
|
||||||
|
@ -49,7 +50,6 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
|
|
||||||
override fun onResume(textColor: Int) {
|
override fun onResume(textColor: Int) {
|
||||||
context!!.updateTextColors(this)
|
context!!.updateTextColors(this)
|
||||||
storedItems = ArrayList()
|
|
||||||
getRecyclerAdapter()?.apply {
|
getRecyclerAdapter()?.apply {
|
||||||
updatePrimaryColor()
|
updatePrimaryColor()
|
||||||
updateTextColor(textColor)
|
updateTextColor(textColor)
|
||||||
|
@ -113,6 +113,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itemsIgnoringSearch = listItems
|
||||||
activity?.runOnUiThread {
|
activity?.runOnUiThread {
|
||||||
activity?.invalidateOptionsMenu()
|
activity?.invalidateOptionsMenu()
|
||||||
addItems(listItems, forceRefresh)
|
addItems(listItems, forceRefresh)
|
||||||
|
@ -294,7 +295,7 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
||||||
when {
|
when {
|
||||||
searchText.isEmpty() -> {
|
searchText.isEmpty() -> {
|
||||||
items_fastscroller.beVisible()
|
items_fastscroller.beVisible()
|
||||||
getRecyclerAdapter()?.updateItems(storedItems)
|
getRecyclerAdapter()?.updateItems(itemsIgnoringSearch)
|
||||||
items_placeholder.beGone()
|
items_placeholder.beGone()
|
||||||
items_placeholder_2.beGone()
|
items_placeholder_2.beGone()
|
||||||
search_progress.hide()
|
search_progress.hide()
|
||||||
|
|
Loading…
Reference in New Issue