1.DownloadClient.ets optimize the code

2.GlideImage display PixelMap  No more blank PixelMap needed

Signed-off-by: zhoulisheng <635547767@qq.com>
This commit is contained in:
zhoulisheng 2022-04-06 10:41:42 +08:00
parent fbca3f8205
commit 28248d3d26
2 changed files with 7 additions and 5 deletions

View File

@ -199,13 +199,11 @@ export struct GlideImage {
this.normalPixelMap = true;
this.normalResource = true;
let pack = new PixelMapPack();
this.glidePixelMapPack = pack;
setTimeout(() => {
let pixelMapPack2 = new PixelMapPack();
pixelMapPack2.pixelMap = data.glideValue as PixelMap;
this.glidePixelMapPack = pixelMapPack2;
},100)
}
displayResource(data:GlideData){

View File

@ -27,7 +27,11 @@ export class DownloadClient implements IDataFetch {
if (requestUrl.startsWith("http") || requestUrl.startsWith("https")) {
let filename = Md5.hashStr(request.generateDataKey);
let downloadFolder = request.getFilesPath() + "/" +request.networkCacheFolder;
let allpath = request.getFilesPath() + "/" + filename + ".img";
let allpath = request.getFilesPath() + "/" +request.networkCacheFolder + "/" + filename + ".img";
if(!FileUtils.getInstance().existFolder(downloadFolder)){
FileUtils.getInstance().createFolder(downloadFolder)
}
if(FileUtils.getInstance().exist(allpath)){
FileUtils.getInstance().deleteFile(allpath)