B4A Library UniversalImageLoader V1.0.2

This is a wrapper for this Github Project.
Actually it only can work with Imageviews.

UniversalImageLoader
Version:
1.02
  • UniversalImageLoader
    Events:
    • onProgressUpdate (String imageUri As , View view As , int current As , int total As )
    • onloadingcomplete (imageUri As String, v as Object As , bmp as Object As )
    • onloadingfailed (imageUri As String, v as Object As , reason As String)
    • onloadingstarted (imageUri As String, v as Object As )
    Methods:
    • Initialize (EventName As String, displayoptions As DisplayImageOptions)
    • clearDiscCache
    • clearMemoryCache
    • loadimg (imageUri As String, iv As ImageView)
    • loadimg2 (imageUri As String, iv As ImageView)
    • loadimgSync (imageUri As String) As Bitmap
      Loads a image from the url imageUri and return a bitmap
      This methos is a Sync method.
    Permissions:
    • android.permission.ACCESS_NETWORK_STATE
    • android.permission.INTERNET
    • android.permission.WRITE_EXTERNAL_STORAGE
  • uilOptions
    Methods:
    • Initialize
    • IsInitialized As Boolean
    • bitmapConfig565 As UilOptions
    • bitmapConfig8888 As UilOptions
    • build As DisplayImageOptions
    • cacheInMemory (cache As Boolean) As UilOptions
    • cacheOnDisc (disc As Boolean) As UilOptions
    • delayBeforeLoading (delay As Int) As UilOptions
    • resetViewBeforeLoading (reset As Boolean) As UilOptions
    • showImageForEmptyUri (d As Drawable) As UilOptions
    • showImageOnFail (d As Drawable) As UilOptions
    • showImageOnLoading (d As Drawable) As UilOptions

This library is Donationware. You can download the library, you can test the library. But if you want to USE the library in your App you need to Donate for it.
Please click here to donate (You can donate any amount you want to donate for the library (or my work) :)


Example 1
uil001.png


Example 2 is using the CustomListViewClass from erel and shows a list of 200+ Flags
uil002.png


The Flags used in this Example can be downloaded here.
 

Attachments

  • libUniversalImageLoader_V1.0.0.zip
    145.5 KB · Views: 549
  • UniversalImagLoaderEx2_Flags.zip
    17.5 KB · Views: 501
  • libUniversalImageLoader_V1.0.1.zip
    142.6 KB · Views: 454
  • UniversalImagLoaderEx.zip
    13.4 KB · Views: 462
  • libUniversalImageLoader_V1.0.2.zip
    144.3 KB · Views: 549
Last edited:

Douglas Farias

Expert
Licensed User
Longtime User
@DonManfred

1° What the diference in loadimg1 2 and 3 ?
2° Why in release dont load the images only on debug?
Note i m using this on manifest.
AddPermission(android.permission.INTERNET)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.GET_ACCOUNTS)

thx
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
Here you can see the settings i used actually.
The most i left the defaults
B4X:
        options = new DisplayImageOptions.Builder()
//    .showImageOnLoading(R.drawable.ic_stub) // resource or drawable
//    .showImageForEmptyUri(R.drawable.ic_empty) // resource or drawable
//    .showImageOnFail(R.drawable.ic_error) // resource or drawable
//    .resetViewBeforeLoading(false)  // default
//    .delayBeforeLoading(1000)
//        .cacheInMemory(false) // default
    .cacheOnDisk(true) // default
//    .preProcessor(...)
//    .postProcessor(...)
//    .extraForDownloader(...)
//    .considerExifParams(false) // default
//    .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default
//    .bitmapConfig(Bitmap.Config.ARGB_8888) // default
    .bitmapConfig(Bitmap.Config.RGB_565)
//    .decodingOptions(...)
    .displayer(new SimpleBitmapDisplayer()) // default
//    .handler(new Handler()) // default
    .build();
        config = new ImageLoaderConfiguration.Builder(ba.context).threadPoolSize(500).build();
       
    ImageLoader.getInstance().init(config);
 

DonManfred

Expert
Licensed User
Longtime User
1° What the diference in loadimg1 2 and 3 ?
loadimg1 sets listeners and raises events
loadimg2 dont sets any listener and dont raise any events
loadimg3 is not exposed/part of the lib. How did you know there is such a method?

2° Why in release dont load the images only on debug?
it works in release for me.
 

Douglas Farias

Expert
Licensed User
Longtime User
strange, dont run in release, i made a test in
debug rapid works
debug device works
release dont work
release obfuscated dont work too

my device is a moto g 5.0.1
 

asales

Expert
Licensed User
Longtime User
Very nice, but I got this error in Example 2 Flags:
B4X:
Error description: Unknown type: uiloptions

It not recognize this:
B4X:
Sub Globals
    Dim ilOptions As uilOptions
 

DonManfred

Expert
Licensed User
Longtime User
uiloptions
uiloptions have been hidden in newest lib due to it does not work as expected as yet
do you plan to implement the "Image Grid"?
No, why should i? The grid example is an example, not the lib.
Use a customlistview, place some imageviews in a grid order and let uil do the downloads for you. No need to extend the library
 

aidymp

Well-Known Member
Licensed User
Longtime User
HI this is a great lib but suffers a bit of a problem, with the android cache, I wanted to use it to download a backdrop to my app, works fine but if I change the image (ANDROID OS) caches it and it doesn't change! I know this not the library at fault but is there a solution??

Thanks

Aidy
 

DonManfred

Expert
Licensed User
Longtime User
HI this is a great lib but suffers a bit of a problem, with the android cache, I wanted to use it to download a backdrop to my app, works fine but if I change the image (ANDROID OS) caches it and it doesn't change! I know this not the library at fault but is there a solution??
Maybe the updated library in Post #1 will help here.

The Lib has a new Object for the configuration.

B4X:
Sub Globals
    Dim il As UniversalImageLoader
    Dim iloptions As uilOptions

Please note that the initialization of the uil has changed too.

B4X:
    '
    ' Start with initializing the UniversalImageLoader
    '
    iloptions.Initialize
    iloptions.bitmapConfig565.cacheInMemory(False).cacheOnDisc(False).delayBeforeLoading(1000)
    il.Initialize("uil",iloptions.build)

Please also note of the two new methods in uil.
  • clearDiscCache
  • clearMemoryCache

What is the advantage when comparing UIL to this imagedownloader class by erel
i dont know
Also how can i clear cache?

The two new methods should help here
 

jazzzzzzz

Active Member
Licensed User
Longtime User
Maybe the updated library in Post #1 will help here.

The Lib has a new Object for the configuration.

B4X:
Sub Globals
    Dim il As UniversalImageLoader
    Dim iloptions As uilOptions

Dim iloptions as uilOptions shows missing reference in lateset too...You enabled that settings right?
 
Top