Palulmu

General

Category
Free
Tag
Views
License
Apache License, Version 2.0
Registered
Apr 13, 2018
Favorites
4
Link
https://github.com/ivanisidrowu/palumu
See also
TicketView
CounterView
MultiStateView
TEmptyView
ComboView

Additional

Language
Kotlin
Version
v1.0.0 (Jul 13, 2020)
Created
Mar 18, 2018
Updated
Jul 13, 2020
Owner
Ivan (ivanisidrowu)
Contributor
Ivan (ivanisidrowu)
1
Activity
Badge
Generate
Download
Source code
APK file

Advertising

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().apply {
  floatingView = floatingPlayer
  recyclerView = recyclerView
  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 . You can also refer to .

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).apply {
  setHead(headView) // set head view or fragments
  setBody(bodyFragment) // set body view or fragments
  attach(root) // attach frame to root view
}

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()

Be careful! Don't forget to detach the frame when destroying the activity or fragment.

override fun onDestroy() {
        super.onDestroy()
        videoPageFrame?.detach()
}

Other details could be found in . You can also refer to .

DraggablePageFrame

It provides a frame container that can be maximized, minimized, and dragged on the screen.

The example below shows you how to initialize a DraggablePageFrame.

val pageFrame = DraggablePageFrame(this).apply {
            setContentView(imageView)
            val margin = resources.getDimensionPixelSize(R.dimen.item_margin)
            setContentMargin(margin)
            attach(root)
        }

You can also set a FrameListener into it.

pageFrame.listener = object : FrameListener {
    override fun onMinimized() {
       // Do it!
    }
}

Be careful! Don't forget to detach the frame when destroying the activity or fragment.

override fun onDestroy() {
        super.onDestroy()
        pageFrame.detach()
}

Other details could be found in . You can also refer to .

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:v1.0.0'
}

Contribution

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