16e80583aSopenharmony_ci/**
26e80583aSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
36e80583aSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
46e80583aSopenharmony_ci * you may not use this file except in compliance with the License.
56e80583aSopenharmony_ci * You may obtain a copy of the License at
66e80583aSopenharmony_ci *
76e80583aSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
86e80583aSopenharmony_ci *
96e80583aSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
106e80583aSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
116e80583aSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
126e80583aSopenharmony_ci * See the License for the specific language governing permissions and
136e80583aSopenharmony_ci * limitations under the License.
146e80583aSopenharmony_ci */
156e80583aSopenharmony_ci
166e80583aSopenharmony_ciimport { Log } from '../utils/Log';
176e80583aSopenharmony_ci
186e80583aSopenharmony_ciconst TAG = 'OverlayAppIcon';
196e80583aSopenharmony_ci
206e80583aSopenharmony_ci@Component
216e80583aSopenharmony_ciexport default struct OverlayAppIcon {
226e80583aSopenharmony_ci  iconSize: number = 0;
236e80583aSopenharmony_ci  icon: ResourceStr = '';
246e80583aSopenharmony_ci
256e80583aSopenharmony_ci  // 0.9(pressed size) / 1.05(hover size) = 0.8571
266e80583aSopenharmony_ci  @State overlaySize: number = 0.8571;
276e80583aSopenharmony_ci
286e80583aSopenharmony_ci  aboutToAppear(): void {
296e80583aSopenharmony_ci  }
306e80583aSopenharmony_ci
316e80583aSopenharmony_ci  build() {
326e80583aSopenharmony_ci    Column() {
336e80583aSopenharmony_ci      Image(this.icon)
346e80583aSopenharmony_ci        .width(this.iconSize)
356e80583aSopenharmony_ci        .height(this.iconSize)
366e80583aSopenharmony_ci        .onComplete(() => {
376e80583aSopenharmony_ci          Log.showInfo(TAG, 'OverlayAppIcon complete');
386e80583aSopenharmony_ci          this.overlaySize = 1;
396e80583aSopenharmony_ci          AppStorage.setOrCreate('isOverlayComplete', true);
406e80583aSopenharmony_ci        })
416e80583aSopenharmony_ci    }
426e80583aSopenharmony_ci    .width(this.iconSize)
436e80583aSopenharmony_ci    .height(this.iconSize)
446e80583aSopenharmony_ci    .scale({ x: this.overlaySize, y: this.overlaySize })
456e80583aSopenharmony_ci    .animation({ duration: 150 })
466e80583aSopenharmony_ci  }
476e80583aSopenharmony_ci}