blob: bbd736341eb2a9d130ff5f7bdeb55ebba7a771a1 [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;
36import android.app.FragmentManager;
37import android.app.FragmentTransaction;
38import android.content.ComponentName;
39import android.content.Context;
40import android.content.Intent;
alisionf76de3b2013-04-16 15:35:22 -040041import android.content.ServiceConnection;
42import android.os.Bundle;
43import android.os.IBinder;
alision5f899632013-04-22 17:26:56 -040044import android.os.RemoteException;
alisionf76de3b2013-04-16 15:35:22 -040045import android.support.v13.app.FragmentStatePagerAdapter;
alisionf76de3b2013-04-16 15:35:22 -040046import android.support.v4.view.ViewPager;
47import android.util.Log;
alisionf76de3b2013-04-16 15:35:22 -040048import android.view.Menu;
49import android.view.MenuItem;
alisionf76de3b2013-04-16 15:35:22 -040050import android.widget.ImageButton;
alisionf76de3b2013-04-16 15:35:22 -040051
52import com.savoirfairelinux.sflphone.R;
alisionf76de3b2013-04-16 15:35:22 -040053import com.savoirfairelinux.sflphone.fragments.CallElementListFragment;
54import com.savoirfairelinux.sflphone.fragments.ContactListFragment;
alisiond9e29442013-04-17 16:10:18 -040055import com.savoirfairelinux.sflphone.fragments.HistoryFragment;
alisionf76de3b2013-04-16 15:35:22 -040056import com.savoirfairelinux.sflphone.model.SipCall;
alision5f899632013-04-22 17:26:56 -040057import com.savoirfairelinux.sflphone.service.ISipClient;
alisionf76de3b2013-04-16 15:35:22 -040058import com.savoirfairelinux.sflphone.service.ISipService;
59import com.savoirfairelinux.sflphone.service.SipService;
60
alisione2a38e12013-04-25 14:20:20 -040061public class SFLPhoneHomeActivity extends Activity implements ActionBar.TabListener, CallElementListFragment.Callbacks, HistoryFragment.Callbacks {
alision5f899632013-04-22 17:26:56 -040062 SectionsPagerAdapter mSectionsPagerAdapter = null;
63 static final String TAG = "SFLPhoneHome";
64 private static final int REQUEST_CODE_PREFERENCES = 1;
65 ImageButton buttonCall, buttonHangup;
66 private ContactListFragment mContactListFragment = null;
67 private CallElementListFragment mCallElementList = null;
68 private HistoryFragment mHistorySectionFragment = null;
69 private boolean mBound = false;
70 private ISipService service;
alisionf76de3b2013-04-16 15:35:22 -040071
alision5f899632013-04-22 17:26:56 -040072 private static final int ACTION_BAR_TAB_CONTACT = 0;
73 private static final int ACTION_BAR_TAB_CALL = 1;
74 private static final int ACTION_BAR_TAB_HISTORY = 2;
alisionf76de3b2013-04-16 15:35:22 -040075
alision5f899632013-04-22 17:26:56 -040076 /**
77 * The {@link ViewPager} that will host the section contents.
78 */
79 ViewPager mViewPager;
alisionf76de3b2013-04-16 15:35:22 -040080
alision5f899632013-04-22 17:26:56 -040081 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 -040082
alision5f899632013-04-22 17:26:56 -040083 // public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener
alisionf76de3b2013-04-16 15:35:22 -040084
alision5f899632013-04-22 17:26:56 -040085 /* called before activity is killed, e.g. rotation */
86 @Override
87 protected void onSaveInstanceState(Bundle bundle) {
88 super.onSaveInstanceState(bundle);
89 for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
90 try {
91 /* putFragment (Bundle bundle, String key, Fragment fragment) */
92 getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getFragment(i));
93 } catch (IllegalStateException e) {
alision7f18fc82013-05-01 09:37:33 -040094 Log.e(TAG, "fragment=" + mSectionsPagerAdapter.getFragment(i));
alision5f899632013-04-22 17:26:56 -040095 }
96 }
97 Log.w(TAG, "onSaveInstanceState()");
98 }
alisionf76de3b2013-04-16 15:35:22 -040099
alision5f899632013-04-22 17:26:56 -0400100 @Override
101 public void onCreate(Bundle savedInstanceState) {
102 super.onCreate(savedInstanceState);
alisionf76de3b2013-04-16 15:35:22 -0400103
alision5f899632013-04-22 17:26:56 -0400104 // Bind to LocalService
105 if (!mBound) {
106 Log.i(TAG, "onStart: Binding service...");
107 Intent intent = new Intent(this, SipService.class);
108 bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
109 }
alisionf76de3b2013-04-16 15:35:22 -0400110
alision5f899632013-04-22 17:26:56 -0400111 setContentView(R.layout.activity_sflphone_home);
alisionf76de3b2013-04-16 15:35:22 -0400112
alision5f899632013-04-22 17:26:56 -0400113 if (mSectionsPagerAdapter == null) {
114 mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
115 }
alisionf76de3b2013-04-16 15:35:22 -0400116
alision5f899632013-04-22 17:26:56 -0400117 /* getFragment(Bundle, String) */
118 if (savedInstanceState != null) {
119 Log.w(TAG, "Activity restarted, recreating PagerAdapter...");
120 /* getFragment (Bundle bundle, String key) */
121 mContactListFragment = (ContactListFragment) getFragmentManager().getFragment(savedInstanceState,
122 mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CONTACT));
123 mCallElementList = (CallElementListFragment) getFragmentManager().getFragment(savedInstanceState,
124 mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_CALL));
125 mHistorySectionFragment = (HistoryFragment) getFragmentManager().getFragment(savedInstanceState,
126 mSectionsPagerAdapter.getClassName(ACTION_BAR_TAB_HISTORY));
127 }
alisionf76de3b2013-04-16 15:35:22 -0400128
alision5f899632013-04-22 17:26:56 -0400129 if (mContactListFragment == null) {
130 mContactListFragment = new ContactListFragment();
131 Log.w(TAG, "Recreated mContactListFragment=" + mContactListFragment);
132 }
133 if (mCallElementList == null) {
134 mCallElementList = new CallElementListFragment();
135 Log.w(TAG, "Recreated mCallElementList=" + mCallElementList);
136 }
137 if (mHistorySectionFragment == null) {
138 mHistorySectionFragment = new HistoryFragment();
139 Log.w(TAG, "Recreated mHistorySectionFragment=" + mHistorySectionFragment);
140 }
alisionf76de3b2013-04-16 15:35:22 -0400141
alision5f899632013-04-22 17:26:56 -0400142 final ActionBar actionBar = getActionBar();
143 actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
144 // final ActionBar actionBar = getActionBar();
alisionf76de3b2013-04-16 15:35:22 -0400145
alision5f899632013-04-22 17:26:56 -0400146 // Set up the ViewPager with the sections adapter.
147 mViewPager = (ViewPager) findViewById(R.id.pager);
148 mViewPager.setAdapter(mSectionsPagerAdapter);
alisionf76de3b2013-04-16 15:35:22 -0400149
alision5f899632013-04-22 17:26:56 -0400150 // When swiping between different sections, select the corresponding tab.
151 // We can also use ActionBar.Tab#select() to do this if we have a reference to the
152 // Tab.
153 mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
154 @Override
155 public void onPageSelected(int position) {
156 actionBar.setSelectedNavigationItem(position);
157 }
158 });
alisionf76de3b2013-04-16 15:35:22 -0400159
alision5f899632013-04-22 17:26:56 -0400160 // For each of the sections in the app, add a tab to the action bar.
161 for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
162 // Create a tab with text corresponding to the page title defined by the adapter.
163 // Also specify this Activity object, which implements the TabListener interface, as the
164 // listener for when this tab is selected.
165 actionBar.addTab(actionBar.newTab().setIcon(icon_res_id[i]).setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this));
166 }
alisionf76de3b2013-04-16 15:35:22 -0400167
alision5f899632013-04-22 17:26:56 -0400168 actionBar.setSelectedNavigationItem(ACTION_BAR_TAB_CALL);
alisionf76de3b2013-04-16 15:35:22 -0400169
alisione2a38e12013-04-25 14:20:20 -0400170 // buttonHangup.setOnClickListener(new OnClickListener() {
171 // @Override
172 // public void onClick(View v) {
173 // processingHangUpAction();
174 //
175 // }
176 // });
alisionf76de3b2013-04-16 15:35:22 -0400177
alision371b77e2013-04-23 14:51:26 -0400178 // IntentFilter callFilter = new IntentFilter(CallManagerCallBack.NEW_CALL_CREATED);
179 // callFilter.addAction(CallManagerCallBack.INCOMING_CALL);
180 // callFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
181 // LocalBroadcastManager.getInstance(this).registerReceiver(mCallList, callFilter);
182 //
183 // mAccountList = mApplication.getAccountList();
184 // Log.w(TAG, "mAccountList=" + mAccountList + ", mCallElementList=" + mCallElementList);
alisionf76de3b2013-04-16 15:35:22 -0400185
alision4a0eb092013-05-07 13:52:03 -0400186// IntentFilter accountFilter = new IntentFilter(ConfigurationManagerCallback.ACCOUNTS_CHANGED);
187// accountFilter.addAction(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED);
alision371b77e2013-04-23 14:51:26 -0400188 // LocalBroadcastManager.getInstance(this).registerReceiver(mAccountList, accountFilter);
alisionf76de3b2013-04-16 15:35:22 -0400189
alisione2a38e12013-04-25 14:20:20 -0400190 // SipCall.setSFLPhoneHomeContext(this);
alision5f899632013-04-22 17:26:56 -0400191 }
alisionf76de3b2013-04-16 15:35:22 -0400192
alision5f899632013-04-22 17:26:56 -0400193 @Override
194 protected void onStart() {
195 Log.i(TAG, "onStart");
196 super.onStart();
197 }
alisionf76de3b2013-04-16 15:35:22 -0400198
alision5f899632013-04-22 17:26:56 -0400199 /* user gets back to the activity, e.g. through task manager */
200 @Override
201 protected void onRestart() {
202 super.onRestart();
203 }
alisionf76de3b2013-04-16 15:35:22 -0400204
alision5f899632013-04-22 17:26:56 -0400205 /* activity gets back to the foreground and user input */
206 @Override
207 protected void onResume() {
208 Log.i(TAG, "onResume");
209 super.onResume();
210 }
alisionf76de3b2013-04-16 15:35:22 -0400211
alision5f899632013-04-22 17:26:56 -0400212 /* activity no more in foreground */
213 @Override
214 protected void onPause() {
215 super.onPause();
216 }
alisionf76de3b2013-04-16 15:35:22 -0400217
alision5f899632013-04-22 17:26:56 -0400218 /* activity is no longer visible */
219 @Override
220 protected void onStop() {
221 super.onStop();
222 }
alisionf76de3b2013-04-16 15:35:22 -0400223
alision5f899632013-04-22 17:26:56 -0400224 /* activity finishes itself or is being killed by the system */
225 @Override
226 protected void onDestroy() {
227 /* stop the service, if no other bound user, no need to check if it is running */
228 if (mBound) {
alision4a0eb092013-05-07 13:52:03 -0400229 Log.i(TAG, "onDestroy: Unbinding service...");
alision5f899632013-04-22 17:26:56 -0400230 unbindService(mConnection);
231 mBound = false;
232 }
alisionf76de3b2013-04-16 15:35:22 -0400233
alision5f899632013-04-22 17:26:56 -0400234 /* unregister broadcast receiver */
alision371b77e2013-04-23 14:51:26 -0400235 // LocalBroadcastManager.getInstance(this).unregisterReceiver(mCallList);
236 // LocalBroadcastManager.getInstance(this).unregisterReceiver(mAccountList);
alisionf76de3b2013-04-16 15:35:22 -0400237
alision5f899632013-04-22 17:26:56 -0400238 super.onDestroy();
239 }
alisione2a38e12013-04-25 14:20:20 -0400240
241 public void launchCallActivity(SipCall.CallInfo infos) {
alision371b77e2013-04-23 14:51:26 -0400242 Log.i(TAG, "Launch Call Activity");
243 Bundle bundle = new Bundle();
244 bundle.putParcelable("CallInfo", infos);
245 Intent intent = new Intent().setClass(this, CallActivity.class);
246 intent.putExtras(bundle);
247 startActivity(intent);
248 }
alisionf76de3b2013-04-16 15:35:22 -0400249
alision5f899632013-04-22 17:26:56 -0400250 /** Defines callbacks for service binding, passed to bindService() */
251 private ServiceConnection mConnection = new ServiceConnection() {
alisionf76de3b2013-04-16 15:35:22 -0400252
alision5f899632013-04-22 17:26:56 -0400253 private ISipClient callback = new ISipClient.Stub() {
alision371b77e2013-04-23 14:51:26 -0400254
alision5f899632013-04-22 17:26:56 -0400255 @Override
alision371b77e2013-04-23 14:51:26 -0400256 public void incomingCall(Intent call) throws RemoteException {
257 Log.i(TAG, "Incoming call transfered from Service");
258 SipCall.CallInfo infos = new SipCall.CallInfo(call);
alisione2a38e12013-04-25 14:20:20 -0400259
alision371b77e2013-04-23 14:51:26 -0400260 SipCall c = new SipCall(infos);
261 mCallElementList.addCall(c);
alision73424b62013-04-26 11:49:18 -0400262
Adrien Béraud1947a102013-04-26 22:05:34 +1000263 launchCallActivity(infos);
alision371b77e2013-04-23 14:51:26 -0400264 }
265
266 @Override
267 public void callStateChanged(Intent callState) throws RemoteException {
268 Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
269 String cID = b.getString("CallID");
270 String state = b.getString("State");
alisione2a38e12013-04-25 14:20:20 -0400271 Log.i(TAG, "callStateChanged" + cID + " " + state);
alision371b77e2013-04-23 14:51:26 -0400272 mCallElementList.updateCall(cID, state);
273
alision5f899632013-04-22 17:26:56 -0400274 }
275 };
alisionf76de3b2013-04-16 15:35:22 -0400276
alision5f899632013-04-22 17:26:56 -0400277 @Override
278 public void onServiceConnected(ComponentName className, IBinder binder) {
279 service = ISipService.Stub.asInterface(binder);
alision371b77e2013-04-23 14:51:26 -0400280
alisione2a38e12013-04-25 14:20:20 -0400281 mBound = true;
282 mCallElementList.onServiceSipBinded(service);
283 mHistorySectionFragment.onServiceSipBinded(service);
284 Log.d(TAG, "Service connected service=" + service);
285
alision5f899632013-04-22 17:26:56 -0400286 try {
alision371b77e2013-04-23 14:51:26 -0400287 service.registerClient(callback);
alision5f899632013-04-22 17:26:56 -0400288 } catch (RemoteException e) {
alision371b77e2013-04-23 14:51:26 -0400289 Log.e(TAG, e.toString());
alision5f899632013-04-22 17:26:56 -0400290 }
alision5f899632013-04-22 17:26:56 -0400291 }
292
293 @Override
294 public void onServiceDisconnected(ComponentName arg0) {
alisione2a38e12013-04-25 14:20:20 -0400295
alision5f899632013-04-22 17:26:56 -0400296 mBound = false;
297 Log.d(TAG, "Service disconnected service=" + service);
298 }
299 };
300
301 @Override
302 public boolean onOptionsItemSelected(MenuItem item) {
alisionfe9cf712013-05-03 17:26:08 -0400303 Log.i(TAG, "onOptionsItemSelected " + item.getItemId());
304 switch(item.getItemId()){
305 case R.id.menu_settings :
alision5f899632013-04-22 17:26:56 -0400306 Intent launchPreferencesIntent = new Intent().setClass(this, SFLPhonePreferenceActivity.class);
alision5f899632013-04-22 17:26:56 -0400307 startActivityForResult(launchPreferencesIntent, REQUEST_CODE_PREFERENCES);
alisionfe9cf712013-05-03 17:26:08 -0400308 break;
309 case R.id.menu_custom_draw:
310 Intent launchNewInterfaceIntent = new Intent().setClass(this, BubblesViewActivity.class);
311 startActivityForResult(launchNewInterfaceIntent, 0);
312 break;
alision5f899632013-04-22 17:26:56 -0400313 }
alisionfe9cf712013-05-03 17:26:08 -0400314
alision5f899632013-04-22 17:26:56 -0400315 return super.onOptionsItemSelected(item);
316 }
alision371b77e2013-04-23 14:51:26 -0400317
alision5f899632013-04-22 17:26:56 -0400318 @Override
alision371b77e2013-04-23 14:51:26 -0400319 public void onActivityResult(int requestCode, int resultCode, Intent data) {
alision5f899632013-04-22 17:26:56 -0400320 super.onActivityResult(requestCode, resultCode, data);
alision371b77e2013-04-23 14:51:26 -0400321 if (REQUEST_CODE_PREFERENCES == requestCode && service != null) {
322 // Refresh Spinner with modified accounts
alision5f899632013-04-22 17:26:56 -0400323 mCallElementList.onServiceSipBinded(service);
324 }
325 }
326
327 @Override
328 public boolean onCreateOptionsMenu(Menu menu) {
329 getMenuInflater().inflate(R.menu.activity_sflphone_home, menu);
330 return true;
331 }
332
333 @Override
334 public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
335 }
336
337 @Override
338 public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
339 // When the given tab is selected, switch to the corresponding page in the ViewPager.
340 mViewPager.setCurrentItem(tab.getPosition());
341 }
342
343 @Override
344 public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
345 // Log.d(TAG, "onTabReselected");
346 }
347
alision5f899632013-04-22 17:26:56 -0400348 public void processingHangUpAction() {
349 SipCall call = (SipCall) buttonHangup.getTag();
350 if (call != null)
351 call.notifyServiceHangup(service);
352 }
alisionf76de3b2013-04-16 15:35:22 -0400353
alision5f899632013-04-22 17:26:56 -0400354 /**
355 * A {@link FragmentStatePagerAdapter} that returns a fragment corresponding to one of the primary sections of the app.
356 */
357 public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
alisionf76de3b2013-04-16 15:35:22 -0400358
alision5f899632013-04-22 17:26:56 -0400359 public SectionsPagerAdapter(FragmentManager fm) {
360 super(fm);
361 }
alisionf76de3b2013-04-16 15:35:22 -0400362
alision5f899632013-04-22 17:26:56 -0400363 @Override
364 public Fragment getItem(int i) {
365 Fragment fragment;
alisionf76de3b2013-04-16 15:35:22 -0400366
alision5f899632013-04-22 17:26:56 -0400367 switch (i) {
368 case 0:
369 mContactListFragment = new ContactListFragment();
370 fragment = mContactListFragment;
371 Log.w(TAG, "getItem() ContactListFragment=" + fragment);
372 break;
373 case 1:
374 mCallElementList = new CallElementListFragment();
alisione2a38e12013-04-25 14:20:20 -0400375 // SipCall.setCallElementList(mCallElementList);
alision371b77e2013-04-23 14:51:26 -0400376 // mCallElementList.setAccountList(mAccountList);
alision5f899632013-04-22 17:26:56 -0400377 fragment = mCallElementList;
378 Log.w(TAG, "getItem() CallElementList=" + fragment);
379 break;
380 case 2:
381 fragment = new HistoryFragment();
382 Log.w(TAG, "getItem() HistoryFragment=" + fragment);
383 break;
384 default:
385 Log.e(TAG, "getItem() unknown tab position " + i);
386 return null;
387 }
alisionf76de3b2013-04-16 15:35:22 -0400388
alision5f899632013-04-22 17:26:56 -0400389 // Log.i(TAG, "getItem() fragment is " + fragment);
390 Bundle args = new Bundle();
391 args.putInt(HistoryFragment.ARG_SECTION_NUMBER, i + 1);
392 fragment.setArguments(args);
393 return fragment;
394 }
alisionf76de3b2013-04-16 15:35:22 -0400395
alision5f899632013-04-22 17:26:56 -0400396 public Fragment getFragment(int i) {
397 Fragment fragment;
alisionf76de3b2013-04-16 15:35:22 -0400398
alision5f899632013-04-22 17:26:56 -0400399 switch (i) {
400 case 0:
401 fragment = mContactListFragment;
402 break;
403 case 1:
404 fragment = mCallElementList;
405 break;
406 case 2:
407 fragment = mHistorySectionFragment;
408 break;
409 default:
410 Log.e(TAG, "getClassName: unknown fragment position " + i);
411 fragment = null;
412 }
alisionf76de3b2013-04-16 15:35:22 -0400413
alision5f899632013-04-22 17:26:56 -0400414 // Log.w(TAG, "getFragment: fragment=" + fragment);
415 return fragment;
416 }
alisionf76de3b2013-04-16 15:35:22 -0400417
alision5f899632013-04-22 17:26:56 -0400418 public String getClassName(int i) {
419 String name;
alisionf76de3b2013-04-16 15:35:22 -0400420
alision5f899632013-04-22 17:26:56 -0400421 switch (i) {
422 case 0:
423 name = ContactListFragment.class.getName();
424 break;
425 case 1:
426 name = CallElementListFragment.class.getName();
427 break;
428 case 2:
429 name = HistoryFragment.class.getName();
430 break;
alisionf76de3b2013-04-16 15:35:22 -0400431
alision5f899632013-04-22 17:26:56 -0400432 default:
433 Log.e(TAG, "getClassName: unknown fragment position " + i);
434 return null;
435 }
alisionf76de3b2013-04-16 15:35:22 -0400436
alision5f899632013-04-22 17:26:56 -0400437 // Log.w(TAG, "getClassName: name=" + name);
438 return name;
439 }
alisionf76de3b2013-04-16 15:35:22 -0400440
alision5f899632013-04-22 17:26:56 -0400441 @Override
442 public int getCount() {
443 return 3;
444 }
alisionf76de3b2013-04-16 15:35:22 -0400445
alision5f899632013-04-22 17:26:56 -0400446 @Override
447 public CharSequence getPageTitle(int position) {
448 switch (position) {
449 case 0:
450 return getString(R.string.title_section0).toUpperCase();
451 case 1:
452 return getString(R.string.title_section1).toUpperCase();
453 case 2:
454 return getString(R.string.title_section2).toUpperCase();
455 case 3:
456 return getString(R.string.title_section3).toUpperCase();
457 default:
458 Log.e(TAG, "getPageTitle: unknown tab position " + position);
459 break;
460 }
461 return null;
462 }
463 }
alisionf76de3b2013-04-16 15:35:22 -0400464
alision371b77e2013-04-23 14:51:26 -0400465 @Override
466 public void onCallSelected(SipCall c) {
467 launchCallActivity(c.mCallInfo);
alisione2a38e12013-04-25 14:20:20 -0400468
469 }
470
471 @Override
472 public ISipService getService() {
473 return service;
alision371b77e2013-04-23 14:51:26 -0400474 }
475
alisionf76de3b2013-04-16 15:35:22 -0400476}