• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Hunan OpenValley Digital Industry Development 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 Caller from '../bean/Caller';
17import IndexController from '../controller/IndexController';
18import ComponentVoiceBg from '../components/ComponentVoiceBg';
19import ComponentOption from '../components/ComponentOption';
20
21/**
22 * 被呼叫页
23 * 提示语不同,头像相同
24 * 按钮group: 拒绝,接听
25 */
26@Component
27export default struct UIAnswer {
28  private controller: IndexController | null = null;
29  @Link mRemote: Caller;
30  @State use: boolean = true;
31
32  build() {
33    Column() {
34      ComponentVoiceBg({ tips: $r('app.string.tips_answer'), mPerson: $mRemote }) {
35        Row() {
36          //拒绝
37          ComponentOption({
38            btnId: 'option_hangup',
39            use: $use,
40            useResource: $r('app.media.icon_openvalley_hangup'),
41            unUseResource: $r('app.media.icon_openvalley_hangup'),
42            useBgColorResource: $r('app.color.color_red'),
43            canChange: () => {
44              return false;
45            },
46            callback: (use: boolean) => {
47              if (this.controller == null) {
48                return;
49              }
50              this.controller.hangUp();
51            }
52          })
53
54          //接受
55          ComponentOption({
56            btnId: 'option_answer',
57            use: $use,
58            useResource: $r('app.media.icon_openvalley_call'),
59            unUseResource: $r('app.media.icon_openvalley_call'),
60            useBgColorResource: $r('app.color.color_green'),
61            canChange: () => {
62              return false;
63            },
64            callback: (use: boolean) => {
65              if (this.controller == null) {
66                return;
67              }
68              this.controller.answer();
69            }
70          })
71        }
72        .justifyContent(FlexAlign.SpaceEvenly)
73        .width('100%')
74      }
75    }
76    .width('100%')
77    .height('100%')
78  }
79}