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,71 +1,65 @@
<?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:id="@+id/media_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RelativeLayout <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_holder" android:id="@+id/media_empty_text_label"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/big_margin"
android:text="@string/no_media_with_filters"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text_label" android:id="@+id/media_empty_text"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_horizontal" android:layout_below="@+id/media_empty_text_label"
android:paddingLeft="@dimen/big_margin" android:layout_centerHorizontal="true"
android:paddingTop="@dimen/activity_margin" android:background="?attr/selectableItemBackground"
android:paddingRight="@dimen/big_margin" android:padding="@dimen/activity_margin"
android:text="@string/no_media_with_filters" android:text="@string/change_filters_underlined"
android:textSize="@dimen/bigger_text_size" android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/> android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView <com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/media_empty_text" android:id="@+id/media_grid"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_below="@+id/media_empty_text_label" android:scrollbars="none"
android:layout_centerHorizontal="true" app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
android:background="?attr/selectableItemBackground" app:spanCount="@integer/media_columns_vertical_scroll"/>
android:padding="@dimen/activity_margin"
android:text="@string/change_filters_underlined"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyRecyclerView <com.simplemobiletools.commons.views.FastScroller
android:id="@+id/media_grid" android:id="@+id/media_vertical_fastscroller"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:scrollbars="none" android:layout_alignParentEnd="true"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager" android:paddingStart="@dimen/normal_margin"
app:spanCount="@integer/media_columns_vertical_scroll"/> android:visibility="gone">
<com.simplemobiletools.commons.views.FastScroller <include layout="@layout/fastscroller_handle_vertical"/>
android:id="@+id/media_vertical_fastscroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:paddingStart="@dimen/normal_margin"
android:visibility="gone">
<include layout="@layout/fastscroller_handle_vertical"/> </com.simplemobiletools.commons.views.FastScroller>
</com.simplemobiletools.commons.views.FastScroller> <com.simplemobiletools.commons.views.FastScroller
android:id="@+id/media_horizontal_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:paddingTop="@dimen/normal_margin"
android:visibility="gone">
<com.simplemobiletools.commons.views.FastScroller <include layout="@layout/fastscroller_handle_horizontal"/>
android:id="@+id/media_horizontal_fastscroller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:paddingTop="@dimen/normal_margin"
android:visibility="gone">
<include layout="@layout/fastscroller_handle_horizontal"/> </com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>