Skip to content

Reload medialibrary when browsing last added tracks

Robert Stone requested to merge rhstone/vlc-android:refresh-on-last-added into master

Description

This MR adds code to re-scan for the latest on-device media after navigating to the last added menu. This is the same function performed in the app when "Refresh" is invoked from the overflow menu.

Motivation and Context

User requested the ability to trigger a rescan from the Android Auto interface without manually using the app UI.

How Has This Been Tested?

Tested on a Pixel 3 Running Android 11.

This modification now triggers UI updates on all ML changes. I performed an entire medialibrary scan from the Android Auto UI which seemed to work perfectly. This also updates the history page live, so if you navigate to history and execute "play next song" via voice command you will see the new history item appear on-screen.

Note: If you send notifyChildrenChanged to the UI while the on-screen keyboard is displayed, it will knock the UI back a page to the cover/list view. I do not want advancing songs via the steering wheel controls (or due to the playlist) to trigger a UI change, so I broke out the history callback separately and disabled onMediaModified to avoid a fight between a driver changing songs and a passenger navigating the menus. If an album/artist/track/genre is added dynamically when in cover/list view, it retains the scroll bar position and inserts the new item as expected.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING section of the README document.

Resolves

Fixes: #2270 (closed)

Edited by Robert Stone

Merge request reports

Loading