Giter VIP home page Giter VIP logo

renzhenming / imageloader Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 251 KB

功能: 1.根据用户需求可以灵活配置(建造者模式) 2.支持高并发,图片加载的优先级 3.支持可以选择不同的加载策略,对加载策略进行扩展 4.二级缓存 加载图片时内存中已经加载了,则从内存中加载,不存在去外置卡中5.加载,外置还不存在则从网络下载 6.并对缓存策略可以扩展 7.支持从加载过程中显示默认加载图片 8.支持加载失败时 显示默认错误图片 9.图片显示自适应。从网络加载下来的图片经最佳比例压缩后显示不能失真变形 10.支持请求转发,下载 用到的模式: 1.生产者 消费者模式 2.建造者模式 3.单例模式 4.模板方法模式 5.策略模式 用到的知识点 1.内存缓存 LruCache技术 2.硬盘缓存技术DiskLruCache技术 3.图片下载时请求转发

Java 100.00%

imageloader's Introduction

ImageLoader

功能: 1.根据用户需求可以灵活配置(建造者模式) 2.支持高并发,图片加载的优先级 3.支持可以选择不同的加载策略,对加载策略进行扩展 4.二级缓存 加载图片时内存中已经加载了,则从内存中加载,不存在去外置卡中5.加载,外置还不存在则从网络下载 6.并对缓存策略可以扩展 7.支持从加载过程中显示默认加载图片 8.支持加载失败时 显示默认错误图片 9.图片显示自适应。从网络加载下来的图片经最佳比例压缩后显示不能失真变形 10.支持请求转发,下载 用到的模式: 1.生产者 消费者模式 2.建造者模式 3.单例模式 4.模板方法模式 5.策略模式 用到的知识点 1.内存缓存 LruCache技术 2.硬盘缓存技术DiskLruCache技术 3.图片下载时请求转发

#引入 在项目根目录build.gradle中添加

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

在app目录build.gradle中添加

implementation 'com.github.renzhenming:ImageLoader:1.0.0'

#初始化

        AbstractDisplay display = new DefaultDisplayConfig.Builder()
                .setLoadingImage(R.drawable.loading)
                .setErrorImage(R.drawable.not_found)
                .build();

        LoaderConfig config = new LoaderConfig.Builder()
                .setThreadCount(3) //线程数量
                .setLoadPolicy(new DefaultLoadPolicy()) //加载策略
                .setCachePolicy(new DefaultDiskCache(this)) //缓存策略
                .setDisplayConfig(display)
                .build();
        //初始化
        SimpleImageLoader.init(config);

#调用

SimpleImageLoader.getInstance().display(imageView,item);

imageloader's People

Contributors

renzhenming avatar

Stargazers

 avatar JasonJan avatar  avatar  avatar

Watchers

James Cloos avatar  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.