180922886Sopenharmony_ci/* 280922886Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 380922886Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 480922886Sopenharmony_ci * you may not use this file except in compliance with the License. 580922886Sopenharmony_ci * You may obtain a copy of the License at 680922886Sopenharmony_ci * 780922886Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 880922886Sopenharmony_ci * 980922886Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1080922886Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1180922886Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1280922886Sopenharmony_ci * See the License for the specific language governing permissions and 1380922886Sopenharmony_ci * limitations under the License. 1480922886Sopenharmony_ci */ 1580922886Sopenharmony_ci 1680922886Sopenharmony_ciif (!('finalizeConstruction' in ViewPU.prototype)) { 1780922886Sopenharmony_ci Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 1880922886Sopenharmony_ci} 1980922886Sopenharmony_ci 2080922886Sopenharmony_ciconst TAG = 'avpicker_component_mock '; 2180922886Sopenharmony_ci 2280922886Sopenharmony_ciexport class AVCastPicker extends ViewPU { 2380922886Sopenharmony_ci constructor(j2, k2, l2, m2 = -1, n2 = undefined, o2) { 2480922886Sopenharmony_ci super(j2, l2, m2, o2); 2580922886Sopenharmony_ci if (typeof n2 === 'function') { 2680922886Sopenharmony_ci this.paramsGenerator_ = n2; 2780922886Sopenharmony_ci } 2880922886Sopenharmony_ci this.customPicker = undefined; 2980922886Sopenharmony_ci this.setInitiallyProvidedValue(k2); 3080922886Sopenharmony_ci this.finalizeConstruction(); 3180922886Sopenharmony_ci } 3280922886Sopenharmony_ci 3380922886Sopenharmony_ci setInitiallyProvidedValue(i2) { 3480922886Sopenharmony_ci if (i2.customPicker !== undefined) { 3580922886Sopenharmony_ci this.customPicker = i2.customPicker; 3680922886Sopenharmony_ci } 3780922886Sopenharmony_ci } 3880922886Sopenharmony_ci 3980922886Sopenharmony_ci updateStateVars(h2) { 4080922886Sopenharmony_ci } 4180922886Sopenharmony_ci 4280922886Sopenharmony_ci purgeVariableDependenciesOnElmtId(g2) { 4380922886Sopenharmony_ci } 4480922886Sopenharmony_ci 4580922886Sopenharmony_ci aboutToBeDeleted() { 4680922886Sopenharmony_ci SubscriberManager.Get().delete(this.id__()); 4780922886Sopenharmony_ci this.aboutToBeDeletedInternal(); 4880922886Sopenharmony_ci } 4980922886Sopenharmony_ci 5080922886Sopenharmony_ci aboutToAppear() { 5180922886Sopenharmony_ci console.info(TAG + 'aboutToAppear'); 5280922886Sopenharmony_ci } 5380922886Sopenharmony_ci 5480922886Sopenharmony_ci aboutToDisappear() { 5580922886Sopenharmony_ci console.info(TAG + 'aboutToDisappear'); 5680922886Sopenharmony_ci } 5780922886Sopenharmony_ci 5880922886Sopenharmony_ci initialRender() { 5980922886Sopenharmony_ci this.observeComponentCreation2((e2, f2) => { 6080922886Sopenharmony_ci Column.create(); 6180922886Sopenharmony_ci Column.size({ width: '100%', height: '100%' }); 6280922886Sopenharmony_ci }, Column); 6380922886Sopenharmony_ci this.observeComponentCreation2((a2, b2) => { 6480922886Sopenharmony_ci If.create(); 6580922886Sopenharmony_ci if (this.customPicker === undefined) { 6680922886Sopenharmony_ci this.ifElseBranchUpdateFunction(0, () => { 6780922886Sopenharmony_ci this.buildDefaultPicker.bind(this)(); 6880922886Sopenharmony_ci }); 6980922886Sopenharmony_ci } else { 7080922886Sopenharmony_ci this.ifElseBranchUpdateFunction(1, () => { 7180922886Sopenharmony_ci this.buildCustomPicker.bind(this)(); 7280922886Sopenharmony_ci }); 7380922886Sopenharmony_ci } 7480922886Sopenharmony_ci }, If); 7580922886Sopenharmony_ci If.pop(); 7680922886Sopenharmony_ci Column.pop(); 7780922886Sopenharmony_ci } 7880922886Sopenharmony_ci 7980922886Sopenharmony_ci buildDefaultPicker(o1 = null) { 8080922886Sopenharmony_ci this.observeComponentCreation2((w1, x1) => { 8180922886Sopenharmony_ci Column.create(); 8280922886Sopenharmony_ci Column.size({ width: '100%', height: '100%' }); 8380922886Sopenharmony_ci }, Column); 8480922886Sopenharmony_ci this.observeComponentCreation2((u1, v1) => { 8580922886Sopenharmony_ci Button.createWithChild(); 8680922886Sopenharmony_ci Button.type(ButtonType.Circle); 8780922886Sopenharmony_ci Button.backgroundColor('#00000000'); 8880922886Sopenharmony_ci Button.size({ width: '100%', height: '100%' }); 8980922886Sopenharmony_ci }, Button); 9080922886Sopenharmony_ci this.observeComponentCreation2((s1, t1) => { 9180922886Sopenharmony_ci Image.create({'id': -1, 'type': 20000, params: ['sys.media.ohos_ic_public_cast_stream'], 9280922886Sopenharmony_ci 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__'}); 9380922886Sopenharmony_ci Image.size({ width: '100%', height: '100%' }); 9480922886Sopenharmony_ci Image.draggable(false); 9580922886Sopenharmony_ci }, Image); 9680922886Sopenharmony_ci Button.pop(); 9780922886Sopenharmony_ci Column.pop(); 9880922886Sopenharmony_ci } 9980922886Sopenharmony_ci 10080922886Sopenharmony_ci buildCustomPicker(h1 = null) { 10180922886Sopenharmony_ci this.observeComponentCreation2((m1, n1) => { 10280922886Sopenharmony_ci Column.create(); 10380922886Sopenharmony_ci Column.size({ width: '100%', height: '100%' }); 10480922886Sopenharmony_ci }, Column); 10580922886Sopenharmony_ci this.observeComponentCreation2((k1, l1) => { 10680922886Sopenharmony_ci Button.createWithChild(); 10780922886Sopenharmony_ci Button.type(ButtonType.Circle); 10880922886Sopenharmony_ci Button.backgroundColor('#00000000'); 10980922886Sopenharmony_ci Button.size({ width: '100%', height: '100%' }); 11080922886Sopenharmony_ci }, Button); 11180922886Sopenharmony_ci this.customPicker.bind(this)(); 11280922886Sopenharmony_ci Button.pop(); 11380922886Sopenharmony_ci Column.pop(); 11480922886Sopenharmony_ci } 11580922886Sopenharmony_ci 11680922886Sopenharmony_ci rerender() { 11780922886Sopenharmony_ci this.updateDirtyElements(); 11880922886Sopenharmony_ci } 11980922886Sopenharmony_ci} 12080922886Sopenharmony_ci 12180922886Sopenharmony_ciexport default AVCastPicker; 122