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

View file

@ -1,71 +1,65 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
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_height="wrap_content">
<RelativeLayout
android:id="@+id/media_holder"
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text_label"
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
android:id="@+id/media_empty_text_label"
android:layout_width="match_parent"
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
android:id="@+id/media_empty_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/media_empty_text_label"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:text="@string/change_filters_underlined"
android:textSize="@dimen/bigger_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/media_empty_text_label"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
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
android:id="@+id/media_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/media_columns_vertical_scroll"/>
<com.simplemobiletools.commons.views.MyRecyclerView
android:id="@+id/media_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/media_columns_vertical_scroll"/>
<com.simplemobiletools.commons.views.FastScroller
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">
<com.simplemobiletools.commons.views.FastScroller
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"/>
<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
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"/>
<include layout="@layout/fastscroller_handle_horizontal"/>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</com.simplemobiletools.commons.views.FastScroller>
</RelativeLayout>