{"id":15478279,"url":"https://github.com/leftcoding/lidownload","last_synced_at":"2025-03-28T14:14:16.774Z","repository":{"id":118733805,"uuid":"198994513","full_name":"leftcoding/LiDownload","owner":"leftcoding","description":"基于 OkDownload 做二次封装","archived":false,"fork":false,"pushed_at":"2019-08-02T09:32:14.000Z","size":141,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-19T03:20:39.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leftcoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support-download/.gitignore","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-26T10:05:07.000Z","updated_at":"2022-05-22T07:22:11.000Z","dependencies_parsed_at":"2023-03-14T09:15:18.022Z","dependency_job_id":null,"html_url":"https://github.com/leftcoding/LiDownload","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.1428571428571429,"last_synced_commit":"dc58008e15e54e0ecf766cde7d26be54a1dd30cd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leftcoding%2FLiDownload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leftcoding%2FLiDownload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leftcoding%2FLiDownload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leftcoding%2FLiDownload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leftcoding","download_url":"https://codeload.github.com/leftcoding/LiDownload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246042013,"owners_count":20714147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T04:03:08.820Z","updated_at":"2025-03-28T14:14:16.735Z","avatar_url":"https://github.com/leftcoding.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"### LiDownload\n\n基于 `OkDownload` 做二次封装\n\n### 使用\n\n#####  Maven 库引入\n\n```java\nimplementation 'android.ling.download:download:0.0.3'\n```\n\n##### 1.初始化\n\n```java\nprivate final static String URL3 = \"http://b9.market.xiaomi.com/download/AppStore/011ac54a116d544b920574f23ee10f9b66e0779e9/io.suzhi8.H5870BC5B.apk\";\n\nLiDownload download = new LiDownload.Builder()\n        .setParentPathFile(file) // 设置下载的文件路径\n        .setMinIntervalMillisCallbackProcess(30) // 设置 progress 回调间隔时间\n        .setPassIfAlreadyCompleted(false) // 已下载完文件，是否重复下载\n        .setTag(TAG) // 设置tag\n        .builder();\ndownload.setListener(downloadListener1);\n```\n\n##### 2.设置监听\n\n```java\nprivate DownloadListener1 downloadListener1 = new DownloadListener1() {\n    @Override\n    public void taskStart(@NonNull DownloadTask task, @NonNull Listener1Assist.Listener1Model model) {\n        Log.d(TAG, \"\u003e\u003etaskStart:\" + task.getUrl());\n    }\n\n    @Override\n    public void retry(@NonNull DownloadTask task, @NonNull ResumeFailedCause cause) {\n        Log.d(TAG, \"\u003e\u003etaskEnd\" + task.getFile() + \",cause:\" + cause.toString());\n    }\n\n    @Override\n    public void connected(@NonNull DownloadTask task, int blockCount, long currentOffset, long totalLength) {\n\n    }\n\n    @Override\n    public void progress(@NonNull DownloadTask task, long currentOffset, long totalLength) {\n        Log.d(TAG, \"\u003e\u003eprogress \" + task.getId() + \" currentOffset:\" + currentOffset + \",totalLength:\" + totalLength);\n    }\n\n    @Override\n    public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause, @NonNull Listener1Assist.Listener1Model model) {\n         Log.d(TAG, \"\u003e\u003etaskEnd\" + task.getFile() + \",cause:\" + cause.toString() + \",realCause:\" + realCause.toString());\n         if (cause == EndCause.COMPLETED) {\n                // ... do end things\n         }\n    }\n};\n```\n\n##### 3.开始下载\n\n```java\ndownload.start(URL3);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleftcoding%2Flidownload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleftcoding%2Flidownload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleftcoding%2Flidownload/lists"}