show a button at folder searching for switching to file searching

This commit is contained in:
tibbi 2019-07-09 22:05:39 +02:00
parent a84821f57c
commit ee929a9d1b
2 changed files with 21 additions and 0 deletions

View File

@ -151,6 +151,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
updateWidgets()
registerFileUpdateListener()
directories_switch_searching.setOnClickListener {
launchSearchActivity()
}
}
override fun onStart() {
@ -198,6 +202,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
invalidateOptionsMenu()
directories_empty_text_label.setTextColor(config.textColor)
directories_empty_text.setTextColor(getAdjustedPrimaryColor())
directories_switch_searching.setTextColor(getAdjustedPrimaryColor())
directories_switch_searching.underlineText()
if (mIsPasswordProtectionPending && !mWasProtectionHandled) {
handleAppPasswordProtection {
@ -351,6 +357,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
MenuItemCompat.setOnActionExpandListener(mSearchMenuItem, object : MenuItemCompat.OnActionExpandListener {
override fun onMenuItemActionExpand(item: MenuItem?): Boolean {
directories_switch_searching.beVisible()
mIsSearchOpen = true
directories_refresh_layout.isEnabled = false
return true
@ -359,6 +366,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
// this triggers on device rotation too, avoid doing anything
override fun onMenuItemActionCollapse(item: MenuItem?): Boolean {
if (mIsSearchOpen) {
directories_switch_searching.beGone()
mIsSearchOpen = false
directories_refresh_layout.isEnabled = config.enablePullToRefresh
setupAdapter(mDirs, "")

View File

@ -11,10 +11,21 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/directories_switch_searching"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:gravity="center"
android:padding="@dimen/activity_margin"
android:text="@string/switch_to_file_search"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/directories_empty_text_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/directories_switch_searching"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin"
android:paddingTop="@dimen/activity_margin"
@ -39,6 +50,7 @@
android:id="@+id/directories_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/directories_switch_searching"
android:scrollbars="none"
app:layoutManager="com.simplemobiletools.commons.views.MyGridLayoutManager"
app:spanCount="@integer/directory_columns_vertical_scroll"/>
@ -47,6 +59,7 @@
android:id="@+id/directories_vertical_fastscroller"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_below="@+id/directories_switch_searching"
android:layout_alignParentEnd="true"
android:paddingStart="@dimen/normal_margin"
android:visibility="gone">