Keyboard Height Listener
This method will make you detect the device's keyboard height. When device's keyboard is shown or hidden, this listener will detect and tell the keyboard's height.
1. Call 'Stipop.setKeyboardHeightDelegate'
This method will make you detect the device's keyboard height which is used in Stipop's PickerView.
Like Stipop did, use this keyboard height value where this value is needed.
MainActivity
Kotlin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
class MainActivity : AppCompatActivity() {
private val stipopButton: StipopImageView by lazy { findViewById(R.id.stipopButton) }
private val stipopImageView: StipopImageView by lazy { findViewById(R.id.stipopImageView) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Stipop.connect(
activity = this,
userId = "userID",
delegate = stipopDelegate,
stipopButton = stipopButton,
StickerPickerFragment = null
)
// If you want to detect keyboard's height, implement this delegate.
Stipop.setKeyboardHeightDelegate(this)
}
}
2. Implement 'StipopKeyboardHeightDelegate' interface
Implement 'StipopKeyboardHeightDelegate' and override 'onHeightChanged' function.
From now on, you can detect keyboard's height in this function.
Activity
Kotlin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class MainActivity : AppCompatActivity() {
private val stipopButton: StipopImageView by lazy { findViewById(R.id.stipopButton) }
private val stipopImageView: StipopImageView by lazy { findViewById(R.id.stipopImageView) }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Stipop.connect(
activity = this,
userId = "userID",
delegate = stipopDelegate,
stipopButton = stipopButton,
StickerPickerFragment = null
)
// If you want to detect keyboard's height, implement this delegate.
Stipop.setKeyboardHeightDelegate(this)
}
override fun onHeightChanged(keyboardHeight: Int) {
Log.e("Stipop","Keyboard height is changed -> $keyboardHeight")
}
}
Was this page helpful?
We’re here to help. Contact us.