• 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, Log } from '@ohos/common';
18import { BrowserController } from '@ohos/common/CommonComponents';
19import { PhotoBrowserComponent } from '../view/PhotoBrowserComponent';
20
21const TAG: string = 'PhotoBrowser';
22
23// page of large photo
24@Entry
25@Component
26export struct PhotoBrowser {
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    Log.debug(TAG, `[aboutToAppear] param: ${JSON.stringify(this.browserController.browserParam)}`);
34  }
35
36  aboutToDisappear() {
37    Log.debug(TAG, '[aboutToDisappear]');
38  }
39
40  onPageShow() {
41    Log.debug(TAG, '[onPageShow]');
42    this.pageStatus = true;
43  }
44
45  onPageHide() {
46    Log.debug(TAG, '[onPageHide]');
47    this.pageStatus = false;
48  }
49
50  build() {
51    Column() {
52      PhotoBrowserComponent({
53        pageStatus: this.pageStatus,
54        geometryTransitionEnable: false,
55        isRunningAnimation: $isRunningAnimation,
56        browserController: this.browserController
57      })
58    }
59  }
60
61  pageTransition() {
62    PageTransitionEnter({ type: RouteType.Pop, duration: BrowserConstants.PHOTO_GRID_ANIMATION_DURATION })
63      .opacity(1)
64    PageTransitionExit({ type: RouteType.Push, duration: BrowserConstants.PHOTO_GRID_ANIMATION_DURATION })
65      .opacity(1)
66  }
67}