1

I'm trying to implement the following miniplayer for a music player: ui gif

I currently have a vertical view pager that is slightly taller than one card/song. It's populated with miniplayer fragments via a FragmentStatePagerAdapter. I now have most of the vertical scrolling behavior I want but as expected, the top of the miniplayer is clipped by the layout bounds of the ViewPager. This led me to look into PopupWindow.

I'm currently trying to implement the fading away effect as seen in the gif. I'm using a PopupWindow so that miniplayer views can be seen outside the view bounds of the vertical viewpager. I tried putting the views from the fragment in the PopupWindow but I got an IllegalStateException because the view already had a parent (which was the VerticalViewPager). I'm now inflating a dummy view that looks exactly like the Miniplayer, but instead of returning it in onCreateView, that's the view I use in the PopupWindow's constructor. I then call

 mPopupWindow.showAtLocation(contentView, Gravity.BOTTOM, 0, 0);

I think I should be passing the TouchEvents from the real miniplayer view in order to translate the dummy view vertically past the bounds of the viewpager, but I'm a little stuck because the real view is showing underneath and I'm not sure where to go from here.

Am I going down the right path (implementation wise)?

Andrew Orobator
  • 7,978
  • 3
  • 36
  • 36

0 Answers0