Giter Site home page Giter Site logo

khalidelsayed / urlimageviewhelper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from koush/urlimageviewhelper

0.0 1.0 0.0 2.34 MB

Android library that sets an ImageView's contents from a url. Manages image downloading, caching, and makes your coffee too.

License: Other

urlimageviewhelper's Introduction

UrlImageViewHelper

UrlImageViewHelper will fill an ImageView with an image that is found at a URL.

Sample Project

The sample will do a Google Image Search and load/show the results asynchronously.

Download

Download the latest JAR or grab via Maven:

<dependency>
    <groupId>com.koushikdutta.urlimageviewhelper</groupId>
    <artifactId>urlimageviewhelper</artifactId>
    <version>(insert latest version)</version>
</dependency>

Usage

UrlImageViewHelper will automatically download and manage all the web images and ImageViews. Duplicate urls will not be loaded into memory twice. Bitmap memory is managed by using a weak reference hash table, so as soon as the image is no longer used by you, it will be garbage collected automatically.

Usage is simple:

UrlImageViewHelper.setUrlDrawable(imageView, "http://example.com/image.png");

Want a placeholder image while it is being downloaded?

UrlImageViewHelper.setUrlDrawable(imageView, "http://example.com/image.png", R.drawable.placeholder);

Don't want to use a placeholder resource, but a drawable instead?

UrlImageViewHelper.setUrlDrawable(imageView, "http://example.com/image.png", drawable);

What if you want to preload images for snazzy fast loading?

UrlImageViewHelper.loadUrlDrawable(context, "http://example.com/image.png");

What if you only want to cache the images for a minute?

// Note that the 3rd argument "null" is an optional interstitial
// placeholder image.
UrlImageViewHelper.setUrlDrawable(imageView, "http://example.com/image.png", null, 60000);

UrlImageViewHelper is pretty smart. It can even load the photo for an Android contact if given a Contact Content Provider URI.

UrlImageViewHelper.setUrlDrawable(imageView, "content://com.android.contacts/contacts/1115", R.drawable.dummy_contact_photo);

FAQ

Does it work in list adapters when views are reused? (convertView)

Yes.

Featured Implementations

  • ROM Manager
  • Carbon
  • Let me know if you use this library, so I can add it to the list!

urlimageviewhelper's People

Contributors

abhishekmukherg avatar cimnine avatar easetheworld avatar jnugh avatar koush avatar pedronveloso avatar scottferg avatar seanoshea avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.