1/* 2 * Copyright (c) 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 { settingItem } from './SettingItem' 17import { SettingDataObj } from '../common/Constants' 18 19class GetModeIcon { 20 icon: Resource; 21 message: Resource; 22 23 constructor(icon: Resource, message: Resource) { 24 this.icon = icon; 25 this.message = message; 26 } 27}; 28 29@Component 30export struct settingRightLayout { 31 @Prop @Watch('onSettingMessageFn') settingMessageNum: number; // Incoming click settings 32 private title: Array<Resource> = [$r('app.string.CONTENT_TYPE_UNKNOWN'), $r('app.string.SELFIE_IMAGE'), $r('app.string.STEADY_VIDEO'), $r('app.string.EXPOSURE_MODE'), 33 $r('app.string.FOCUS_MODE'), $r('app.string.CAPTURE_QUALITY'), 34 $r('app.string.DISPLAY_LOCATION'), $r('app.string.PHOTO_FORMAT'), 35 $r('app.string.PHOTO_DIRECTION_CONFIGURATION'), $r('app.string.PHOTO_RESOLUTION'), 36 $r('app.string.VIDEO_RESOLUTION'), $r('app.string.VIDEO_RATE'), $r('app.string.REFERENCE_LINE'),]; 37 private settingItemDataList: Array<Array<Resource>> = [ 38 [], [], 39 [$r('app.string.CLOSE_STEADY_VIDEO'), $r('app.string.BASIC_ANTI_SHAKE_ALGORITHM'), $r('app.string.GENERAL_ANTI_SHAKE_ALGORITHM'), $r('app.string.BEST_ANTI_SHAKE_ALGORITHM'), $r('app.string.AUTO_SELECT')], 40 [$r('app.string.LOCK_EXPOSURE_MODE'), $r('app.string.AUTO_EXPOSURE_MODE'), $r('app.string.CONTINUE_AUTO_EXPOSURE')], 41 [$r('app.string.MANUAL_FOCUS'), $r('app.string.CONTINUE_AUTO_FOCUS'), $r('app.string.AUTO_ZOOM'), $r('app.string.LOCK_FOCUS')], 42 [$r('app.string.HIGH'), $r('app.string.MIDDLE'), $r('app.string.BAD')], 43 [], 44 [$r('app.string.PHOTO_FORMAT_PNG'), $r('app.string.PHOTO_FORMAT_JPG'), $r('app.string.PHOTO_FORMAT_BMP'), $r('app.string.PHOTO_FORMAT_WEBP'), $r('app.string.PHOTO_FORMAT_JPEG')], 45 [$r('app.string.SRC'), $r('app.string.OVERTURN90'), $r('app.string.OVERTURN180'), $r('app.string.OVERTURN270')], 46 [$r('app.string.RESOLUTION1'), $r('app.string.RESOLUTION2'), $r('app.string.RESOLUTION3')], 47 [$r('app.string.RESOLUTION1'), $r('app.string.RESOLUTION2'), $r('app.string.RESOLUTION3')], 48 [$r('app.string.VIDEO_RATE_15'), $r('app.string.VIDEO_RATE_30')], 49 ]; 50 @State isIndex: number = 0; 51 private settingItemNumberArray = [2, 3, 4, 5, 7, 8, 9, 10, 11]; 52 private settingDataObj: SettingDataObj = { 53 mirrorBol: false, 54 videoStabilizationMode: 0, 55 exposureMode: 1, 56 focusMode: 2, 57 photoQuality: 1, 58 locationBol: false, 59 photoFormat: 1, 60 photoOrientation: 0, 61 photoResolution: 0, 62 videoResolution: 0, 63 videoFrame: 0, 64 referenceLineBol: false 65 }; 66 private getModeIcon1: GetModeIcon = new GetModeIcon($r('app.media.pic_camera_mirror'), $r('app.string.SELF_IMAGE_FUNC_ONLY_FRONT_CAMERA_OPEN_USE')) 67 private getModeIcon6: GetModeIcon = new GetModeIcon($r('app.media.pic_camera_mirror'), $r('app.string.DISPLAY_LOCATION_RECORD_PHOTO_OR_VIDEO_INFO')) 68 private getModeIcon12: GetModeIcon = new GetModeIcon($r('app.media.pic_camera_line'), $r('app.string.OPEN_CAMERA_REFERENCE_LINE_CREATE_BETTER_FRAME')) 69 70 onSettingMessageFn() { 71 switch (this.settingMessageNum) { 72 case 2: 73 this.isIndex = this.settingDataObj.videoStabilizationMode; 74 break; 75 case 3: 76 this.isIndex = this.settingDataObj.exposureMode; 77 break; 78 case 4: 79 this.isIndex = this.settingDataObj.focusMode; 80 break; 81 case 5: 82 this.isIndex = this.settingDataObj.photoQuality; 83 break; 84 case 7: 85 this.isIndex = this.settingDataObj.photoFormat; 86 break; 87 case 8: 88 this.isIndex = this.settingDataObj.photoOrientation; 89 break; 90 case 9: 91 this.isIndex = this.settingDataObj.photoResolution; 92 break; 93 case 10: 94 this.isIndex = this.settingDataObj.videoResolution; 95 break; 96 case 11: 97 this.isIndex = this.settingDataObj.videoFrame; 98 break; 99 } 100 } 101 102 build() { 103 Column() { 104 Row() { 105 Text(this.title[this.settingMessageNum]) 106 .fontSize(24) 107 .fontWeight(700) 108 .fontColor('#182431') 109 .width('96%') 110 .textAlign(TextAlign.Start) 111 }.margin({ top: 20 }) 112 113 if (this.settingMessageNum == 1 || this.settingMessageNum == 6 || this.settingMessageNum == 12) { 114 Column() { 115 Image(this.getModeIcon1.icon).width(450).height(350).objectFit(ImageFit.ScaleDown); 116 Text(this.getModeIcon1.message).fontColor('#182431').fontSize(18).fontWeight(400); 117 }.margin({ top: 90 }) 118 } else if (this.settingMessageNum == 6) { 119 Column() { 120 Image(this.getModeIcon6.icon).width(450).height(350).objectFit(ImageFit.ScaleDown); 121 Text(this.getModeIcon6.message).fontColor('#182431').fontSize(18).fontWeight(400); 122 }.margin({ top: 90 }) 123 } else if (this.settingMessageNum == 12) { 124 Column() { 125 Image(this.getModeIcon12.icon).width(450).height(350).objectFit(ImageFit.ScaleDown); 126 Text(this.getModeIcon12.message).fontColor('#182431').fontSize(18).fontWeight(400); 127 }.margin({ top: 90 }) 128 } else { 129 Column() { 130 ForEach(this.settingItemDataList[this.settingMessageNum], (item: string, index: number) => { 131 settingItem({ 132 itemData: item, 133 index: index, 134 isIndex: $isIndex, 135 settingMessageNum: this.settingMessageNum 136 }) 137 }) 138 } 139 .margin({ top: 20 }) 140 .borderRadius(24) 141 .width(720) 142 .backgroundColor(Color.White) 143 } 144 } 145 } 146}