blob: 1a26b155a8e315fed6ff4f96afa1d88f1650674d [file] [log] [blame]
alisionf76de3b2013-04-16 15:35:22 -04001/*
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 */
31package com.savoirfairelinux.sflphone.client;
32
alisionf76de3b2013-04-16 15:35:22 -040033import android.app.ActionBar;
34import android.app.Activity;
35import android.app.Fragment;
alisionf76de3b2013-04-16 15:35:22 -040036import android.app.FragmentTransaction;
37import android.content.ComponentName;
38import android.content.Context;
39import android.content.Intent;
alisionf76de3b2013-04-16 15:35:22 -040040import android.content.ServiceConnection;
41import android.os.Bundle;
42import android.os.IBinder;
alision5f899632013-04-22 17:26:56 -040043import android.os.RemoteException;
alision9f7a6ec2013-05-24 16:26:26 -040044import android.support.v4.app.ActionBarDrawerToggle;
45import android.support.v4.view.GravityCompat;
alisionf76de3b2013-04-16 15:35:22 -040046import android.support.v4.view.ViewPager;
alision9f7a6ec2013-05-24 16:26:26 -040047import android.support.v4.widget.DrawerLayout;
alisionf76de3b2013-04-16 15:35:22 -040048import android.util.Log;
alision9f7a6ec2013-05-24 16:26:26 -040049import android.view.MenuItem;
50import android.view.View;
51import android.view.View.OnClickListener;
alisionf76de3b2013-04-16 15:35:22 -040052import android.widget.ImageButton;
alision7297bdb2013-05-21 11:56:55 -040053import android.widget.RelativeLayout;
alision04a00182013-05-10 17:05:29 -040054import android.widget.Toast;
alisionf76de3b2013-04-16 15:35:22 -040055
56import com.savoirfairelinux.sflphone.R;
alision9f7a6ec2013-05-24 16:26:26 -040057import com.savoirfairelinux.sflphone.adapters.SectionsPagerAdapter;
alisionf76de3b2013-04-16 15:35:22 -040058import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
59import com.savoirfairelinux.sflphone.fragments.ContactListFragment;
alision7297bdb2013-05-21 11:56:55 -040060import com.savoirfairelinux.sflphone.fragments.DialingFragment;
alisiond9e29442013-04-17 16:10:18 -040061import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
alision9f7a6ec2013-05-24 16:26:26 -040062import com.savoirfairelinux.sflphone.fragments.MenuFragment;
alisionf76de3b2013-04-16 15:35:22 -040063import com.savoirfairelinux.sflphone.model.SipCall;
alision5f899632013-04-22 17:26:56 -040064import com.savoirfairelinux.sflphone.service.ISipClient;
alisionf76de3b2013-04-16 15:35:22 -040065import com.savoirfairelinux.sflphone.service.ISipService;
66import com.savoirfairelinux.sflphone.service.SipService;
alision7297bdb2013-05-21 11:56:55 -040067import com.savoirfairelinux.sflphone.views.CustomSlidingDrawer;
alisionf76de3b2013-04-16 15:35:22 -040068
alision9f7a6ec2013-05-24 16:26:26 -040069public class SFLPhoneHomeActivity extends Activity implements ActionBar.TabListener, DialingFragment.Callbacks, CallElementListFragment.Callbacks,
70 HistoryFragment.Callbacks {
71 SectionsPagerAdapter mSectionsPagerAdapter = null;
72 static final String TAG = "SFLPhoneHome";
alisionf76de3b2013-04-16 15:35:22 -040073
alision9f7a6ec2013-05-24 16:26:26 -040074 ImageButton buttonCall, buttonHangup;
75 private ContactListFragment mContactsFragment = null;
76 private DialingFragment mDialingFragment = null;
77 private CallElementListFragment mCallElementList = null;
78 private HistoryFragment mHistorySectionFragment = null;
alisionf76de3b2013-04-16 15:35:22 -040079
alision9f7a6ec2013-05-24 16:26:26 -040080 Fragment fMenu;
alisionf76de3b2013-04-16 15:35:22 -040081
alision9f7a6ec2013-05-24 16:26:26 -040082 private boolean mBound = false;
83 private ISipService service;
alisionf76de3b2013-04-16 15:35:22 -040084
alision9f7a6ec2013-05-24 16:26:26 -040085 private CharSequence mDrawerTitle;
86 private CharSequence mTitle;
alisionf76de3b2013-04-16 15:35:22 -040087
alision9f7a6ec2013-05-24 16:26:26 -040088 private static final int REQUEST_CODE_PREFERENCES = 1;
89 private static final int REQUEST_CODE_CALL = 2;
alisionf76de3b2013-04-16 15:35:22 -040090
alision9f7a6ec2013-05-24 16:26:26 -040091 private static final int ACTION_BAR_TAB_DIALING = 0;
92 private static final int ACTION_BAR_TAB_CALL = 1;
93 private static final int ACTION_BAR_TAB_HISTORY = 2;
alisionf76de3b2013-04-16 15:35:22 -040094
alision9f7a6ec2013-05-24 16:26:26 -040095 RelativeLayout mSliderButton;
96 CustomSlidingDrawer mDrawer;
alisionf76de3b2013-04-16 15:35:22 -040097
alision9f7a6ec2013-05-24 16:26:26 -040098 private DrawerLayout mDrawerLayout;
alisionf76de3b2013-04-16 15:35:22 -040099
alision9f7a6ec2013-05-24 16:26:26 -0400100 private ActionBarDrawerToggle mDrawerToggle;
101 /**
102 * The {@link ViewPager} that will host the section contents.
103 */
104 ViewPager mViewPager;
alisionf76de3b2013-04-16 15:35:22 -0400105
alision9f7a6ec2013-05-24 16:26:26 -0400106 final private int[] icon_res_id = { R.drawable.ic_tab_call, R.drawable.ic_tab_call, R.drawable.ic_tab_history };
alisionf76de3b2013-04-16 15:35:22 -0400107
alision9f7a6ec2013-05-24 16:26:26 -0400108 // public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
109
110 /* called before activity is killed, e.g. rotation */
111 @Override
112 protected void onSaveInstanceState(Bundle bundle) {
113 super.onSaveInstanceState(bundle);
114 for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
115 try {
116 getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getItem(i));
117 } catch (IllegalStateException e) {
118 Log.e(TAG, "fragment=" + mSectionsPagerAdapter.getItem(i));
119 }
120 }
121
122 getFragmentManager().putFragment(bundle, "ContactsListFragment", mContactsFragment);
123 Log.w(TAG, "onSaveInstanceState()");
124 }
125
126 @Override
127 public void onCreate(Bundle savedInstanceState) {
128 super.onCreate(savedInstanceState);
129
130 String libraryPath = getApplicationInfo().dataDir + "/lib";
131 Log.i(TAG, libraryPath);
132
133 // Bind to LocalService
134 if (!mBound) {
135 Log.i(TAG, "onStart: Binding service...");
136 Intent intent = new Intent(this, SipService.class);
137 bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
138 }
139
140 setContentView(R.layout.activity_sflphone_home);
141
142 if (mSectionsPagerAdapter == null) {
143 mSectionsPagerAdapter = new SectionsPagerAdapter(this, getFragmentManager());
144 }
145
146 /* getFragment(Bundle, String) */
147 if (savedInstanceState != null) {
148 Log.w(TAG, "Activity restarted, recreating PagerAdapter...");
149 /* getFragment (Bundle bundle, String key) */
150 mDialingFragment = (DialingFragment) getFragmentManager().getFragment(savedInstanceState,
151 mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_DIALING));
152 mCallElementList = (CallElementListFragment) getFragmentManager().getFragment(savedInstanceState,
153 mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CALL));
154 mHistorySectionFragment = (HistoryFragment) getFragmentManager().getFragment(savedInstanceState,
155 mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_HISTORY));
156 }
157
158 if (mDialingFragment == null) {
159 mDialingFragment = new DialingFragment();
alision7297bdb2013-05-21 11:56:55 -0400160 Log.w(TAG, "Recreated mDialingFragment=" + mDialingFragment);
alision9f7a6ec2013-05-24 16:26:26 -0400161 }
alisionf76de3b2013-04-16 15:35:22 -0400162
alision9f7a6ec2013-05-24 16:26:26 -0400163 if (mContactsFragment == null) {
164 mContactsFragment = new ContactListFragment();
165 Log.w(TAG, "Recreated mContactListFragment=" + mContactsFragment);
166 getFragmentManager().beginTransaction().replace(R.id.contacts_frame, mContactsFragment).commit();
167 }
168 if (mCallElementList == null) {
169 mCallElementList = new CallElementListFragment();
170 Log.w(TAG, "Recreated mCallElementList=" + mCallElementList);
171 }
172 if (mHistorySectionFragment == null) {
173 mHistorySectionFragment = new HistoryFragment();
174 Log.w(TAG, "Recreated mHistorySectionFragment=" + mHistorySectionFragment);
175 }
176
177 mDrawer = (CustomSlidingDrawer) findViewById(R.id.custom_sliding_drawer);
alision7297bdb2013-05-21 11:56:55 -0400178 mSliderButton = (RelativeLayout) findViewById(R.id.slider_button);
alision9f7a6ec2013-05-24 16:26:26 -0400179 ((ImageButton) mSliderButton.findViewById(R.id.contact_search)).setTag(R.id.contact_search, false);
180 ((ImageButton) mSliderButton.findViewById(R.id.contact_search)).setOnClickListener(new OnClickListener() {
alision7297bdb2013-05-21 11:56:55 -0400181
alision9f7a6ec2013-05-24 16:26:26 -0400182 @Override
183 public void onClick(View v) {
184 Log.i(TAG, "Click on serach");
185 mDrawer.toggle();
alision7297bdb2013-05-21 11:56:55 -0400186
alision9f7a6ec2013-05-24 16:26:26 -0400187 }
188 });
alision7297bdb2013-05-21 11:56:55 -0400189 mDrawer.setmTrackHandle(findViewById(R.id.handle_title));
alisionf76de3b2013-04-16 15:35:22 -0400190
alision9f7a6ec2013-05-24 16:26:26 -0400191 final ActionBar actionBar = getActionBar();
192 actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
alisionf76de3b2013-04-16 15:35:22 -0400193
alision9f7a6ec2013-05-24 16:26:26 -0400194 // Set up the ViewPager with the sections adapter.
195 mViewPager = (ViewPager) findViewById(R.id.pager);
196 mViewPager.setAdapter(mSectionsPagerAdapter);
alisionf76de3b2013-04-16 15:35:22 -0400197
alision9f7a6ec2013-05-24 16:26:26 -0400198 mTitle = mDrawerTitle = getTitle();
199 mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
200 // mDrawerList = (ListView) findViewById(R.id.left_drawer);
alisionf76de3b2013-04-16 15:35:22 -0400201
alision9f7a6ec2013-05-24 16:26:26 -0400202 // set a custom shadow that overlays the main content when the drawer opens
203 mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
204 // set up the drawer's list view with items and click listener
205 // mDrawerList.setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, mPlanetTitles));
206 // mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
alisionf76de3b2013-04-16 15:35:22 -0400207
alision9f7a6ec2013-05-24 16:26:26 -0400208 getActionBar().setDisplayHomeAsUpEnabled(true);
209 getActionBar().setHomeButtonEnabled(true);
alisionf76de3b2013-04-16 15:35:22 -0400210
alision9f7a6ec2013-05-24 16:26:26 -0400211 mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
212 mDrawerLayout, /* DrawerLayout object */
213 R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
214 R.string.drawer_open, /* "open drawer" description for accessibility */
215 R.string.drawer_close /* "close drawer" description for accessibility */
216 ) {
217 public void onDrawerClosed(View view) {
218 getActionBar().setTitle(mTitle);
219 invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
220 }
alisionf76de3b2013-04-16 15:35:22 -0400221
alision9f7a6ec2013-05-24 16:26:26 -0400222 public void onDrawerOpened(View drawerView) {
223 getActionBar().setTitle(mDrawerTitle);
224 invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
225 }
226 };
alisionf76de3b2013-04-16 15:35:22 -0400227
alision9f7a6ec2013-05-24 16:26:26 -0400228 mDrawerLayout.setDrawerListener(mDrawerToggle);
alisionf76de3b2013-04-16 15:35:22 -0400229
alision9f7a6ec2013-05-24 16:26:26 -0400230 mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
231 @Override
232 public void onPageSelected(int position) {
233 actionBar.setSelectedNavigationItem(position);
234 }
235 });
alisionf76de3b2013-04-16 15:35:22 -0400236
alision9f7a6ec2013-05-24 16:26:26 -0400237 // For each of the sections in the app, add a tab to the action bar.
238 for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
alisionf76de3b2013-04-16 15:35:22 -0400239
alision9f7a6ec2013-05-24 16:26:26 -0400240 actionBar.addTab(actionBar.newTab().setIcon(icon_res_id[i]).setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
241 }
alisionf76de3b2013-04-16 15:35:22 -0400242
alision9f7a6ec2013-05-24 16:26:26 -0400243 actionBar.setSelectedNavigationItem(ACTION_BAR_TAB_CALL);
alisionf76de3b2013-04-16 15:35:22 -0400244
alision9f7a6ec2013-05-24 16:26:26 -0400245 fMenu = new MenuFragment();
246 getFragmentManager().beginTransaction().replace(R.id.left_drawer, fMenu).commit();
247 }
alisionf76de3b2013-04-16 15:35:22 -0400248
alision9f7a6ec2013-05-24 16:26:26 -0400249 @Override
250 protected void onStart() {
251 Log.i(TAG, "onStart");
252 super.onStart();
253 }
alisionf76de3b2013-04-16 15:35:22 -0400254
alision9f7a6ec2013-05-24 16:26:26 -0400255 /* user gets back to the activity, e.g. through task manager */
256 @Override
257 protected void onRestart() {
258 super.onRestart();
259 }
alisionf76de3b2013-04-16 15:35:22 -0400260
alision9f7a6ec2013-05-24 16:26:26 -0400261 /* activity gets back to the foreground and user input */
262 @Override
263 protected void onResume() {
264 Log.i(TAG, "onResume");
265 super.onResume();
266 }
alisione2a38e12013-04-25 14:20:20 -0400267
alision9f7a6ec2013-05-24 16:26:26 -0400268 /* activity no more in foreground */
269 @Override
270 protected void onPause() {
271 super.onPause();
272 }
alisionf76de3b2013-04-16 15:35:22 -0400273
alision9f7a6ec2013-05-24 16:26:26 -0400274 /* activity is no longer visible */
275 @Override
276 protected void onStop() {
277 super.onStop();
278 }
alisionf76de3b2013-04-16 15:35:22 -0400279
alision9f7a6ec2013-05-24 16:26:26 -0400280 /* activity finishes itself or is being killed by the system */
281 @Override
282 protected void onDestroy() {
283 /* stop the service, if no other bound user, no need to check if it is running */
284 if (mBound) {
285 Log.i(TAG, "onDestroy: Unbinding service...");
286 unbindService(mConnection);
287 mBound = false;
288 }
alision371b77e2013-04-23 14:51:26 -0400289
alision9f7a6ec2013-05-24 16:26:26 -0400290 /* unregister broadcast receiver */
291 // LocalBroadcastManager.getInstance(this).unregisterReceiver(mCallList);
292 // LocalBroadcastManager.getInstance(this).unregisterReceiver(mAccountList);
alisione2a38e12013-04-25 14:20:20 -0400293
alision9f7a6ec2013-05-24 16:26:26 -0400294 super.onDestroy();
295 }
alision73424b62013-04-26 11:49:18 -0400296
alision9f7a6ec2013-05-24 16:26:26 -0400297 public void launchCallActivity(SipCall.CallInfo infos) {
298 Log.i(TAG, "Launch Call Activity");
299 Bundle bundle = new Bundle();
300 bundle.putString("action", "incoming");
301 // bundle.putParcelable("CallContact", mListAdapter.getItem(pos));
302 bundle.putParcelable("CallInfo", infos);
303 Intent intent = new Intent().setClass(this, CallActivity.class);
304 intent.putExtras(bundle);
305 startActivityForResult(intent, REQUEST_CODE_CALL);
306 }
307
308 private ISipClient callback = new ISipClient.Stub() {
Adrien Béraud33268882013-05-18 03:41:15 +1000309
alision9f7a6ec2013-05-24 16:26:26 -0400310 @Override
311 public void incomingCall(Intent call) throws RemoteException {
312 Log.i(TAG, "Incoming call transfered from Service");
313 SipCall.CallInfo infos = new SipCall.CallInfo(call);
Adrien Béraud33268882013-05-18 03:41:15 +1000314
alision9f7a6ec2013-05-24 16:26:26 -0400315 SipCall c = new SipCall(infos);
316 mCallElementList.addCall(c);
Adrien Béraud33268882013-05-18 03:41:15 +1000317
alision9f7a6ec2013-05-24 16:26:26 -0400318 launchCallActivity(infos);
319 }
Adrien Béraud33268882013-05-18 03:41:15 +1000320
alision9f7a6ec2013-05-24 16:26:26 -0400321 @Override
322 public void callStateChanged(Intent callState) throws RemoteException {
323 Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
324 String cID = b.getString("CallID");
325 String state = b.getString("State");
326 Log.i(TAG, "callStateChanged" + cID + " " + state);
327 mCallElementList.updateCall(cID, state);
alision371b77e2013-04-23 14:51:26 -0400328
alision9f7a6ec2013-05-24 16:26:26 -0400329 }
alision371b77e2013-04-23 14:51:26 -0400330
alision9f7a6ec2013-05-24 16:26:26 -0400331 @Override
332 public void incomingText(Intent msg) throws RemoteException {
333 Bundle b = msg.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext");
334 b.getString("CallID");
335 String from = b.getString("From");
336 String mess = b.getString("Msg");
337 Toast.makeText(getApplicationContext(), "text from " + from + " : " + mess, Toast.LENGTH_LONG).show();
alision04a00182013-05-10 17:05:29 -0400338
alision9f7a6ec2013-05-24 16:26:26 -0400339 }
340 };
alisionf76de3b2013-04-16 15:35:22 -0400341
alision9f7a6ec2013-05-24 16:26:26 -0400342 /** Defines callbacks for service binding, passed to bindService() */
343 private ServiceConnection mConnection = new ServiceConnection() {
alision371b77e2013-04-23 14:51:26 -0400344
alision9f7a6ec2013-05-24 16:26:26 -0400345
alision5f899632013-04-22 17:26:56 -0400346
alision9f7a6ec2013-05-24 16:26:26 -0400347 @Override
348 public void onServiceConnected(ComponentName className, IBinder binder) {
349 service = ISipService.Stub.asInterface(binder);
alisione2a38e12013-04-25 14:20:20 -0400350
alision9f7a6ec2013-05-24 16:26:26 -0400351 mBound = true;
352 mCallElementList.onServiceSipBinded(service);
353 mHistorySectionFragment.onServiceSipBinded(service);
354 mDialingFragment.onServiceSipBinded(service);
355 Log.d(TAG, "Service connected service=" + service);
alision371b77e2013-04-23 14:51:26 -0400356
alision9f7a6ec2013-05-24 16:26:26 -0400357 try {
358 service.registerClient(callback);
359 } catch (RemoteException e) {
360 Log.e(TAG, e.toString());
361 }
362 }
alision5f899632013-04-22 17:26:56 -0400363
alision9f7a6ec2013-05-24 16:26:26 -0400364 @Override
365 public void onServiceDisconnected(ComponentName arg0) {
alision5f899632013-04-22 17:26:56 -0400366
alision9f7a6ec2013-05-24 16:26:26 -0400367 mBound = false;
368 Log.d(TAG, "Service disconnected service=" + service);
369 }
370 };
alision5f899632013-04-22 17:26:56 -0400371
alision9f7a6ec2013-05-24 16:26:26 -0400372 @Override
373 public boolean onOptionsItemSelected(MenuItem item) {
374 Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
alision5f899632013-04-22 17:26:56 -0400375
alision9f7a6ec2013-05-24 16:26:26 -0400376 if (mDrawerToggle.onOptionsItemSelected(item)) {
377 return true;
378 }
379 // switch(item.getItemId()){
380 // case R.id.menu_settings :
381 // Intent launchPreferencesIntent = new Intent().setClass(this, SFLPhonePreferenceActivity.class);
382 // startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
383 // break;
384 // case R.id.menu_custom_draw:
385 // Intent launchNewInterfaceIntent = new Intent().setClass(this, BubblesViewActivity.class);
386 // startActivityForResult(launchNewInterfaceIntent, 0);
387 // break;
388 // }
alision5f899632013-04-22 17:26:56 -0400389
alision9f7a6ec2013-05-24 16:26:26 -0400390 return super.onOptionsItemSelected(item);
391 }
alisionf76de3b2013-04-16 15:35:22 -0400392
alision9f7a6ec2013-05-24 16:26:26 -0400393 @Override
394 public void onActivityResult(int requestCode, int resultCode, Intent data) {
395 super.onActivityResult(requestCode, resultCode, data);
396
397 switch (requestCode){
398 case REQUEST_CODE_PREFERENCES:
399 mCallElementList.onServiceSipBinded(service);
400 break;
401 case REQUEST_CODE_CALL:
402 try {
403 service.registerClient(callback);
404 } catch (RemoteException e) {
405 Log.e(TAG,e.toString());
406 }
407 break;
408 }
alisionf76de3b2013-04-16 15:35:22 -0400409
alision9f7a6ec2013-05-24 16:26:26 -0400410 }
alisionf76de3b2013-04-16 15:35:22 -0400411
alision9f7a6ec2013-05-24 16:26:26 -0400412 // @Override
413 // public boolean onCreateOptionsMenu(Menu menu) {
414 // getMenuInflater().inflate(R.menu.activity_sflphone_home, menu);
415 // return true;
416 // }
alisionf76de3b2013-04-16 15:35:22 -0400417
alision9f7a6ec2013-05-24 16:26:26 -0400418 @Override
419 public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
420 }
alisionf76de3b2013-04-16 15:35:22 -0400421
alision9f7a6ec2013-05-24 16:26:26 -0400422 @Override
423 public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
424 // When the given tab is selected, switch to the corresponding page in the ViewPager.
425 mViewPager.setCurrentItem(tab.getPosition());
426 }
alisionf76de3b2013-04-16 15:35:22 -0400427
alision9f7a6ec2013-05-24 16:26:26 -0400428 @Override
429 public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
430 // Log.d(TAG, "onTabReselected");
431 }
alisionf76de3b2013-04-16 15:35:22 -0400432
alision9f7a6ec2013-05-24 16:26:26 -0400433 public void processingHangUpAction() {
434 SipCall call = (SipCall) buttonHangup.getTag();
435 if (call != null)
436 call.notifyServiceHangup(service);
437 }
alisionf76de3b2013-04-16 15:35:22 -0400438
alision9f7a6ec2013-05-24 16:26:26 -0400439 @Override
440 public void onCallSelected(SipCall c) {
441 launchCallActivity(c.mCallInfo);
alisionf76de3b2013-04-16 15:35:22 -0400442
alision9f7a6ec2013-05-24 16:26:26 -0400443 }
alisionf76de3b2013-04-16 15:35:22 -0400444
alision9f7a6ec2013-05-24 16:26:26 -0400445 @Override
446 public ISipService getService() {
447 return service;
448 }
alisionf76de3b2013-04-16 15:35:22 -0400449
alision9f7a6ec2013-05-24 16:26:26 -0400450 @Override
451 public void onCallCreated(SipCall c) {
452 mCallElementList.addCall(c);
453 launchCallActivity(c.mCallInfo);
454
455 }
alision371b77e2013-04-23 14:51:26 -0400456
alisionf76de3b2013-04-16 15:35:22 -0400457}