Palumu

A floating view helper lib to let you create floating view above other views!

  • Floating view can follow specified view
  • Scalable view supported
  • Fullscreen supported

Components

FloatingViewHelper

Here is an example of how to create a floating view above a RecyclerView

val floatingViewHelper = FloatingViewHelper()
floatingViewHelper.floatingView = floatingPlayer
floatingViewHelper.recyclerView = recyclerView
floatingViewHelper.listener = listener

The listener is needed for helper to get the view followed by floating view.
Please make sure you override getTargetView() in FloatingViewListener.

Then, you attach the view and start the helper.

floatingViewHelper.attachFloatingView()
floatingViewHelper.start()

Fullscreen is supported.

// Enter fullscreen (use it in activity onConfigurationChanged)
floatingViewHelper.enterFullScreen()

// Leave fullscreen (use it in activity onConfigurationChanged)
floatingViewHelper.leaveFullScreen()

Other details could be found in wiki. You can also refer to the sample APP.

ScalablePageFrame

This class provides youtubish style view. It can be scaled and swipe-to-close. You can set head view as the upper part of the UI and body view as lower part of the UI. In general, you can set any views to head and body. But SurfaceView now is not supported.

Add the frame into the specified view.

val videoPageFrame = ScalablePageFrame(context)
videoPageFrame.init(headView, bodyView, root)

It also supports fullscreen, just add few lines of code into onConfigurationChanged.

// Enter fullscreen (use it in activity onConfigurationChanged)
videoPageFrame?.enterFullScreen()
// Leave fullscreen (use it in activity onConfigurationChanged)
videoPageFrame?.leaveFullScreen()

Other details could be found in wiki. You can also refer to the sample APP.

Download

Add this repo to the root build.gradle file.

allprojects {
  repositories {
  ...
  maven { url 'https://jitpack.io' }
  }
}

Then add this dependency to app's build.gradle file.

dependencies {
  compile 'com.github.ivanisidrowu:palumu:0.9.1'
}

Contribution

Contributions are always welcome. If you have any ideas or suggestions, you can contact me or create a github issue.

TODOs

  • [ ] Allow sharing floating views across activities.
  • [ ] ScalablePageFrame supports taking fragments as the content of upper and lower view.

GitHub