diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 5fff99950..ade0db791 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -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, "") diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index bbf53b09e..6b728133f 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -11,10 +11,21 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + + @@ -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">