Private Sub B4XPage_KeyboardStateChanged (Height As Float)
m_KeyboardHeight = Height
Dim ow As NativeObject
Dim duration As Int = ow.Initialize("B4IObjectWrapper").RunMethod("getMap:", Array(B4XPages.GetNativeParent(Me))) _
.RunMethod("objectForKey:", Array("animation_duration")).AsNumber * 1000
Log("duration in ms: " & duration)
Log("keyboard state changed: " & Height)
Dim curveIndex As Int = ow.Initialize("B4IObjectWrapper").RunMethod("getMap:", Array(B4XPages.GetNativeParent(Me))) _
.RunMethod("objectForKey:", Array("animation_curve")).AsNumber
Log("curve: " & curveIndex)
Dim Page As NativeObject = B4XPages.GetNativeParent(Me)
If Height > 0 Then 'Keyboard is open
xpnl_AddNewGroup.Top = Root.Height - xpnl_AddNewGroup.Height
Page.RunMethod("animateView:toYPosition:duration:curve:", Array(xpnl_AddNewGroup, Root.Top + Root.Height - Height - xpnl_AddNewGroup.Height, duration, curveIndex))
Else 'Keyboard is closed
Page.RunMethod("animateView:toYPosition:duration:curve:", Array(xpnl_AddNewGroup,Root.Height - xpnl_AddNewGroup.Height - B4XPages.GetNativeParent(Me).SafeAreaInsets.Bottom, duration, curveIndex))
End If
End Sub