Skip to content

Commit 884a454

Browse files
Material Design Teamdrchen
authored andcommitted
[Search] Support stylus handwriting in SearchBar
PiperOrigin-RevId: 524098693
1 parent 206928b commit 884a454

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/java/com/google/android/material/search/SearchView.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,15 @@ public void setupWithSearchBar(@Nullable SearchBar searchBar) {
543543
searchViewAnimationHelper.setSearchBar(searchBar);
544544
if (searchBar != null) {
545545
searchBar.setOnClickListener(v -> show());
546+
if (BuildCompat.isAtLeastU()) {
547+
try {
548+
searchBar.setHandwritingDelegatorCallback(this::show);
549+
editText.setIsHandwritingDelegate(true);
550+
} catch (LinkageError e) {
551+
// Running on a device with an older build of Android U
552+
// TODO(b/274154553): Remove try/catch block after Android U Beta 1 is released
553+
}
554+
}
546555
}
547556
updateNavigationIconIfNeeded();
548557
setUpBackgroundViewElevationOverlay();

0 commit comments

Comments
 (0)