Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private Pane1 As B4XView
Private Button1 As B4XView
Private Label1 As B4XView
Private xivSnapshot As B4XImageView
Private mPaneLeft, mPaneTop, mPaneW, mPaneH As Int
Private mDuration As Int = 400
End Sub
Public Sub Initialize
B4XPages.GetManager.TransitionAnimationDuration = 0
End Sub
#Region B4XPage EVENTS
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("mainpage")
B4XPages.SetTitle(Me, "Home")
mPaneLeft = Pane1.Left
mPaneTop = Pane1.Top
mPaneW = Pane1.Width
mPaneH = Pane1.Height
'Sposta Pane1 nella pagina di appoggio.
Pane1.Top=-500
Pane1.Visible = True
xivSnapshot.Bitmap = Pane1.Snapshot
xivSnapshot.mBase.SetLayoutAnimated(mDuration, mPaneLeft + mPaneW / 2, mPaneTop + mPaneH / 2, 0, 0)
Pane1.Visible = False
Pane1.Top=mPaneTop
End Sub
Private Sub B4XPage_CloseRequest As ResumableSub
Dim sf As Object = xui.Msgbox2Async("Do you really want to close?", "", "Yes", "", "No", Null)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
Return True
End If
Return False
End Sub
#End Region
#Region VIEWS' EVENTS
Private Sub Button1_Click
If Pane1.Visible Then
'hide it
xivSnapshot.Bitmap = Pane1.Snapshot
xivSnapshot.mBase.Visible = True
Pane1.Visible = False
xivSnapshot.mBase.SetLayoutAnimated(mDuration, mPaneLeft + mPaneW / 2, mPaneTop + mPaneH / 2, 0, 0)
Else
'show it
xivSnapshot.mBase.Visible = True
xivSnapshot.mBase.SetLayoutAnimated(mDuration, mPaneLeft, mPaneTop, mPaneW , mPaneH)
Sleep(mDuration)
Pane1.Visible = True
xivSnapshot.mBase.Visible = False
End If
End Sub
#End Region