1 /*
2  * Copyright (C) 2016 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 
17 package com.android.incallui.answer.impl.answermethod;
18 
19 import android.content.Context;
20 import android.graphics.drawable.Drawable;
21 import android.support.annotation.Nullable;
22 import android.support.v4.app.Fragment;
23 import com.android.dialer.common.FragmentUtils;
24 
25 /** A fragment that can be used to answer/reject calls. */
26 public abstract class AnswerMethod extends Fragment {
27 
setHintText(@ullable CharSequence hintText)28   public abstract void setHintText(@Nullable CharSequence hintText);
29 
setShowIncomingWillDisconnect(boolean incomingWillDisconnect)30   public abstract void setShowIncomingWillDisconnect(boolean incomingWillDisconnect);
31 
setContactPhoto(@ullable Drawable contactPhoto)32   public void setContactPhoto(@Nullable Drawable contactPhoto) {
33     // default implementation does nothing. Only some AnswerMethods show a photo
34   }
35 
getParent()36   protected AnswerMethodHolder getParent() {
37     return FragmentUtils.getParentUnsafe(this, AnswerMethodHolder.class);
38   }
39 
40   @Override
onAttach(Context context)41   public void onAttach(Context context) {
42     super.onAttach(context);
43     FragmentUtils.checkParent(this, AnswerMethodHolder.class);
44   }
45 }
46