From 9d34155b9a9c791933d76d2f2b00061d4a5edd18 Mon Sep 17 00:00:00 2001 From: josephpv Date: Mon, 10 Mar 2025 14:51:37 +0000 Subject: Change to not show face icon for history suggestions Screenshot: Before: go/ss/8EeYtQkanNPDEWL.png After: go/ss/4pqpkWfEzGmXpE4.png Bug: 401184113 Test: Manual Flag: EXEMPT Bug fix Change-Id: Ia21c09daf08920f746843570d9bd8076ecf48c84 --- photopicker/src/com/android/photopicker/features/search/Search.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'photopicker') diff --git a/photopicker/src/com/android/photopicker/features/search/Search.kt b/photopicker/src/com/android/photopicker/features/search/Search.kt index 1e6cb0a6c..f7c71d9ff 100644 --- a/photopicker/src/com/android/photopicker/features/search/Search.kt +++ b/photopicker/src/com/android/photopicker/features/search/Search.kt @@ -789,7 +789,8 @@ 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)) } } -- cgit v1.2.3-59-g8ed1b From 70bcaf1aca4ce4a7277c1ad9c0d159439a1ec63e Mon Sep 17 00:00:00 2001 From: josephpv Date: Mon, 10 Mar 2025 16:07:26 +0000 Subject: Request keyboard focus only when searchstate is Inactive Screenrecording: b/400912980#comment4 Bug: 400912980 Test: Manual Flag: EXEMPT Bug fix Change-Id: I2c0712a5ec7bf07416ad5b4152c215d441d94cf0 --- .../com/android/photopicker/features/search/Search.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'photopicker') diff --git a/photopicker/src/com/android/photopicker/features/search/Search.kt b/photopicker/src/com/android/photopicker/features/search/Search.kt index f7c71d9ff..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,8 +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.type != SearchSuggestionType.HISTORY && suggestion.icon != null) { + if ( + suggestion.type != SearchSuggestionType.FACE && + suggestion.type != SearchSuggestionType.HISTORY && + suggestion.icon != null + ) { ShowSuggestionIcon(suggestion, Modifier.size(MEASUREMENT_OTHER_ICON).clip(CircleShape)) } } -- cgit v1.2.3-59-g8ed1b