diff --git a/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets b/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets index 4e02044..71dfa05 100644 --- a/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets +++ b/entry/src/ohosTest/ets/test/DefaultJobQueueTest.test.ets @@ -14,8 +14,8 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; import { ImageKnifeOption, ImageKnifeRequest } from '@ohos/imageknife/Index'; -import { DefaultJobQueue } from '@ohos/imageknife/src/main/ets/utils/DefaultJobQueue'; -import { IJobQueue } from '@ohos/imageknife/src/main/ets/utils/IJobQueue'; +import { DefaultJobQueue } from '@ohos/imageknife/src/main/ets/queue/DefaultJobQueue'; +import { IJobQueue } from '@ohos/imageknife/src/main/ets/queue/IJobQueue'; import taskpool from '@ohos.taskpool'; import common from '@ohos.app.ability.common'; diff --git a/entry/src/ohosTest/ets/test/FileLruCache.test.ets b/entry/src/ohosTest/ets/test/FileLruCache.test.ets index 3081972..ed4d183 100644 --- a/entry/src/ohosTest/ets/test/FileLruCache.test.ets +++ b/entry/src/ohosTest/ets/test/FileLruCache.test.ets @@ -17,7 +17,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import Constants from '../../../main/ets/common/Constants'; import taskpool from '@ohos.taskpool'; import { GlobalContext } from '../../../main/ets/common/GlobalContext'; -import { FileCache } from '@ohos/imageknife/src/main/ets/utils/FileCache'; +import { FileCache } from '@ohos/imageknife/src/main/ets/cache/FileCache'; import { IEngineKey, ImageKnifeOption } from '@ohos/imageknife'; import { DefaultEngineKey } from '@ohos/imageknife/src/main/ets/key/DefaultEngineKey'; diff --git a/entry/src/ohosTest/ets/test/ImageKnifeOption.test.ets b/entry/src/ohosTest/ets/test/ImageKnifeOption.test.ets index ffd20b9..6a3acac 100644 --- a/entry/src/ohosTest/ets/test/ImageKnifeOption.test.ets +++ b/entry/src/ohosTest/ets/test/ImageKnifeOption.test.ets @@ -44,7 +44,7 @@ export default function ImageKnifeOptionTest() { imageWidth: 0, imageHeight: 0, } - let ImageKnifeOption: ImageKnifeOption = { + let imageKnifeOption: ImageKnifeOption = new ImageKnifeOption({ loadSrc: $r("app.media.rabbit"), onLoadListener: { onLoadFailed: (err) => { @@ -58,10 +58,10 @@ export default function ImageKnifeOptionTest() { return data; }, }, - } - if (ImageKnifeOption.onLoadListener && ImageKnifeOption.onLoadListener.onLoadSuccess && ImageKnifeOption.onLoadListener.onLoadFailed) { - ImageKnifeOption.onLoadListener.onLoadSuccess(a,imageData); - ImageKnifeOption.onLoadListener.onLoadFailed(a); + }) + if (imageKnifeOption.onLoadListener && imageKnifeOption.onLoadListener.onLoadSuccess && imageKnifeOption.onLoadListener.onLoadFailed) { + imageKnifeOption.onLoadListener.onLoadSuccess(a,imageData); + imageKnifeOption.onLoadListener.onLoadFailed(a); } expect(a).assertEqual(b); }); diff --git a/entry/src/ohosTest/ets/test/MemoryLruCache.test.ets b/entry/src/ohosTest/ets/test/MemoryLruCache.test.ets index 26ade90..d0d7302 100644 --- a/entry/src/ohosTest/ets/test/MemoryLruCache.test.ets +++ b/entry/src/ohosTest/ets/test/MemoryLruCache.test.ets @@ -17,7 +17,7 @@ import image from '@ohos.multimedia.image'; import Constants from '../../../main/ets/common/Constants'; -import { MemoryLruCache } from '@ohos/imageknife/src/main/ets/utils/MemoryLruCache'; +import { MemoryLruCache } from '@ohos/imageknife/src/main/ets/cache/MemoryLruCache'; import { ImageKnifeData } from '@ohos/imageknife/src/main/ets/model/ImageKnifeData'; import { IEngineKey, ImageKnifeOption,ImageKnifeRequestSource } from '@ohos/imageknife'; import { DefaultEngineKey } from '@ohos/imageknife/src/main/ets/key/DefaultEngineKey'; diff --git a/library/index.ets b/library/index.ets index 4576c08..1f67f70 100644 --- a/library/index.ets +++ b/library/index.ets @@ -18,9 +18,9 @@ export { ImageKnifeAnimatorComponent } from './src/main/ets/components/ImageKnif export { ImageKnife } from './src/main/ets/ImageKnife' -export { ImageKnifeOption , AnimatorOption } from './src/main/ets/ImageKnifeOption' +export { ImageKnifeOption , AnimatorOption } from './src/main/ets/model/ImageKnifeOption' -export { ImageKnifeRequest } from './src/main/ets/ImageKnifeRequest' +export { ImageKnifeRequest } from './src/main/ets/model/ImageKnifeRequest' export { FileUtils } from './src/main/ets/utils/FileUtils' diff --git a/library/src/main/ets/ImageKnife.ets b/library/src/main/ets/ImageKnife.ets index 88f099a..41eeb64 100644 --- a/library/src/main/ets/ImageKnife.ets +++ b/library/src/main/ets/ImageKnife.ets @@ -12,14 +12,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeRequest } from './ImageKnifeRequest'; +import { ImageKnifeRequest } from './model/ImageKnifeRequest'; import { CacheStrategy, ImageKnifeData, ImageKnifeRequestSource } from './model/ImageKnifeData'; -import { MemoryLruCache } from './utils/MemoryLruCache'; -import { IMemoryCache } from './utils/IMemoryCache' -import { FileCache } from './utils/FileCache'; +import { MemoryLruCache } from './cache/MemoryLruCache'; +import { IMemoryCache } from './cache/IMemoryCache' +import { FileCache } from './cache/FileCache'; import { ImageKnifeDispatcher } from './ImageKnifeDispatcher'; import { IEngineKey } from './key/IEngineKey'; -import { HeaderOptions, ImageKnifeOption } from './ImageKnifeOption'; +import { HeaderOptions, ImageKnifeOption } from './model/ImageKnifeOption'; import { FileTypeUtil } from './utils/FileTypeUtil'; import { util } from '@kit.ArkTS'; import { image } from '@kit.ImageKit'; diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index f321402..fbbb3a8 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -12,9 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeRequest, ImageKnifeRequestState } from './ImageKnifeRequest' -import { DefaultJobQueue } from './utils/DefaultJobQueue' -import { IJobQueue } from './utils/IJobQueue' +import { ImageKnifeRequest, ImageKnifeRequestState } from './model/ImageKnifeRequest' +import { DefaultJobQueue } from './queue/DefaultJobQueue' +import { IJobQueue } from './queue/IJobQueue' import List from '@ohos.util.List'; import LightWeightMap from '@ohos.util.LightWeightMap'; import { LogUtil } from './utils/LogUtil'; diff --git a/library/src/main/ets/ImageKnifeLoader.ets b/library/src/main/ets/ImageKnifeLoader.ets index 8b0be11..1c14d0c 100644 --- a/library/src/main/ets/ImageKnifeLoader.ets +++ b/library/src/main/ets/ImageKnifeLoader.ets @@ -17,11 +17,11 @@ import { ImageKnifeRequestSource, ImageKnifeRequestWithSource, RequestJobRequest } from './model/ImageKnifeData'; import List from '@ohos.util.List' -import { FileCache } from './utils/FileCache'; +import { FileCache } from './cache/FileCache'; import { LogUtil } from './utils/LogUtil'; import { Constants } from './utils/Constants'; import http from '@ohos.net.http'; -import { combineArrayBuffers } from './model/utils'; +import { combineArrayBuffers } from './utils/ArrayBufferUtils'; import { BusinessError } from '@kit.BasicServicesKit'; import fs from '@ohos.file.fs'; import emitter from '@ohos.events.emitter'; diff --git a/library/src/main/ets/utils/FileCache.ets b/library/src/main/ets/cache/FileCache.ets similarity index 98% rename from library/src/main/ets/utils/FileCache.ets rename to library/src/main/ets/cache/FileCache.ets index 957a2c0..41978b8 100644 --- a/library/src/main/ets/utils/FileCache.ets +++ b/library/src/main/ets/cache/FileCache.ets @@ -13,9 +13,9 @@ * limitations under the License. */ import util from '@ohos.util'; -import { FileUtils } from './FileUtils'; +import { FileUtils } from '../utils/FileUtils'; import fs from '@ohos.file.fs'; -import { LogUtil } from './LogUtil'; +import { LogUtil } from '../utils/LogUtil'; import { SparkMD5 } from '../3rd_party/sparkmd5/spark-md5'; const INT_MAX = 2147483647 diff --git a/library/src/main/ets/utils/IMemoryCache.ets b/library/src/main/ets/cache/IMemoryCache.ets similarity index 100% rename from library/src/main/ets/utils/IMemoryCache.ets rename to library/src/main/ets/cache/IMemoryCache.ets diff --git a/library/src/main/ets/utils/MemoryLruCache.ets b/library/src/main/ets/cache/MemoryLruCache.ets similarity index 100% rename from library/src/main/ets/utils/MemoryLruCache.ets rename to library/src/main/ets/cache/MemoryLruCache.ets diff --git a/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets b/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets index 4417ff1..93cdf84 100644 --- a/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets +++ b/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { AnimatorOption, ImageKnifeOption } from '../ImageKnifeOption'; -import { ImageKnifeRequest, ImageKnifeRequestState } from '../ImageKnifeRequest'; +import { AnimatorOption, ImageKnifeOption } from '../model/ImageKnifeOption'; +import { ImageKnifeRequest, ImageKnifeRequestState } from '../model/ImageKnifeRequest'; import common from '@ohos.app.ability.common'; import { ImageKnife } from '../ImageKnife'; import { LogUtil } from '../utils/LogUtil'; diff --git a/library/src/main/ets/components/ImageKnifeComponent.ets b/library/src/main/ets/components/ImageKnifeComponent.ets index 1232ba3..f96cecc 100644 --- a/library/src/main/ets/components/ImageKnifeComponent.ets +++ b/library/src/main/ets/components/ImageKnifeComponent.ets @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeOption } from '../ImageKnifeOption'; -import { ImageKnifeRequest, ImageKnifeRequestState } from '../ImageKnifeRequest'; +import { ImageKnifeOption } from '../model/ImageKnifeOption'; +import { ImageKnifeRequest, ImageKnifeRequestState } from '../model/ImageKnifeRequest'; import common from '@ohos.app.ability.common'; import { ImageKnife } from '../ImageKnife'; import { LogUtil } from '../utils/LogUtil'; diff --git a/library/src/main/ets/key/DefaultEngineKey.ets b/library/src/main/ets/key/DefaultEngineKey.ets index 6d43be1..f28024b 100644 --- a/library/src/main/ets/key/DefaultEngineKey.ets +++ b/library/src/main/ets/key/DefaultEngineKey.ets @@ -13,7 +13,7 @@ * limitations under the License. */ import { SparkMD5 } from '../3rd_party/sparkmd5/spark-md5'; -import { ImageKnifeOption } from '../ImageKnifeOption'; +import { ImageKnifeOption } from '../model/ImageKnifeOption'; import { IEngineKey } from './IEngineKey'; import { PixelMapTransformation } from '../transform/PixelMapTransformation'; import { ImageKnifeRequestSource } from '../model/ImageKnifeData'; diff --git a/library/src/main/ets/key/IEngineKey.ets b/library/src/main/ets/key/IEngineKey.ets index 54be5bb..3f7a903 100644 --- a/library/src/main/ets/key/IEngineKey.ets +++ b/library/src/main/ets/key/IEngineKey.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeOption } from '../ImageKnifeOption' +import { ImageKnifeOption } from '../model/ImageKnifeOption' import { ImageKnifeRequestSource } from '../model/ImageKnifeData' export interface IEngineKey { diff --git a/library/src/main/ets/model/ImageKnifeData.ets b/library/src/main/ets/model/ImageKnifeData.ets index 2c7156c..e8a4c2a 100644 --- a/library/src/main/ets/model/ImageKnifeData.ets +++ b/library/src/main/ets/model/ImageKnifeData.ets @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { HeaderOptions } from '../ImageKnifeOption' -import { ImageKnifeRequest } from '../ImageKnifeRequest' +import { HeaderOptions } from './ImageKnifeOption' +import { ImageKnifeRequest } from './ImageKnifeRequest' import { IEngineKey } from '../key/IEngineKey' import { PixelMapTransformation } from '../transform/PixelMapTransformation' import common from '@ohos.app.ability.common'; diff --git a/library/src/main/ets/ImageKnifeOption.ets b/library/src/main/ets/model/ImageKnifeOption.ets similarity index 96% rename from library/src/main/ets/ImageKnifeOption.ets rename to library/src/main/ets/model/ImageKnifeOption.ets index 3a9bf6f..5c5f292 100644 --- a/library/src/main/ets/ImageKnifeOption.ets +++ b/library/src/main/ets/model/ImageKnifeOption.ets @@ -14,8 +14,8 @@ */ import taskpool from '@ohos.taskpool'; import common from '@ohos.app.ability.common' -import { CacheStrategy, ImageKnifeData,EventImage } from './model/ImageKnifeData'; -import { PixelMapTransformation } from './transform/PixelMapTransformation'; +import { CacheStrategy, ImageKnifeData,EventImage } from './ImageKnifeData'; +import { PixelMapTransformation } from '../transform/PixelMapTransformation'; import { drawing } from '@kit.ArkGraphics2D'; export interface HeaderOptions { diff --git a/library/src/main/ets/ImageKnifeRequest.ets b/library/src/main/ets/model/ImageKnifeRequest.ets similarity index 97% rename from library/src/main/ets/ImageKnifeRequest.ets rename to library/src/main/ets/model/ImageKnifeRequest.ets index cb2115b..c63f8be 100644 --- a/library/src/main/ets/ImageKnifeRequest.ets +++ b/library/src/main/ets/model/ImageKnifeRequest.ets @@ -14,7 +14,7 @@ */ import { ImageKnifeOption } from './ImageKnifeOption'; import common from '@ohos.app.ability.common'; -import { ImageKnifeRequestSource } from './model/ImageKnifeData'; +import { ImageKnifeRequestSource } from './ImageKnifeData'; export class ImageKnifeRequest { diff --git a/library/src/main/ets/utils/DefaultJobQueue.ets b/library/src/main/ets/queue/DefaultJobQueue.ets similarity index 96% rename from library/src/main/ets/utils/DefaultJobQueue.ets rename to library/src/main/ets/queue/DefaultJobQueue.ets index ac31956..53f3d2a 100644 --- a/library/src/main/ets/utils/DefaultJobQueue.ets +++ b/library/src/main/ets/queue/DefaultJobQueue.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeRequest } from '../ImageKnifeRequest'; +import { ImageKnifeRequest } from '../model/ImageKnifeRequest'; import { IJobQueue } from './IJobQueue' import Queue from '@ohos.util.Queue'; import { taskpool,Stack } from '@kit.ArkTS'; diff --git a/library/src/main/ets/utils/IJobQueue.ets b/library/src/main/ets/queue/IJobQueue.ets similarity index 93% rename from library/src/main/ets/utils/IJobQueue.ets rename to library/src/main/ets/queue/IJobQueue.ets index 0a51ff0..39a3923 100644 --- a/library/src/main/ets/utils/IJobQueue.ets +++ b/library/src/main/ets/queue/IJobQueue.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { ImageKnifeRequest } from '../ImageKnifeRequest' +import { ImageKnifeRequest } from '../model/ImageKnifeRequest' export interface IJobQueue { diff --git a/library/src/main/ets/model/utils.ets b/library/src/main/ets/utils/ArrayBufferUtils.ets similarity index 100% rename from library/src/main/ets/model/utils.ets rename to library/src/main/ets/utils/ArrayBufferUtils.ets