Photos迁移, BasicFeature -> SystemFeature

Signed-off-by: ywx1281445 <yuandongping@huawei.com>
This commit is contained in:
ywx1281445 2024-04-18 14:51:56 +08:00
parent 0be5d480a0
commit bb738f3b86
267 changed files with 984 additions and 909 deletions

75
OAT.xml
View File

@ -169,6 +169,22 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="code/Solutions/Media/MultiMedia/lib/VideoPlayer.hap" desc="Provided by code/Solutions/Media/MultiMedia"/>
<filteritem type="filepath" name="code/Solutions/Media/MultiMedia/lib/CameraPage-1.0.0.hap" desc="Provided by code/Solutions/Media/MultiMedia"/>
<filteritem type="filepath" name="code/BasicFeature/Media/AVRecorder/lib/VideoRecorder-1.0.0.hap" desc="Provided by code/BasicFeature/Media/AVRecorder"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_avatar_radio01.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_avatar_regular.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_popup_right.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/AppScope/resources/base/media/app_icon.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/app_pic/auth3.jpg" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_popup_left.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/icon.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/app_pic/auth2.jpg" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_avatar_radio02.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_camera_line.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/app_pic/setting.jpg" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/main/resources/base/media/pic_camera_mirror.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/app_pic/preview.jpg" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/app_pic/auth1.jpg" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/app_pic/auth4.jpg" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Media/Camera_js/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/BasicFeature/Media/Camera_js"/>
<filteritem type="filepath" name="code/BasicFeature/Connectivity/VPN/server/server.zip" desc="Provided by code/BasicFeature/Connectivity/VPN"/>
<filteritem type="filepath" name="code/BasicFeature/Connectivity/StageSocket/certificate_file.zip" desc="Provided by code/BasicFeature/Connectivity/StageSocket"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkDrawing/screenshots/device/Index.jpg" desc="Provided by code/BasicFeature/Native/NdkDrawing"/>
@ -182,6 +198,14 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="code/BasicFeature/Native/NdkRenderNodeDrawing/entry/src/main/resources/base/media/icon.png" desc="Provided by code/BasicFeature/Native/NdkRenderNodeDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkRenderNodeDrawing/entry/src/main/resources/base/media/startIcon.png" desc="Provided by code/BasicFeature/Native/NdkRenderNodeDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkRenderNodeDrawing/AppScope/resources/base/media/app_icon.png" desc="Provided by code/BasicFeature/Native/NdkRenderNodeDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/screenshots/Index.jpeg" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/screenshots/DrawPath.jpeg" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/screenshots/DrawRect.jpeg" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/screenshots/DrawText.jpeg" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/entry/src/main/resources/base/media/icon.png" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/entry/src/main/resources/base/media/startIcon.png" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkTsDrawing/AppScope/resources/base/media/app_icon.png" desc="Provided by code/BasicFeature/Native/NdkTsDrawing"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkNativeWindow/screenshots/device/ChangeColor.jpg" desc="Provided by code/BasicFeature/Native/NdkNativeWindow"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkNativeWindow/screenshots/device/GetAvailableCount.jpg" desc="Provided by code/BasicFeature/Native/NdkNativeWindow"/>
<filteritem type="filepath" name="code/BasicFeature/Native/NdkNativeWindow/screenshots/device/Main.jpg" desc="Provided by code/BasicFeature/Native/NdkNativeWindow"/>
@ -243,6 +267,57 @@ Note:If the text contains special characters, please escape them according to th
<filteritem type="filepath" name="code/SystemFeature/Security/CertificateFramework/screenshots/device/chain_fail.jpeg" desc="Provided by code/SystemFeature/Security/CertificateFramework"/>
<filteritem type="filepath" name="code/BasicFeature/Security/DLPManager/screenshots/device/index.jpeg" desc="Provided by code/BasicFeature/Security/DLPManager"/>
<filteritem type="filepath" name="code/SystemFeature/Security/CertificateFramework/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/SystemFeature/Security/CertificateFramework"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/AppScope/resources/base/media/app_icon.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/js/common/qing.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/js/common/widget.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/resources/base/media/add.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/resources/base/media/back.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/resources/base/media/book.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/resources/base/media/delete.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/main/resources/base/media/icon.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/ApplicationModels/StageModel/screenshots/device/stage_mode.png" desc="Provided by code/SystemFeature/ApplicationModels/StageModel"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/AppScope/resources/base/media/app_icon.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/airqulity.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/calculator.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/camera.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/clock.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/contacts.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/ecg.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/flashlight.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/icon.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/msg.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/musicplayer.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/notes.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/photos.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/settings.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/Library/src/main/resources/base/media/shopping.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics/screenshots/devices/main.png" desc="Provided by code/SystemFeature/DeviceUsageStatistics/DeviceUsageStatistics"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/AppScope/resources/base/media/app_icon.png" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/entry/src/main/resources/base/media/icon.png" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/screenshots/device/Edit.jpeg" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/screenshots/device/Index.jpeg" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/screenshots/device/Picture.jpeg" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/FileShare/Picker/screenshots/device/Video.jpeg" desc="Provided by code/SystemFeature/FileManagement/FileShare/Picker"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/AppScope/resources/base/media/app_icon.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/album_empty.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/ic_video_play_btn_png.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/icon.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/ohos_gallery.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/photo_empty.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/scroll_light.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/scroll_press_light.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/ohosTest/resources/base/media/icon.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/screenshots/detail.jpeg" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/screenshots/home.jpeg" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/screenshots/photos.jpeg" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/screenshots/selector.jpeg" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/gradient_mask_layer.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/arrow.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/gradientBasePlate.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/SystemFeature/FileManagement/Photos/entry/src/main/resources/base/media/no_image_icon.png" desc="Provided by code/SystemFeature/FileManagement/Photos"/>
<filteritem type="filepath" name="code/BasicFeature/ArkTSCard/ArkTSCard/libs/ArkTSUser.hap" desc="Provided by code/BasicFeature/ArkTSCard/ArkTSCard"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/sign_tool/OpenHarmonyProfileDebug.pem" desc="Provided by code/Project/HapBuild"/>
<filteritem type="filepath" name="code/Project/HapBuild/compile-tool/tool/sign_tool/OpenHarmonyApplication.pem" desc="Provided by code/Project/HapBuild"/>

View File

@ -1,24 +1,24 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
{
"app": {
"bundleName": "com.samples.photos",
"vendor": "samples",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
{
"app": {
"bundleName": "com.samples.photos",
"vendor": "samples",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}

View File

@ -1,8 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "PhotosSample"
}
]
}
{
"string": [
{
"name": "app_name",
"value": "PhotosSample"
}
]
}

View File

@ -1,215 +1,215 @@
# 相册
### 介绍
本示例主要展示了相册相关的功能,使用[@ohos.file.photoAccessHelper](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-photoAccessHelper.md)
接口,实现了查看系统相册、创建用户相册、查看相册照片、用户相册文件添加和删除、以及预览图片、最近删除、收藏夹操作等功能;
### 效果预览
| 主页 | 图片列表 | 大图 | 图片选择 |
|---------------------------------|-----------------------------------|-----------------------------------|-------------------------------------|
| ![image](screenshots/home.jpeg) | ![image](screenshots/photos.jpeg) | ![image](screenshots/detail.jpeg) | ![image](screenshots/selector.jpeg) |
使用说明
1. 主界面:查询显示所有照片、系统相册(相机/视频/截屏录屏/动态照片/我的收藏/最近删除)、用户相册
2. 主界面点击“+”,创建用户相册
3. 创建用户相册时添加图片到用户相册
4. 长按相册,删除相册
5. 长按相册,重命名相册(不可重名)
6. 长按相册,相册多选,批量删除
7. 点击相册,查看相册中的图片列表
8. 点击图片,查看单个图片大图
9. 点击心形图标,收藏图片
10. 点击心形图标,取消收藏
11. 大图界面,重命名文件(可重名)
12. 大图界面,删除文件(移动到最近删除相册)
13. 从最近删除恢复照片
14. 点击视频,查看视频并播放
15. 点击图片页面右上角叹号,查看图片详情
16. 长按图片批量操作:多选/全选、删除、恢复
17. 相册内图片列表界面点击“+”,从已有相册添加照片
18. 长按图片列表图片,更多菜单,从图片选择添加到已有相册
19. 在相册图片列表界面,长按图片,选择图片,点击更多,可以将图片加入到其他相册(可多选)
20. 在用户相册图片列表界面,长按图片,选择图片,点击更多,可以将图片从当前相册移除(可多选)
21. 在用户相册图片列表界面,长按图片,选择图片,点击更多,可以查看图片详情(可多选)
### 工程目录
```
.
├── base // @ohos.file.photoAccessHelper接口封装
│ ├── FavorUserFileDataItem.ts // 收藏夹图片数据类
│ ├── InnerUserFileDataItem.ts // 大图数据类
│ ├── TrashUserFileDataItemCache.ts // 最近删除图片数据缓存
│ ├── TrashUserFileDataItem.ts // 最近删除图片数据类
│ ├── UserFileDataChangeCallback.ts // 图片数据变化回调
│ ├── UserFileDataHelper.ts // 图片展示信息查询接口
│ ├── UserFileDataItemCache.ts // 图片数据缓存
│ ├── UserFileDataItem.ts // 图片数据类
│ ├── UserFileModel.ts // photoAccessHelper接口封装
│ ├── UserFileObserverCallback.ts // 图片数据监听回调
│ └── UserFileObserver.ts // 图片数据监听类
├── common //业务逻辑
│ ├── ActionBarProp.ts
│ ├── AlbumDataImpl.ts // 相册数据查询接口封装
│ ├── AlbumDataItem.ts // 相册数据类
│ ├── AlbumsDataSource.ts
│ ├── BroadcastManager.ts
│ ├── Broadcast.ts
│ ├── CommonObserverCallback.ts
│ ├── EventPipeline.ts
│ ├── GlobalContext.ts
│ ├── GroupDataImpl.ts // 相册成员数组数据接口封装
│ ├── GroupItemDataSource.ts // 相册成员数组数据
│ ├── ItemDataSource.ts
│ ├── MultimodalInputManager.ts
│ ├── ScreenManager.ts // 屏幕显示逻辑
│ ├── SelectManager.ts // 选择状态逻辑
│ └── SimpleAlbumDataItem.ts // 简化相册数据类
├── components //UI组件
│ ├── ActionBarButton.ets
│ ├── ActionBar.ets
│ ├── AddNotesDialog.ets
│ ├── AlbumGridItemNewStyle.ets
│ ├── AlbumListCard.ets
│ ├── AlbumScrollBar.ets
│ ├── AlbumSelectGridItemNewStyle.ets
│ ├── AlbumSetPage.ets
│ ├── CancelOperationDialog.ets
│ ├── CustomDialogView.ets
│ ├── DeleteDialog.ets
│ ├── DeleteProgressDialog.ets
│ ├── DetailMenuPanel.ets
│ ├── DetailsDialog.ets
│ ├── DetailTitle.ets
│ ├── EmptyAlbumComponent.ets
│ ├── FindSameNameDialog.ets
│ ├── GridScrollBar.ets
│ ├── ImageGridItemComponent.ets
│ ├── LoadingPanel.ets
│ ├── MediaOperationActionBar.ets
│ ├── MultiSelectDialog.ets
│ ├── NewAlbumDialog.ets
│ ├── NoPhotoComponent.ets
│ ├── NoPhotoIndexComponent.ets
│ ├── PhotoBrowserActionBar.ets
│ ├── PhotoBrowserBg.ets
│ ├── PhotoItem.ets
│ ├── PhotoSwiper.ets
│ ├── ProgressDialog.ets
│ ├── RenameDialog.ets
│ ├── SaveDialog.ets
│ ├── SaveImageDialog.ets
│ ├── SelectionTitle.ets
│ ├── SingleTitle.ets
│ ├── ToolBarButton.ets
│ ├── ToolBar.ets
│ └── VideoIcon.ets
├── constants //常量
│ ├── AnimationConstants.ts
│ ├── BroadcastConstants.ts
│ ├── BrowserConstants.ts
│ ├── Constants.ts
│ ├── MediaConstants.ts
│ ├── QueryConstants.ts
│ └── RouterConstants.ts
├── entryability //HAP入口
│ └── EntryAbility.ts
├── menus //菜单操作
│ ├── AlbumSetDeleteMenuOperation.ts
│ ├── AlbumSetNewMenuOperation.ts
│ ├── AlbumSetRenameMenuOperation.ts
│ ├── AsyncCallback.ts
│ ├── BatchDeleteMenuOperation.ts
│ ├── BatchRecoverMenuOperation.ts
│ ├── BatchRemoveMenuOperation.ts
│ ├── ClearRecycleMenuOperation.ts
│ ├── GotoPhotosMenuOperation.ts
│ ├── MenuContext.ts
│ ├── MenuOperationCallback.ts
│ ├── MenuOperation.ts
│ ├── MoveMenuOperation.ets
│ ├── ProcessMenuOperation.ts
│ ├── RenameMenuOperation.ts
├── models //类型定义
│ ├── ActionBarMode.ts
│ ├── Action.ts
│ ├── AlbumBarModel.ts
│ ├── AlbumSelectBarModel.ts
│ ├── JumpSourceToMain.ts
│ ├── MediaOperationType.ts
│ ├── NewAlbumBarModel.ts
│ ├── PhotoGridBarModel.ts
│ ├── ThumbnailModel.ts
│ └── ViewType.ts
├── pages //页面
│ ├── AlbumSelect.ets // 相册选择页面
│ ├── Index.ets // 主页面
│ ├── MediaOperationPage.ets // 图片文件操作页面
│ ├── NewAlbumPage.ets // 新建相册页面
│ ├── PhotoBrowser.ets // 大图展示页面
│ ├── PhotoGridPage.ets // 图片列表页面
│ ├── SelectPhotoBrowser.ets // 图片选择页面
│ └── VideoBrowser.ets // 视频查看页面
└── utils //工具类
├── AbilityUtils.ts
├── AlbumUtil.ts
├── DateUtil.ts
├── DialogUtil.ts
├── hisysEventUtil.ts
├── ImageUtil.ts
├── Log.ts
├── MathUtils.ts
├── ResourceUtils.ts
├── SingleInstanceUtils.ts
└── UiUtil.ts
```
### 具体实现
在base模块中通过封装photoAccessHelper向外提供功能接口如Album查询操作源码参考[AlbumDataImpl.ts](entry/src/main/ets/common/AlbumDataImpl.ts)
* 如效果预览中的**相册列表**:在[AlbumSetPage.ets](entry/src/main/ets/components/AlbumSetPage.ets)
中调用AlbumDataImpl.reloadAlbumItemData()
在base模块中通过封装photoAccessHelper向外提供功能接口源码参考[UserFileModel.ts](entry/src/main/ets/base/UserFileModel.ts)
* 如**新建相册**:在[AlbumSetPage.ets](entry/src/main/ets/components/AlbumSetPage.ets)
中调用userFileModel.createAlbum()
* 如**删除图片**:在[BatchDeleteMenuOperation.ets](entry/src/main/ets/menus/MoveMenuOperation.ets)
中调用userFileModel.deleteOne()
* 如**恢复图片**:在[TrashUserFileDataItem.ets](entry/src/main/ets/base/TrashUserFileDataItem.ts)
中调用userFileModel.recover()
* 如**永久删除图片**:在[TrashUserFileDataItem.ets](entry/src/main/ets/base/TrashUserFileDataItem.ts)
中调用userFileModel.permanentDelete()
* 如**删除相册**:在[AlbumDataItem.ets](entry/src/main/ets/common/AlbumDataItem.ts)
中调用userFileModel.deleteAlbum()
### 相关权限
[ohos.permission.WRITE_IMAGEVIDEO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)
[ohos.permission.READ_IMAGEVIDEO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)
### 约束与限制
1. 本示例仅支持标准系统上运行支持设备RK3568。
2. 本示例为Stage模型支持API12版本SDKSDK版本号(API Version 12 5.0.0.20),镜像版本号(5.0.0.20)
3. 本示例需要使用DevEco Studio 版本号(4.0 Release)及以上版本才可编译运行。需要配置"apl":"system_basic"才可安装成功;
### 下载
如需单独下载本工程,执行如下命令:
```
git init
git config core.sparsecheckout true
echo FileManagement/Photos/ > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master
```
# 相册
### 介绍
本示例主要展示了相册相关的功能,使用[@ohos.file.photoAccessHelper](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-media-library-kit/js-apis-photoAccessHelper-sys.md)
接口,实现了查看系统相册、创建用户相册、查看相册照片、用户相册文件添加和删除、以及预览图片、最近删除、收藏夹操作等功能;
### 效果预览
| 主页 | 图片列表 | 大图 | 图片选择 |
|---------------------------------|-----------------------------------|-----------------------------------|-------------------------------------|
| ![image](screenshots/home.jpeg) | ![image](screenshots/photos.jpeg) | ![image](screenshots/detail.jpeg) | ![image](screenshots/selector.jpeg) |
使用说明
1. 主界面:查询显示所有照片、系统相册(相机/视频/截屏录屏/动态照片/我的收藏/最近删除)、用户相册
2. 主界面点击“+”,创建用户相册
3. 创建用户相册时添加图片到用户相册
4. 长按相册,删除相册
5. 长按相册,重命名相册(不可重名)
6. 长按相册,相册多选,批量删除
7. 点击相册,查看相册中的图片列表
8. 点击图片,查看单个图片大图
9. 点击心形图标,收藏图片
10. 点击心形图标,取消收藏
11. 大图界面,重命名文件(可重名)
12. 大图界面,删除文件(移动到最近删除相册)
13. 从最近删除恢复照片
14. 点击视频,查看视频并播放
15. 点击图片页面右上角叹号,查看图片详情
16. 长按图片批量操作:多选/全选、删除、恢复
17. 相册内图片列表界面点击“+”,从已有相册添加照片
18. 长按图片列表图片,更多菜单,从图片选择添加到已有相册
19. 在相册图片列表界面,长按图片,选择图片,点击更多,可以将图片加入到其他相册(可多选)
20. 在用户相册图片列表界面,长按图片,选择图片,点击更多,可以将图片从当前相册移除(可多选)
21. 在用户相册图片列表界面,长按图片,选择图片,点击更多,可以查看图片详情(可多选)
### 工程目录
```
.
├── base // @ohos.file.photoAccessHelper接口封装
│ ├── FavorUserFileDataItem.ts // 收藏夹图片数据类
│ ├── InnerUserFileDataItem.ts // 大图数据类
│ ├── TrashUserFileDataItemCache.ts // 最近删除图片数据缓存
│ ├── TrashUserFileDataItem.ts // 最近删除图片数据类
│ ├── UserFileDataChangeCallback.ts // 图片数据变化回调
│ ├── UserFileDataHelper.ts // 图片展示信息查询接口
│ ├── UserFileDataItemCache.ts // 图片数据缓存
│ ├── UserFileDataItem.ts // 图片数据类
│ ├── UserFileModel.ts // photoAccessHelper接口封装
│ ├── UserFileObserverCallback.ts // 图片数据监听回调
│ └── UserFileObserver.ts // 图片数据监听类
├── common //业务逻辑
│ ├── ActionBarProp.ts
│ ├── AlbumDataImpl.ts // 相册数据查询接口封装
│ ├── AlbumDataItem.ts // 相册数据类
│ ├── AlbumsDataSource.ts
│ ├── BroadcastManager.ts
│ ├── Broadcast.ts
│ ├── CommonObserverCallback.ts
│ ├── EventPipeline.ts
│ ├── GlobalContext.ts
│ ├── GroupDataImpl.ts // 相册成员数组数据接口封装
│ ├── GroupItemDataSource.ts // 相册成员数组数据
│ ├── ItemDataSource.ts
│ ├── MultimodalInputManager.ts
│ ├── ScreenManager.ts // 屏幕显示逻辑
│ ├── SelectManager.ts // 选择状态逻辑
│ └── SimpleAlbumDataItem.ts // 简化相册数据类
├── components //UI组件
│ ├── ActionBarButton.ets
│ ├── ActionBar.ets
│ ├── AddNotesDialog.ets
│ ├── AlbumGridItemNewStyle.ets
│ ├── AlbumListCard.ets
│ ├── AlbumScrollBar.ets
│ ├── AlbumSelectGridItemNewStyle.ets
│ ├── AlbumSetPage.ets
│ ├── CancelOperationDialog.ets
│ ├── CustomDialogView.ets
│ ├── DeleteDialog.ets
│ ├── DeleteProgressDialog.ets
│ ├── DetailMenuPanel.ets
│ ├── DetailsDialog.ets
│ ├── DetailTitle.ets
│ ├── EmptyAlbumComponent.ets
│ ├── FindSameNameDialog.ets
│ ├── GridScrollBar.ets
│ ├── ImageGridItemComponent.ets
│ ├── LoadingPanel.ets
│ ├── MediaOperationActionBar.ets
│ ├── MultiSelectDialog.ets
│ ├── NewAlbumDialog.ets
│ ├── NoPhotoComponent.ets
│ ├── NoPhotoIndexComponent.ets
│ ├── PhotoBrowserActionBar.ets
│ ├── PhotoBrowserBg.ets
│ ├── PhotoItem.ets
│ ├── PhotoSwiper.ets
│ ├── ProgressDialog.ets
│ ├── RenameDialog.ets
│ ├── SaveDialog.ets
│ ├── SaveImageDialog.ets
│ ├── SelectionTitle.ets
│ ├── SingleTitle.ets
│ ├── ToolBarButton.ets
│ ├── ToolBar.ets
│ └── VideoIcon.ets
├── constants //常量
│ ├── AnimationConstants.ts
│ ├── BroadcastConstants.ts
│ ├── BrowserConstants.ts
│ ├── Constants.ts
│ ├── MediaConstants.ts
│ ├── QueryConstants.ts
│ └── RouterConstants.ts
├── entryability //HAP入口
│ └── EntryAbility.ts
├── menus //菜单操作
│ ├── AlbumSetDeleteMenuOperation.ts
│ ├── AlbumSetNewMenuOperation.ts
│ ├── AlbumSetRenameMenuOperation.ts
│ ├── AsyncCallback.ts
│ ├── BatchDeleteMenuOperation.ts
│ ├── BatchRecoverMenuOperation.ts
│ ├── BatchRemoveMenuOperation.ts
│ ├── ClearRecycleMenuOperation.ts
│ ├── GotoPhotosMenuOperation.ts
│ ├── MenuContext.ts
│ ├── MenuOperationCallback.ts
│ ├── MenuOperation.ts
│ ├── MoveMenuOperation.ets
│ ├── ProcessMenuOperation.ts
│ ├── RenameMenuOperation.ts
├── models //类型定义
│ ├── ActionBarMode.ts
│ ├── Action.ts
│ ├── AlbumBarModel.ts
│ ├── AlbumSelectBarModel.ts
│ ├── JumpSourceToMain.ts
│ ├── MediaOperationType.ts
│ ├── NewAlbumBarModel.ts
│ ├── PhotoGridBarModel.ts
│ ├── ThumbnailModel.ts
│ └── ViewType.ts
├── pages //页面
│ ├── AlbumSelect.ets // 相册选择页面
│ ├── Index.ets // 主页面
│ ├── MediaOperationPage.ets // 图片文件操作页面
│ ├── NewAlbumPage.ets // 新建相册页面
│ ├── PhotoBrowser.ets // 大图展示页面
│ ├── PhotoGridPage.ets // 图片列表页面
│ ├── SelectPhotoBrowser.ets // 图片选择页面
│ └── VideoBrowser.ets // 视频查看页面
└── utils //工具类
├── AbilityUtils.ts
├── AlbumUtil.ts
├── DateUtil.ts
├── DialogUtil.ts
├── hisysEventUtil.ts
├── ImageUtil.ts
├── Log.ts
├── MathUtils.ts
├── ResourceUtils.ts
├── SingleInstanceUtils.ts
└── UiUtil.ts
```
### 具体实现
在base模块中通过封装photoAccessHelper向外提供功能接口如Album查询操作源码参考[AlbumDataImpl.ts](entry/src/main/ets/common/AlbumDataImpl.ts)
* 如效果预览中的**相册列表**:在[AlbumSetPage.ets](entry/src/main/ets/components/AlbumSetPage.ets)
中调用AlbumDataImpl.reloadAlbumItemData()
在base模块中通过封装photoAccessHelper向外提供功能接口源码参考[UserFileModel.ts](entry/src/main/ets/base/UserFileModel.ts)
* 如**新建相册**:在[AlbumSetPage.ets](entry/src/main/ets/components/AlbumSetPage.ets)
中调用userFileModel.createAlbum()
* 如**删除图片**:在[BatchDeleteMenuOperation.ets](entry/src/main/ets/menus/MoveMenuOperation.ets)
中调用userFileModel.deleteOne()
* 如**恢复图片**:在[TrashUserFileDataItem.ets](entry/src/main/ets/base/TrashUserFileDataItem.ts)
中调用userFileModel.recover()
* 如**永久删除图片**:在[TrashUserFileDataItem.ets](entry/src/main/ets/base/TrashUserFileDataItem.ts)
中调用userFileModel.permanentDelete()
* 如**删除相册**:在[AlbumDataItem.ets](entry/src/main/ets/common/AlbumDataItem.ts)
中调用userFileModel.deleteAlbum()
### 相关权限
[ohos.permission.WRITE_IMAGEVIDEO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionwrite_imagevideo)
[ohos.permission.READ_IMAGEVIDEO](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionread_imagevideo)
### 约束与限制
1. 本示例仅支持标准系统上运行支持设备RK3568。
2. 本示例为Stage模型支持API12版本SDKSDK版本号(API Version 12 5.0.0.20),镜像版本号(5.0.0.20)
3. 本示例需要使用DevEco Studio 版本号(4.0 Release)及以上版本才可编译运行。需要配置"apl":"system_basic"才可安装成功;
### 下载
如需单独下载本工程,执行如下命令:
```
git init
git config core.sparsecheckout true
echo code/SystemFeature/FileManagement/Photos/ > .git/info/sparse-checkout
git remote add origin https://gitee.com/openharmony/applications_app_samples.git
git pull origin master
```

View File

@ -1,42 +1,42 @@
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"compileSdkVersion": 12,
"compatibleSdkVersion": 12,
"runtimeOS": "OpenHarmony"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
/*
* Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
*/
{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"compileSdkVersion": 12,
"compatibleSdkVersion": 12,
"runtimeOS": "OpenHarmony"
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}

View File

@ -1,29 +1,29 @@
/*
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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.
*/
{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default",
"runtimeOS": "OpenHarmony"
},
{
"name": "ohosTest",
}
]
/*
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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.
*/
{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default",
"runtimeOS": "OpenHarmony"
},
{
"name": "ohosTest",
}
]
}

View File

@ -1,10 +1,10 @@
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}

View File

@ -1,93 +1,93 @@
/*
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window';
import deviceInfo from '@ohos.deviceInfo';
import Ability from '@ohos.app.ability.UIAbility';
import wantConstant from '@ohos.ability.wantConstant';
import { Log } from '../utils/Log';
import { screenManager } from '../common/ScreenManager';
import { Constants } from '../constants/Constants';
import { broadcastManager } from '../common/BroadcastManager';
import { BroadcastConstants } from '../constants/BroadcastConstants';
import { userFileModel } from '../base/UserFileModel';
import router from '@system.router';
import { RouterOptions } from '@system.router';
import { GroupItemDataSource } from '../common/GroupItemDataSource';
import atManager from '@ohos.abilityAccessCtrl';
import bundleManager from '@ohos.bundle.bundleManager';
import { MediaConstants } from '../constants/MediaConstants';
import { getResourceString } from '../utils/ResourceUtils';
import { GlobalContext } from '../common/GlobalContext';
import Want from '@ohos.app.ability.Want';
let mCallerUid: number = 0;
let mMaxSelectCount: number = 0;
let mFilterMediaType: number = MediaConstants.SELECT_TYPE_ALL;
let appBroadcast = broadcastManager.getBroadcast();
let pagePath: string = 'pages/Index';
export default class EntryAbility extends UIAbility {
private TAG: string = 'EntryAbility';
private static readonly RETRY_MAX_TIMES = 100;
private static readonly ACTION_URI_SINGLE_SELECT = 'singleselect';
private static readonly ACTION_URI_MULTIPLE_SELECT = 'multipleselect';
private static readonly ACTION_URI_PHOTO_DETAIL = 'photodetail';
private browserDataSource: GroupItemDataSource = new GroupItemDataSource();
onCreate(want: Want, launchParam): void {
Log.info(this.TAG, 'Application onCreate');
// Ability is creating, initialize resources for this ability
GlobalContext.getContext().setObject('appContext', this.context);
userFileModel.onCreate(this.context);
mFilterMediaType = MediaConstants.SELECT_TYPE_ALL;
AppStorage.SetOrCreate<number>(Constants.ENTRY_FROM_HAP, Constants.ENTRY_FROM_NONE);
Log.info(this.TAG, 'Application onCreate end');
}
onNewWant(want: Want): void {
AppStorage.SetOrCreate<number>(Constants.ENTRY_FROM_HAP, Constants.ENTRY_FROM_NONE);
}
onDestroy(): void {
// Ability is creating, release resources for this ability
Log.info(this.TAG, 'Application onDestroy');
AppStorage.Delete(Constants.ENTRY_FROM_HAP);
}
onWindowStageCreate(windowStage): void {
// Main window is created, set main page for this ability
Log.info(this.TAG, 'Application onWindowStageCreate');
GlobalContext.getContext().setObject('photosWindowStage', windowStage);
windowStage.getMainWindow().then((win: window.Window): void => {
AppStorage.SetOrCreate<window.Window>(Constants.MAIN_WINDOW, win);
screenManager.initializationSize(win).then<void, void>((): void => {
windowStage.setUIContent(this.context, pagePath, null);
}).catch<void>((): void => {
Log.error(this.TAG, 'get device screen info failed.');
});
});
}
onWindowStageDestroy(): void {
}
onForeground(): void {
}
onBackground(): void {
}
}
/*
* Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 UIAbility from '@ohos.app.ability.UIAbility';
import window from '@ohos.window';
import deviceInfo from '@ohos.deviceInfo';
import Ability from '@ohos.app.ability.UIAbility';
import wantConstant from '@ohos.ability.wantConstant';
import { Log } from '../utils/Log';
import { screenManager } from '../common/ScreenManager';
import { Constants } from '../constants/Constants';
import { broadcastManager } from '../common/BroadcastManager';
import { BroadcastConstants } from '../constants/BroadcastConstants';
import { userFileModel } from '../base/UserFileModel';
import router from '@system.router';
import { RouterOptions } from '@system.router';
import { GroupItemDataSource } from '../common/GroupItemDataSource';
import atManager from '@ohos.abilityAccessCtrl';
import bundleManager from '@ohos.bundle.bundleManager';
import { MediaConstants } from '../constants/MediaConstants';
import { getResourceString } from '../utils/ResourceUtils';
import { GlobalContext } from '../common/GlobalContext';
import Want from '@ohos.app.ability.Want';
let mCallerUid: number = 0;
let mMaxSelectCount: number = 0;
let mFilterMediaType: number = MediaConstants.SELECT_TYPE_ALL;
let appBroadcast = broadcastManager.getBroadcast();
let pagePath: string = 'pages/Index';
export default class EntryAbility extends UIAbility {
private TAG: string = 'EntryAbility';
private static readonly RETRY_MAX_TIMES = 100;
private static readonly ACTION_URI_SINGLE_SELECT = 'singleselect';
private static readonly ACTION_URI_MULTIPLE_SELECT = 'multipleselect';
private static readonly ACTION_URI_PHOTO_DETAIL = 'photodetail';
private browserDataSource: GroupItemDataSource = new GroupItemDataSource();
onCreate(want: Want, launchParam): void {
Log.info(this.TAG, 'Application onCreate');
// Ability is creating, initialize resources for this ability
GlobalContext.getContext().setObject('appContext', this.context);
userFileModel.onCreate(this.context);
mFilterMediaType = MediaConstants.SELECT_TYPE_ALL;
AppStorage.SetOrCreate<number>(Constants.ENTRY_FROM_HAP, Constants.ENTRY_FROM_NONE);
Log.info(this.TAG, 'Application onCreate end');
}
onNewWant(want: Want): void {
AppStorage.SetOrCreate<number>(Constants.ENTRY_FROM_HAP, Constants.ENTRY_FROM_NONE);
}
onDestroy(): void {
// Ability is creating, release resources for this ability
Log.info(this.TAG, 'Application onDestroy');
AppStorage.Delete(Constants.ENTRY_FROM_HAP);
}
onWindowStageCreate(windowStage): void {
// Main window is created, set main page for this ability
Log.info(this.TAG, 'Application onWindowStageCreate');
GlobalContext.getContext().setObject('photosWindowStage', windowStage);
windowStage.getMainWindow().then((win: window.Window): void => {
AppStorage.SetOrCreate<window.Window>(Constants.MAIN_WINDOW, win);
screenManager.initializationSize(win).then<void, void>((): void => {
windowStage.setUIContent(this.context, pagePath, null);
}).catch<void>((): void => {
Log.error(this.TAG, 'get device screen info failed.');
});
});
}
onWindowStageDestroy(): void {
}
onForeground(): void {
}
onBackground(): void {
}
}

Some files were not shown because too many files have changed in this diff Show More