1/**
2 * Copyright (c) 2021-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 */
15
16import { Log } from '../utils/Log';
17
18const TAG = 'OverlayAppIcon';
19
20@Component
21export default struct OverlayAppIcon {
22  iconSize: number = 0;
23  icon: ResourceStr = '';
24
25  // 0.9(pressed size) / 1.05(hover size) = 0.8571
26  @State overlaySize: number = 0.8571;
27
28  aboutToAppear(): void {
29  }
30
31  build() {
32    Column() {
33      Image(this.icon)
34        .width(this.iconSize)
35        .height(this.iconSize)
36        .onComplete(() => {
37          Log.showInfo(TAG, 'OverlayAppIcon complete');
38          this.overlaySize = 1;
39          AppStorage.setOrCreate('isOverlayComplete', true);
40        })
41    }
42    .width(this.iconSize)
43    .height(this.iconSize)
44    .scale({ x: this.overlaySize, y: this.overlaySize })
45    .animation({ duration: 150 })
46  }
47}