Skip to content

Instantly share code, notes, and snippets.

@camaelon
Last active June 26, 2018 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save camaelon/eb308912e86c9e7eaf29b10d4bb3f444 to your computer and use it in GitHub Desktop.
Save camaelon/eb308912e86c9e7eaf29b10d4bb3f444 to your computer and use it in GitHub Desktop.
package com.google.androidstudio.motionlayoutexample.utils
import android.content.Context
import android.support.constraint.motion.MotionLayout
import android.support.v4.view.ViewPager
import android.util.AttributeSet
class ViewpagerHeader @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : MotionLayout(context, attrs, defStyleAttr), ViewPager.OnPageChangeListener {
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
var numPages = 3
progress = (position + positionOffset) / (numPages - 1)
}
override fun onPageSelected(position: Int) {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment