Merge branch 'dev/app_remove_liulishuo' into dev/app_vip_liulishuo
# Conflicts: # app/src/main/java/com/chwl/app/home/fragment/MeFragment.kt feat ; 合并 去除liulishuo分支 到 vip分支
This commit is contained in:
@@ -71,11 +71,11 @@ dependencies {
|
||||
api 'io.agora.rtc:voice-sdk:4.2.2'
|
||||
|
||||
// core
|
||||
implementation 'com.liulishuo.okdownload:okdownload:1.0.4'
|
||||
// implementation 'com.liulishuo.okdownload:okdownload:1.0.4'
|
||||
// provide sqlite to store breakpoints
|
||||
implementation 'com.liulishuo.okdownload:sqlite:1.0.4'
|
||||
// implementation 'com.liulishuo.okdownload:sqlite:1.0.4'
|
||||
// provide okhttp to connect to backend
|
||||
implementation 'com.liulishuo.okdownload:okhttp:1.0.4'
|
||||
// implementation 'com.liulishuo.okdownload:okhttp:1.0.4'
|
||||
// Room
|
||||
api 'androidx.room:room-runtime:2.5.1'
|
||||
annotationProcessor 'androidx.room:room-compiler:2.5.1'
|
||||
@@ -93,8 +93,8 @@ dependencies {
|
||||
api project(':nim_uikit')
|
||||
api project(':library')
|
||||
|
||||
implementation 'com.liulishuo.okdownload:okdownload:1.0.7'
|
||||
implementation 'com.liulishuo.okdownload:okhttp:1.0.7'
|
||||
// implementation 'com.liulishuo.okdownload:okdownload:1.0.7'
|
||||
// implementation 'com.liulishuo.okdownload:okhttp:1.0.7'
|
||||
|
||||
implementation 'com.tencent.liteav:LiteAVSDK_TRTC:11.7.0.13946'
|
||||
|
||||
|
@@ -10,10 +10,13 @@ import android.util.SparseArray;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.engine.GlideException;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.chwl.core.utils.MyUriUtils;
|
||||
import com.chwl.library.common.glide.GlideUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.liulishuo.okdownload.DownloadTask;
|
||||
import com.liulishuo.okdownload.core.cause.EndCause;
|
||||
import com.liulishuo.okdownload.core.listener.DownloadListener2;
|
||||
import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
@@ -52,6 +55,7 @@ import java.io.BufferedOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -63,6 +67,11 @@ import io.reactivex.Single;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.BiConsumer;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.Headers;
|
||||
@@ -621,27 +630,47 @@ public class DynamicFaceModel extends BaseModel implements IDynamicFaceModel {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String url = onlineFacesList.getZipUrl();
|
||||
|
||||
DownloadTask task = new DownloadTask.Builder(url, facesRootDir)
|
||||
.setFilename("face.zip")
|
||||
.setMinIntervalMillisCallbackProcess(1000)
|
||||
.setPassIfAlreadyCompleted(true)
|
||||
.build();
|
||||
|
||||
task.enqueue(new DownloadListener2() {
|
||||
GlideUtils.instance().downloadFromUrl(getContext(), url, new RequestListener<File>() {
|
||||
@Override
|
||||
public void taskStart(@NonNull DownloadTask task) {
|
||||
Logger.d("face.zip download start");
|
||||
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<File> target, boolean isFirstResource) {
|
||||
Logger.d("face.zip download onLoadFailed");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause) {
|
||||
Logger.d("face.zip download end" + "response dir: " + facesRootDir.getAbsolutePath());
|
||||
unzipFaceZipFile(onlineFacesList);
|
||||
isRequestingZip = false;
|
||||
public boolean onResourceReady(File resource, Object model, Target<File> target, DataSource dataSource, boolean isFirstResource) {
|
||||
if (resource != null) {
|
||||
MyUriUtils.INSTANCE.copyFile(resource,new File(facesRootDir,"face.zip"));
|
||||
Logger.d("face.zip download end" + "response dir: " + facesRootDir.getAbsolutePath());
|
||||
unzipFaceZipFile(onlineFacesList);
|
||||
isRequestingZip = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// DownloadTask task = new DownloadTask.Builder(url, facesRootDir)
|
||||
// .setFilename("face.zip")
|
||||
// .setMinIntervalMillisCallbackProcess(1000)
|
||||
// .setPassIfAlreadyCompleted(true)
|
||||
// .build();
|
||||
//
|
||||
// task.enqueue(new DownloadListener2() {
|
||||
// @Override
|
||||
// public void taskStart(@NonNull DownloadTask task) {
|
||||
// Logger.d("face.zip download start");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void taskEnd(@NonNull DownloadTask task, @NonNull EndCause cause, @Nullable Exception realCause) {
|
||||
// Logger.d("face.zip download end" + "response dir: " + facesRootDir.getAbsolutePath());
|
||||
// unzipFaceZipFile(onlineFacesList);
|
||||
// isRequestingZip = false;
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -81,5 +81,12 @@ object MyUriUtils {
|
||||
return data
|
||||
}
|
||||
|
||||
fun copyFile(file:File,dir:File){
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs()
|
||||
}
|
||||
file.copyTo(dir,true)
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user