• 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;
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              this.controller.hangUp();
48            }
49          })
50
51          //接受
52          ComponentOption({
53            btnId: 'option_answer',
54            use: $use,
55            useResource: $r('app.media.icon_openvalley_call'),
56            unUseResource: $r('app.media.icon_openvalley_call'),
57            useBgColorResource: $r('app.color.color_green'),
58            canChange: () => {
59              return false;
60            },
61            callback: (use: boolean) => {
62              this.controller.answer();
63            }
64          })
65        }
66        .justifyContent(FlexAlign.SpaceEvenly)
67        .width('100%')
68      }
69    }
70    .width('100%')
71    .height('100%')
72  }
73}