• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import photoAccessHelper from '@ohos.file.photoAccessHelper';
17
18export class MediaConstants {
19  // Media item status
20  static readonly UNDEFINED = 0;
21  static readonly PART_LOADED = 1
22  static readonly LOADED = 2;
23  static readonly TRASHED = 3;
24  // Media type
25  static readonly MEDIA_TYPE_IMAGE: string = 'image';
26  static readonly MEDIA_TYPE_VIDEO: string = 'video';
27  static readonly MEDIA_TYPE_ALBUM: string = 'album';
28  static readonly MEDIA_TYPE_DEVICE: string = 'device';
29  static readonly MEDIA_TYPE_REMOTE: string = 'remote';
30
31  static readonly DEVICE_STATE_ONLINE: string = 'online';
32  static readonly DEVICE_STATE_OFFLINE: string = 'offline';
33  static readonly DEVICE_STATE_CHANGE: string = 'change';
34  static readonly ROTATE_NONE = 0;
35  static readonly ROTATE_ONCE = 90;
36  static readonly ROTATE_TWICE = 180;
37  static readonly ROTATE_THIRD = 270;
38  static readonly ROTATE_AROUND = 360;
39  static readonly DEFAULT_SIZE = 256;
40  static readonly DEFAULT_THUMBNAIL_SIZE = 1920;
41  // select type
42  static readonly SELECT_TYPE_ALL = 0;
43  static readonly SELECT_TYPE_VIDEO = 1;
44  static readonly SELECT_TYPE_IMAGE = 2;
45  //album type
46  static readonly ALBUM_TYPE_ALL = -1;
47  static readonly ALBUM_TYPE_USER = photoAccessHelper.AlbumType.USER;
48  static readonly ALBUM_TYPE_SYSTEM = photoAccessHelper.AlbumType.SYSTEM;
49  // album subtype
50  static readonly ALBUM_SUBTYPE_ALL = photoAccessHelper.AlbumSubtype.ANY
51  static readonly ALBUM_SUBTYPE_CAMERA = photoAccessHelper.AlbumSubtype.CAMERA;
52  static readonly ALBUM_SUBTYPE_VIDEO = photoAccessHelper.AlbumSubtype.VIDEO;
53  static readonly ALBUM_SUBTYPE_RECYCLE = photoAccessHelper.AlbumSubtype.TRASH;
54  static readonly ALBUM_SUBTYPE_FAVOR = photoAccessHelper.AlbumSubtype.FAVORITE;
55  static readonly ALBUM_SUBTYPE_SNAPSHOT = photoAccessHelper.AlbumSubtype.SCREENSHOT;
56  static readonly ALBUM_SUBTYPE_HIDDEN = photoAccessHelper.AlbumSubtype.HIDDEN;
57  static readonly ALBUM_SUBTYPE_USER_GENERIC = photoAccessHelper.AlbumSubtype.USER_GENERIC;
58  static readonly ALBUM_SUBTYPE_REMOTE = -1;
59  // album id
60  static readonly ALBUM_ID_USER = 'default_user';
61  static readonly ALBUM_ID_ALL = 'default_all';
62  static readonly ALBUM_ID_HIDDEN = 'default_hidden';
63  static readonly ALBUM_ID_CAMERA = 'default_camera';
64  static readonly ALBUM_ID_VIDEO = 'default_video';
65  static readonly ALBUM_ID_RECYCLE = 'default_recycle';
66  static readonly ALBUM_ID_FAVOR = 'default_favor';
67  static readonly ALBUM_ID_SNAPSHOT = 'default_snapshot';
68  static readonly ALBUM_ID_REMOTE = 'default_remote';
69  static readonly ALBUM_DISABLE_COPY_LIST: Set<string> = new Set<string>([
70  MediaConstants.ALBUM_ID_ALL,
71  MediaConstants.ALBUM_ID_VIDEO,
72  MediaConstants.ALBUM_ID_RECYCLE,
73  MediaConstants.ALBUM_ID_FAVOR,
74  MediaConstants.ALBUM_ID_CAMERA,
75  MediaConstants.ALBUM_ID_SNAPSHOT
76  ] as string[]);
77  static readonly ALBUM_DISABLE_DELETE_LIST: Set<string> = new Set<string>([
78  MediaConstants.ALBUM_ID_ALL,
79  MediaConstants.ALBUM_ID_CAMERA,
80  MediaConstants.ALBUM_ID_VIDEO,
81  MediaConstants.ALBUM_ID_RECYCLE,
82  MediaConstants.ALBUM_ID_FAVOR,
83  MediaConstants.ALBUM_ID_SNAPSHOT
84  ] as string[]);
85  static readonly ALBUM_DISABLE_NEW_LIST: Set<string> = new Set<string>([
86  MediaConstants.ALBUM_ID_ALL,
87  MediaConstants.ALBUM_ID_CAMERA,
88  MediaConstants.ALBUM_ID_VIDEO,
89  MediaConstants.ALBUM_ID_RECYCLE,
90  MediaConstants.ALBUM_ID_FAVOR,
91  MediaConstants.ALBUM_ID_SNAPSHOT
92  ] as string[]);
93  static readonly ALBUM_DISABLE_RENAME_LIST: Set<string> = new Set<string>([
94  MediaConstants.ALBUM_ID_ALL,
95  MediaConstants.ALBUM_ID_CAMERA,
96  MediaConstants.ALBUM_ID_VIDEO,
97  MediaConstants.ALBUM_ID_RECYCLE,
98  MediaConstants.ALBUM_ID_FAVOR,
99  MediaConstants.ALBUM_ID_SNAPSHOT
100  ] as string[]);
101  static readonly ALBUM_DEFAULT_SORT_LIST: string[] = [
102  MediaConstants.ALBUM_ID_ALL,
103  MediaConstants.ALBUM_ID_CAMERA,
104  MediaConstants.ALBUM_ID_VIDEO,
105  MediaConstants.ALBUM_ID_SNAPSHOT,
106  MediaConstants.ALBUM_ID_FAVOR
107  ];
108  static readonly CAMERA_ALBUM_PATH = 'Camera'
109  static readonly REMOTE_ALBUM_PATH = 'FromOtherDevices'
110  static readonly SNAPSHOT_ALBUM_PATH = 'Screenshots'
111
112  // 需要过滤的媒体文件类型
113  static readonly FILTER_MEDIA_TYPE_ALL: string = 'FILTER_MEDIA_TYPE_ALL';
114  static readonly FILTER_MEDIA_TYPE_IMAGE: string = 'FILTER_MEDIA_TYPE_IMAGE';
115  static readonly FILTER_MEDIA_TYPE_VIDEO: string = 'FILTER_MEDIA_TYPE_VIDEO';
116  //TODO delete
117  static readonly DIR_CAMERA = 0
118  static readonly DIR_VIDEO = 1
119  static readonly DIR_IMAGE = 2
120  static readonly DIR_AUDIO = 3
121  static readonly DIR_DOCUMENTS = 4
122  static readonly DIR_DOWNLOAD = 5
123  static readonly EMPTY_FETCH_COLUMNS = []
124  static readonly FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
125  photoAccessHelper.PhotoKeys.PHOTO_TYPE,
126  photoAccessHelper.PhotoKeys.DISPLAY_NAME,
127  photoAccessHelper.PhotoKeys.SIZE,
128  photoAccessHelper.PhotoKeys.DATE_ADDED,
129  photoAccessHelper.PhotoKeys.DATE_MODIFIED,
130  photoAccessHelper.PhotoKeys.DURATION,
131  photoAccessHelper.PhotoKeys.WIDTH,
132  photoAccessHelper.PhotoKeys.HEIGHT,
133  photoAccessHelper.PhotoKeys.DATE_TAKEN,
134  photoAccessHelper.PhotoKeys.ORIENTATION,
135  photoAccessHelper.PhotoKeys.FAVORITE,
136  photoAccessHelper.PhotoKeys.TITLE,
137  photoAccessHelper.PhotoKeys.POSITION,
138  photoAccessHelper.PhotoKeys.DATE_TRASHED,
139  photoAccessHelper.PhotoKeys.HIDDEN]
140  static readonly ALBUM_ASSET_FETCH_COLUMNS = [photoAccessHelper.AlbumKeys.URI, photoAccessHelper.AlbumKeys.ALBUM_NAME]
141}