Skip to content

Conversation

VougJo23
Copy link
Contributor

@VougJo23 VougJo23 commented Jun 8, 2025

Display fragment based on search text

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • settings_preferencesearch_fragment.xml: when displaying "No Results", make screen non-clickable
  • SettingsActivity.java:
    Create function showMainSettingsFragment() to display main fragment without adding it to a stack
    Dynamically switches between PreferenceSearchFragment and MainSettingsFragment depending on the input text.
    Disposes of searchDisposable safely in onDestroy() to avoid memory leaks.
  • SettingsActivityTest.java: targeted tests for the new search logic by isolating SettingsActivity behavior from a full Android
    runtime.
  • PreferenceSearcher.java: remove checking for empty text as it is handled in the changes above

Before/After Screenshots/Screen Record

Fixes the following issue(s)

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.

Due diligence

Keep Main Fragment until user's input
@github-actions github-actions bot added the size/medium PRs with less than 250 changed lines label Jun 8, 2025
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

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

Thanks! I think we can keep things simpler though, and just make the "No results" page non clickable. Once you press on "search" it makes sense to open the search menu fully I believe, instead of continuing to show the list of main categories. What do others think? @Profpatsch @ShareASmile

Copy link
Member

Choose a reason for hiding this comment

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

Changes in this class should be reverted as they are caused by different indentation settings in the IDE

Comment on lines +440 to +452
// Functions needed for testing
protected EditText getSearchEditText() {
return searchEditText;
}

public void setMockEditText(final EditText editText) {
this.searchEditText = editText;
}

protected static int getFragmentHolderId() {
return FRAGMENT_HOLDER_ID;
}

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to mock these?

@ShareASmile ShareASmile added bug Issue is related to a bug search Anything related to the search function labels Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug search Anything related to the search function size/medium PRs with less than 250 changed lines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings Search Bar hides categories UI but retains navigation
3 participants