B4A Library ProBundle

Informatix

Expert
Licensed User
Longtime User
While I was working on ArchiverPlus7z (which works fine for now but is very slow), I realized that the event system of ArchiverPlusZip was completely stupid. I'm replacing it completely by a new and more simple event system. You will have only two execution modes: synchronous and asynchronous. Both use a separate thread to allow cancelling the task or displaying the progression. One waits for the end of the task, the other does not.
 

aidymp

Well-Known Member
Licensed User
Longtime User

Hi regarding this lib ArchiverPlusZip, it works well for me, however just a few points, The Percent done seems to round up, so 99.5% shows 100% this would be fine in most situations, however my large 1GB Zips, it shows 100% for about 2-3minutes before the actual zip is extracted. any chance you could either round down, or provide the progress as float?

Thanks

Aidy
 

Informatix

Expert
Licensed User
Longtime User
Yes, I noticed this problem. It is a float in the new version.
 

padvou

Active Member
Licensed User
Longtime User
Could you please show me how to do this:
 

Informatix

Expert
Licensed User
Longtime User
The new version of ProBundle is available for download. I modified ArchiverPlusZip.

Changelog for ArchiverPlusZip:
- I replaced the event system by a simpler and more efficient system. Only two execution modes now;
- PercentDone is now a float value;
- I renamed ZipResult to ZipResultCode;
- I added a little bit of code to the first demo.
 

Harris

Expert
Licensed User
Longtime User
- PackageUtils v2.0
It allows experts to change the enabled state of components.

Does this imply that we can pro-grammatically can the state of GPS (turn it ON for example)?
 

Informatix

Expert
Licensed User
Longtime User
My Unrar library is done but before making it available for download, I'd like to explain why there will be no 7z library before long.

It took me a few days to create the Unrar library because it is entirely in C, with no documentation and no useful code on internet. The Java implementations that you can find are either very old and poorly featured, or very slow, or very limited (e.g. in CyanogenMod, a fork of Android, they removed the interesting features and the exceptions handling ), or not adapted to Android. In brief, I had to figure out myself how to use the official source code of the Unrar.dll to create my .so libraries for Android. Fortunately, the code is very well written, with enough comments to get the whole picture. After a few hundreds of lines in C++ to call the right functions with the right parameters and a few hundreds of lines in Java, I'm glad to see all this stuff working fine and fast.

At the beginning, I wanted to do the same for the 7z format, as the code is freely available on internet. But I spent too much time on the Unrar library and the code of 7z is a lot more difficult to understand. I could do like almost everybody did: instead of trying to access directly the functions to open archives, get headers, get streams, etc., I could use the command line tool 7za and pass things like "7za -x myarchive" but I find very weird to do that. It's an easy solution but the size of the library becomes so big! There's inside all the code to manage the console and the user input, with all dialogs... for a silent use. I succeed in shrinking it but it's still too big (for arm and x86 cpus, we're still above 1Mb for the .so). As I created a 7z library already in pure Java, I prefer to stop working on the C version for now. Too much work, not enough time and poor documentation.

I prefer to start writing a little guide explaining how to write yourself a .so library for Android. No Java or C knowledge will be required. The goal is to provide a model with blanks to fill. You won't do wonders with that, but you will be able to store data (primitive types) or computations in the library to hide them from prying eyes.
 

Harris

Expert
Licensed User
Longtime User
There's no relation between them. A component is an Activity, a Provider, a Service or a Receiver. You can, for example, disable some receivers in your application when you don't want to receive intents at a given time.
Thanks for clearing that up.
 

Informatix

Expert
Licensed User
Longtime User
I added the UnRar library to ProBundle and, by the way, I removed the option to get the libraries only for 20 euros as nobody used this option. It is easier for me to manage only one amount of donation.

I also revised the ProtectMyApp guide to remove an useless line in the HelloWorld example due to the new version of ArchiverPlusZip.

I added a Proguard configuration file for libGDX projects.

Note that there's a strange bug in ArchiverPlusUnRar with passwords. I tested a lot of them and I noticed that "1234" failed to decrypt the archive. That works fine with "123" or "12345" but not with "1234". I found that passwords with 4 characters do not work. Go figure. However, a password with 4 characters is too short so the problem should not be really annoying.
 
Last edited:

aidymp

Well-Known Member
Licensed User
Longtime User
ArchiverProZip 1.1 I think its broken! I only get progress 0%-6% Then a long delay (3-4mins!) then 25% Then another long delay (3-4mins), 49% and a very long delay (5-10mins) 79% and another long delay (5-10mins) then most of the time the app just exits with no errors!? nothing!

Reverting back to ArchiverProZip 1.0 the zip unzips in under a minute and I see progress from 0-100%

Also you say " I renamed ZipResult to ZipResultCode;" I presume you meant

B4X:
Sub Archiver_ZipResultCode(Result As Int, ErrorMsg As String)
    Select Result
        Case Arc.ZIP_RESULT_SUCCESS
            LogColor(txtTask & " OK", Colors.Blue)
        Case Arc.ZIP_RESULT_ERROR
            LogColor(txtTask & " ERROR / ErrorMsg=" & ErrorMsg, Colors.Red)
        Case Arc.ZIP_RESULT_CANCELLED
            LogColor(txtTask & " CANCELLED", Colors.Magenta)
        Case Else
            Log(txtTask & " ???")
    End Select
End Sub

But the program just exits! without any error message's!

I have tested your examples and they work, but sometime just exit without any error messages?

Thanks

Aidy
 

Informatix

Expert
Licensed User
Longtime User

Could you post the code that you put in your events? The events are raised in the library thread, which is not the main UI thread, and thus you cannot do what you're allowed to do in the main thread, e.g. updating directly the views (you have to do it with another sub called by CallSubDelayed). You also have to avoid calls to DoEvents, which are only useful in the main thread and are maybe the cause of your strange slowdowns.
As you noticed, my demo runs without any issue so try to replicate how it is made in your own code and you'll probably see that nothing is broken.

Also you say " I renamed ZipResult to ZipResultCode;" I presume you meant

B4X:
Sub Archiver_ZipResultCode(Result As Int, ErrorMsg As String)

No. In the first version, the function and the event had the same name, so I renamed the function to avoid confusion. When you have a doubt like this, you have many help sources at your disposal: a "Functions and properties" document, an inline help, the space+tab menu and my demo code.
 
Last edited:
Cookies are required to use this site. You must accept them to continue using the site. Learn more…