• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 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 */
15
16import {
17  Action,
18  ActionBarMode,
19  ActionBarProp,
20  ActionBarSelectionMode,
21  Constants,
22  Log,
23  ScreenManager
24} from '@ohos/common';
25import { ActionBar } from '@ohos/common/CommonComponents';
26
27const TAG: string = 'browser_NewAlbumPageActionBar';
28
29@Component
30export struct NewAlbumPageActionBar {
31  onMenuClicked: Function = (): void => {};
32  @StorageLink('isHorizontal') @Watch('createActionBar') isHorizontal: boolean = ScreenManager.getInstance()
33    .isHorizontal();
34  @State actionBarProp: ActionBarProp = new ActionBarProp();
35  @Provide moreMenuList: Action[] = new Array<Action>();
36  @Provide hidePopup: boolean = false;
37
38  aboutToAppear(): void {
39    this.createActionBar();
40  }
41
42  build() {
43    Column() {
44      ActionBar({
45        actionBarProp: $actionBarProp,
46        onMenuClicked: this.onMenuClicked,
47        isNeedPlaceholder: false
48      })
49    }
50    .padding({
51      top: this.isHorizontal ? Constants.NUMBER_0 : $r('app.float.album_set_page_action_bar_padding_top')
52    })
53  }
54
55  private createActionBar(): void {
56    let actionBarProp: ActionBarProp = new ActionBarProp();
57    actionBarProp
58      .setLeftAction(Action.CANCEL)
59      .setMode(ActionBarMode.STANDARD_MODE)
60      .setSelectionMode(ActionBarSelectionMode.SINGLE)
61      .setTitle($r('app.string.title_select_photos'));
62
63    this.actionBarProp = actionBarProp;
64  }
65}