blob: 20625c43dcaf5f59503bb9827b927927bd09832f [file] [log] [blame]
Eric Erfanianccca3152017-02-22 16:32:36 -08001/*
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
19import android.os.Bundle;
20import android.view.LayoutInflater;
21import android.view.View;
22import android.view.ViewGroup;
23import android.widget.ListView;
Eric Erfanianfc0eb8c2017-08-31 06:57:16 -070024import com.android.dialer.contactphoto.ContactPhotoManager;
Eric Erfanianccca3152017-02-22 16:32:36 -080025import com.android.dialer.logging.Logger;
Eric Erfanian8369df02017-05-03 10:27:13 -070026import com.android.dialer.logging.ScreenEvent;
Eric Erfanianccca3152017-02-22 16:32:36 -080027import com.android.incallui.ConferenceManagerPresenter.ConferenceManagerUi;
28import com.android.incallui.baseui.BaseFragment;
29import com.android.incallui.call.CallList;
30import com.android.incallui.call.DialerCall;
31import java.util.List;
32
33/** Fragment that allows the user to manage a conference call. */
34public class ConferenceManagerFragment
35 extends BaseFragment<ConferenceManagerPresenter, ConferenceManagerUi>
36 implements ConferenceManagerPresenter.ConferenceManagerUi {
37
linyuh183cb712017-12-27 17:02:37 -080038 private ListView conferenceParticipantList;
39 private ContactPhotoManager contactPhotoManager;
40 private ConferenceParticipantListAdapter conferenceParticipantListAdapter;
Eric Erfanianccca3152017-02-22 16:32:36 -080041
42 @Override
43 public ConferenceManagerPresenter createPresenter() {
44 return new ConferenceManagerPresenter();
45 }
46
47 @Override
48 public ConferenceManagerPresenter.ConferenceManagerUi getUi() {
49 return this;
50 }
51
52 @Override
53 public void onCreate(Bundle savedInstanceState) {
54 super.onCreate(savedInstanceState);
55 if (savedInstanceState != null) {
56 Logger.get(getContext()).logScreenView(ScreenEvent.Type.CONFERENCE_MANAGEMENT, getActivity());
57 }
58 }
59
60 @Override
61 public View onCreateView(
62 LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
63 final View parent = inflater.inflate(R.layout.conference_manager_fragment, container, false);
64
linyuh183cb712017-12-27 17:02:37 -080065 conferenceParticipantList = (ListView) parent.findViewById(R.id.participantList);
66 contactPhotoManager = ContactPhotoManager.getInstance(getActivity().getApplicationContext());
Eric Erfanianccca3152017-02-22 16:32:36 -080067
68 return parent;
69 }
70
71 @Override
72 public void onResume() {
73 super.onResume();
74 final CallList calls = CallList.getInstance();
75 getPresenter().init(calls);
76 // Request focus on the list of participants for accessibility purposes. This ensures
77 // that once the list of participants is shown, the first participant is announced.
linyuh183cb712017-12-27 17:02:37 -080078 conferenceParticipantList.requestFocus();
Eric Erfanianccca3152017-02-22 16:32:36 -080079 }
80
81 @Override
82 public void onSaveInstanceState(Bundle outState) {
83 super.onSaveInstanceState(outState);
84 }
85
86 @Override
87 public boolean isFragmentVisible() {
88 return isVisible();
89 }
90
91 @Override
92 public void update(List<DialerCall> participants, boolean parentCanSeparate) {
linyuh183cb712017-12-27 17:02:37 -080093 if (conferenceParticipantListAdapter == null) {
94 conferenceParticipantListAdapter =
95 new ConferenceParticipantListAdapter(conferenceParticipantList, contactPhotoManager);
Eric Erfanianccca3152017-02-22 16:32:36 -080096
linyuh183cb712017-12-27 17:02:37 -080097 conferenceParticipantList.setAdapter(conferenceParticipantListAdapter);
Eric Erfanianccca3152017-02-22 16:32:36 -080098 }
linyuh183cb712017-12-27 17:02:37 -080099 conferenceParticipantListAdapter.updateParticipants(participants, parentCanSeparate);
Eric Erfanianccca3152017-02-22 16:32:36 -0800100 }
101
102 @Override
103 public void refreshCall(DialerCall call) {
linyuh183cb712017-12-27 17:02:37 -0800104 conferenceParticipantListAdapter.refreshCall(call);
Eric Erfanianccca3152017-02-22 16:32:36 -0800105 }
106}