Created
June 25, 2018 02:55
-
-
Save camaelon/4d574b38a90557a6512da3a9ff7dad51 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.widget.DrawerLayout | |
import android.util.AttributeSet | |
import android.view.View | |
class DrawerContent @JvmOverloads constructor( | |
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0 | |
) : MotionLayout(context, attrs, defStyleAttr), DrawerLayout.DrawerListener { | |
override fun onDrawerStateChanged(newState: Int) { | |
} | |
override fun onDrawerSlide(drawerView: View, slideOffset: Float) { | |
progress = slideOffset | |
} | |
override fun onDrawerClosed(drawerView: View) { | |
} | |
override fun onDrawerOpened(drawerView: View) { | |
} | |
override fun onAttachedToWindow() { | |
super.onAttachedToWindow() | |
(parent as? DrawerLayout)?.addDrawerListener(this) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment