Save the last search term and added a button to clear text#2004
Draft
Save the last search term and added a button to clear text#2004
Conversation
Contributor
agrogers
commented
Dec 26, 2021
- The previous search text is now saved
- Button added to clear that text if when you don't want it

This was referenced Dec 31, 2021
Closed
Contributor
|
Contains new strings, so 4.1 |
Contributor
|
Bug:
|
Contributor
|
I think this would be better: #186 (comment) |
Contributor
Author
|
Yeah, I have wanted that at times also. I think there is a place for both
remembering, clearing with the X and selecting from a history list.
So saving the last term and having an option to disable it is still helpful
to me.
What control would you use for the drop down list?
…On Fri, 14 Jan 2022, 12:58 am Tuomas Airaksinen, ***@***.***> wrote:
I think this would be better: #186 (comment)
<#186 (comment)>
What do you think about implementing that instead?
—
Reply to this email directly, view it on GitHub
<#2004 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADKGTJQMTJLR6KRPQXNFRDDUV3SCHANCNFSM5KY3RAAQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Contributor
I have used AutoCompleteTextView in document selection (see document_selection.xml). I think it would work here. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the search functionality by saving the last search term and introducing a clear text button.
- Stores the user's preference to remember the last search string.
- Automatically pre-loads the saved search text if available.
- Adds a button to clear the search text on demand.
Files not reviewed (2)
- app/src/main/res/layout/search.xml: Language not supported
- app/src/main/res/values/strings.xml: Language not supported
| } | ||
| currentBookRadioButton.text = currentBookName | ||
|
|
||
| binding.textClear.setOnClickListener({binding.searchText.setText("")}) |
There was a problem hiding this comment.
When clearing the search text in the UI, the persisted search text is not updated. Consider also clearing or updating the saved 'search_text' preference so that the cleared state is reflected across sessions.
Suggested change
| binding.textClear.setOnClickListener({binding.searchText.setText("")}) | |
| binding.textClear.setOnClickListener({ | |
| binding.searchText.setText("") | |
| val sharedPreferences = getSharedPreferences("search_preferences", MODE_PRIVATE) | |
| sharedPreferences.edit().putString("search_text", "").apply() | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.