Skip to content

Conversation

@tejas-rkd
Copy link

@tejas-rkd tejas-rkd commented May 19, 2025

Purpose

When using Transdroid with a Torrent server that has a large number of torrents (e.g., 3000+), navigating the torrent list can be inefficient. Specifically, if a user selects an active torrent and then changes the sort order (e.g., "all order by size"), the list often remains scrolled to the middle. This makes it difficult to quickly view torrents at the beginning of the newly sorted list, such as the largest torrents when sorting by size. (fixes #587)

Solution

Create a "Scroll to top" button which allows users to easily scroll back to the top of the torrent list when they've scrolled down. The button appears with a smooth fade-in animation when scrolling down and disappears with a fade-out when returning to the top of the list.

  1. Created a vector drawable icon for the up arrow (ic_arrow_up.xml)
  2. Created a circular background for the button (scroll_to_top_background.xml)
  3. Added the button to the fragment layout (fragment_torrents.xml)
  4. Added animation files for smooth transitions (fade_in.xml and fade_out.xml)
  5. Updated the TorrentsFragment Java class to:
    • Add a reference to the button
    • Implement a scroll listener that shows/hides the button as needed
    • Add a scroll to top method that's called when the button is clicked
    • Update the visibility management for proper showing/hiding of the button

Testing

Demo Link: https://drive.google.com/file/d/1vbRJz1j2XKxQ-S9aIArYCGdrt9AgQiVH/view?usp=drivesdk

  1. Empty list -> no button
  2. List expanded upto non scrollable view -> no button
  3. List expanded with scroll bar -> button visible -> click takes to top
  4. Opening detail view -> button visible if scroll bar exist
  5. Check sorting and filtering functionality with no side effects

@tejas-rkd
Copy link
Author

tejas-rkd commented May 19, 2025

I have added single drawable file ic_arrow_up.xml, which should have been folder with support for different resolutions and night mode. This will be added after first pass of review.

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

Successfully merging this pull request may close these issues.

Feature Request: reach top quickly

1 participant