Created
April 21, 2022 09:59
-
-
Save hiking93/7d9f5204a11e9a7a29c177f2a851e8dd 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
ViewCompat.setOnApplyWindowInsetsListener(binding.root) { v, insets -> | |
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime()) | |
Log.d("Hiking", "onApplyWindowInsets, bottom = ${imeInsets.bottom}") | |
insets | |
} | |
ViewCompat.setWindowInsetsAnimationCallback( | |
binding.root, | |
object : WindowInsetsAnimationCompat.Callback(DISPATCH_MODE_STOP) { | |
override fun onPrepare(animation: WindowInsetsAnimationCompat) { | |
super.onPrepare(animation) | |
Log.d("Hiking", "onPrepare") | |
} | |
override fun onStart( | |
animation: WindowInsetsAnimationCompat, | |
bounds: WindowInsetsAnimationCompat.BoundsCompat | |
): WindowInsetsAnimationCompat.BoundsCompat { | |
Log.d("Hiking", "onStart, bounds = $bounds") | |
return bounds | |
} | |
override fun onProgress( | |
insets: WindowInsetsCompat, | |
runningAnimations: MutableList<WindowInsetsAnimationCompat>, | |
): WindowInsetsCompat { | |
val imeInsets = insets.getInsets(WindowInsetsCompat.Type.ime()) | |
Log.d("Hiking", "onProgress, bottom = ${imeInsets.bottom}") | |
return insets | |
} | |
override fun onEnd(animation: WindowInsetsAnimationCompat) { | |
super.onEnd(animation) | |
Log.d("Hiking", "onEnd") | |
} | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment