imageKnife支持heic展示demo页面独立展示

Signed-off-by: 18829029633 <18829029633@163.com>
This commit is contained in:
18829029633 2024-04-19 16:09:25 +08:00
parent 90ff9edf1d
commit 43daaec752
5 changed files with 55 additions and 20 deletions

View File

@ -7,6 +7,7 @@
- 更新SDK到API12
- 适配Sendable内存共享优化
- 修改全局请求头覆盖request请求头
- imageKnife支持heic测试demo独立页面展示
## 2.1.2-rc.12
- 新增gif播放次数功能

View File

@ -388,6 +388,14 @@ struct IndexFunctionDemo {
router.pushUrl({ url: 'pages/testStopPlayingGifPage' });
}).margin({ top: 5, left: 3 })
}.width('100%').height(60).backgroundColor(Color.Pink)
Text('测试heic图片加载').fontSize(15)
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button('测试heic')
.onClick(() => {
router.pushUrl({ url: 'pages/testImageKnifeHeic' });
}).margin({ top: 5, left: 3 })
}.width('100%').height(60).backgroundColor(Color.Pink)
}
}
.width('100%')

View File

@ -44,16 +44,6 @@ struct IndexFunctionDemo {
errorholderSrc: $r('app.media.icon_failed'),
headerOption: [this.headerOptions1]
};
@State imageKnifeOption3: ImageKnifeOption =
{
loadSrc: $r('app.media.yunHeic'),
placeholderSrc: $r('app.media.icon_loading'),
errorholderSrc: $r('app.media.icon_failed'),
};
@State flag: boolean = true;
build() {
Scroll() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
@ -93,15 +83,6 @@ struct IndexFunctionDemo {
router.pushUrl({ url: "pages/imageknifeTestCaseIndex" });
}).margin({ top: 15 })
}.width('100%').height(60).backgroundColor(Color.Pink)
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button("heic图片测试")
.onClick(() => {
this.flag = !this.flag
}).margin({ top: 15 })
ImageKnifeComponent({ imageKnifeOption: this.imageKnifeOption3 }).width(300).height(300)
.visibility(this.flag ? Visibility.Hidden : Visibility.Visible)
}.width('100%').height(60).backgroundColor(Color.Pink)
}
}
.width('100%')

View File

@ -0,0 +1,44 @@
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { ImageKnifeComponent, ImageKnifeOption } from '@ohos/libraryimageknife'
@Entry
@Component
struct testImageKnifeHeic {
@State imageKnifeOption1: ImageKnifeOption =
{
loadSrc: $r('app.media.yunHeic'),
placeholderSrc: $r('app.media.icon_loading'),
errorholderSrc: $r('app.media.icon_failed'),
};
@State flag: boolean = true;
build() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button("heic图片测试")
.onClick(() => {
this.flag = !this.flag
if (this.flag) {
this.imageKnifeOption1.errorholderSrc = $r('app.media.icon_loading')
} else {
this.imageKnifeOption1.errorholderSrc = $r('app.media.icon_failed')
}
}).margin({ top: 15 })
ImageKnifeComponent({ imageKnifeOption: this.imageKnifeOption1 }).width(300).height(300)
}.width('100%').height(300).backgroundColor(Color.Pink)
}
}

View File

@ -52,6 +52,7 @@
"pages/testImageKnifeCache",
"pages/webpImageTestPage",
"pages/testStopPlayingGifPage",
"pages/testImageKnifeDataFetch"
"pages/testImageKnifeDataFetch",
"pages/testImageKnifeHeic"
]
}