控制动图组件新增事件和文件缓存数量最大值修改
Signed-off-by: zgf <zenggaofeng2@h-partners.com>
This commit is contained in:
parent
bea89c5c77
commit
986aa2679a
|
@ -1,3 +1,7 @@
|
||||||
|
## 3.1.0-rc.1
|
||||||
|
- ImageKnifeAnimatorComponent新增开始、结束、暂停的回调事件
|
||||||
|
- 文件缓存数量负数和超过INT最大值时默认为INT最大值
|
||||||
|
|
||||||
## 3.1.0-rc.0
|
## 3.1.0-rc.0
|
||||||
- ComponentV2装饰器适配
|
- ComponentV2装饰器适配
|
||||||
- imageKnifeOption={...}用法改为new ImageKnifeOption({...})
|
- imageKnifeOption={...}用法改为new ImageKnifeOption({...})
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"main": "index.ets",
|
"main": "index.ets",
|
||||||
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.0.1-rc.2",
|
"version": "3.1.0-rc.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ohos/gpu_transform": "^1.0.2"
|
"@ohos/gpu_transform": "^1.0.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -26,6 +26,11 @@ interface AnimatorType {
|
||||||
state?: AnimationStatus
|
state?: AnimationStatus
|
||||||
iterations?: number
|
iterations?: number
|
||||||
reverse?: boolean
|
reverse?: boolean
|
||||||
|
onStart?:()=>void
|
||||||
|
onFinish?:()=>void
|
||||||
|
onPause?:()=>void
|
||||||
|
onCancel?:()=>void
|
||||||
|
onRepeat?:()=>void
|
||||||
}
|
}
|
||||||
@ObservedV2
|
@ObservedV2
|
||||||
export class AnimatorOption {
|
export class AnimatorOption {
|
||||||
|
@ -35,11 +40,25 @@ export class AnimatorOption {
|
||||||
iterations?: number = -1
|
iterations?: number = -1
|
||||||
@Trace
|
@Trace
|
||||||
reverse?: boolean = false
|
reverse?: boolean = false
|
||||||
|
@Trace
|
||||||
|
onStart?:()=>void
|
||||||
|
@Trace
|
||||||
|
onFinish?:()=>void
|
||||||
|
@Trace
|
||||||
|
onPause?:()=>void
|
||||||
|
@Trace
|
||||||
|
onCancel?:()=>void
|
||||||
|
@Trace
|
||||||
|
onRepeat?:()=>void
|
||||||
constructor(option?:AnimatorType) {
|
constructor(option?:AnimatorType) {
|
||||||
this.state = option?.state
|
this.state = option?.state
|
||||||
this.iterations = option?.iterations
|
this.iterations = option?.iterations
|
||||||
this.reverse = option?.reverse
|
this.reverse = option?.reverse
|
||||||
|
this.onStart = option?.onStart
|
||||||
|
this.onFinish = option?.onFinish
|
||||||
|
this.onPause = option?.onPause
|
||||||
|
this.onCancel = option?.onCancel
|
||||||
|
this.onRepeat = option?.onRepeat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
interface ImageOption {
|
interface ImageOption {
|
||||||
|
|
|
@ -88,6 +88,11 @@ export struct ImageKnifeAnimatorComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.onStart(this.animatorOption.onStart)
|
||||||
|
.onFinish(this.animatorOption.onFinish)
|
||||||
|
.onPause(this.animatorOption.onPause)
|
||||||
|
.onCancel(this.animatorOption.onCancel)
|
||||||
|
.onRepeat(this.animatorOption.onRepeat)
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentContext(): common.UIAbilityContext {
|
getCurrentContext(): common.UIAbilityContext {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import fs from '@ohos.file.fs';
|
||||||
import { LogUtil } from './LogUtil';
|
import { LogUtil } from './LogUtil';
|
||||||
import { SparkMD5 } from '../3rd_party/sparkmd5/spark-md5';
|
import { SparkMD5 } from '../3rd_party/sparkmd5/spark-md5';
|
||||||
|
|
||||||
|
const INT_MAX = 2147483647
|
||||||
/**
|
/**
|
||||||
* 二级文件缓存
|
* 二级文件缓存
|
||||||
* 主线程通过lruCache管理缓存大小
|
* 主线程通过lruCache管理缓存大小
|
||||||
|
@ -34,12 +34,12 @@ export class FileCache {
|
||||||
private isInited: boolean = false
|
private isInited: boolean = false
|
||||||
private context?: Context
|
private context?: Context
|
||||||
readonly defaultMaxSize: number = 512;
|
readonly defaultMaxSize: number = 512;
|
||||||
readonly defaultSize: number = 128;
|
readonly defaultSize: number = INT_MAX;
|
||||||
readonly defaultMaxMemorySize: number = 512 * 1024 * 1024;
|
readonly defaultMaxMemorySize: number = 512 * 1024 * 1024;
|
||||||
readonly defaultMemorySize: number = 128 * 1024 * 1024;
|
readonly defaultMemorySize: number = 128 * 1024 * 1024;
|
||||||
|
|
||||||
constructor(context: Context, size: number, memory: number) {
|
constructor(context: Context, size: number, memory: number) {
|
||||||
if (size <= 0) {
|
if (size <= 0 || size > INT_MAX) {
|
||||||
size = this.defaultSize
|
size = this.defaultSize
|
||||||
}
|
}
|
||||||
if (memory <= 0 || memory > this.defaultMaxMemorySize) {
|
if (memory <= 0 || memory > this.defaultMaxMemorySize) {
|
||||||
|
|
Loading…
Reference in New Issue