Skip to content

Save the last search term and added a button to clear text#2004

Draft
agrogers wants to merge 4 commits intodevelopfrom
Search-Saved-Last-Term
Draft

Save the last search term and added a button to clear text#2004
agrogers wants to merge 4 commits intodevelopfrom
Search-Saved-Last-Term

Conversation

@agrogers
Copy link
Contributor

  • The previous search text is now saved
  • Button added to clear that text if when you don't want it

image

@agrogers agrogers added the 4.0 label Dec 27, 2021
This was referenced Dec 31, 2021
@tuomas2 tuomas2 added 4.1 and removed 4.0 labels Jan 13, 2022
@tuomas2
Copy link
Contributor

tuomas2 commented Jan 13, 2022

Contains new strings, so 4.1

@tuomas2
Copy link
Contributor

tuomas2 commented Jan 13, 2022

Bug:

  1. Open Find
  2. Write "Jesus"
  3. Enable "Remember search text"
  4. Click "Find"
  5. Click back btn
    -> "Remeber search text" is disabled
    (should be enabled)

@tuomas2
Copy link
Contributor

tuomas2 commented Jan 13, 2022

I think this would be better: #186 (comment)
What do you think about implementing that instead?

@agrogers
Copy link
Contributor Author

agrogers commented Jan 13, 2022 via email

@tuomas2
Copy link
Contributor

tuomas2 commented Jan 19, 2022

What control would you use for the drop down list?

I have used AutoCompleteTextView in document selection (see document_selection.xml). I think it would work here.

@tuomas2 tuomas2 requested a review from Copilot April 28, 2025 11:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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("")})
Copy link

Copilot AI Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
})

Copilot uses AI. Check for mistakes.
@agrogers agrogers marked this pull request as draft December 28, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Waiting for others

Development

Successfully merging this pull request may close these issues.

2 participants