• Stars
    star
    414
  • Rank 104,550 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A cost-effective Android file downloader

Downloader

Downloader 是一个非常轻巧以及功能强大快速下载库,只有50KB 左右大小,对于大多数应用来说,性价比最高的一个下载库, Downloader 提供的API更简单、轻量且Downloader提供同步下载,系统通知进度等功能。

预览图

特性

  • 支持串行,多线程并行下载
  • 支持断点续传
  • 支持分块传输
  • 支持系统通知进度
  • 支持同步,异步下载
  • 支持自义定路径
  • 支持添加请求头
  • 支持超时配置
  • 提供简易的Api
  • 支持重定向下载
  • 支持进度回调
  • 重试次数配置
  • 支持下载APK文件完成后自动安装
  • 支持暂停,恢复下载等操作

下载

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

     implementation 'com.github.Justson:Downloader:v5.0.4' 
  • Androidx

     implementation 'com.github.Justson:Downloader:v5.0.4-androidx'

例子

同步

File file = DownloadImpl.getInstance(getApplicationContext())
				.url("http://shouji.360tpcdn.com/170918/93d1695d87df5a0c0002058afc0361f1/com.ss.android.article.news_636.apk")
				.get();

异步

DownloadImpl.getInstance(getApplicationContext())
                .url("http://shouji.360tpcdn.com/170918/f7aa8587561e4031553316ada312ab38/com.tencent.qqlive_13049.apk")
                .enqueue();

进度监听

DownloadImpl.getInstance(getApplicationContext())
		.target(new File(this.getExternalCacheDir(), "com.ss.android.article.news_636.apk"))
		.setUniquePath(false)
		.setForceDownload(true)
.url("http://shouji.360tpcdn.com/170918/93d1695d87df5a0c0002058afc0361f1/com.ss.android.article.news_636.apk")
		.enqueue(new DownloadListenerAdapter() {
					@Override
					public void onStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength, Extra extra) {
						super.onStart(url, userAgent, contentDisposition, mimetype, contentLength, extra);
					}

					@Override
					public void onProgress(String url, long downloaded, long length, long usedTime) {
						super.onProgress(url, downloaded, length, usedTime);
						Log.i(TAG, " progress:" + downloaded + " url:" + url);
					}

					@Override
					public boolean onResult(Throwable throwable, Uri path, String url, Extra extra) {
						Log.i(TAG, " path:" + path + " url:" + url + " length:" + new File(path.getPath()).length());
						return super.onResult(throwable, path, url, extra);
					}
		});

默认的文件目录

/data/data/com.download.sample(packagename)/cache/download/private/filename.jpg
/data/data/com.download.sample(packagename)/cache/download/public/filename.jpg

More Repositories

1

AgentWeb

AgentWeb is a powerful library based on Android WebView.
Java
9,243
star
2

AgentWebX5

AgentWebX5 是基于腾讯X5 的一个Web库
Java
434
star
3

flying-pigeon

flying-pigeon 是一个IPC 跨进程通信组件,底层是匿名内存+Binder , 突破1MB大小限制,无需写AIDL文件,让实现跨进程通信就像写一个接口一样简单
Java
206
star
4

CoolIndicator

A dazzling indicator
Java
109
star
5

BluetoothChatting

蓝牙即时通信,界面仿微信, 自动配对。
Java
73
star
6

Pixel-Activity-Keep-Alive

This is android keep alive library,Using a pixel activity to keep process alive.
Java
25
star
7

WheelProgress

iOS风格进度指示器
Java
22
star
8

dispatch-queue

Dispatch queue is an ultra-high performance queue extending Android message queue. Similar to the coroutine, it supports synchronous return and asynchronous execution. It can wrap the main thread and schedule flexibly
Java
17
star
9

Retrofit-RxAndroid-RxJava-MVP__DownFile

基于 MVP DownLoad 带进度条下载。
Java
7
star
10

PayProgressBar

支付宝确定支付过程的进度条
Java
4
star
11

ScView

仿芝麻信用控件-自定义控件
Java
3
star
12

imitate-Alipay-Sesame-credit

高仿支付宝芝麻信用控件
1
star
13

Justson_custom_progressview

custom_progress_view
Java
1
star
14

Justson

1
star
15

WheelProgressBar

微信和支付宝QQ等最常用的进度条...
1
star
16

Pratical

The repository main put personal pratical code
Java
1
star
17

Beautiful_Wallpaper

Java
1
star
18

Contacts_Helper

Java
1
star
19

ImageLoader

ImagerLoader
Java
1
star
20

aes256

openssl aes usage
C++
1
star
21

Promise

Promise
Java
1
star