Skip to content

Commit

Permalink
Merge pull request #4092 from ryg-git/issue-3869
Browse files Browse the repository at this point in the history
Focus on search bar when opening reaction view
  • Loading branch information
bmarty authored Sep 29, 2021
2 parents 357d7ee + 0099a37 commit 856fc8f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog.d/4092.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Added changes that will make SearchView in search bar focused by default on opening reaction picker.

When tapping close icon of SearchView, the SearchView did not collapse therefore added the on close listener
which will collapse the SearchView on close.
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ class EmojiReactionPickerActivity : VectorBaseActivity<ActivityEmojiReactionPick
}
})

searchView.setOnCloseListener {
currentFocus?.clearFocus()
searchItem.collapseActionView()
true
}

searchView.queryTextChanges()
.throttleWithTimeout(600, TimeUnit.MILLISECONDS)
.doOnError { err -> Timber.e(err) }
Expand All @@ -174,6 +180,7 @@ class EmojiReactionPickerActivity : VectorBaseActivity<ActivityEmojiReactionPick
}
.disposeOnDestroy()
}
searchItem.expandActionView()
return true
}

Expand Down
2 changes: 1 addition & 1 deletion vector/src/main/res/menu/menu_emoji_reaction_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
app:iconTint="?vctr_content_primary"
android:title="@string/search"
app:actionViewClass="android.widget.SearchView"
app:showAsAction="collapseActionView|ifRoom" />
app:showAsAction="collapseActionView|always" />
</menu>

0 comments on commit 856fc8f

Please sign in to comment.