forked from floraachy/ImageKnife
1.codecheck整改
Signed-off-by: zhoulisheng <635547767@qq.com>
This commit is contained in:
parent
70a1c0911e
commit
d87cda1d15
|
@ -28,10 +28,10 @@ export default class EntryAbility extends UIAbility {
|
|||
let atManager = abilityAccessCtrl.createAtManager();
|
||||
atManager.requestPermissionsFromUser(this.context, list, (err: BusinessError, result: Object) => {
|
||||
if (err) {
|
||||
console.log("dodo requestPermissionsFromUserError:" + JSON.stringify(err));
|
||||
|
||||
} else {
|
||||
permissionRequestResult = result;
|
||||
console.log("dodo permissionRequestResult:" + JSON.stringify(permissionRequestResult))
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export default function LogUtilTest() {
|
|||
})
|
||||
it('TestLogUtilLevel',0, ()=> {
|
||||
|
||||
console.log("tag:LogUtil LogUtil.mLogLevel="+LogUtil.mLogLevel);
|
||||
|
||||
LogUtil.mLogLevel = LogUtil.OFF;
|
||||
expect(LogUtil.mLogLevel).assertEqual(LogUtil.OFF);
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ export default function lruCacheTest() {
|
|||
expect(key).assertEqual("2")
|
||||
expect(value).assertEqual("2")
|
||||
}
|
||||
console.log('dodo count='+count+' key='+key+' value='+value)
|
||||
|
||||
count++;
|
||||
}
|
||||
memoryCache.foreachLruCache( (value:string, key:string, map:Map<string,string>)=> {
|
||||
|
@ -117,7 +117,7 @@ export default function lruCacheTest() {
|
|||
expect(key).assertEqual("1")
|
||||
expect(value).assertEqual("1")
|
||||
}
|
||||
console.log('dodo count='+count+' key='+key+' value='+value)
|
||||
|
||||
count++;
|
||||
}
|
||||
memoryCache.foreachLruCache( (value:string, key:string, map:Map<string,string>)=> {
|
||||
|
|
|
@ -360,9 +360,9 @@ export class ImageKnife {
|
|||
|
||||
// 执行相同key的pending队列请求
|
||||
private keyEqualPendingToRun(nextPending: RequestOption) {
|
||||
// let nextPending = this.pendingRequest.splice(index, 1)[0];
|
||||
// this.runningRequest.push(nextPending)
|
||||
// RequestManager.execute((nextPending as RequestOption), this.memoryCache, this.diskMemoryCache, this.dataFetch, this.resourceFetch)
|
||||
|
||||
|
||||
|
||||
|
||||
this.pendingMaps.remove(nextPending.uuid)
|
||||
this.runningMaps.put(nextPending.uuid, nextPending);
|
||||
|
@ -445,11 +445,11 @@ export class ImageKnife {
|
|||
if (hasRunningRequest) {
|
||||
this.pendingMaps.put(request.uuid, request);
|
||||
|
||||
// this.pendingRequest.push(request);
|
||||
|
||||
} else {
|
||||
this.runningMaps.put(request.uuid, request)
|
||||
|
||||
// this.runningRequest.push(request);
|
||||
|
||||
// 不存在相同key的 任务可以并行
|
||||
RequestManager.execute(request, this.memoryCache, this.diskMemoryCache, this.dataFetch, this.resourceFetch)
|
||||
}
|
||||
|
|
|
@ -529,11 +529,11 @@ export class RequestOption {
|
|||
}
|
||||
}
|
||||
|
||||
// // 加载成功之后
|
||||
// let imageKnife:ImageKnife | undefined = ImageKnifeGlobal.getInstance().getImageKnife();
|
||||
// if(imageKnife != undefined) {
|
||||
// imageKnife.removeRunning(this);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 图片文件落盘之后会自动去寻找下一个数据加载
|
||||
|
|
|
@ -15,5 +15,6 @@
|
|||
import { BusinessError } from '@ohos.base'
|
||||
export interface IParseImage<T> {
|
||||
parseImage:(imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
|
||||
parseImageThumbnail:(scale:number, imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
|
||||
parseImageThumbnail:(scale:number, imageinfo:ArrayBuffer, onCompleteFunction:(value:T)=>void | PromiseLike<T>,
|
||||
onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
|
||||
}
|
|
@ -44,7 +44,6 @@ export class DownloadClient implements IDataFetch {
|
|||
this.dataShareFileClient.loadData(request, onCompleteFunction, onErrorFunction)
|
||||
} else {
|
||||
// 网络下载
|
||||
// this.networkDownloadClient.loadData(request, onCompleteFunction, onErrorFunction)
|
||||
this.httpDownloadClient.loadData(request, onCompleteFunction, onErrorFunction)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,5 +18,6 @@ import common from '@ohos.app.ability.common';
|
|||
|
||||
// 本地资源解析抽象接口
|
||||
export interface IResourceFetch<T> {
|
||||
loadResource:(context:common.UIAbilityContext ,res: Resource, onCompleteFunction:(value:T)=>void | PromiseLike<T>, onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
|
||||
loadResource:(context:common.UIAbilityContext ,res: Resource, onCompleteFunction:(value:T)=>void | PromiseLike<T>,
|
||||
onErrorFunction:(reason?:BusinessError|string)=>void)=>void;
|
||||
}
|
|
@ -14,13 +14,6 @@
|
|||
*/
|
||||
import { LogUtil } from '../../imageknife/utils/LogUtil'
|
||||
|
||||
// jpg = 'jpg,0,FFD8',
|
||||
// png = 'png,0,89504E470D0A1A0A',
|
||||
// bmp = 'bmp,0,424D',
|
||||
// gif = 'gif,0,474946383961',
|
||||
// svg = 'svg,0,3C3F786D6C',
|
||||
// webp = 'webp,0,52494646',
|
||||
// tiff = 'tiff,0,492049|49492A00|4D4D002A|4D4D002B'
|
||||
|
||||
export class FileTypeUtil {
|
||||
private fileSignatureMap: Record<string, Array<Uint8Array>> = {
|
||||
|
|
|
@ -25,7 +25,8 @@ export class ParseImageUtil implements IParseImage<PixelMap> {
|
|||
}
|
||||
|
||||
// scale(0,1)
|
||||
parseImageThumbnail(scale: number, imageinfo: ArrayBuffer, onCompleteFunction: (value: PixelMap) => void | PromiseLike<PixelMap>, onErrorFunction: (reason?: BusinessError | string) => void) {
|
||||
parseImageThumbnail(scale: number, imageinfo: ArrayBuffer, onCompleteFunction: (value: PixelMap) => void | PromiseLike<PixelMap>,
|
||||
onErrorFunction: (reason?: BusinessError | string) => void) {
|
||||
// taskPoolExecutePixelMap(imageinfo,scale,onCompleteFunction,onErrorFunction);
|
||||
|
||||
let imageSource:image.ImageSource = image.createImageSource(imageinfo); // 步骤一:文件转为pixelMap 然后变换 给Image组件
|
||||
|
|
|
@ -112,7 +112,7 @@ function taskPoolExecutePixelMapList(arrayBuffer: ArrayBuffer, callback: (data?:
|
|||
LogUtil.log("ceshi321 : arrayBuffer长度" + arrayBuffer.byteLength)
|
||||
let task = new taskpool.Task(taskParseGif, arrayBuffer)
|
||||
taskpool.execute(task).then((imageFrames: GIFFrame[]) => {
|
||||
// LogUtil.log('ceshi321 : Succeeded in creating pixelmap Ui .' + imageFrames.getPixelBytesNumber())
|
||||
|
||||
callback(imageFrames,undefined)
|
||||
}).catch((err: string) => {
|
||||
LogUtil.log("ceshi321 : test occur error: " + err)
|
||||
|
|
Loading…
Reference in New Issue