blob: 45e2a828b4a348633335ee1975cac2e9f8aebf52 [file] [log] [blame]
Alexandre Savard14323be2012-10-24 10:02:13 -04001/*
alisionb1763882013-06-18 17:30:51 -04002 * Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
Alexandre Savard14323be2012-10-24 10:02:13 -04003 *
4 * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Adrien Béraud71b2f812013-04-26 18:51:02 +10005 * Author: Adrien Béraud <adrien.beraud@savoirfairelinux.com>
alisionfde875f2013-05-28 17:01:54 -04006 * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com>
Alexandre Savard14323be2012-10-24 10:02:13 -04007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Additional permission under GNU GPL version 3 section 7:
23 *
24 * If you modify this program, or any covered work, by linking or
25 * combining it with the OpenSSL project's OpenSSL library (or a
26 * modified version of that library), containing parts covered by the
27 * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
28 * grants you additional permission to convey the resulting work.
29 * Corresponding Source for a non-source form of such a combination
30 * shall include the source code for the parts of OpenSSL used as well
31 * as that of the covered work.
32 */
33
Alexandre Lision064e1e02013-10-01 16:18:42 -040034package org.sflphone.client;
Alexandre Savard14323be2012-10-24 10:02:13 -040035
Alexandre Lisiond5686032013-10-29 11:09:21 -040036import java.util.ArrayList;
alision85704182013-05-29 15:23:03 -040037import java.util.HashMap;
Adrien Béraud33268882013-05-18 03:41:15 +100038
Alexandre Lision064e1e02013-10-01 16:18:42 -040039import org.sflphone.R;
40import org.sflphone.fragments.CallFragment;
Alexandre Lision666b3772013-10-28 17:42:48 -040041import org.sflphone.fragments.IMFragment;
Alexandre Lision064e1e02013-10-01 16:18:42 -040042import org.sflphone.interfaces.CallInterface;
Alexandre Lisiond588bff2013-10-08 12:43:01 -040043import org.sflphone.model.Account;
Alexandre Lision064e1e02013-10-01 16:18:42 -040044import org.sflphone.model.CallContact;
45import org.sflphone.model.Conference;
46import org.sflphone.model.SipCall;
Alexandre Lision666b3772013-10-28 17:42:48 -040047import org.sflphone.model.SipMessage;
Alexandre Lision064e1e02013-10-01 16:18:42 -040048import org.sflphone.receivers.CallReceiver;
49import org.sflphone.service.CallManagerCallBack;
50import org.sflphone.service.ISipService;
51import org.sflphone.service.SipService;
Alexandre Lisionb8add812013-10-24 11:42:42 -040052import org.sflphone.utils.CallProximityManager;
53import org.sflphone.utils.CallProximityManager.ProximityDirector;
Alexandre Lision064e1e02013-10-01 16:18:42 -040054import org.sflphone.views.CallPaneLayout;
55
Alexandre Savard14323be2012-10-24 10:02:13 -040056import android.app.Activity;
Alexandre Savard6d54bbc2012-10-24 11:04:23 -040057import android.content.ComponentName;
alision17052d42013-04-22 10:39:38 -040058import android.content.Context;
Alexandre Savard6d54bbc2012-10-24 11:04:23 -040059import android.content.Intent;
alision84813a12013-05-27 17:40:39 -040060import android.content.IntentFilter;
Alexandre Savard6d54bbc2012-10-24 11:04:23 -040061import android.content.ServiceConnection;
Alexandre Lision93ed33d2013-10-29 15:56:59 -040062import android.graphics.Color;
Alexandre Lision0edf18c2013-09-23 17:35:50 -040063import android.graphics.PixelFormat;
alision55c36cb2013-06-14 14:57:38 -040064import android.net.Uri;
Alexandre Savard14323be2012-10-24 10:02:13 -040065import android.os.Bundle;
Alexandre Lision0c384512013-09-17 17:15:57 -040066import android.os.Handler;
Alexandre Savard6d54bbc2012-10-24 11:04:23 -040067import android.os.IBinder;
alision85992112013-05-29 12:18:08 -040068import android.os.RemoteException;
Alexandre Lision0c384512013-09-17 17:15:57 -040069import android.os.SystemClock;
alisionfde875f2013-05-28 17:01:54 -040070import android.support.v4.widget.SlidingPaneLayout;
Alexandre Savard6d54bbc2012-10-24 11:04:23 -040071import android.util.Log;
Alexandre Lision64dc8c02013-09-25 15:32:25 -040072import android.view.KeyEvent;
alisionfde875f2013-05-28 17:01:54 -040073import android.view.View;
Alexandre Lision93ed33d2013-10-29 15:56:59 -040074import android.view.ViewPropertyAnimator;
Alexandre Lision0edf18c2013-09-23 17:35:50 -040075import android.view.Window;
Alexandre Lision93ed33d2013-10-29 15:56:59 -040076import android.view.WindowManager;
77import android.view.animation.BounceInterpolator;
78import android.view.inputmethod.EditorInfo;
Adrien Béraud33268882013-05-18 03:41:15 +100079import android.widget.Toast;
Alexandre Savard14323be2012-10-24 10:02:13 -040080
Alexandre Lision666b3772013-10-28 17:42:48 -040081public class CallActivity extends Activity implements CallInterface, IMFragment.Callbacks, CallFragment.Callbacks, ProximityDirector {
alision55c36cb2013-06-14 14:57:38 -040082 static final String TAG = "CallActivity";
83 private ISipService service;
alision84813a12013-05-27 17:40:39 -040084
alision55c36cb2013-06-14 14:57:38 -040085 CallReceiver receiver;
alision85992112013-05-29 12:18:08 -040086
alision55c36cb2013-06-14 14:57:38 -040087 CallPaneLayout slidingPaneLayout;
Adrien Béraud33268882013-05-18 03:41:15 +100088
Alexandre Lision666b3772013-10-28 17:42:48 -040089 IMFragment mIMFragment;
alision55c36cb2013-06-14 14:57:38 -040090 CallFragment mCurrentCallFragment;
Alexandre Lision0edf18c2013-09-23 17:35:50 -040091 // private boolean fragIsChanging;
Alexandre Lision1a9e3b12013-09-16 11:06:07 -040092
Alexandre Lisionf1850c02013-09-23 14:19:34 -040093 /* result code sent in case of call failure */
Alexandre Lisionc51ccb12013-09-11 16:00:30 -040094 public static int RESULT_FAILURE = -10;
Alexandre Lision666b3772013-10-28 17:42:48 -040095
Alexandre Lisionb8add812013-10-24 11:42:42 -040096 private CallProximityManager proximityManager;
Alexandre Savard4f42ade2012-10-24 18:03:31 -040097
alision55c36cb2013-06-14 14:57:38 -040098 @Override
99 protected void onCreate(Bundle savedInstanceState) {
100 super.onCreate(savedInstanceState);
101 setContentView(R.layout.activity_call_layout);
Alexandre Savard4f42ade2012-10-24 18:03:31 -0400102
alision55c36cb2013-06-14 14:57:38 -0400103 receiver = new CallReceiver(this);
Adrien Béraud33268882013-05-18 03:41:15 +1000104
Alexandre Lisionb8add812013-10-24 11:42:42 -0400105 proximityManager = new CallProximityManager(this, this);
alision85992112013-05-29 12:18:08 -0400106
alision55c36cb2013-06-14 14:57:38 -0400107 slidingPaneLayout = (CallPaneLayout) findViewById(R.id.slidingpanelayout);
Alexandre Lision93ed33d2013-10-29 15:56:59 -0400108 slidingPaneLayout.setParallaxDistance(500);
109 slidingPaneLayout.setSliderFadeColor(Color.TRANSPARENT);
110// ViewPropertyAnimator anim = slidingPaneLayout.animate();
111// anim.setInterpolator(new BounceInterpolator());
112// anim.setDuration(5000);
113// anim.s
114
115
116
alision55c36cb2013-06-14 14:57:38 -0400117 slidingPaneLayout.setPanelSlideListener(new SlidingPaneLayout.PanelSlideListener() {
alision84813a12013-05-27 17:40:39 -0400118
alision55c36cb2013-06-14 14:57:38 -0400119 @Override
120 public void onPanelSlide(View view, float offSet) {
121 }
alisionfde875f2013-05-28 17:01:54 -0400122
alision55c36cb2013-06-14 14:57:38 -0400123 @Override
124 public void onPanelOpened(View view) {
Alexandre Lision93ed33d2013-10-29 15:56:59 -0400125 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
alision55c36cb2013-06-14 14:57:38 -0400126 }
alisionfde875f2013-05-28 17:01:54 -0400127
alision55c36cb2013-06-14 14:57:38 -0400128 @Override
129 public void onPanelClosed(View view) {
Alexandre Lision666b3772013-10-28 17:42:48 -0400130 mCurrentCallFragment.getBubbleView().restartDrawing();
Alexandre Lision93ed33d2013-10-29 15:56:59 -0400131 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
alision55c36cb2013-06-14 14:57:38 -0400132 }
133 });
alisionfde875f2013-05-28 17:01:54 -0400134
Alexandre Lisionb8add812013-10-24 11:42:42 -0400135 proximityManager.startTracking();
alision55c36cb2013-06-14 14:57:38 -0400136 Intent intent = new Intent(this, SipService.class);
137 bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
alision55c36cb2013-06-14 14:57:38 -0400138 }
alisiond45da712013-05-30 09:18:49 -0400139
alision55c36cb2013-06-14 14:57:38 -0400140 /* activity gets back to the foreground and user input */
141 @Override
142 protected void onResume() {
143 Log.i(TAG, "onResume");
144 IntentFilter intentFilter = new IntentFilter();
145 intentFilter.addAction(CallManagerCallBack.INCOMING_CALL);
146 intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT);
147 intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
alisiondf1dac92013-06-27 17:35:53 -0400148 intentFilter.addAction(CallManagerCallBack.CONF_CREATED);
149 intentFilter.addAction(CallManagerCallBack.CONF_REMOVED);
150 intentFilter.addAction(CallManagerCallBack.CONF_CHANGED);
151 intentFilter.addAction(CallManagerCallBack.RECORD_STATE_CHANGED);
alision55c36cb2013-06-14 14:57:38 -0400152 registerReceiver(receiver, intentFilter);
Alexandre Lision0c384512013-09-17 17:15:57 -0400153
alision55c36cb2013-06-14 14:57:38 -0400154 super.onResume();
155 }
alisiond45da712013-05-30 09:18:49 -0400156
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400157 @Override
158 public void onAttachedToWindow() {
159 super.onAttachedToWindow();
160 Window window = getWindow();
161 window.setFormat(PixelFormat.RGBA_8888);
162 }
163
Alexandre Lision0c384512013-09-17 17:15:57 -0400164 private Handler mHandler = new Handler();
165 private Runnable mUpdateTimeTask = new Runnable() {
Adrien Béraud9360f242013-09-19 11:07:42 +1000166 @Override
Alexandre Lision0c384512013-09-17 17:15:57 -0400167 public void run() {
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400168 if (mCurrentCallFragment != null)
Alexandre Lisionfd7a88f2013-09-18 10:03:17 -0400169 mCurrentCallFragment.updateTime();
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400170 // mCallsFragment.update();
Alexandre Lision0c384512013-09-17 17:15:57 -0400171
Adrien Béraud9360f242013-09-19 11:07:42 +1000172 mHandler.postAtTime(this, SystemClock.uptimeMillis() + 1000);
Alexandre Lision0c384512013-09-17 17:15:57 -0400173 }
174 };
175
alision55c36cb2013-06-14 14:57:38 -0400176 /* activity no more in foreground */
177 @Override
178 protected void onPause() {
179 super.onPause();
Alexandre Lision0c384512013-09-17 17:15:57 -0400180 mHandler.removeCallbacks(mUpdateTimeTask);
alision55c36cb2013-06-14 14:57:38 -0400181 }
Alexandre Lision40954dc2013-10-09 15:24:03 -0400182
Alexandre Lision64dc8c02013-09-25 15:32:25 -0400183 @Override
184 public boolean onKeyUp(int keyCode, KeyEvent event) {
Alexandre Lision40954dc2013-10-09 15:24:03 -0400185
186 if (keyCode == KeyEvent.KEYCODE_BACK) {
Alexandre Lision31f46fc2013-09-26 11:19:54 -0400187 return super.onKeyUp(keyCode, event);
188 }
Alexandre Lision64dc8c02013-09-25 15:32:25 -0400189 mCurrentCallFragment.onKeyUp(keyCode, event);
190 return true;
191 }
Alexandre Savard6d54bbc2012-10-24 11:04:23 -0400192
alision55c36cb2013-06-14 14:57:38 -0400193 @Override
194 protected void onDestroy() {
alision55c36cb2013-06-14 14:57:38 -0400195 unregisterReceiver(receiver);
alision55c36cb2013-06-14 14:57:38 -0400196 unbindService(mConnection);
Alexandre Lisionb8add812013-10-24 11:42:42 -0400197 proximityManager.stopTracking();
198 proximityManager.release(0);
alision55c36cb2013-06-14 14:57:38 -0400199 super.onDestroy();
200 }
Adrien Béraud33268882013-05-18 03:41:15 +1000201
alision55c36cb2013-06-14 14:57:38 -0400202 /** Defines callbacks for service binding, passed to bindService() */
203 private ServiceConnection mConnection = new ServiceConnection() {
204 @Override
205 public void onServiceConnected(ComponentName className, IBinder binder) {
206 service = ISipService.Stub.asInterface(binder);
alisiondf1dac92013-06-27 17:35:53 -0400207
alision55c36cb2013-06-14 14:57:38 -0400208 mCurrentCallFragment = new CallFragment();
Alexandre Lisiond5686032013-10-29 11:09:21 -0400209 mIMFragment = new IMFragment();
Adrien Béraud9360f242013-09-19 11:07:42 +1000210
alision55c36cb2013-06-14 14:57:38 -0400211 Uri u = getIntent().getData();
212 if (u != null) {
213 CallContact c = CallContact.ContactBuilder.buildUnknownContact(u.getSchemeSpecificPart());
214 try {
215 service.destroyNotification();
Alexandre Lision666b3772013-10-28 17:42:48 -0400216
Alexandre Lisiond5686032013-10-29 11:09:21 -0400217 String accountID = (String) service.getAccountList().get(1); // We use the first account to place outgoing calls
Alexandre Lision666b3772013-10-28 17:42:48 -0400218 Account acc = new Account(accountID, (HashMap<String, String>) service.getAccountDetails(accountID));
219
220 SipCall call = SipCall.SipCallBuilder.getInstance().startCallCreation().setContact(c).setAccount(acc)
221 .setCallType(SipCall.state.CALL_TYPE_OUTGOING).build();
alisiondf1dac92013-06-27 17:35:53 -0400222 Conference tmp = new Conference("-1");
223 tmp.getParticipants().add(call);
alision55c36cb2013-06-14 14:57:38 -0400224 Bundle b = new Bundle();
alisiondf1dac92013-06-27 17:35:53 -0400225 b.putParcelable("conference", tmp);
alision55c36cb2013-06-14 14:57:38 -0400226 mCurrentCallFragment.setArguments(b);
227 } catch (RemoteException e) {
alision55c36cb2013-06-14 14:57:38 -0400228 e.printStackTrace();
229 } catch (Exception e) {
alision55c36cb2013-06-14 14:57:38 -0400230 e.printStackTrace();
231 }
alision55c36cb2013-06-14 14:57:38 -0400232 } else {
alisiondf1dac92013-06-27 17:35:53 -0400233 if (getIntent().getBooleanExtra("resuming", false)) {
234
235 Bundle b = new Bundle();
Alexandre Lisiond5686032013-10-29 11:09:21 -0400236 Conference resumed = getIntent().getParcelableExtra("conference");
Adrien Béraud9360f242013-09-19 11:07:42 +1000237 b.putParcelable("conference", getIntent().getParcelableExtra("conference"));
Alexandre Lision1a9e3b12013-09-16 11:06:07 -0400238 mCurrentCallFragment.setArguments(b);
239
Alexandre Lisiond5686032013-10-29 11:09:21 -0400240 Bundle IMBundle = new Bundle();
241 IMBundle.putParcelableArrayList("messages", resumed.getMessages());
242 mIMFragment.setArguments(IMBundle);
243
alisiondf1dac92013-06-27 17:35:53 -0400244 } else {
245 mCurrentCallFragment.setArguments(getIntent().getExtras());
Alexandre Lisiond5686032013-10-29 11:09:21 -0400246
247 Bundle IMBundle = new Bundle();
248 IMBundle.putParcelableArrayList("messages", new ArrayList<SipMessage>());
249 mIMFragment.setArguments(IMBundle);
alisiondf1dac92013-06-27 17:35:53 -0400250 }
251
alision55c36cb2013-06-14 14:57:38 -0400252 }
Alexandre Lisiond5686032013-10-29 11:09:21 -0400253
Alexandre Lision666b3772013-10-28 17:42:48 -0400254 slidingPaneLayout.setCurFragment(mCurrentCallFragment);
alision55c36cb2013-06-14 14:57:38 -0400255 getIntent().getExtras();
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400256 // mCallsFragment.update();
alision55c36cb2013-06-14 14:57:38 -0400257 getFragmentManager().beginTransaction().replace(R.id.ongoingcall_pane, mCurrentCallFragment).commit();
Alexandre Lision666b3772013-10-28 17:42:48 -0400258 getFragmentManager().beginTransaction().replace(R.id.message_list_frame, mIMFragment).commit();
alisiond8c83882013-05-17 17:00:42 -0400259
alision55c36cb2013-06-14 14:57:38 -0400260 }
Adrien Béraud6bbce912013-05-24 00:48:13 +1000261
alision55c36cb2013-06-14 14:57:38 -0400262 @Override
263 public void onServiceDisconnected(ComponentName arg0) {
264 }
265 };
Adrien Béraud6bbce912013-05-24 00:48:13 +1000266
alision55c36cb2013-06-14 14:57:38 -0400267 @Override
268 public void incomingCall(Intent call) {
Alexandre Lisiondafe9512013-10-28 16:31:41 -0400269 Bundle b = new Bundle();
270 Conference tmp = new Conference("-1");
Alexandre Lision666b3772013-10-28 17:42:48 -0400271 tmp.getParticipants().add((SipCall) call.getParcelableExtra("newcall"));
Alexandre Lisiondafe9512013-10-28 16:31:41 -0400272 b.putParcelable("conference", tmp);
273 mCurrentCallFragment = new CallFragment();
274 mCurrentCallFragment.setArguments(b);
275 getFragmentManager().beginTransaction().replace(R.id.ongoingcall_pane, mCurrentCallFragment).commit();
Alexandre Lision666b3772013-10-28 17:42:48 -0400276 slidingPaneLayout.setCurFragment(mCurrentCallFragment);
Alexandre Savarddf544262012-10-25 14:24:08 -0400277
alision55c36cb2013-06-14 14:57:38 -0400278 }
alision84813a12013-05-27 17:40:39 -0400279
alision55c36cb2013-06-14 14:57:38 -0400280 @Override
281 public void callStateChanged(Intent callState) {
alision84813a12013-05-27 17:40:39 -0400282
alision55c36cb2013-06-14 14:57:38 -0400283 Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
284 processCallStateChangedSignal(b.getString("CallID"), b.getString("State"));
alision84813a12013-05-27 17:40:39 -0400285
alision55c36cb2013-06-14 14:57:38 -0400286 }
alision84813a12013-05-27 17:40:39 -0400287
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400288 @SuppressWarnings("unchecked")
289 // No proper solution with HashMap runtime cast
alision55c36cb2013-06-14 14:57:38 -0400290 public void processCallStateChangedSignal(String callID, String newState) {
alision84813a12013-05-27 17:40:39 -0400291
Alexandre Lision4fb22622013-10-21 16:26:33 -0400292 if (mCurrentCallFragment != null) {
Alexandre Lisiona764c682013-09-09 10:02:07 -0400293 mCurrentCallFragment.changeCallState(callID, newState);
Alexandre Lision4fb22622013-10-21 16:26:33 -0400294 }
Adrien Béraud29556042013-04-26 17:35:43 +1000295
Alexandre Lisionb8add812013-10-24 11:42:42 -0400296 proximityManager.updateProximitySensorMode();
Alexandre Lision666b3772013-10-28 17:42:48 -0400297
alision55c36cb2013-06-14 14:57:38 -0400298 try {
alisiondf1dac92013-06-27 17:35:53 -0400299 HashMap<String, SipCall> callMap = (HashMap<String, SipCall>) service.getCallList();
300 HashMap<String, Conference> confMap = (HashMap<String, Conference>) service.getConferenceList();
Alexandre Lision3c6b7102013-09-16 16:56:46 -0400301
alision55c36cb2013-06-14 14:57:38 -0400302 } catch (RemoteException e) {
Alexandre Lision3c6b7102013-09-16 16:56:46 -0400303
alision55c36cb2013-06-14 14:57:38 -0400304 Log.e(TAG, e.toString());
305 }
Adrien Béraud29556042013-04-26 17:35:43 +1000306
alision55c36cb2013-06-14 14:57:38 -0400307 Log.w(TAG, "processCallStateChangedSignal " + newState);
Adrien Béraud71b2f812013-04-26 18:51:02 +1000308
alision55c36cb2013-06-14 14:57:38 -0400309 }
310
311 @Override
Alexandre Lision666b3772013-10-28 17:42:48 -0400312 public void incomingText(Intent in) {
313 Bundle b = in.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext");
Alexandre Lisiond5686032013-10-29 11:09:21 -0400314
315 if (mIMFragment != null) {
Alexandre Lision666b3772013-10-28 17:42:48 -0400316 SipMessage msg = new SipMessage(true, b.getString("Msg"));
317 mIMFragment.putMessage(msg);
318 }
Adrien Béraud71b2f812013-04-26 18:51:02 +1000319
alision55c36cb2013-06-14 14:57:38 -0400320 }
alision7f18fc82013-05-01 09:37:33 -0400321
alision55c36cb2013-06-14 14:57:38 -0400322 @Override
323 public ISipService getService() {
324 return service;
325 }
alision04a00182013-05-10 17:05:29 -0400326
alision55c36cb2013-06-14 14:57:38 -0400327 @Override
328 public void onBackPressed() {
329 super.onBackPressed();
330 Intent launchHome = new Intent(this, SFLPhoneHomeActivity.class);
331 launchHome.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Alexandre Lision5ed2c972013-10-11 15:36:33 -0400332 launchHome.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
alision55c36cb2013-06-14 14:57:38 -0400333 startActivity(launchHome);
334 }
alision85992112013-05-29 12:18:08 -0400335
alision806e18e2013-06-21 15:30:17 -0400336 @Override
337 public void confCreated(Intent intent) {
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400338 // mCallsFragment.update();
alision34673e62013-06-25 14:40:07 -0400339
alision806e18e2013-06-21 15:30:17 -0400340 }
341
342 @Override
343 public void confRemoved(Intent intent) {
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400344 // mCallsFragment.update();
alision806e18e2013-06-21 15:30:17 -0400345 }
346
347 @Override
348 public void confChanged(Intent intent) {
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400349 // mCallsFragment.update();
alision806e18e2013-06-21 15:30:17 -0400350 }
351
alisiondf1dac92013-06-27 17:35:53 -0400352 @Override
353 public void recordingChanged(Intent intent) {
Alexandre Lision0edf18c2013-09-23 17:35:50 -0400354 // mCallsFragment.update();
alisiondf1dac92013-06-27 17:35:53 -0400355 }
356
Alexandre Lisionccf0c932013-10-10 16:24:41 -0400357 @Override
Alexandre Lisiondafe9512013-10-28 16:31:41 -0400358 public void terminateCall() {
Alexandre Lisionccf0c932013-10-10 16:24:41 -0400359 mHandler.removeCallbacks(mUpdateTimeTask);
360 mCurrentCallFragment.getBubbleView().stopThread();
Alexandre Lision666b3772013-10-28 17:42:48 -0400361 // getFragmentManager().beginTransaction().remove(mCurrentCallFragment).commit();
362 // mCurrentCallFragment = null;
Alexandre Lision5ed2c972013-10-11 15:36:33 -0400363 finish();
Alexandre Lisionccf0c932013-10-10 16:24:41 -0400364
365 }
alision806e18e2013-06-21 15:30:17 -0400366
Alexandre Lision0c384512013-09-17 17:15:57 -0400367 @Override
Alexandre Lisiond5686032013-10-29 11:09:21 -0400368 public boolean sendIM(SipMessage msg) {
369
370 try {
371 service.sendTextMessage(mCurrentCallFragment.getConference().getId(), msg);
372 } catch (RemoteException e) {
373 e.printStackTrace();
374 return false;
375 }
376
377 return true;
378 }
379
380 @Override
Alexandre Lision0c384512013-09-17 17:15:57 -0400381 public void startTimer() {
382 mHandler.postDelayed(mUpdateTimeTask, 0);
383 }
384
Alexandre Lision40954dc2013-10-09 15:24:03 -0400385 public void onCallSuspended() {
386 try {
387 if (mCurrentCallFragment.getConference().hasMultipleParticipants()) {
388 service.holdConference(mCurrentCallFragment.getConference().getId());
389 } else {
390 service.hold(mCurrentCallFragment.getConference().getParticipants().get(0).getCallId());
391 }
392 } catch (RemoteException e) {
Alexandre Lision40954dc2013-10-09 15:24:03 -0400393 e.printStackTrace();
394 }
395 }
Alexandre Lision68855472013-10-10 16:20:46 -0400396
397 @Override
398 public void slideChatScreen() {
Alexandre Lision666b3772013-10-28 17:42:48 -0400399
400 if (slidingPaneLayout.isOpen()) {
401 slidingPaneLayout.closePane();
402 } else {
403 mCurrentCallFragment.getBubbleView().stopThread();
404 slidingPaneLayout.openPane();
405 }
Alexandre Lision68855472013-10-10 16:20:46 -0400406 }
Alexandre Lisionb8add812013-10-24 11:42:42 -0400407
408 @Override
409 public boolean shouldActivateProximity() {
410 return true;
411 }
412
413 @Override
414 public void onProximityTrackingChanged(boolean acquired) {
415 // TODO Stub de la méthode généré automatiquement
Alexandre Lision666b3772013-10-28 17:42:48 -0400416
Alexandre Lisionb8add812013-10-24 11:42:42 -0400417 }
Alexandre Savard14323be2012-10-24 10:02:13 -0400418}