alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 1 | /* |
alision | 2ec64f9 | 2013-06-17 17:28:58 -0400 | [diff] [blame] | 2 | * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 3 | * |
| 4 | * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | * |
| 20 | * Additional permission under GNU GPL version 3 section 7: |
| 21 | * |
| 22 | * If you modify this program, or any covered work, by linking or |
| 23 | * combining it with the OpenSSL project's OpenSSL library (or a |
| 24 | * modified version of that library), containing parts covered by the |
| 25 | * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. |
| 26 | * grants you additional permission to convey the resulting work. |
| 27 | * Corresponding Source for a non-source form of such a combination |
| 28 | * shall include the source code for the parts of OpenSSL used as well |
| 29 | * as that of the covered work. |
| 30 | */ |
| 31 | |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 32 | package com.savoirfairelinux.sflphone.fragments; |
| 33 | |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 34 | import java.util.ArrayList; |
| 35 | |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 36 | import android.app.Activity; |
| 37 | import android.app.Fragment; |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 38 | import android.app.FragmentManager; |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 39 | import android.content.Context; |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 40 | import android.content.Intent; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 41 | import android.graphics.Bitmap; |
Adrien Béraud | 0c9bd8f | 2013-05-30 16:16:57 +1000 | [diff] [blame] | 42 | import android.graphics.BitmapFactory; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 43 | import android.graphics.PointF; |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 44 | import android.hardware.Sensor; |
| 45 | import android.hardware.SensorEvent; |
| 46 | import android.hardware.SensorEventListener; |
| 47 | import android.hardware.SensorManager; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 48 | import android.os.Bundle; |
| 49 | import android.os.RemoteException; |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 50 | import android.text.Editable; |
| 51 | import android.text.method.KeyListener; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 52 | import android.util.Log; |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 53 | import android.view.KeyEvent; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 54 | import android.view.LayoutInflater; |
Adrien Béraud | 13cde0b | 2013-05-30 20:27:20 +1000 | [diff] [blame] | 55 | import android.view.SurfaceHolder; |
| 56 | import android.view.SurfaceHolder.Callback; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 57 | import android.view.View; |
Alexandre Lision | 84208a3 | 2013-09-25 13:18:37 -0400 | [diff] [blame] | 58 | import android.view.View.OnClickListener; |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 59 | import android.view.View.OnKeyListener; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 60 | import android.view.ViewGroup; |
Alexandre Lision | 84208a3 | 2013-09-25 13:18:37 -0400 | [diff] [blame] | 61 | import android.view.inputmethod.InputMethodManager; |
| 62 | import android.widget.ImageButton; |
Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 63 | import android.widget.TextView; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 64 | |
| 65 | import com.savoirfairelinux.sflphone.R; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 66 | import com.savoirfairelinux.sflphone.model.Attractor; |
| 67 | import com.savoirfairelinux.sflphone.model.Bubble; |
| 68 | import com.savoirfairelinux.sflphone.model.BubbleModel; |
| 69 | import com.savoirfairelinux.sflphone.model.BubblesView; |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 70 | import com.savoirfairelinux.sflphone.model.Conference; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 71 | import com.savoirfairelinux.sflphone.model.SipCall; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 72 | import com.savoirfairelinux.sflphone.service.ISipService; |
| 73 | |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 74 | public class CallFragment extends Fragment implements Callback, SensorEventListener { |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 75 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 76 | static final String TAG = "CallFragment"; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 77 | |
alision | f57d8a6 | 2013-07-02 09:37:12 -0400 | [diff] [blame] | 78 | float BUBBLE_SIZE = 75; |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 79 | static final float ATTRACTOR_SIZE = 40; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 80 | |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 81 | public static final int REQUEST_TRANSFER = 10; |
| 82 | |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 83 | private Conference conf; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 84 | |
Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 85 | private TextView callStatusTxt; |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 86 | private BubblesView view; |
| 87 | private BubbleModel model; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 88 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 89 | private Callbacks mCallbacks = sDummyCallbacks; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 90 | |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 91 | private SipCall myself; |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 92 | |
Alexandre Lision | a764c68 | 2013-09-09 10:02:07 -0400 | [diff] [blame] | 93 | boolean accepted = false; |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 94 | private Bitmap call_icon; |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 95 | |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 96 | private SensorManager mSensorManager; |
| 97 | |
| 98 | private Sensor mSensor; |
| 99 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 100 | @Override |
| 101 | public void onCreate(Bundle savedBundle) { |
| 102 | super.onCreate(savedBundle); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 103 | Bundle b = getArguments(); |
alision | cd8fb91 | 2013-06-28 14:43:51 -0400 | [diff] [blame] | 104 | conf = new Conference((Conference) b.getParcelable("conference")); |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 105 | model = new BubbleModel(getResources().getDisplayMetrics().density); |
alision | 729b0a2 | 2013-07-02 11:57:33 -0400 | [diff] [blame] | 106 | BUBBLE_SIZE = getResources().getDimension(R.dimen.bubble_size); |
Alexandre Lision | a764c68 | 2013-09-09 10:02:07 -0400 | [diff] [blame] | 107 | Log.e(TAG, "BUBBLE_SIZE " + BUBBLE_SIZE); |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 108 | mSensorManager = (SensorManager) getActivity().getSystemService(Context.SENSOR_SERVICE); |
| 109 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY); |
alision | 729b0a2 | 2013-07-02 11:57:33 -0400 | [diff] [blame] | 110 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 111 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 112 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 113 | /** |
| 114 | * A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when this fragment is not attached to an activity. |
| 115 | */ |
| 116 | private static Callbacks sDummyCallbacks = new Callbacks() { |
| 117 | @Override |
| 118 | public void onSendMessage(SipCall call, String msg) { |
| 119 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 120 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 121 | @Override |
| 122 | public void callContact(SipCall call) { |
| 123 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 124 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 125 | @Override |
| 126 | public void onCallAccepted(SipCall call) { |
| 127 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 128 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 129 | @Override |
| 130 | public void onCallRejected(SipCall call) { |
| 131 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 132 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 133 | @Override |
| 134 | public void onCallEnded(SipCall call) { |
| 135 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 136 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 137 | @Override |
| 138 | public void onCallSuspended(SipCall call) { |
| 139 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 140 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 141 | @Override |
| 142 | public void onCallResumed(SipCall call) { |
| 143 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 144 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 145 | @Override |
| 146 | public void onCalltransfered(SipCall call, String to) { |
| 147 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 148 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 149 | @Override |
| 150 | public void onRecordCall(SipCall call) { |
| 151 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 152 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 153 | @Override |
| 154 | public ISipService getService() { |
| 155 | return null; |
| 156 | } |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 157 | |
| 158 | @Override |
| 159 | public void replaceCurrentCallDisplayed() { |
| 160 | } |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 161 | |
| 162 | @Override |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 163 | public void startTimer() { |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 164 | } |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 165 | }; |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 166 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 167 | /** |
| 168 | * The Activity calling this fragment has to implement this interface |
| 169 | * |
| 170 | */ |
| 171 | public interface Callbacks { |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 172 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 173 | public ISipService getService(); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 174 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 175 | public void callContact(SipCall call); |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 176 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 177 | public void onCallAccepted(SipCall call); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 178 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 179 | public void onCallRejected(SipCall call); |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 180 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 181 | public void onCallEnded(SipCall call); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 182 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 183 | public void onCallSuspended(SipCall call); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 184 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 185 | public void onCallResumed(SipCall call); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 186 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 187 | public void onCalltransfered(SipCall call, String to); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 188 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 189 | public void onRecordCall(SipCall call); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 190 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 191 | public void onSendMessage(SipCall call, String msg); |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 192 | |
| 193 | public void replaceCurrentCallDisplayed(); |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 194 | |
| 195 | public void startTimer(); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 196 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 197 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 198 | @Override |
| 199 | public void onAttach(Activity activity) { |
| 200 | super.onAttach(activity); |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 201 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 202 | if (!(activity instanceof Callbacks)) { |
| 203 | throw new IllegalStateException("Activity must implement fragment's callbacks."); |
| 204 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 205 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 206 | // rootView.requestDisallowInterceptTouchEvent(true); |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 207 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 208 | mCallbacks = (Callbacks) activity; |
alision | 50fa072 | 2013-06-25 17:29:44 -0400 | [diff] [blame] | 209 | myself = SipCall.SipCallBuilder.buildMyselfCall(activity.getContentResolver(), "Me"); |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 210 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 211 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 212 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 213 | @Override |
| 214 | public void onDetach() { |
| 215 | super.onDetach(); |
| 216 | mCallbacks = sDummyCallbacks; |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 217 | mSensorManager.unregisterListener(this); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 218 | } |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 219 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 220 | @Override |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 221 | public void onStop() { |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 222 | super.onStop(); |
| 223 | } |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 224 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 225 | @Override |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 226 | public void onResume() { |
| 227 | super.onResume(); |
| 228 | mSensorManager.registerListener(this, mSensor, SensorManager.SENSOR_DELAY_NORMAL); |
| 229 | } |
| 230 | |
| 231 | @Override |
| 232 | public void onPause() { |
| 233 | super.onPause(); |
| 234 | mSensorManager.unregisterListener(this); |
| 235 | } |
| 236 | |
| 237 | @Override |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 238 | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 239 | super.onActivityResult(requestCode, resultCode, data); |
| 240 | SipCall transfer = null; |
| 241 | if (requestCode == REQUEST_TRANSFER) { |
| 242 | switch (resultCode) { |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 243 | case TransferDFragment.RESULT_TRANSFER_CONF: |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 244 | Conference c = data.getParcelableExtra("target"); |
| 245 | transfer = data.getParcelableExtra("transfer"); |
| 246 | try { |
| 247 | |
| 248 | mCallbacks.getService().attendedTransfer(transfer.getCallId(), c.getParticipants().get(0).getCallId()); |
| 249 | |
| 250 | } catch (RemoteException e) { |
| 251 | // TODO Auto-generated catch block |
| 252 | e.printStackTrace(); |
| 253 | } |
Alexandre Lision | 6deda41 | 2013-09-25 13:21:22 -0400 | [diff] [blame] | 254 | // Toast.makeText(getActivity(), "Transfer complete", Toast.LENGTH_LONG).show(); |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 255 | break; |
| 256 | |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 257 | case TransferDFragment.RESULT_TRANSFER_NUMBER: |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 258 | String to = data.getStringExtra("to_number"); |
| 259 | transfer = data.getParcelableExtra("transfer"); |
| 260 | try { |
Alexandre Lision | 6deda41 | 2013-09-25 13:21:22 -0400 | [diff] [blame] | 261 | // Toast.makeText(getActivity(), "Transferring " + transfer.getContact().getmDisplayName() + " to " + to, |
| 262 | // Toast.LENGTH_SHORT).show(); |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 263 | mCallbacks.getService().transfer(transfer.getCallId(), to); |
| 264 | mCallbacks.getService().hangUp(transfer.getCallId()); |
| 265 | } catch (RemoteException e) { |
| 266 | // TODO Auto-generated catch block |
| 267 | e.printStackTrace(); |
| 268 | } |
| 269 | break; |
Adrien Béraud | 9751284 | 2013-09-19 13:37:19 +1000 | [diff] [blame] | 270 | case Activity.RESULT_CANCELED: |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 271 | default: |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 272 | model.clear(); |
| 273 | initNormalStateDisplay(); |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 274 | break; |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | @Override |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 280 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
Alexandre Lision | 84208a3 | 2013-09-25 13:18:37 -0400 | [diff] [blame] | 281 | final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.frag_call, container, false); |
alision | 8599211 | 2013-05-29 12:18:08 -0400 | [diff] [blame] | 282 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 283 | view = (BubblesView) rootView.findViewById(R.id.main_view); |
alision | 34673e6 | 2013-06-25 14:40:07 -0400 | [diff] [blame] | 284 | view.setFragment(this); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 285 | view.setModel(model); |
| 286 | view.getHolder().addCallback(this); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 287 | |
Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 288 | callStatusTxt = (TextView) rootView.findViewById(R.id.call_status_txt); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 289 | call_icon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_call); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 290 | |
Alexandre Lision | 84208a3 | 2013-09-25 13:18:37 -0400 | [diff] [blame] | 291 | ((ImageButton) rootView.findViewById(R.id.dialpad_btn)).setOnClickListener(new OnClickListener() { |
| 292 | |
| 293 | @Override |
| 294 | public void onClick(View v) { |
| 295 | InputMethodManager lManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); |
| 296 | lManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY); |
| 297 | } |
| 298 | }); |
| 299 | |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 300 | |
| 301 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 302 | return rootView; |
| 303 | } |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 304 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 305 | private void initNormalStateDisplay() { |
| 306 | Log.i(TAG, "Start normal display"); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 307 | |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 308 | mCallbacks.startTimer(); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 309 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 310 | getBubbleFor(myself, model.width / 2, model.height / 2); |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 311 | |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 312 | int angle_part = 360 / conf.getParticipants().size(); |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 313 | double dX = 0; |
| 314 | double dY = 0; |
alision | 465ceba | 2013-07-04 09:24:30 -0400 | [diff] [blame] | 315 | int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE); |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 316 | for (int i = 0; i < conf.getParticipants().size(); ++i) { |
| 317 | |
| 318 | if (conf.getParticipants().get(i) == null) { |
| 319 | Log.i(TAG, i + " null "); |
| 320 | continue; |
| 321 | } |
alision | 34673e6 | 2013-06-25 14:40:07 -0400 | [diff] [blame] | 322 | dX = Math.cos(Math.toRadians(angle_part * i - 90)) * radiusCalls; |
| 323 | dY = Math.sin(Math.toRadians(angle_part * i - 90)) * radiusCalls; |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 324 | getBubbleFor(conf.getParticipants().get(i), (int) (model.width / 2 + dX), (int) (model.height / 2 + dY)); |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 325 | } |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 326 | |
| 327 | model.clearAttractors(); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 328 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 329 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 330 | private void initIncomingCallDisplay() { |
| 331 | Log.i(TAG, "Start incoming display"); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 332 | |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 333 | mCallbacks.startTimer(); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 334 | |
Alexandre Lision | 23628c1 | 2013-09-24 11:17:05 -0400 | [diff] [blame] | 335 | int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE); |
| 336 | getBubbleFor(myself, model.width / 2, model.height / 2 + radiusCalls); |
| 337 | getBubbleFor(conf.getParticipants().get(0), model.width / 2, model.height / 2 - radiusCalls); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 338 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 339 | model.clearAttractors(); |
Alexandre Lision | 23628c1 | 2013-09-24 11:17:05 -0400 | [diff] [blame] | 340 | model.addAttractor(new Attractor(new PointF(model.width / 2, model.height / 2), ATTRACTOR_SIZE, new Attractor.Callback() { |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 341 | @Override |
| 342 | public boolean onBubbleSucked(Bubble b) { |
Alexandre Lision | a764c68 | 2013-09-09 10:02:07 -0400 | [diff] [blame] | 343 | |
| 344 | if (!accepted) { |
| 345 | mCallbacks.onCallAccepted(conf.getParticipants().get(0)); |
| 346 | accepted = true; |
| 347 | } |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 348 | return false; |
| 349 | } |
| 350 | }, call_icon)); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 351 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 352 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 353 | private void initOutGoingCallDisplay() { |
| 354 | Log.i(TAG, "Start outgoing display"); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 355 | |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 356 | mCallbacks.startTimer(); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 357 | |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 358 | getBubbleFor(myself, model.width / 2, model.height / 2); |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 359 | |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 360 | // TODO off-thread image loading |
| 361 | int angle_part = 360 / conf.getParticipants().size(); |
| 362 | double dX = 0; |
| 363 | double dY = 0; |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 364 | int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE); |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 365 | for (int i = 0; i < conf.getParticipants().size(); ++i) { |
| 366 | dX = Math.cos(Math.toRadians(angle_part * i - 90)) * radiusCalls; |
| 367 | dY = Math.sin(Math.toRadians(angle_part * i - 90)) * radiusCalls; |
| 368 | getBubbleFor(conf.getParticipants().get(i), (int) (model.width / 2 + dX), (int) (model.height / 2 + dY)); |
| 369 | } |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 370 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 371 | model.clearAttractors(); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 372 | } |
alision | 8570418 | 2013-05-29 15:23:03 -0400 | [diff] [blame] | 373 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 374 | /** |
| 375 | * Retrieves or create a bubble for a given contact. If the bubble exists, it is moved to the new location. |
| 376 | * |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 377 | * @param call |
| 378 | * The call associated to a contact |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 379 | * @param x |
| 380 | * Initial or new x position. |
| 381 | * @param y |
| 382 | * Initial or new y position. |
| 383 | * @return Bubble corresponding to the contact. |
| 384 | */ |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 385 | private Bubble getBubbleFor(SipCall call, float x, float y) { |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 386 | Bubble contact_bubble = model.getBubble(call); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 387 | if (contact_bubble != null) { |
| 388 | contact_bubble.attractor.set(x, y); |
| 389 | return contact_bubble; |
| 390 | } |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 391 | |
alision | 34673e6 | 2013-06-25 14:40:07 -0400 | [diff] [blame] | 392 | contact_bubble = new Bubble(getActivity(), call, x, y, BUBBLE_SIZE); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 393 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 394 | model.addBubble(contact_bubble); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 395 | return contact_bubble; |
| 396 | } |
Adrien Béraud | 0c9bd8f | 2013-05-30 16:16:57 +1000 | [diff] [blame] | 397 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 398 | /** |
| 399 | * Should be called when a bubble is removed from the model |
| 400 | */ |
| 401 | void bubbleRemoved(Bubble b) { |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 402 | if (b.associated_call == null) { |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 403 | return; |
| 404 | } |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 405 | } |
Adrien Béraud | c9c424d | 2013-05-30 17:47:35 +1000 | [diff] [blame] | 406 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 407 | public void changeCallState(String callID, String newState) { |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 408 | Log.w(TAG, "Call :" + callID + " " + newState); |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 409 | if (newState.contentEquals("FAILURE")) { |
| 410 | try { |
| 411 | mCallbacks.getService().hangUp(callID); |
| 412 | } catch (RemoteException e) { |
| 413 | e.printStackTrace(); |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 414 | } |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 415 | } |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 416 | for (int i = 0; i < conf.getParticipants().size(); ++i) { |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 417 | if (callID.equals(conf.getParticipants().get(i).getCallId())) { |
| 418 | if (newState.contentEquals("HUNGUP")) { |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 419 | model.removeBubble(conf.getParticipants().get(i)); |
| 420 | conf.getParticipants().remove(i); |
| 421 | } else { |
| 422 | conf.getParticipants().get(i).setCallState(newState); |
| 423 | } |
| 424 | } |
| 425 | } |
| 426 | |
| 427 | if (conf.isOnGoing()) |
| 428 | initNormalStateDisplay(); |
| 429 | |
| 430 | if (conf.getParticipants().size() == 0) { |
| 431 | mCallbacks.replaceCurrentCallDisplayed(); |
| 432 | } |
| 433 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 434 | } |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 435 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 436 | public boolean draggingBubble() { |
| 437 | return view == null ? false : view.isDraggingBubble(); |
| 438 | } |
Adrien Béraud | c9c424d | 2013-05-30 17:47:35 +1000 | [diff] [blame] | 439 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 440 | @Override |
| 441 | public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { |
Adrien Béraud | 13cde0b | 2013-05-30 20:27:20 +1000 | [diff] [blame] | 442 | |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 443 | if (conf.getParticipants().size() == 1) { |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 444 | if (conf.getParticipants().get(0).isIncoming() && conf.getParticipants().get(0).isRinging()) { |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 445 | initIncomingCallDisplay(); |
| 446 | } else { |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 447 | if (conf.getParticipants().get(0).isRinging()) { |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 448 | initOutGoingCallDisplay(); |
| 449 | } |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 450 | try { |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 451 | if (conf.getParticipants().get(0).isOutGoing() |
| 452 | && mCallbacks.getService().getCall(conf.getParticipants().get(0).getCallId()) == null) { |
| 453 | mCallbacks.getService().placeCall(conf.getParticipants().get(0)); |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 454 | initOutGoingCallDisplay(); |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 455 | } else if (conf.getParticipants().get(0).isOutGoing() && conf.getParticipants().get(0).isRinging()) { |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 456 | initOutGoingCallDisplay(); |
| 457 | } |
| 458 | } catch (RemoteException e) { |
| 459 | Log.e(TAG, e.toString()); |
| 460 | } |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 461 | } |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 462 | if (conf.getParticipants().get(0).isOngoing()) { |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 463 | initNormalStateDisplay(); |
| 464 | } |
alision | df1dac9 | 2013-06-27 17:35:53 -0400 | [diff] [blame] | 465 | } else if (conf.getParticipants().size() > 1) { |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 466 | initNormalStateDisplay(); |
| 467 | } |
Adrien Béraud | 13cde0b | 2013-05-30 20:27:20 +1000 | [diff] [blame] | 468 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 469 | } |
Adrien Béraud | 13cde0b | 2013-05-30 20:27:20 +1000 | [diff] [blame] | 470 | |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 471 | public void makeTransfer(Bubble contact) { |
| 472 | FragmentManager fm = getFragmentManager(); |
| 473 | TransferDFragment editName = new TransferDFragment(); |
| 474 | |
| 475 | Bundle b = new Bundle(); |
| 476 | b.putParcelableArrayList("calls", new ArrayList<Conference>()); |
| 477 | b.putParcelable("call_selected", contact.associated_call); |
| 478 | editName.setArguments(b); |
| 479 | editName.setTargetFragment(this, REQUEST_TRANSFER); |
| 480 | editName.show(fm, ""); |
Alexandre Lision | 2b23792 | 2013-09-09 16:23:02 -0400 | [diff] [blame] | 481 | } |
| 482 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 483 | @Override |
| 484 | public void surfaceCreated(SurfaceHolder holder) { |
| 485 | } |
Adrien Béraud | 13cde0b | 2013-05-30 20:27:20 +1000 | [diff] [blame] | 486 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 487 | @Override |
| 488 | public void surfaceDestroyed(SurfaceHolder holder) { |
Alexandre Lision | 84208a3 | 2013-09-25 13:18:37 -0400 | [diff] [blame] | 489 | // check that soft input is hidden |
| 490 | InputMethodManager lManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); |
| 491 | lManager.hideSoftInputFromWindow(view.getWindowToken(), 0); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 492 | } |
Adrien Béraud | 13cde0b | 2013-05-30 20:27:20 +1000 | [diff] [blame] | 493 | |
alision | e38001f | 2013-06-04 14:14:39 -0400 | [diff] [blame] | 494 | public BubblesView getBubbleView() { |
| 495 | return view; |
alision | e38001f | 2013-06-04 14:14:39 -0400 | [diff] [blame] | 496 | |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 497 | } |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 498 | |
| 499 | public void updateTime() { |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 500 | long duration = System.currentTimeMillis() / 1000 - this.conf.getParticipants().get(0).getTimestamp_start(); |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 501 | callStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60)); |
| 502 | |
| 503 | } |
| 504 | |
| 505 | @Override |
| 506 | public void onAccuracyChanged(Sensor sensor, int accuracy) { |
| 507 | Log.i(TAG, "onAccuracyChanged"); |
| 508 | |
| 509 | } |
| 510 | |
| 511 | @Override |
| 512 | public void onSensorChanged(SensorEvent event) { |
| 513 | Log.i(TAG, "onSensorChanged:" + event.sensor.getName()); |
| 514 | Log.i(TAG, "onSensorChanged:" + event.sensor.getType()); |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 515 | // if (event.values[0] == 0) { |
| 516 | // // PowerManager pm = (PowerManager) getActivity().getSystemService(Context.POWER_SERVICE); |
| 517 | // // pm.goToSleep(SystemClock.uptimeMillis()); |
| 518 | // WindowManager.LayoutParams params = getActivity().getWindow().getAttributes(); |
| 519 | // params.flags |= WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; |
| 520 | // params.screenBrightness = 0.004f; |
| 521 | // getActivity().getWindow().setAttributes(params); |
| 522 | // // Settings.System.putInt(getActivity().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 1000); |
| 523 | // } else { |
| 524 | // WindowManager.LayoutParams params = getActivity().getWindow().getAttributes(); |
| 525 | // params.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; |
| 526 | // params.screenBrightness = 1f; |
| 527 | // getActivity().getWindow().setAttributes(params); |
| 528 | // } |
Alexandre Lision | f1850c0 | 2013-09-23 14:19:34 -0400 | [diff] [blame] | 529 | // Sensor.TYPE_PROXIMITY |
Adrien Béraud | e78d06f | 2013-09-19 13:33:44 +1000 | [diff] [blame] | 530 | |
Alexandre Lision | 0c38451 | 2013-09-17 17:15:57 -0400 | [diff] [blame] | 531 | } |
Alexandre Lision | 0edf18c | 2013-09-23 17:35:50 -0400 | [diff] [blame] | 532 | |
| 533 | public Conference getConference() { |
| 534 | return conf; |
| 535 | } |
Alexandre Lision | 64dc8c0 | 2013-09-25 15:32:25 -0400 | [diff] [blame^] | 536 | |
| 537 | public void onKeyUp(int keyCode, KeyEvent event) { |
| 538 | try { |
| 539 | Log.d(TAG, "Sending "+event.getDisplayLabel()); |
| 540 | String toSend = "" + event.getDisplayLabel(); |
| 541 | mCallbacks.getService().playDtmf(toSend); |
| 542 | } catch (RemoteException e) { |
| 543 | e.printStackTrace(); |
| 544 | } |
| 545 | } |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 546 | } |