Android异步网络和图片加载库:ion
jopen
10年前
ion是的一个Android异步网络和图片加载库。
特性
- 异步下载:
- 专为Android设计,易于使有的 Fluent API
- Automatically cancels operations when the calling Activity finishes
- Manages invocation back onto the UI thread
- All operations return a Future and can be cancelled
- HTTP POST/PUT:
- text/plain
- application/json - both JsonObject and POJO
- application/x-www-form-urlencoded
- multipart/form-data
- Transparent usage of HTTP features and optimizations:
- Caching
- Gzip/Deflate Compression
- Connection pooling/reuse via HTTP Connection: keep-alive
- Uses the best/stablest connection from a server if it has multiple IP addresses
- Cookies
- View received headers
- Grouping and cancellation of requests
- Download progress callbacks
- Supports file:/, http(s):/, and content:/ URIs
- Request level logging and profiling
- Support for proxy servers like Charles Proxy to do request analysis
- Based on NIO and AndroidAsync
- Ability to use self signed SSL certificates
Ion.with(context) .load("http://example.com/really-big-file.zip") // have a ProgressBar get updated automatically with the percent .progressBar(progressBar) // and a ProgressDialog .progressDialog(progressDialog) // can also use a custom callback .progress(new ProgressCallback() {@Override public void onProgress(int downloaded, int total) { System.out.println("" + downloaded + " / " + total); } }) .write(new File("/sdcard/really-big-file.zip")) .setCallback(new FutureCallback<File>() { @Override public void onCompleted(Exception e, File file) { // download done... // do stuff with the File or error } });