remove pull to refresh layout from the search results

This commit is contained in:
tibbi 2019-06-26 11:18:48 +02:00
parent 6ee3f04d8f
commit 10f903129d
2 changed files with 62 additions and 56 deletions

View file

@ -39,6 +39,9 @@ class SearchActivity : SimpleActivity() {
override fun onQueryTextSubmit(query: String) = false override fun onQueryTextSubmit(query: String) = false
override fun onQueryTextChange(newText: String): Boolean { override fun onQueryTextChange(newText: String): Boolean {
if (mIsSearchOpen) {
textChanged(newText)
}
return true return true
} }
}) })
@ -46,14 +49,23 @@ class SearchActivity : SimpleActivity() {
MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener { MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?): Boolean { override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
mIsSearchOpen = true
return true return true
} }
// this triggers on device rotation too, avoid doing anything // this triggers on device rotation too, avoid doing anything
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean { override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
if (mIsSearchOpen) {
mIsSearchOpen = false
textChanged("")
}
return true return true
} }
}) })
mSearchMenuItem?.expandActionView() mSearchMenuItem?.expandActionView()
} }
private fun textChanged(text: String) {
}
} }

View file

@ -1,12 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/media_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/media_holder" android:id="@+id/media_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
@ -67,5 +62,4 @@
<include layout="@layout/fastscroller_handle_horizontal"/> <include layout="@layout/fastscroller_handle_horizontal"/>
</com.simplemobiletools.commons.views.FastScroller> </com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout> </RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>