rajatbeck / WindowInsetAnimationWithKeyboard

Sample application showing keyboard animation controls for android 11 in action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WindowInsetAnimationWithKeyboard

Sample application showing keyboard animation controls for android 11 in action

Minimum Requirement

  • Compile SDK >= 30
  • AppCompat version >= 1.3.0-alpha02
  • Jetpack version also available (Androidx core version >= 1.5.0-alpha02)

Features provided

  • Check the visibility of the keyboard.
  • Control the visibility of different insets including keyboard.
  • Listening to window inset animation eg. keyboard hide and show.
  • Controlling window inset animations eg. make keyboard part of the scroll.
 * Except for the first feature, all the other are only available above SDK >= 30, and the feature to check the visibility and height of the keyboard has some caveats like works for API 23+ when using windowSoftInputMode adjustResize and API 14 above for adjustpan.

UseCase

Can be used in the layout where we have lots of text inputs with frequent keyboard interaction like chat and conversation applications.

Listed below are the functions needed to achieve the above effect.

  • The inset type taken into observation is ime().
  • Integrated window inset animation callback provides us with callbacks which include :
    1. onPrepare(...)
    2. onStart(...)
    3. onProgress(...)
    4. onEnd(...)
  • Window inset listener to record start and end snapshot of the inset

Challenges Faced

  • Ran into some issues with animation offset when set to soft input keyboard behavior type adjustpan.

Useful links

 

About

Sample application showing keyboard animation controls for android 11 in action


Languages

Language:Kotlin 100.0%