• 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 router from '@ohos.router';
17import { BrowserConstants } from '@ohos/common';
18import { BrowserController } from '@ohos/common/CommonComponents';
19import { SelectPhotoBrowserView } from '../view/SelectPhotoBrowserView';
20
21const TAG: string = 'SelectPhotoBrowser';
22
23// select mode
24@Entry
25@Component
26struct SelectPhotoBrowser {
27  @State pageStatus: boolean = false;
28  @State isRunningAnimation: boolean = false;
29  @State browserController: BrowserController = new BrowserController(false);
30
31  aboutToAppear() {
32    this.browserController.browserParam = router.getParams();
33  }
34
35  onPageShow() {
36    this.pageStatus = true;
37  }
38
39  onPageHide() {
40    this.pageStatus = false;
41  }
42
43  build() {
44    Column() {
45      SelectPhotoBrowserView({
46        pageStatus: this.pageStatus,
47        geometryTransitionEnable: false,
48        isRunningAnimation: $isRunningAnimation,
49        browserController: this.browserController
50      })
51    }
52  }
53
54  pageTransition() {
55    PageTransitionEnter({ type: RouteType.Pop, duration: BrowserConstants.PHOTO_GRID_ANIMATION_DURATION })
56      .opacity(1)
57    PageTransitionExit({ type: RouteType.Push, duration: BrowserConstants.PHOTO_GRID_ANIMATION_DURATION })
58      .opacity(1)
59  }
60}
61