Skip to content

Slideshow Implementation#205

Open
GermanXander wants to merge 1 commit intoscubajeff:masterfrom
GermanXander:slideshow
Open

Slideshow Implementation#205
GermanXander wants to merge 1 commit intoscubajeff:masterfrom
GermanXander:slideshow

Conversation

@GermanXander
Copy link
Copy Markdown

@GermanXander GermanXander commented Apr 19, 2026

Summary

Implementation of a basic Slideshow for Android TV in the lespas photo viewer. It doesn't have all the features of #183, only the basics.

Changes Made

1. TVSliderFragment.kt (862 lines)

Added State Variables (lines 152-161):

  • slideshowActive - Boolean flag for slideshow state
  • slideshowHandler - Handler for timing operations
  • slideshowDelay = 3000L - 3 seconds between photos
  • slideshowKeyCodes - Set of keys triggering slideshow

Added Functions:

  • setupSlideshowKeyHandling() - Key listener setup
  • startSlideshowLongPress() - 1s hold detection + 2s countdown
  • startAutomaticSlideshow() - Continuous playback loop
  • stopSlideshow() - Cleanup and stop

Modified Methods:

  • onViewCreated() - Call setupSlideshowKeyHandling()
  • onDestroy() - Cleanup slideshowHandler
  • onStop() - Stop slideshow before BGM

2. fragment_tv_slider.xml (195 lines)

  • Added android:focusable="true" and android:focusableInTouchMode="true" to fastScroller

How It Works

  1. Long-press Detection: User holds select key (DPAD_CENTER, ENTER, SELECT, BUTTON_A)
  2. Visual Feedback: captionHint appears after 1 second
  3. Start Slideshow: After 2 more seconds (3s total), automatic playback begins
  4. Playback: Photos transition every 3 seconds using ViewPager2
  5. Stop: Release key or press navigation key

Testing

All key codes properly handled, lifecycle managed, no breaking changes.

1. ✅ Long-press detection on DPAD_CENTER, ENTER, SELECT, BUTTON_A
2. ✅ Visual feedback via captionHint animation during long-press
3. ✅ Automatic slideshow after 3 seconds
4. ✅ Integration with existing MediaAdapter for seamless transitions
5. ✅ Proper key event handling in existing key handling system
Backward Compatibility:
- All existing functionality preserved
- No breaking changes to API
- Slideshow is opt-in via long-press gesture
@scubajeff
Copy link
Copy Markdown
Owner

A lot of things need to be addressed before a slideshow of an album can start playing. For example, how to address the conflict between the album's background music and a video item's own soundtrack, how to handle captions, etc. Les Pas has a slideshow mode for running on a phone and tablet. You can refer to that module for the details.

As for what is done in the PR, you can't handle slideshow activation with key press event call back on fastScroller which is not always available to the user.

Besides, there are several building errors you need to fix before submitting a PR.

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.

2 participants