• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device 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 */
15import { Log } from '@ohos/common';
16
17const TAG: string = 'EmptyAlbumComponent';
18
19// New style
20@Component
21export struct EmptyAlbumComponent {
22  @Consume gridWidth: number;
23
24  aboutToAppear(): void {
25    Log.debug(TAG, 'aboutToAppear');
26  }
27
28  build() {
29    Column() {
30      Flex({
31        direction: FlexDirection.Column,
32        justifyContent: FlexAlign.Center,
33        alignItems: ItemAlign.Center
34      }) {
35        Image($r('app.media.ic_goto_photos'))
36          .width($r('app.float.recycle_album_cover_icon_size'))
37          .height($r('app.float.recycle_album_cover_icon_size'))
38          .fillColor($r('app.color.empty_or_recycle_album_icon'))
39      }
40      .width('100%')
41      .aspectRatio(1)
42      .backgroundColor($r('sys.color.ohos_id_color_button_normal'))
43      .border({ radius: $r('sys.float.ohos_id_corner_radius_default_m') })
44    }
45    .width('100%')
46    .height(this.gridWidth);
47  }
48}
49
50// Traditional style
51@Component
52export struct EmptyAlbumComponentForTraditionalStyle {
53  build() {
54    Flex({
55      direction: FlexDirection.Column,
56      justifyContent: FlexAlign.Center,
57      alignItems: ItemAlign.Center
58    }) {
59      Image($r('app.media.ic_goto_photos'))
60        .width($r('app.float.album_set_icon_size'))
61        .aspectRatio(1)
62        .fillColor($r('sys.color.ohos_id_color_secondary'))
63    }
64    .aspectRatio(1)
65    .backgroundColor($r('app.color.album_set_empty_album_bright')) // bright and dark mode
66    .border({ radius: $r('sys.float.ohos_id_corner_radius_default_s') })
67  }
68}