B4A Library UniversalImageLoader V1.0.2

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Apr 26, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    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) :)
    [​IMG]

    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.
     

    Attached Files:

    Last edited: Feb 28, 2016
  2. Douglas Farias

    Douglas Farias Expert Licensed 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.
    thx
     
    Last edited: Jun 4, 2015
  3. bluedude

    bluedude Well-Known Member Licensed User

    Interesting, does it support caching settings already?
     
  4. DonManfred

    DonManfred Expert Licensed User

    I´m at work and dont have the java source here... I will post the default settings the lib is using at the moment later when i´m at home.
     
    Peter Simpson likes this.
  5. DonManfred

    DonManfred Expert Licensed User

    Here you can see the settings i used actually.
    The most i left the defaults
    Code:
    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);
     
    Peter Simpson likes this.
  6. DonManfred

    DonManfred Expert Licensed User

    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?

    it works in release for me.
     
    Peter Simpson likes this.
  7. Douglas Farias

    Douglas Farias Expert Licensed 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
     
    Peter Simpson likes this.
  8. MarcoRome

    MarcoRome Expert Licensed User

    Hi Don, why Version in #1 is 1.0.1 but library is 1.00 ?
     
  9. DonManfred

    DonManfred Expert Licensed User

    Maybe because someone (me) has forgotten to upload the new lib.

    Added now. See #1
     
    Johan Schoeman, aidymp and MarcoRome like this.
  10. asales

    asales Well-Known Member Licensed User

    Very nice, but I got this error in Example 2 Flags:
    Code:
    Error description: Unknown type: uiloptions
    It not recognize this:
    Code:
    Sub Globals
        
    Dim ilOptions As uilOptions
     
  11. asales

    asales Well-Known Member Licensed User

    Another question:
    do you plan to implement the "Image Grid"?
     
  12. DonManfred

    DonManfred Expert Licensed User

    uiloptions have been hidden in newest lib due to it does not work as expected as yet
    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
     
    asales likes this.
  13. aidymp

    aidymp Active Member Licensed 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
     
  14. jazzzzzzz

    jazzzzzzz Active Member Licensed User

  15. DonManfred

    DonManfred Expert Licensed User

    Maybe the updated library in Post #1 will help here.

    The Lib has a new Object for the configuration.

    Code:
    Sub Globals
        
    Dim il As UniversalImageLoader
        
    Dim iloptions As uilOptions
    Please note that the initialization of the uil has changed too.

    Code:
    '
        ' 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

    i dont know
    The two new methods should help here
     
    MarcoRome, Johan Schoeman and aidymp like this.
  16. jazzzzzzz

    jazzzzzzz Active Member Licensed User

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

    DonManfred Expert Licensed User

    You are using V1.0.2 (See libs tab)?
     
  18. jazzzzzzz

    jazzzzzzz Active Member Licensed User

    ya its 1.02,see screenshot
     

    Attached Files:

  19. DonManfred

    DonManfred Expert Licensed User

    you copied the file universal-image-loader-1.9.5.jar to your additional libs folder too?
     
  20. DonManfred

    DonManfred Expert Licensed User

    I´ve packed it again. Try this achive please
     

    Attached Files:

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice