Sub Process_Globals
Private xui As XUI
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private CustomListView1 As CustomListView
Private pnlTop As B4XView
Private lblHeader As B4XView
Private ImageView1 As B4XView
Private busy As Boolean
Private touchPanel As Panel
Private lastAction As Int
Private inPanelY As Float
Private origHeight As Float
Private origTextSize As Float
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
origHeight = pnlTop.height
origTextSize = lblHeader.TextSize
ImageView1.Height = origHeight
CustomListView1.DefaultTextBackgroundColor = Colors.White
pnlTop.Visible = True
pnlTop.SendToBack
For i = 1 To 100
CustomListView1.AddTextItem("Item #" & i, "")
Next
End Sub
Private Sub touchPanel_Touch (Action As Int, X As Float, Y As Float)
If Action = 1 Then
lastAction = 0
Else if lastAction = 0 Then
inPanelY = Y
lastAction = Action
Else
If busy = True Then Return
busy = True
Dim change As Float = Y - inPanelY
If touchPanel.top = 80dip Then
If change < 0 Then
CustomListView1.sv.ScrollViewOffsetY = - change
Else
touchPanel.top = 80dip + change
End If
Else
touchPanel.Top = touchPanel.Top + change
If change < 0 And touchPanel.top < 80dip Then
touchPanel.top = 80dip
Else If change > 0 And touchPanel.top > origHeight Then
touchPanel.top = origHeight
End If
CustomListView1.GetBase.SetLayoutAnimated(0, 0, touchPanel.Top, touchPanel.Width, Activity.Height - touchPanel.Top)
CustomListView1.Base_resize(touchPanel.Width, Activity.Height - touchPanel.Top)
pnlTop.Height = touchPanel.Top
ImageView1.Height = touchPanel.Top
lblHeader.Top = pnlTop.Height/2 - lblHeader.height/2
lblHeader.TextSize = origTextSize - (1 - pnlTop.Height / origHeight) * 30
Activity.Invalidate
End If
End If
busy = False
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub