Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should clear the input array when we swipe right and are looking for apps, once you open the app the search bar should be clear so that you don't have to manually erase it and just better UI experience #258

Closed
MostlyKIGuess opened this issue Jul 7, 2023 · 7 comments
Assignees

Comments

@MostlyKIGuess
Copy link

No description provided.

@MostlyKIGuess
Copy link
Author

I want to work on this issue ,

I think the function is already there in https://github.com/mslalith/focus_launcher/blob/main/core/ui/src/main/kotlin/dev/mslalith/focuslauncher/core/ui/SearchField.kt

trailingIcon = {
AnimatedVisibility(visible = query.isNotEmpty()) {
Box(
modifier = Modifier
.clip(shape = CircleShape)
.clickable { onQueryChange("") }
.padding(all = 4.dp)
) {
Icon(
painter = painterResource(id = R.drawable.ic_close),
contentDescription = stringResource(id = R.string.clear)
)

                but it's not emptying the string on query, can anyone guide me through it?

@mslalith
Copy link
Owner

mslalith commented Jul 8, 2023

Hey @MostlyKIGuess, you can clear the query by setting it to empty before launching the app

fun onAppClick(appDrawerItem: AppDrawerItem) {
focusManager.clearFocus()
context.launchApp(app = appDrawerItem.app)
}

@mslalith mslalith self-assigned this Sep 3, 2023
@supermar1010
Copy link
Contributor

supermar1010 commented Oct 31, 2023

I'd also like this feature. I tried to have a go but I'm not really good with jetpack-compose.

Resetting when opening the app works like this:

appDrawerPageViewModel.searchAppQuery("")

But what I failed at achieving was, to empty the searchfield everytime you navigate away (e.g. by going to the homescreen)

I created a PR for this :)

supermar1010 added a commit to supermar1010/focus_launcher that referenced this issue Oct 31, 2023
@mslalith
Copy link
Owner

mslalith commented Nov 1, 2023

@supermar1010 thanks for the PR. As for the other scenario, below is where we hide the keyboard on navigating away. You can reset here

snapshotFlow { pagerState.currentPage }.collectLatest { page ->
if (page != 2) keyboardController?.hide()
}

I'm planning on refactoring to stateless & stateful Composables. I would take care of this as part of refactoring

@mslalith
Copy link
Owner

mslalith commented Nov 1, 2023

Fixed in 9138520

@mslalith mslalith closed this as completed Nov 1, 2023
@MostlyKIGuess
Copy link
Author

oh cool, thanks, sorry I didn't update!

@mslalith
Copy link
Owner

Fixed in v0.8.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants