Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
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.
Dim PicPanel As Panel
Dim GD As GestureDetector
Dim GDPanel(10) As Panel ' panels of pictures or documents
Dim GDIndex As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("CustComp3")
GDPanel(0).Initialize("GDPanel")
GDPanel(0).Tag = "0"
PicPanel.AddView(GDPanel(0),10dip,10dip,140dip,135dip)
GDPanel(0).SetBackgroundImage(LoadBitmapResize(File.DirAssets,"CashCow.jpg",140dip,135dip,False))
GDPanel(1).Initialize("GDPanel")
GDPanel(1).Tag = "1"
PicPanel.AddView(GDPanel(1),210dip,10dip,140dip,135dip)
GDPanel(1).SetBackgroundImage(LoadBitmapResize(File.DirAssets,"s-touchme.png",140dip,135dip,False))
End Sub
Sub GDPanel_Touch(Action As Int, X As Float, Y As Float)
Try
GD.RemoveGestureListener
Catch
Log("RemoveGestureListner Not On")
End Try
Dim pnl As Panel
pnl = Sender
GDIndex = pnl.Tag
Log("GDPanel_Touch TAG = " & pnl.Tag)
GD.SetOnGestureListener(GDPanel(GDIndex), "Gesture") ' IF I COMMENT OUT THIS LINE, PANEL_TOUCH IS FIRED NEXT TIME
End Sub
Sub Gesture_onTouch(Action As Int, X As Float, Y As Float, MotionEvent As Object) As Boolean
'' Log("onTouch action=" & Action & ", x=" & X & ", y=" & Y & ", ev=" & MotionEvent)
Try
GD.RemoveGestureListener
Catch
Log("RemoveGestureListner Not On")
End Try
Dim pnl As Panel
pnl = Sender
Log("Gesture_onTouch TAG = " & pnl.Tag)
GDIndex = pnl.Tag
GD.SetOnGestureListener(GDPanel(GDIndex), "Gesture")
Return True
End Sub
Sub Gesture_onDrag(deltaX As Float, deltaY As Float, MotionEvent As Object)
Log(" onDrag deltaX = " & deltaX & ", deltaY = " & deltaY & ", ev = " & MotionEvent)
GDPanel(GDIndex).Left = Max(0, Min(GDPanel(GDIndex).Left + deltaX, 100%x - GDPanel(GDIndex).Width))
GDPanel(GDIndex).Top = Max(0, Min(GDPanel(GDIndex).Top + deltaY, 100%y - GDPanel(GDIndex).Height))
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub