Private KC As String
Sub Activity_KeyPress (KeyCode As Int) As Boolean
If KeyCode = KeyCodes.KEYCODE_BACK Or KeyCode = KeyCodes.KEYCODE_MENU Then
KC = KeyCode
CallSubDelayed(Me, "HandleSideBar")
Return True
End If
Return False
End Sub
Sub HandleSideBar
If KC = KeyCodes.KEYCODE_MENU Then
If PanelWithSidebar.IsSidebarVisible = True Then
PanelWithSidebar.CloseSidebar
Else
PanelWithSidebar.OpenSidebar
End If
Else If KC = KeyCodes.KEYCODE_BACK Then
If PanelWithSidebar.IsSidebarVisible = True Then
PanelWithSidebar.CloseSidebar
Else
If WV1Extra.CanGoback = True Then
WV1.Back
Else
Activity.Finish
End If
End If
End If
End Sub