Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An loading image called Coil

An loading image called Coil

Introducing the first Android image upload library made in Kotlin. Fast, light, easy to use and modern are the features of this wonderful tool that will captivate you.

Avatar for Célio Gonzaga

Célio Gonzaga

October 05, 2019

Other Decks in Programming

Transcript

  1. Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis

    non erat sem An loading image library called Coil
  2. Let’s start val url = URL(imageUrl) val con: HttpURLConnection =

    url.openConnection() as HttpURLConnection var bMap: Bitmap = BitmapFactory.decodeFile(con.inputStream.toString()) mImageView.setImageBitmap(bMap)
  3. Famous libraries • Glide - Bump Tech (https://github.com/bumptech/glide) • Fresco

    - Facebook (https://github.com/facebook/fresco) • Picasso - Square (https://github.com/square/picasso)
  4. Glide Pros • very easy to use; • it support

    gif loading; • it requires little configuration; • it’s been actively maintained. Cons • it’s kind of large in terms of size and memory; • it requires large amount of caching space cause it saves different sizes of image separately.
  5. Fresco Pros • its has a custom view for its

    configuration, which makes it very easy to use; • its well optimized in terms of memory usage and allocation; • its has a lot of configuration option; • its has a very verbose documentation; • its easy to configure; • its load progressive JPEG,webP, gif; • it does not require a lot configuration to get started. Cons • it’s very large; • it’s documentation are kind of complicated.
  6. Picasso Pros • small size and method count; • very

    easy to use; • little configuration to set up. Cons • it cannot load gif; • it cannot be used to load a very large file; • it download and cache the the original image which will be resized to the view it’s been loaded to, this is an additional computation at display time.
  7. Glide Glide .with(mContext) .load(imgUrl) .placeholder(R.drawable.loading_spinner) .into(mImageView) .error(imageUri) // this is

    the image shown in case of error .fitcenter() //this makes the image to be centered in the imageView .centerCrop() .fades() .transform() .fetch()
  8. Coil • ImageLoader • Extension Functions • Supported data types

    • Cancelling Requests • Image Sampling • Bitmap Pooling
  9. Size Coil 21.697 Kb 1500 methods Fresco 42.549 Kb 5714

    methods Glide 32.583 Kb 2879 methods Picasso 1.199 Kb 849 methods