Skip to content

Keep the history controls visible while scrolling long history lists - #13968

Closed
Fzflz-Sun wants to merge 5 commits into
TeamNewPipe:devfrom
Fzflz-Sun:fix/history-controls-13487
Closed

Fzflz-Sun wants to merge 5 commits into
TeamNewPipe:devfrom
Fzflz-Sun:fix/history-controls-13487

Conversation

@Fzflz-Sun

Copy link
Copy Markdown

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

The sort button and the playlist action buttons of the history screen were handed to the adapter through getListHeaderSupplier(), so they were rendered as list item 0 and scrolled out of the screen as soon as the history list became longer than one screen.

  • added fragment_history.xml, which pins statistic_playlist_control above a reused fragment_playlist layout, so the list, the loading indicator, the empty state and the error panel keep working unchanged
  • StatisticsPlaylistFragment now binds the controls that are already in the layout instead of supplying a list header
  • the controls stay visible while a reload is running, so toggling the sort mode no longer makes the whole bar blink and the list jump up and down
  • the sort click listener is registered once in initListeners() instead of being re-registered on every database emission
  • the controls are hidden only while the history is empty or an error is shown
  • added an instrumentation test covering the layout in portrait and landscape

Note: I noticed after starting that this issue is already assigned to @kenneySiu. I am submitting this PR so that the work is documented for a university course assignment (COMP6120 at ANU). I would be happy to close it if you would rather handle this differently - no merge is expected.

Before/After Screenshots/Screen Record

Fixes the following issue(s)

Relies on the following changes

Testing/QA

Devices
  • covered by the new HistoryControlsLayoutTest instrumentation test; the CI runs connectedCheck on API 23 and API 35
  • checkstyle and ktlint are clean on the changed files
Steps for testing
  1. Open the history with more than one screen of entries
  2. Scroll down: the sort row and the three action buttons (Background / Play All / Popup) stay at the top
  3. Toggle the sort mode while scrolled down: the controls do not move or blink, the list re-sorts
  4. Clear the history: the controls are hidden and the empty state is shown, as before

The sort button and the playlist action buttons were supplied to the
adapter through getListHeaderSupplier(), so they were rendered as list
item 0 and scrolled out of the screen on long history lists.

Pin them above the list instead, in a new fragment_history layout which
reuses fragment_playlist for the list, the loading indicator, the empty
state and the error panel. Bind the controls once in initViews() and
register the sort listener in initListeners() instead of re-registering
it on every database emission.

The controls are hidden while the history is empty or an error is shown,
but no longer while a reload is running: hiding them in showLoading()
made the whole bar blink and the list jump every time the sort mode was
toggled.
The first version scrolled the RecyclerView from the instrumentation
thread and sized the screen in raw pixels, so the assertions depended on
the density of the emulator and on the test running off the main thread.

Run the whole test body on the main thread, express the screen size in
dp, and add assertions for the controls not covering the list and for
the controls not eating up a landscape screen.
@github-actions github-actions Bot added size/medium PRs with less than 250 changed lines template-ignored labels Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Please link this PR to an existing issue you are assigned to. This PR might be closed if the details of this PR were not agreed upon beforehand.

@sonarqubecloud

Copy link
Copy Markdown

@Fzflz-Sun

Copy link
Copy Markdown
Author

Closing this: it was opened to document the work for a course assignment, and I had noticed too late that the issue is already being handled by @kenneySiu. Sorry for the noise, no merge was expected.

@Fzflz-Sun Fzflz-Sun closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/medium PRs with less than 250 changed lines template-ignored

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep history control buttons visible when scrolling up long history lists

2 participants