AnswerPresenter.java revision 7df3ac3f95c9d23396e1319beb6ca34435d965f5
1/*
2 * Copyright (C) 2013 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License
15 */
16
17package com.android.incallui;
18
19/**
20 *
21 */
22public class AnswerPresenter {
23
24    private Ui mUi;
25    private Listener mListener;
26
27    public AnswerPresenter(Ui ui, Listener listener) {
28        this.mUi = ui;
29        this.mListener = listener;
30
31        mUi.setPresenter(this);
32    }
33
34    public void onAnswer() {
35        // TODO(klp): hook in call id.
36        CallMonitorService.answerCall(1);
37        mListener.onAnswered();
38    }
39
40    public void onDecline() {
41        mListener.onAnswered();
42    }
43
44    public void onText() {
45        mListener.onAnswered();
46    }
47
48    public interface Ui {
49        void setPresenter(AnswerPresenter presenter);
50    }
51
52    public interface Listener {
53        void onAnswered();
54    }
55}
56