1
Предложения / Suggestions / Implement ViewPager2 to swipe on the Current Played Track/ Album Cover
« on: June 28, 2021, 11:21:26 »
Hi,
I'd suggest to integrate/use the Androidx ViewPager2 View in the player screen for the Album Cover and the Currently Played Track in the Navbar. Why? This allows a more smooth Navigation between Songs (Next & Previous) and also supports Swiping. You can also make a nicer transition when a new song is played.
Examples from my Test App:
Whats the ViewPager2?
Thats Androids Carousel View/Widget, that allows to display a "list" of ViewHolders/Layouts. Its implemented pretty similar to how ListViews are created.
Some notes about Implementing the ViewPager2: (i used it in a Player I've been working on)
- The ViewPager2s Listener has to respect a couple conditions inside the OnPageSelected Method:
- call the Skip Method/Play Method only when the User swiped. (I have a boolean that is set to true when the Pagers page is updated from Code, because a new song is played etc., and set to false in the OnPageSelected, and Skip/Play/Prev is only called if that boolean was false)
- the adapter might just take a similar dataset as the Playlist Views.
I'd suggest to integrate/use the Androidx ViewPager2 View in the player screen for the Album Cover and the Currently Played Track in the Navbar. Why? This allows a more smooth Navigation between Songs (Next & Previous) and also supports Swiping. You can also make a nicer transition when a new song is played.
Examples from my Test App:
Whats the ViewPager2?
Thats Androids Carousel View/Widget, that allows to display a "list" of ViewHolders/Layouts. Its implemented pretty similar to how ListViews are created.
Some notes about Implementing the ViewPager2: (i used it in a Player I've been working on)
- The ViewPager2s Listener has to respect a couple conditions inside the OnPageSelected Method:
- call the Skip Method/Play Method only when the User swiped. (I have a boolean that is set to true when the Pagers page is updated from Code, because a new song is played etc., and set to false in the OnPageSelected, and Skip/Play/Prev is only called if that boolean was false)
- the adapter might just take a similar dataset as the Playlist Views.