diff options
author | 2025-03-11 07:19:32 -0700 | |
---|---|---|
committer | 2025-03-11 07:19:32 -0700 | |
commit | ae5be30553ffa5eceb82834c2b99da4eb16f50ab (patch) | |
tree | 67d5aa2fa36e81352a02b0dfaadfa4bc15b555fc /photopicker | |
parent | 2d779528c00b7a90234741dcba0af4aa31d7a338 (diff) | |
parent | 70bcaf1aca4ce4a7277c1ad9c0d159439a1ec63e (diff) |
Merge changes I2c0712a5,Ia21c09da into main
* changes:
Request keyboard focus only when searchstate is Inactive
Change to not show face icon for history suggestions
Diffstat (limited to 'photopicker')
-rw-r--r-- | photopicker/src/com/android/photopicker/features/search/Search.kt | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/photopicker/src/com/android/photopicker/features/search/Search.kt b/photopicker/src/com/android/photopicker/features/search/Search.kt index 1e6cb0a6c..0f2c619be 100644 --- a/photopicker/src/com/android/photopicker/features/search/Search.kt +++ b/photopicker/src/com/android/photopicker/features/search/Search.kt @@ -479,10 +479,15 @@ private fun SearchInput( } @Composable -private fun RequestFocusOnResume(focusRequester: FocusRequester, focused: Boolean) { +private fun RequestFocusOnResume( + focusRequester: FocusRequester, + focused: Boolean, + viewModel: SearchViewModel = obtainViewModel(), +) { val lifecycleOwner = LocalLifecycleOwner.current + val searchState by viewModel.searchState.collectAsStateWithLifecycle() LaunchedEffect(Unit) { - when (focused) { + when (focused && searchState is SearchState.Inactive) { true -> lifecycleOwner.repeatOnLifecycle(state = Lifecycle.State.RESUMED) { focusRequester.requestFocus() @@ -789,7 +794,11 @@ fun SuggestionItem(suggestion: SearchSuggestion) { } val text = suggestion.displayText ?: "" Text(text = text, modifier = Modifier.padding(start = MEASUREMENT_LARGE_PADDING).weight(1f)) - if (suggestion.type != SearchSuggestionType.FACE && suggestion.icon != null) { + if ( + suggestion.type != SearchSuggestionType.FACE && + suggestion.type != SearchSuggestionType.HISTORY && + suggestion.icon != null + ) { ShowSuggestionIcon(suggestion, Modifier.size(MEASUREMENT_OTHER_ICON).clip(CircleShape)) } } |