• 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 ABSTRACT_ALBUM_TYPE_MOVING_PHOTO = -2;
48  static readonly ALBUM_TYPE_USER = photoAccessHelper.AlbumType.USER;
49  static readonly ALBUM_TYPE_SYSTEM = photoAccessHelper.AlbumType.SYSTEM;
50  // album subtype
51  static readonly ALBUM_SUBTYPE_ALL = photoAccessHelper.AlbumSubtype.ANY
52  static readonly ALBUM_SUBTYPE_CAMERA = photoAccessHelper.AlbumSubtype.CAMERA;
53  static readonly ALBUM_SUBTYPE_VIDEO = photoAccessHelper.AlbumSubtype.VIDEO;
54  static readonly ALBUM_SUBTYPE_RECYCLE = photoAccessHelper.AlbumSubtype.TRASH;
55  static readonly ALBUM_SUBTYPE_FAVOR = photoAccessHelper.AlbumSubtype.FAVORITE;
56  static readonly ALBUM_SUBTYPE_SNAPSHOT = photoAccessHelper.AlbumSubtype.SCREENSHOT;
57  static readonly ALBUM_SUBTYPE_HIDDEN = photoAccessHelper.AlbumSubtype.HIDDEN;
58  static readonly ALBUM_SUBTYPE_USER_GENERIC = photoAccessHelper.AlbumSubtype.USER_GENERIC;
59  static readonly ALBUM_SUBTYPE_REMOTE = -1;
60  // album id
61  static readonly ALBUM_ID_USER = 'default_user';
62  static readonly ALBUM_ID_ALL = 'default_all';
63  static readonly ALBUM_ID_HIDDEN = 'default_hidden';
64  static readonly ALBUM_ID_CAMERA = 'default_camera';
65  static readonly ALBUM_ID_VIDEO = 'default_video';
66  static readonly ALBUM_ID_RECYCLE = 'default_recycle';
67  static readonly ALBUM_ID_FAVOR = 'default_favor';
68  static readonly ALBUM_ID_SNAPSHOT = 'default_snapshot';
69  static readonly ALBUM_ID_REMOTE = 'default_remote';
70  static readonly ALBUM_ID_MOVING_PHOTO = 'default_moving_photo';
71  static readonly ALBUM_DISABLE_COPY_LIST: Set<string> = new Set<string>([
72  MediaConstants.ALBUM_ID_ALL,
73  MediaConstants.ALBUM_ID_VIDEO,
74  MediaConstants.ALBUM_ID_RECYCLE,
75  MediaConstants.ALBUM_ID_FAVOR,
76  MediaConstants.ALBUM_ID_CAMERA,
77  MediaConstants.ALBUM_ID_SNAPSHOT,
78  MediaConstants.ALBUM_ID_MOVING_PHOTO
79  ] as string[]);
80  static readonly ALBUM_DISABLE_DELETE_LIST: Set<string> = new Set<string>([
81  MediaConstants.ALBUM_ID_ALL,
82  MediaConstants.ALBUM_ID_CAMERA,
83  MediaConstants.ALBUM_ID_VIDEO,
84  MediaConstants.ALBUM_ID_RECYCLE,
85  MediaConstants.ALBUM_ID_FAVOR,
86  MediaConstants.ALBUM_ID_SNAPSHOT,
87  MediaConstants.ALBUM_ID_MOVING_PHOTO
88  ] as string[]);
89  static readonly ALBUM_DISABLE_NEW_LIST: Set<string> = new Set<string>([
90  MediaConstants.ALBUM_ID_ALL,
91  MediaConstants.ALBUM_ID_CAMERA,
92  MediaConstants.ALBUM_ID_VIDEO,
93  MediaConstants.ALBUM_ID_RECYCLE,
94  MediaConstants.ALBUM_ID_FAVOR,
95  MediaConstants.ALBUM_ID_SNAPSHOT,
96  MediaConstants.ALBUM_ID_MOVING_PHOTO
97  ] as string[]);
98  static readonly ALBUM_DISABLE_RENAME_LIST: Set<string> = new Set<string>([
99  MediaConstants.ALBUM_ID_ALL,
100  MediaConstants.ALBUM_ID_CAMERA,
101  MediaConstants.ALBUM_ID_VIDEO,
102  MediaConstants.ALBUM_ID_RECYCLE,
103  MediaConstants.ALBUM_ID_FAVOR,
104  MediaConstants.ALBUM_ID_SNAPSHOT,
105  MediaConstants.ALBUM_ID_MOVING_PHOTO
106  ] as string[]);
107  static readonly ALBUM_DEFAULT_SORT_LIST: string[] = [
108  MediaConstants.ALBUM_ID_ALL,
109  MediaConstants.ALBUM_ID_CAMERA,
110  MediaConstants.ALBUM_ID_VIDEO,
111  MediaConstants.ALBUM_ID_SNAPSHOT,
112  MediaConstants.ALBUM_ID_MOVING_PHOTO,
113  MediaConstants.ALBUM_ID_FAVOR
114  ];
115  static readonly CAMERA_ALBUM_PATH = 'Camera'
116  static readonly REMOTE_ALBUM_PATH = 'FromOtherDevices'
117  static readonly SNAPSHOT_ALBUM_PATH = 'Screenshots'
118  static readonly PHOTO_SUBTYPE = photoAccessHelper.PhotoKeys.PHOTO_SUBTYPE.toString();
119  static readonly MOVING_PHOTO = photoAccessHelper.PhotoSubtype.MOVING_PHOTO;
120
121  // 需要过滤的媒体文件类型
122  static readonly FILTER_MEDIA_TYPE_ALL: string = 'FILTER_MEDIA_TYPE_ALL';
123  static readonly FILTER_MEDIA_TYPE_IMAGE: string = 'FILTER_MEDIA_TYPE_IMAGE';
124  static readonly FILTER_MEDIA_TYPE_VIDEO: string = 'FILTER_MEDIA_TYPE_VIDEO';
125  //TODO delete
126  static readonly DIR_CAMERA = 0
127  static readonly DIR_VIDEO = 1
128  static readonly DIR_IMAGE = 2
129  static readonly DIR_AUDIO = 3
130  static readonly DIR_DOCUMENTS = 4
131  static readonly DIR_DOWNLOAD = 5
132  static readonly EMPTY_FETCH_COLUMNS = []
133  static readonly FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI,
134  photoAccessHelper.PhotoKeys.PHOTO_TYPE,
135  photoAccessHelper.PhotoKeys.DISPLAY_NAME,
136  photoAccessHelper.PhotoKeys.SIZE,
137  photoAccessHelper.PhotoKeys.DATE_ADDED,
138  photoAccessHelper.PhotoKeys.DATE_MODIFIED,
139  photoAccessHelper.PhotoKeys.DURATION,
140  photoAccessHelper.PhotoKeys.WIDTH,
141  photoAccessHelper.PhotoKeys.HEIGHT,
142  photoAccessHelper.PhotoKeys.DATE_TAKEN,
143  photoAccessHelper.PhotoKeys.ORIENTATION,
144  photoAccessHelper.PhotoKeys.FAVORITE,
145  photoAccessHelper.PhotoKeys.TITLE,
146  photoAccessHelper.PhotoKeys.POSITION,
147  photoAccessHelper.PhotoKeys.DATE_TRASHED,
148  photoAccessHelper.PhotoKeys.HIDDEN]
149  static readonly ALBUM_ASSET_FETCH_COLUMNS = [photoAccessHelper.AlbumKeys.URI, photoAccessHelper.AlbumKeys.ALBUM_NAME]
150}