Skip to content

Commit

Permalink
Merge branch 'release/rxdownload2_v1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ssseasonnn committed Jan 17, 2017
2 parents 66d4972 + be39a1f commit 24e935b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ RxDownload 现在支持RxJava2, 只需将包名改为 ```zlc.season.rxdownload2.

```groovy
dependencies{
compile 'zlc.season:rxdownload2:1.1.0'
compile 'zlc.season:rxdownload2:1.1.1'
}
```

Expand Down
2 changes: 1 addition & 1 deletion rxdownload2/bintray.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'com.jfrog.bintray'

// This is the library version used when deploying the artifact
version = "1.1.0"
version = "1.1.1"

def siteUrl = 'https://github.com/ssseasonnn/RxDownload' // 项目的主页
def gitUrl = 'https://github.com/ssseasonnn/RxDownload.git' // Git仓库的url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public ObservableSource<? extends DownloadEvent> apply(Object o) throws Exceptio
}

/**
* Read all the download record from the database
* Read all the download record from the database.
* 从数据库中读取所有的下载记录
*
* @return Observable<List<DownloadRecord>>
Expand All @@ -184,7 +184,10 @@ public Observable<List<DownloadRecord>> getTotalDownloadRecords() {

/**
* Read single download record with url.
* 从数据库中读取下载地址为url的下载记录
* If record exists, return correct record, else return empty record.
* <p>
* 从数据库中读取下载地址为url的下载记录, 如果数据库中存在该记录,则正常返回.
* 如果不存在该记录,则返回一个空的DownloadRecord(url = null, saveName = null.)
*
* @param url download url
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ public long repairErrorFlag() {
new String[]{DownloadFlag.WAITING + "", DownloadFlag.STARTED + ""});
}

/**
* 获得url对应的下载记录
* <p>
* ps: 如果数据库中没有记录,则返回一个空的DownloadRecord.
*
* @param url url
*
* @return record
*/
public Observable<DownloadRecord> readRecord(final String url) {
return Observable.create(new ObservableOnSubscribe<DownloadRecord>() {
@Override
Expand All @@ -167,7 +176,10 @@ public void subscribe(ObservableEmitter<DownloadRecord> emitter) throws Exceptio
try {
cursor = getReadableDatabase().rawQuery("select * from " + TABLE_NAME +
" where " + "url=?", new String[]{url});
while (cursor.moveToNext()) {
if (cursor.getCount() == 0) {
emitter.onNext(new DownloadRecord());
} else {
cursor.moveToFirst();
emitter.onNext(Db.RecordTable.read(cursor));
}
emitter.onComplete();
Expand Down

0 comments on commit 24e935b

Please sign in to comment.