Android Question Need help with unzip progress

Ricardo Bunschoten

Active Member
Licensed User
This is my code

B4X:
#Region  Project Attributes 
    #ApplicationLabel: Veolo 4K Kodi Skin installer
    #VersionCode: 1
    #VersionName: 
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    Private link1 As String = "https://copy.com/iPuNeMRRsGiVcwk4/1Channel-master.zip"
End Sub

Sub Globals
    Dim ProgressBar1 As ProgressBar
    Dim Label1 As Label
    Dim btnDownload As Button
    Dim btnCancel As Button
    Dim Arc As Archiver
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1")
End Sub

Sub btnDownload_Click
    Dim dd As DownloadData
    dd.url = link1
    dd.EventName = "dd"
    dd.Target = Me
    CallSubDelayed2(DownloadService, "StartDownload", dd)
End Sub

Sub dd_Progress(Progress As Long, Total As Long)
    ProgressBar1.Progress = Progress / Total * 100
    Label1.Text = NumberFormat(Progress / 1024, 0, 0) & "KB / " & _
        NumberFormat(Total / 1024, 0, 0) & "KB"
End Sub

Sub dd_Complete(Job As HttpJob)
    Log("Job completed: " & Job.Success)

    Dim o As OutputStream
    o = File.OpenOutput(File.dirrootExternal, "Download/Veolo4K.zip", False)
   
    File.Copy2(Job.GetInputStream, o)
    o.Close
    Arc.aSyncUnZip(File.DirRootExternal, "/Download/Veolo4K.zip" , File.DirRootExternal & "/Android/data/org.xbmc.kodi/files/.kodi/", "arc")
Job.Release
    End Sub
   
Sub btnCancel_Click
    CallSubDelayed2(DownloadService, "CancelDownload", link1)
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
It download a zipfile and unpacks it to a folder
This works but now i want to see the unpack progress ?
And if the file fails or is done with unpacking i get a message done or error
I am struggling with this ?
 

Ricardo Bunschoten

Active Member
Licensed User
ok but how do i trigger this events.

I can use a label with text i think when its unzipping and a label with text done when zipping is done but i need to k ow how to trigger that.
 

ilan

Expert
Licensed User
In the IDE, type Sub <space bar> <TAB> and you will see a list of views, search for Archiver, select it and you will see all the available events.
cool, i didnot knew that... thank you NjDude
 
Top