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 16if (!('finalizeConstruction' in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 18} 19 20const TAG = 'avpicker_component_mock '; 21 22export class AVCastPicker extends ViewPU { 23 constructor(j2, k2, l2, m2 = -1, n2 = undefined, o2) { 24 super(j2, l2, m2, o2); 25 if (typeof n2 === 'function') { 26 this.paramsGenerator_ = n2; 27 } 28 this.customPicker = undefined; 29 this.setInitiallyProvidedValue(k2); 30 this.finalizeConstruction(); 31 } 32 33 setInitiallyProvidedValue(i2) { 34 if (i2.customPicker !== undefined) { 35 this.customPicker = i2.customPicker; 36 } 37 } 38 39 updateStateVars(h2) { 40 } 41 42 purgeVariableDependenciesOnElmtId(g2) { 43 } 44 45 aboutToBeDeleted() { 46 SubscriberManager.Get().delete(this.id__()); 47 this.aboutToBeDeletedInternal(); 48 } 49 50 aboutToAppear() { 51 console.info(TAG + 'aboutToAppear'); 52 } 53 54 aboutToDisappear() { 55 console.info(TAG + 'aboutToDisappear'); 56 } 57 58 initialRender() { 59 this.observeComponentCreation2((e2, f2) => { 60 Column.create(); 61 Column.size({ width: '100%', height: '100%' }); 62 }, Column); 63 this.observeComponentCreation2((a2, b2) => { 64 If.create(); 65 if (this.customPicker === undefined) { 66 this.ifElseBranchUpdateFunction(0, () => { 67 this.buildDefaultPicker.bind(this)(); 68 }); 69 } else { 70 this.ifElseBranchUpdateFunction(1, () => { 71 this.buildCustomPicker.bind(this)(); 72 }); 73 } 74 }, If); 75 If.pop(); 76 Column.pop(); 77 } 78 79 buildDefaultPicker(o1 = null) { 80 this.observeComponentCreation2((w1, x1) => { 81 Column.create(); 82 Column.size({ width: '100%', height: '100%' }); 83 }, Column); 84 this.observeComponentCreation2((u1, v1) => { 85 Button.createWithChild(); 86 Button.type(ButtonType.Circle); 87 Button.backgroundColor('#00000000'); 88 Button.size({ width: '100%', height: '100%' }); 89 }, Button); 90 this.observeComponentCreation2((s1, t1) => { 91 Image.create({'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_cast_stream'], 92 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__'}); 93 Image.size({ width: '100%', height: '100%' }); 94 Image.draggable(false); 95 }, Image); 96 Button.pop(); 97 Column.pop(); 98 } 99 100 buildCustomPicker(h1 = null) { 101 this.observeComponentCreation2((m1, n1) => { 102 Column.create(); 103 Column.size({ width: '100%', height: '100%' }); 104 }, Column); 105 this.observeComponentCreation2((k1, l1) => { 106 Button.createWithChild(); 107 Button.type(ButtonType.Circle); 108 Button.backgroundColor('#00000000'); 109 Button.size({ width: '100%', height: '100%' }); 110 }, Button); 111 this.customPicker.bind(this)(); 112 Button.pop(); 113 Column.pop(); 114 } 115 116 rerender() { 117 this.updateDirtyElements(); 118 } 119} 120 121export default AVCastPicker; 122