Sub Process_Globals
End Sub
Sub Globals
Dim arc As Archiver
Dim lbl As Label
Dim Msg As String
Dim NumberOfFiles, Progression As Int
Dim AcSf As AcceleratedSurface
Dim R As Rect
Dim Unzipping As Boolean
End Sub
Sub Activity_Create(FirstTime As Boolean)
lbl.Initialize("")
lbl.Color = Colors.White
lbl.TextColor = Colors.Black
Activity.AddView(lbl, 0, 0, 100%x, 200dip)
AcSf.Initialize("AcSf", True)
Activity.AddView(AcSf, 0, 200dip, 100%x, 200dip)
R.Initialize(0, 50dip, 0, 100dip)
End Sub
Sub Activity_Resume
AcSf.StartRegularDraw(30)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
AcSf.StopRegularDraw
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
If Unzipping Then Return
NumberOfFiles = arc.NumberOfZipEntries(File.DirRootExternal, "archive.zip")
arc.AsyncUnZip(File.DirRootExternal, "archive.zip", File.DirRootExternal & "/test", "prog")
Unzipping = True
End Sub
Sub prog_UnZipProgression(Count As Int, FileName As String)
Msg = Count & " " & FileName
Progression = Count
CallSubDelayed(Me, "UpdateLabel")
End Sub
Sub prog_UnZipDone(CompletedWithoutError As Boolean, NbOfFiles As Int)
Msg = "All done"
Progression = NbOfFiles
CallSubDelayed(Me, "UpdateLabel")
End Sub
Sub UpdateLabel
lbl.Text = Msg
End Sub
Sub AcSf_Draw(AC As AS_Canvas)
AC.DrawText(Msg, 0, 50dip, Typeface.DEFAULT, 14, Colors.White, AC.ALIGN_LEFT)
R.Right = 100%x * (Progression/NumberOfFiles)
AC.DrawRect(R, Colors.Red, True, 0, False)
End Sub