Эх сурвалжийг харах

Unified search: clear focus from search view on open

Signed-off-by: Álvaro Brey Vilas <alvaro.brey@nextcloud.com>
Álvaro Brey Vilas 3 жил өмнө
parent
commit
30091a7aa4

+ 5 - 4
src/main/java/com/owncloud/android/ui/fragment/UnifiedSearchFragment.kt

@@ -226,10 +226,11 @@ class UnifiedSearchFragment : Fragment(), Injectable, UnifiedSearchListInterface
 
     override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
         val item = menu.findItem(R.id.action_search)
-        val sv = MenuItemCompat.getActionView(item) as SearchView
-        sv.setQuery(vm.query.value, false)
-        sv.setOnQueryTextListener(this)
-        sv.isIconified = false
+        val searchView = MenuItemCompat.getActionView(item) as SearchView
+        searchView.setQuery(vm.query.value, false)
+        searchView.setOnQueryTextListener(this)
+        searchView.isIconified = false
+        searchView.clearFocus()
     }
 
     companion object {

+ 2 - 2
src/main/java/com/owncloud/android/ui/fragment/util/PairMediatorLiveData.kt

@@ -18,9 +18,9 @@
  *
  * You should have received a copy of the GNU Affero General Public License
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
- * 
+ *
  * Inspired by https://medium.com/codex/how-to-use-mediatorlivedata-with-multiple-livedata-types-a40e1a59e8cf
- * 
+ *
  */
 
 package com.owncloud.android.ui.fragment.util