Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SirLYC committed Jun 15, 2019
1 parent 3824a4f commit 9be8074
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,36 @@ YCDownloader.queryFinishedDownloadInfoList();
- set if you want to avoid main thread receive too much progress update message
- other...


## Important classes

**YCDownloader**: [`com.lyc.downloader.YCDownloader`](https://github.com/SirLYC/YC-Downloader/blob/master/downloader/src/main/java/com/lyc/downloader/YCDownloader.java)

Export main apis.

**DownloadListener**: [`com.lyc.downloader.DownloadListener`](https://github.com/SirLYC/YC-Downloader/blob/master/downloader/src/main/java/com/lyc/downloader/DownloadListener.java)

Callback of the download progress and state change of every downloadTask.

**DownloadTasksChangeListener**: [`com.lyc.downloader.DownloadTasksChangeListener`](https://github.com/SirLYC/YC-Downloader/blob/master/downloader/src/main/java/com/lyc/downloader/DownloadTasksChangeListener.java)

Callback of the change in downloadTasks: created or removed. It's a good feature to implement a function like eventBus.

**DownloadInfo**: [`com.lyc.downloader.db.DownloadInfo`](https://github.com/SirLYC/YC-Downloader/blob/master/downloader/src/main/java/com/lyc/downloader/db/DownloadInfo.java)

Database entity, also `Parcelable` to pass between **multi-process**.

## Permissions

```xml
<!--required-->
<uses-permission android:name="android.permission.INTERNET"/>
<!--not required but important-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
```


## Licence
```
MIT License
Expand Down
2 changes: 1 addition & 1 deletion config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ext {
'targetSdkVersion' : 28,
'minSdkVersion' : 19,
'versionCode' : 1,
'versionName' : '0.2.0-beta'
'versionName' : '0.3.0-beta'
]
deps = [
'kotlin-stdlib' : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.lyc.downloader;

import android.Manifest;
import android.Manifest.permission;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Looper;
Expand Down Expand Up @@ -52,7 +53,10 @@ private static void checkPermissions(Context context) {
}

// these permissions is not required but important for downloader
String[] importantPermissions = {Manifest.permission.WRITE_EXTERNAL_STORAGE};
String[] importantPermissions = {
Manifest.permission.WRITE_EXTERNAL_STORAGE,
permission.READ_EXTERNAL_STORAGE
};
for (String importantPermission : importantPermissions) {
if (ContextCompat.checkSelfPermission(context, importantPermission) != PackageManager.PERMISSION_GRANTED) {
Log.w(TAG, "missing important permission: " + importantPermission);
Expand Down
8 changes: 6 additions & 2 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lyc.yuchuan_downloader">

<!--required-->
<uses-permission android:name="android.permission.INTERNET"/>
<!--not required but important-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:name=".App"
Expand All @@ -14,8 +18,8 @@
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
Expand Down

0 comments on commit 9be8074

Please sign in to comment.