Skip to content

Commit

Permalink
* 代码修改
Browse files Browse the repository at this point in the history
  • Loading branch information
wengyijiong committed Sep 5, 2019
1 parent ae454f0 commit 63261d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.eajon.function;

import com.github.eajon.body.DownloadResponseBody;
import com.github.eajon.task.DownloadTask;
import com.github.eajon.util.FileUtils;

import java.lang.reflect.Field;
Expand All @@ -11,16 +12,16 @@
/**
* @author eajon
*/
public class DownloadResponseFunction<T> implements Function<ResponseBody, Object> {
public class DownloadResponseFunction<T extends ResponseBody> implements Function<ResponseBody, DownloadTask> {

@SuppressWarnings(value = "unchecked")
@Override
public T apply(ResponseBody responseBody) throws Exception {
public DownloadTask apply(ResponseBody responseBody) throws Exception {
Class c = responseBody.getClass();
Field field = c.getDeclaredField("delegate");
field.setAccessible(true);
DownloadResponseBody downloadResponseBody = ( DownloadResponseBody ) field.get(responseBody);
FileUtils.write2File(downloadResponseBody);
return ( T ) downloadResponseBody.getDownloadTask();
return downloadResponseBody.getDownloadTask();
}
}
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ dependencies {
// //权限控制
implementation 'com.github.tbruyelle:rxpermissions:0.10.2'
/*图片选择*/
implementation 'com.github.qingmei2:rximagepicker:2.2.0'
implementation 'com.github.qingmei2:rximagepicker_support:2.2.0'
implementation 'com.github.qingmei2:rximagepicker_support_zhihu:2.2.0'
implementation 'com.github.qingmei2:rximagepicker:2.5.1'
implementation 'com.github.qingmei2:rximagepicker_support:2.5.1'
implementation 'com.github.qingmei2:rximagepicker_support_zhihu:2.5.1'


implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1'
Expand Down

0 comments on commit 63261d9

Please sign in to comment.