1/* 2 * Copyright (c) 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 router from '@ohos.router' 17import { TitleBar, Title, Taggle, Show } from './common/Common' 18 19@Entry 20@Component 21struct Bluetooth { 22 private isLand: boolean = false 23 24 build() { 25 Column() { 26 if (this.isLand) { 27 TitleBar() 28 } 29 30 Title({ title: $r('app.string.bluetooth') }) 31 Taggle({ info: $r('app.string.bluetooth') }) 32 33 Row() { 34 Text($r('app.string.device_found')) 35 .fontSize(14) 36 .fontColor('#182431') 37 38 Blank() 39 .width('87%') 40 } 41 .opacity(0.6) 42 .height(48) 43 .margin({ bottom: 8, left: 24 }) 44 45 Row() { 46 Text($r('app.string.device_name')) 47 .fontSize(16) 48 .fontColor('#182431') 49 .layoutWeight(1) 50 51 Blank() 52 53 Text($r('app.string.phone')) 54 .fontSize(16) 55 .fontColor('#182431') 56 .margin({ right: 4 }) 57 58 Image($r('app.media.right')) 59 .width(16) 60 .height(18) 61 .objectFit(ImageFit.Contain) 62 } 63 .width('95%') 64 .height(56) 65 .borderRadius(24) 66 .padding({ top: 4, bottom: 4, left: 24, right: 24 }) 67 .backgroundColor(Color.White) 68 69 Show({ info: $r('app.string.connect_device') }) 70 .margin({ left: 24 }) 71 72 Column() { 73 this.deviceShow($r('app.media.phone'), $r('app.string.my_pc'), $r('app.media.setting')) 74 this.deviceShow($r('app.media.phone'), $r('app.string.standby_machine'), $r('app.media.setting')) 75 } 76 .width('95%') 77 .borderRadius(24) 78 .padding({ top: 4, bottom: 4, left: 24, right: 24 }) 79 .backgroundColor(Color.White) 80 81 Show({ info: $r('app.string.use_device') }) 82 .margin({ left: 24 }) 83 84 Column() { 85 this.deviceShow($r('app.media.watch'), $r('app.string.smart_watch'), null) 86 this.deviceShow($r('app.media.computer'), $r('app.string.my_pc'), null) 87 this.deviceShow($r('app.media.earphone'), $r('app.string.my_earphones'), null) 88 } 89 .width('95%') 90 .borderRadius(24) 91 .padding({ top: 4, bottom: 4, left: 24, right: 24 }) 92 .backgroundColor(Color.White) 93 } 94 .width('100%') 95 .height('100%') 96 .backgroundColor('#fff6f6f6') 97 } 98 99 @Builder deviceShow(device: Resource, info: Resource, img: Resource) { 100 Row() { 101 Row() { 102 Image(device) 103 .width(24) 104 .height(20) 105 .margin({ right: 18 }) 106 .objectFit(ImageFit.Contain) 107 108 Text(info) 109 .fontSize(16) 110 } 111 .layoutWeight(1) 112 113 Blank() 114 115 Image(img) 116 .width(24) 117 .height(20) 118 .objectFit(ImageFit.Contain) 119 } 120 .height(48) 121 .width('100%') 122 } 123 124 aboutToAppear() { 125 try { 126 this.isLand = router.getParams()['bool'] 127 } catch (err) { 128 this.isLand = false 129 } 130 } 131}