1.library依赖更名为sharedlibrary
Signed-off-by: zhoulisheng <635547767@qq.com>
This commit is contained in:
parent
89fcb3a5d3
commit
9dd89db3e3
|
@ -39,8 +39,8 @@
|
|||
"srcPath": "./gpu_transform"
|
||||
},
|
||||
{
|
||||
"name": "library",
|
||||
"srcPath": "./library",
|
||||
"name": "sharedlibrary",
|
||||
"srcPath": "./sharedlibrary",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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')
|
||||
})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "library",
|
||||
"name": "sharedlibrary",
|
||||
"version": "1.0.0",
|
||||
"description": "Please describe the basic information.",
|
||||
"main": "./src/main/ets/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
|
||||
}
|
||||
})
|
||||
})
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"module": {
|
||||
"name": "library",
|
||||
"name": "sharedlibrary",
|
||||
"type": "shared",
|
||||
"description": "$string:shared_desc",
|
||||
"deviceTypes": [
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue