Last active
June 26, 2018 17:48
-
-
Save camaelon/eb308912e86c9e7eaf29b10d4bb3f444 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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