1/* 2 * Copyright (c) 2024 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 */ 15import image from '@ohos.multimedia.image'; 16import { CommonConstants } from '../common/constant/CommonConstants'; 17import { ImageUtils } from '../utils/ImageUtil'; 18import { AdjustImageView } from './AdjustImageView'; 19import { AdjustThreadView } from './AdjustThreadView'; 20import { ImageView } from './ImageView'; 21 22@Component 23export struct ThreadDataTransferHomePage { 24 @Provide pixelMap: image.PixelMap | undefined = undefined; 25 @Provide isPixelMapChanged: boolean = false; 26 @Provide isParamsByTransfer: boolean = false; 27 @Provide currentAdjustData: number = CommonConstants.ADJUST_SLIDER_VALUE; 28 @Provide currentTaskNum: number = CommonConstants.ADJUST_TASK_VALUE; 29 @State message: string = ''; 30 @StorageLink('timeCost') @Watch('timeCostChanged') timeCost: String = ''; 31 32 aboutToAppear() { 33 this.pixelInit(); 34 } 35 36 timeCostChanged(): void { 37 let timeCost: string | undefined = AppStorage.get<string>('timeCost'); 38 if (timeCost !== undefined) { 39 this.message = timeCost; 40 } 41 } 42 43 build() { 44 Column() { 45 Column() { 46 AdjustThreadView() 47 } 48 .width($r('app.string.layout_100_percent')) 49 .height($r('app.string.layout_20_percent')) 50 Column() { 51 Row(){ 52 Text($r('app.string.running_time')) 53 .fontColor(Color.White) 54 .fontSize($r('app.float.result_font_size')) 55 Text(this.message) 56 .fontColor(Color.White) 57 .fontSize($r('app.float.result_font_size')) 58 } 59 } 60 .width($r('app.string.layout_100_percent')) 61 .height($r('app.string.layout_10_percent')) 62 Column() { 63 ImageView() 64 } 65 .width($r('app.string.layout_100_percent')) 66 .height($r("app.string.layout_60_percent")) 67 Column() { 68 AdjustImageView() 69 } 70 .align(Alignment.End) 71 .width($r('app.string.layout_100_percent')) 72 .height($r('app.string.layout_10_percent')) 73 } 74 .width($r('app.string.layout_100_percent')) 75 .height($r('app.string.layout_100_percent')) 76 .backgroundColor(Color.Black) 77 78 } 79 80 pixelInit() : void{ 81 ImageUtils.createPixelMapFromResource($r('app.media.nightView'), getContext()).then(pixelMap => { 82 this.pixelMap = pixelMap; 83 this.currentAdjustData = CommonConstants.ADJUST_SLIDER_VALUE; 84 }); 85 } 86} 87