Git Product home page Git Product logo

vangogh's Introduction

VanGogh

适用 Android 开发,用于加载或缓存图片,接口设计参考了 okhttppicasso,V2 版大量借鉴(抄袭)了 picasso 的设计,本项目是根据个人需求而定制的,作为学习练习之用,如无特殊需求建议使用 picasso.

1. 特性

  • 支持网络图片、本地文件以及 Android 资源文件加载。
  • 支持内存、磁盘两级缓存,自动管理缓存大小。
  • 支持“暂停/恢复”加载,可与 RecyclerView 和 ListView 等配合使用实现滚动时暂停加载。
  • 支持缓存策略配置,可自定义只加载内存、只加载本地、只加载网络或多种策略组合使用,默认任何来源。
  • 支持自定义图片变形处理等。
  • 支持根据图片来源为图片添加水印,便于开发状态观察图片来源,对应关系:内存——绿色,磁盘——蓝色,网络——红色,此功能默认关闭。
  • 支持正在加载及加载失败的占位图。

2. 用法举例

VanGogh.with(getContext()) //如已设置单例或调用过 VanGogh.with(getContext()) 也可使用 VanGogh.get()
    .load("http://www.xxx.xx/test.png")
    .into(imageView);

3. 使用方法

(1) 在项目的 build.gradle 中配置仓库地址:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

(2) 添加项目依赖:

dependencies {
    implementation 'com.github.ccolorcat:VanGogh:v2.4.0'
}

4. 版本历史

v2.4.0

  1. 修复一个 bug.

v2.3.0

  1. 添加 Creator.peek() 方法,可尝试从内存中获取图片。

v2.2.0

  1. 添加 CompoundViewTarget,对应功能可见 TextView.setCompoundDrawablesWithIntrinsicBounds(Drawable, Drawable, Drawable, Drawable).
  2. 修改了 Creator.fetch() 的实现。

v2.1.0

  1. 细节改善。
  2. 添加了两个方法,对图片的大小进行限制可直接使用 DP 作单位。

v2.0.0

改变了原有的设计,新版本大量借鉴(抄袭)了 picasso 的设计。

v1.1.1

  1. 新增 content 资源支持,即 Uri.getScheme() 为 content 的内容。
  2. 新增任务加载策略配置,见 VanGogh.Builder#taskPolicy(boolean mostRecentFirst).
  3. 新增清除最大尺寸限制(可用于清除全局配置的最大尺寸限制)的方法。
  4. 新增清除 Transformation 的方法。
  5. 从内存缓存中获取的图片不再进行 resize 操作。

vangogh's People

Contributors

fireworld avatar

Stargazers

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