diff --git a/build-profile.json5 b/build-profile.json5 index 4f249a9..7ec08ca 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -39,8 +39,8 @@ "srcPath": "./gpu_transform" }, { - "name": "library", - "srcPath": "./library", + "name": "sharedlibrary", + "srcPath": "./sharedlibrary", "targets": [ { "name": "default", diff --git a/entry/oh-package.json5 b/entry/oh-package.json5 index 7f3ed43..1b44a8f 100644 --- a/entry/oh-package.json5 +++ b/entry/oh-package.json5 @@ -9,10 +9,10 @@ // 如果测试entry的demo需要开启以下2个依赖, 然后点击entry勾选 Edit Configurations->点击Deploy Multi Hap->勾选Deploy Multi Hap Packages // 然后点击module栏目 把library也勾选上,这样就可以在HSP场景下测试Entry里面的HSP场景 - "@ohos/libraryimageknife": "file:../library", + "@ohos/libraryimageknife": "file:../sharedlibrary", "@ohos/disklrucache": "^2.0.2-rc.0", // 下面这个依赖是为了跑XTS用例的,需要跑XTS时 需要注释上面2个依赖单独使用imageknife依赖 "@ohos/imageknife": "file:../imageknife" } -} +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets b/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets index ac35f87..77024bd 100644 --- a/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets +++ b/entry/src/main/ets/pages/imageknifeTestCaseIndex.ets @@ -262,7 +262,7 @@ struct IndexFunctionDemo { Button("进入HSP的library共享包") .onClick(() => { - router.pushUrl({url:'@bundle:com.openharmony.imageknife/library/ets/pages/Index'}) + router.pushUrl({url:'@bundle:com.openharmony.imageknife/sharedlibrary/ets/pages/Index'}) .then(()=>{ console.log('push page suceess') }) diff --git a/library/.gitignore b/sharedlibrary/.gitignore similarity index 100% rename from library/.gitignore rename to sharedlibrary/.gitignore diff --git a/library/build-profile.json5 b/sharedlibrary/build-profile.json5 similarity index 100% rename from library/build-profile.json5 rename to sharedlibrary/build-profile.json5 diff --git a/library/hvigorfile.ts b/sharedlibrary/hvigorfile.ts similarity index 100% rename from library/hvigorfile.ts rename to sharedlibrary/hvigorfile.ts diff --git a/library/oh-package.json5 b/sharedlibrary/oh-package.json5 similarity index 89% rename from library/oh-package.json5 rename to sharedlibrary/oh-package.json5 index beeccdc..e0cfa8a 100644 --- a/library/oh-package.json5 +++ b/sharedlibrary/oh-package.json5 @@ -1,5 +1,5 @@ { - "name": "library", + "name": "sharedlibrary", "version": "1.0.0", "description": "Please describe the basic information.", "main": "./src/main/ets/Index.ets", diff --git a/library/src/main/ets/Index.ets b/sharedlibrary/src/main/ets/Index.ets similarity index 100% rename from library/src/main/ets/Index.ets rename to sharedlibrary/src/main/ets/Index.ets diff --git a/library/src/main/ets/pages/Index.ets b/sharedlibrary/src/main/ets/pages/Index.ets similarity index 76% rename from library/src/main/ets/pages/Index.ets rename to sharedlibrary/src/main/ets/pages/Index.ets index 86f8d60..b34810d 100644 --- a/library/src/main/ets/pages/Index.ets +++ b/sharedlibrary/src/main/ets/pages/Index.ets @@ -22,15 +22,15 @@ struct Index { @State imageOption1:ImageKnifeOption = { loadSrc: $r('app.media.icon'), - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } @State imageOption2:ImageKnifeOption = { loadSrc: $r('app.media.icon'), - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } @State imageOption3:ImageKnifeOption = { loadSrc: $r('app.media.icon'), - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } build() { @@ -40,27 +40,27 @@ struct Index { this.imageOption1 = { loadSrc: $r('app.media.setting'), // 只要涉及resource加载 在HSP中都要带上context属性 - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } }) ImageKnifeComponent({imageKnifeOption:this.imageOption1}).width(300).height(300).backgroundColor(Color.Pink) Button('点击加载网络图片').onClick(()=>{ this.imageOption2 = { loadSrc: 'https://hbimg.huabanimg.com/cc6af25f8d782d3cf3122bef4e61571378271145735e9-vEVggB', - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } }) ImageKnifeComponent({imageKnifeOption:this.imageOption2}).width(300).height(300).backgroundColor(Color.Pink) Button('点击加载本地文件').onClick(()=>{ - getContext(this).createModuleContext('library').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{ + getContext(this).createModuleContext('sharedlibrary').resourceManager.getMediaContent($r('app.media.setting').id).then((data:Uint8Array)=>{ let ctx = ImageKnifeGlobal.getInstance().getHapContext() as common.UIAbilityContext; let path = ctx.filesDir+"/set.jpeg"; FileUtils.getInstance().writeFile(path,data.buffer) FileUtils.getInstance().readFilePicAsync(path).then(buffer=>{ this.imageOption3 = { loadSrc: path, - context: getContext(this).createModuleContext('library') as common.UIAbilityContext + context: getContext(this).createModuleContext('sharedlibrary') as common.UIAbilityContext } }) }) diff --git a/library/src/main/ets/pages/InitImageKnife.ets b/sharedlibrary/src/main/ets/pages/InitImageKnife.ets similarity index 100% rename from library/src/main/ets/pages/InitImageKnife.ets rename to sharedlibrary/src/main/ets/pages/InitImageKnife.ets diff --git a/library/src/main/module.json5 b/sharedlibrary/src/main/module.json5 similarity index 88% rename from library/src/main/module.json5 rename to sharedlibrary/src/main/module.json5 index 74570f9..7e37699 100644 --- a/library/src/main/module.json5 +++ b/sharedlibrary/src/main/module.json5 @@ -1,6 +1,6 @@ { "module": { - "name": "library", + "name": "sharedlibrary", "type": "shared", "description": "$string:shared_desc", "deviceTypes": [ diff --git a/library/src/main/resources/base/element/color.json b/sharedlibrary/src/main/resources/base/element/color.json similarity index 100% rename from library/src/main/resources/base/element/color.json rename to sharedlibrary/src/main/resources/base/element/color.json diff --git a/library/src/main/resources/base/element/string.json b/sharedlibrary/src/main/resources/base/element/string.json similarity index 100% rename from library/src/main/resources/base/element/string.json rename to sharedlibrary/src/main/resources/base/element/string.json diff --git a/library/src/main/resources/base/media/icon.png b/sharedlibrary/src/main/resources/base/media/icon.png similarity index 100% rename from library/src/main/resources/base/media/icon.png rename to sharedlibrary/src/main/resources/base/media/icon.png diff --git a/library/src/main/resources/base/media/setting.jpeg b/sharedlibrary/src/main/resources/base/media/setting.jpeg similarity index 100% rename from library/src/main/resources/base/media/setting.jpeg rename to sharedlibrary/src/main/resources/base/media/setting.jpeg diff --git a/library/src/main/resources/base/profile/main_pages.json b/sharedlibrary/src/main/resources/base/profile/main_pages.json similarity index 100% rename from library/src/main/resources/base/profile/main_pages.json rename to sharedlibrary/src/main/resources/base/profile/main_pages.json