Sub ToggleDrawerState
Dim Duration As Int = 100
OverlayVisible = Not(OverlayVisible)
Overlay.SetVisibleAnimated(Duration, OverlayVisible)
Dim pnlBottomVisibleHeight As Int = pnlBottom.Height - 8dip 'hide bottom round corners
If OverlayVisible Then
SetActionBarColor(Colors.ARGB(150, 0, 0, 0))
SetStatusBarColor( mixColors(Colors.ARGB(150, 0, 0, 0), Colors.black) )
pnlBottom.SetLayoutAnimated(0, 0, pnlBottom.Parent.Height, pnlBottom.Width, pnlBottom.Height)
pnlBottom.SetLayoutAnimated(Duration, 0, pnlBottom.Parent.Height - pnlBottomVisibleHeight, pnlBottom.Width, pnlBottom.Height)
Else
SetActionBarColor(Colors.Transparent)
SetStatusBarColor(Colors.ARGB(150, 0, 0, 0))
pnlBottom.SetLayoutAnimated(0, 0, pnlBottom.Parent.Height - pnlBottomVisibleHeight, pnlBottom.Width, pnlBottom.Height)
pnlBottom.SetLayoutAnimated(Duration, 0, pnlBottom.Parent.Height, pnlBottom.Width, pnlBottom.Height)
End If
End Sub
Sub SetStatusBarColor(Color As Int)
'status
Dim jo As JavaObject
jo.InitializeContext
Dim window As JavaObject = jo.RunMethodJO("getWindow", Null)
window.RunMethod("addFlags", Array (0x80000000))
window.RunMethod("clearFlags", Array (0x04000000))
window.RunMethod("setStatusBarColor", Array(Color))
End Sub
Sub SetActionBarColor(Color As Int)
'menu bar
Dim jo As JavaObject
jo.InitializeContext
Dim cd As ColorDrawable
cd.Initialize(Color, 0)
jo.RunMethodJO("getActionBar", Null).RunMethod("setBackgroundDrawable", Array(cd))
End Sub