alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2012 Savoir-Faire Linux Inc. |
| 3 | * |
| 4 | * Author: Adrien Beraud <adrien.beraud@gmail.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 | package com.savoirfairelinux.sflphone.fragments; |
| 32 | |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 33 | import java.util.ArrayList; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 34 | import java.util.HashMap; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 35 | |
| 36 | import android.app.Activity; |
| 37 | import android.app.AlertDialog; |
| 38 | import android.app.ListFragment; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 39 | import android.content.Context; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 40 | import android.content.DialogInterface; |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 41 | import android.content.Intent; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 42 | import android.os.Bundle; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 43 | import android.os.RemoteException; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 44 | import android.util.Log; |
| 45 | import android.view.LayoutInflater; |
alision | d8c8388 | 2013-05-17 17:00:42 -0400 | [diff] [blame] | 46 | import android.view.Menu; |
| 47 | import android.view.MenuInflater; |
| 48 | import android.view.MenuItem; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 49 | import android.view.View; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 50 | import android.view.View.OnClickListener; |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 51 | import android.view.ViewGroup; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 52 | import android.widget.AdapterView; |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 53 | import android.widget.AdapterView.OnItemClickListener; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 54 | import android.widget.AdapterView.OnItemLongClickListener; |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 55 | import android.widget.Button; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 56 | import android.widget.ListView; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 57 | import android.widget.Toast; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 58 | |
| 59 | import com.savoirfairelinux.sflphone.R; |
alision | a432515 | 2013-04-19 11:10:03 -0400 | [diff] [blame] | 60 | import com.savoirfairelinux.sflphone.adapters.CallElementAdapter; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 61 | import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity; |
alision | d8c8388 | 2013-05-17 17:00:42 -0400 | [diff] [blame] | 62 | import com.savoirfairelinux.sflphone.client.SFLPhonePreferenceActivity; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 63 | import com.savoirfairelinux.sflphone.model.SipCall; |
| 64 | import com.savoirfairelinux.sflphone.service.ISipService; |
| 65 | |
| 66 | /** |
| 67 | * Main list of Call Elements. We don't manage contacts ourself so they are |
| 68 | */ |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame^] | 69 | public class HomeFragment extends ListFragment { |
| 70 | private static final String TAG = HomeFragment.class.getSimpleName(); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 71 | private CallElementAdapter mAdapter; |
alision | a432515 | 2013-04-19 11:10:03 -0400 | [diff] [blame] | 72 | |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 73 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 74 | private Callbacks mCallbacks = sDummyCallbacks; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 75 | Button access_calls; |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 76 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 77 | /** |
| 78 | * A dummy implementation of the {@link Callbacks} interface that does nothing. Used only when this fragment is not attached to an activity. |
| 79 | */ |
| 80 | private static Callbacks sDummyCallbacks = new Callbacks() { |
| 81 | @Override |
| 82 | public void onCallSelected(SipCall c) { |
| 83 | } |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 84 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 85 | @Override |
| 86 | public ISipService getService() { |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 87 | Log.i(TAG, "I'm a dummy"); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 88 | return null; |
| 89 | } |
| 90 | }; |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 91 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 92 | /** |
| 93 | * The Activity calling this fragment has to implement this interface |
| 94 | * |
| 95 | */ |
| 96 | public interface Callbacks { |
| 97 | public void onCallSelected(SipCall c); |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 98 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 99 | public ISipService getService(); |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 100 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 101 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 102 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 103 | @Override |
| 104 | public void onAttach(Activity activity) { |
| 105 | super.onAttach(activity); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 106 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 107 | if (!(activity instanceof Callbacks)) { |
| 108 | throw new IllegalStateException("Activity must implement fragment's callbacks."); |
| 109 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 110 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 111 | mCallbacks = (Callbacks) activity; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 112 | |
| 113 | |
| 114 | } |
| 115 | |
| 116 | @Override |
| 117 | public void onResume(){ |
| 118 | super.onResume(); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 119 | if (mCallbacks.getService() != null) { |
| 120 | try { |
| 121 | HashMap<String, SipCall> calls = (HashMap<String, SipCall>) mCallbacks.getService().getCallList(); |
| 122 | Log.i(TAG, "Call size "+calls.size()); |
| 123 | access_calls.setText(calls.size()+" on going calls"); |
| 124 | |
| 125 | |
| 126 | } catch (RemoteException e) { |
| 127 | Log.e(TAG, e.toString()); |
| 128 | } |
| 129 | } |
| 130 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 131 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 132 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 133 | @Override |
| 134 | public void onDetach() { |
| 135 | super.onDetach(); |
| 136 | mCallbacks = sDummyCallbacks; |
| 137 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 138 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 139 | /** |
| 140 | * Runnable that fill information in a contact card asynchroniously. |
| 141 | */ |
| 142 | /* |
| 143 | * public static class InfosLoader implements Runnable { private View view; private long cid; private ContentResolver cr; |
| 144 | * |
| 145 | * public InfosLoader(Context context, View element, long contact_id) { cid = contact_id; cr = context.getContentResolver(); view = element; } |
| 146 | * |
| 147 | * public static Bitmap loadContactPhoto(ContentResolver cr, long id) { Uri uri = |
| 148 | * ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, id); InputStream input = |
| 149 | * ContactsContract.Contacts.openContactPhotoInputStream(cr, uri); if (input == null) { return null; } return BitmapFactory.decodeStream(input); } |
| 150 | * |
| 151 | * @Override public void run() { final Bitmap photo_bmp = loadContactPhoto(cr, cid); |
| 152 | * |
| 153 | * Cursor phones = cr.query(CommonDataKinds.Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION, CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[] |
| 154 | * { Long.toString(cid) }, null); |
| 155 | * |
| 156 | * final List<String> numbers = new ArrayList<String>(); while (phones.moveToNext()) { String number = |
| 157 | * phones.getString(phones.getColumnIndex(CommonDataKinds.Phone.NUMBER)); // int type = |
| 158 | * phones.getInt(phones.getColumnIndex(CommonDataKinds.Phone.TYPE)); numbers.add(number); } phones.close(); // TODO: same for SIP adresses. |
| 159 | * |
| 160 | * final Bitmap bmp = photo_bmp; view.post(new Runnable() { |
| 161 | * |
| 162 | * @Override public void run() { } }); } } |
| 163 | */ |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 164 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 165 | public void addCall(SipCall c) { |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 166 | // Log.i(TAG, "Adding call " + c.mCallInfo.mDisplayName); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 167 | if (mAdapter == null) { |
| 168 | Log.w(TAG, "mAdapter is null"); |
| 169 | return; |
| 170 | } |
| 171 | mAdapter.add(c); |
| 172 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 173 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 174 | // public void removeCall(SipCall c) { |
| 175 | // Log.i(TAG, "Removing call " + c.mCallInfo.mDisplayName); |
| 176 | // mAdapter.remove(c); |
| 177 | // } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 178 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 179 | @Override |
| 180 | public void onCreate(Bundle savedInstanceState) { |
| 181 | super.onCreate(savedInstanceState); |
| 182 | mAdapter = new CallElementAdapter(getActivity(), new ArrayList<SipCall>()); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 183 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 184 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 185 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 186 | @Override |
| 187 | public void onActivityCreated(Bundle savedInstanceState) { |
| 188 | super.onActivityCreated(savedInstanceState); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 189 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 190 | // Give some text to display if there is no data. In a real |
| 191 | // application this would come from a resource. |
| 192 | // setEmptyText("No phone numbers"); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 193 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 194 | // We have a menu item to show in action bar. |
| 195 | setHasOptionsMenu(true); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 196 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 197 | final Context context = getActivity(); |
| 198 | ListView lv = getListView(); |
| 199 | lv.setAdapter(mAdapter); |
| 200 | lv.setOnItemLongClickListener(new OnItemLongClickListener() { |
| 201 | @Override |
| 202 | public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) { |
| 203 | Log.i(TAG, "On Long Click"); |
| 204 | final CharSequence[] items = { "Hang up Call", "Send Message", "Add to Conference" }; |
| 205 | final SipCall call = mAdapter.getItem(pos); |
| 206 | // // FIXME |
| 207 | // service = sflphoneApplication.getSipService(); |
| 208 | AlertDialog.Builder builder = new AlertDialog.Builder(context); |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 209 | builder.setTitle("Action to perform with " + call.getContacts().get(0).getmDisplayName()).setCancelable(true) |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 210 | .setItems(items, new DialogInterface.OnClickListener() { |
| 211 | @Override |
| 212 | public void onClick(DialogInterface dialog, int item) { |
| 213 | Log.i(TAG, "Selected " + items[item]); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 214 | // switch (item) { |
| 215 | // case 0: |
| 216 | // call.notifyServiceHangup(service); |
| 217 | // break; |
| 218 | // case 1: |
| 219 | // call.sendTextMessage(); |
| 220 | // // Need to hangup this call immediately since no way to do it after this action |
| 221 | // call.notifyServiceHangup(service); |
| 222 | // break; |
| 223 | // case 2: |
| 224 | // call.addToConference(); |
| 225 | // // Need to hangup this call immediately since no way to do it after this action |
| 226 | // call.notifyServiceHangup(service); |
| 227 | // break; |
| 228 | // default: |
| 229 | // break; |
| 230 | // } |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 231 | } |
| 232 | }); |
| 233 | AlertDialog alert = builder.create(); |
| 234 | alert.show(); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 235 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 236 | return true; |
| 237 | } |
| 238 | }); |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 239 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 240 | lv.setOnItemClickListener(new OnItemClickListener() { |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 241 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 242 | @Override |
| 243 | public void onItemClick(AdapterView<?> arg0, View v, int pos, long arg3) { |
| 244 | mCallbacks.onCallSelected(mAdapter.getItem(pos)); |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 245 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 246 | } |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 247 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 248 | }); |
| 249 | } |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 250 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 251 | @Override |
| 252 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { |
| 253 | inflater.inflate(R.menu.call_element_menu, menu); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 254 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 255 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 256 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame^] | 257 | // private static final int REQUEST_CODE_PREFERENCES = 1; |
| 258 | // |
| 259 | // @Override |
| 260 | // public boolean onOptionsItemSelected(MenuItem item) { |
| 261 | // Log.i(TAG, "onOptionsItemSelected " + item.getItemId()); |
| 262 | // switch (item.getItemId()) { |
| 263 | // case R.id.menu_settings: |
| 264 | // Intent launchPreferencesIntent = new Intent().setClass(getActivity(), SFLPhonePreferenceActivity.class); |
| 265 | // startActivityForResult(launchPreferencesIntent, SFLPhoneHomeActivity.REQUEST_CODE_PREFERENCES); |
| 266 | // break; |
| 267 | // } |
| 268 | // |
| 269 | // return super.onOptionsItemSelected(item); |
| 270 | // } |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 271 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 272 | public void updateCall(String iD, String newState) { |
| 273 | if (mAdapter == null) { |
| 274 | Log.w(TAG, "mAdapter is null"); |
| 275 | return; |
| 276 | } |
| 277 | mAdapter.update(iD, newState); |
| 278 | } |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 279 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 280 | @Override |
| 281 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { |
| 282 | Log.i(TAG, "onCreateView"); |
| 283 | View inflatedView = inflater.inflate(R.layout.frag_call_element, container, false); |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 284 | |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 285 | access_calls = (Button) inflatedView.findViewById(R.id.access_callactivity); |
| 286 | |
| 287 | access_calls.setOnClickListener(new OnClickListener() { |
| 288 | |
| 289 | @Override |
| 290 | public void onClick(View v) { |
| 291 | HashMap<String, SipCall> calls; |
| 292 | try { |
| 293 | calls = (HashMap<String, SipCall>) mCallbacks.getService().getCallList(); |
| 294 | if (calls.size() == 0) { |
| 295 | Toast.makeText(getActivity(), "No calls", Toast.LENGTH_SHORT).show(); |
| 296 | } else { |
| 297 | mCallbacks.onCallSelected((SipCall) calls.values().toArray()[0]); |
| 298 | } |
| 299 | } catch (RemoteException e) { |
| 300 | Log.e(TAG, e.toString()); |
| 301 | } |
| 302 | |
| 303 | } |
| 304 | }); |
| 305 | |
| 306 | |
| 307 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 308 | // ((Button) inflatedView.findViewById(R.id.button_attended)).setOnClickListener(new OnClickListener() { |
| 309 | // |
| 310 | // @Override |
| 311 | // public void onClick(View v) { |
| 312 | // if (mAdapter.getCount() == 2) { |
| 313 | // try { |
| 314 | // service.attendedTransfer(mAdapter.getItem(0).getCallId(), mAdapter.getItem(1).getCallId()); |
| 315 | // mAdapter.clear(); |
| 316 | // } catch (RemoteException e) { |
| 317 | // Log.e(TAG, e.toString()); |
| 318 | // } |
| 319 | // } else { |
| 320 | // Toast.makeText(getActivity(), "You need two calls one on Hold the other current to bind them", Toast.LENGTH_LONG).show(); |
| 321 | // } |
| 322 | // |
| 323 | // } |
| 324 | // }); |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 325 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 326 | // ((Button) inflatedView.findViewById(R.id.button_conf)).setOnClickListener(new OnClickListener() { |
| 327 | // |
| 328 | // @Override |
| 329 | // public void onClick(View v) { |
| 330 | // if (mAdapter.getCount() == 2) { |
| 331 | // try { |
| 332 | // service.joinParticipant(mAdapter.getItem(0).getCallId(), mAdapter.getItem(1).getCallId()); |
| 333 | // } catch (RemoteException e) { |
| 334 | // Log.e(TAG, e.toString()); |
| 335 | // } |
| 336 | // } else { |
| 337 | // Toast.makeText(getActivity(), "You need two calls one on Hold the other current to create a conference", Toast.LENGTH_LONG) |
| 338 | // .show(); |
| 339 | // } |
| 340 | // } |
| 341 | // }); |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 342 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 343 | // ((ToggleButton) inflatedView.findViewById(R.id.switch_hold)).setOnCheckedChangeListener(new OnCheckedChangeListener() { |
| 344 | // |
| 345 | // @Override |
| 346 | // public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
| 347 | // try { |
| 348 | // ArrayList<String> confList = (ArrayList<String>) service.getConferenceList(); |
| 349 | // if (!confList.isEmpty()) { |
| 350 | // if (isChecked) { |
| 351 | // service.holdConference(confList.get(0)); |
| 352 | // } else { |
| 353 | // service.unholdConference(confList.get(0)); |
| 354 | // } |
| 355 | // } |
| 356 | // } catch (RemoteException e) { |
| 357 | // Log.e(TAG, e.toString()); |
| 358 | // } |
| 359 | // |
| 360 | // } |
| 361 | // }); |
alision | 43a9b36 | 2013-05-01 16:30:15 -0400 | [diff] [blame] | 362 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 363 | return inflatedView; |
| 364 | } |
alision | e2a38e1 | 2013-04-25 14:20:20 -0400 | [diff] [blame] | 365 | |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 366 | |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 367 | } |