alision | f76de3b | 2013-04-16 15:35:22 -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 | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 3 | * |
| 4 | * Author: Adrien Beraud <adrien.beraud@gmail.com> |
alision | 11e8e16 | 2013-05-28 10:33:14 -0400 | [diff] [blame] | 5 | * Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program; if not, write to the Free Software |
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | * |
| 21 | * Additional permission under GNU GPL version 3 section 7: |
| 22 | * |
| 23 | * If you modify this program, or any covered work, by linking or |
| 24 | * combining it with the OpenSSL project's OpenSSL library (or a |
| 25 | * modified version of that library), containing parts covered by the |
| 26 | * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. |
| 27 | * grants you additional permission to convey the resulting work. |
| 28 | * Corresponding Source for a non-source form of such a combination |
| 29 | * shall include the source code for the parts of OpenSSL used as well |
| 30 | * as that of the covered work. |
| 31 | */ |
| 32 | package com.savoirfairelinux.sflphone.client; |
| 33 | |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 34 | import java.util.ArrayList; |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 35 | import java.util.HashMap; |
alision | bd45a82 | 2013-06-06 17:35:35 -0400 | [diff] [blame] | 36 | import java.util.Timer; |
| 37 | import java.util.TimerTask; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 38 | |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 39 | import android.app.Activity; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 40 | import android.content.ComponentName; |
| 41 | import android.content.Context; |
| 42 | import android.content.Intent; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 43 | import android.content.IntentFilter; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 44 | import android.content.ServiceConnection; |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 45 | import android.database.Cursor; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 46 | import android.os.Bundle; |
| 47 | import android.os.IBinder; |
alision | 5f89963 | 2013-04-22 17:26:56 -0400 | [diff] [blame] | 48 | import android.os.RemoteException; |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 49 | import android.provider.ContactsContract.CommonDataKinds.Phone; |
| 50 | import android.provider.ContactsContract.CommonDataKinds.SipAddress; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 51 | import android.support.v4.app.ActionBarDrawerToggle; |
| 52 | import android.support.v4.view.GravityCompat; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 53 | import android.support.v4.view.ViewPager; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 54 | import android.support.v4.widget.DrawerLayout; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 55 | import android.util.Log; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 56 | import android.view.MenuItem; |
| 57 | import android.view.View; |
alision | 7297bdb | 2013-05-21 11:56:55 -0400 | [diff] [blame] | 58 | import android.widget.RelativeLayout; |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 59 | import android.widget.TabHost; |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 60 | import android.widget.TabHost.OnTabChangeListener; |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 61 | import android.widget.TabHost.TabContentFactory; |
alision | 04a0018 | 2013-05-10 17:05:29 -0400 | [diff] [blame] | 62 | import android.widget.Toast; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 63 | |
| 64 | import com.savoirfairelinux.sflphone.R; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 65 | import com.savoirfairelinux.sflphone.adapters.SectionsPagerAdapter; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 66 | import com.savoirfairelinux.sflphone.fragments.ContactListFragment; |
alision | 7297bdb | 2013-05-21 11:56:55 -0400 | [diff] [blame] | 67 | import com.savoirfairelinux.sflphone.fragments.DialingFragment; |
alision | d9e2944 | 2013-04-17 16:10:18 -0400 | [diff] [blame] | 68 | import com.savoirfairelinux.sflphone.fragments.HistoryFragment; |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 69 | import com.savoirfairelinux.sflphone.fragments.HomeFragment; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 70 | import com.savoirfairelinux.sflphone.fragments.MenuFragment; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 71 | import com.savoirfairelinux.sflphone.interfaces.CallInterface; |
alision | 2ec64f9 | 2013-06-17 17:28:58 -0400 | [diff] [blame] | 72 | import com.savoirfairelinux.sflphone.loaders.LoaderConstants; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 73 | import com.savoirfairelinux.sflphone.model.CallContact; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 74 | import com.savoirfairelinux.sflphone.model.SipCall; |
alision | cc7bb42 | 2013-06-06 15:31:39 -0400 | [diff] [blame] | 75 | import com.savoirfairelinux.sflphone.receivers.CallReceiver; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 76 | import com.savoirfairelinux.sflphone.service.CallManagerCallBack; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 77 | import com.savoirfairelinux.sflphone.service.ISipService; |
| 78 | import com.savoirfairelinux.sflphone.service.SipService; |
alision | 7297bdb | 2013-05-21 11:56:55 -0400 | [diff] [blame] | 79 | import com.savoirfairelinux.sflphone.views.CustomSlidingDrawer; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 80 | |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 81 | public class SFLPhoneHomeActivity extends Activity implements DialingFragment.Callbacks, ContactListFragment.Callbacks, HomeFragment.Callbacks, |
| 82 | HistoryFragment.Callbacks, CallInterface, MenuFragment.Callbacks { |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 83 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 84 | SectionsPagerAdapter mSectionsPagerAdapter = null; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 85 | static final String TAG = "SFLPhoneHomeActivity"; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 86 | |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 87 | /** |
| 88 | * Fragments used |
| 89 | */ |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 90 | private ContactListFragment mContactsFragment = null; |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 91 | // private DialingFragment mDialingFragment = null; |
| 92 | // private CallElementListFragment mCallElementList = null; |
| 93 | // private HistoryFragment mHistorySectionFragment = null; |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 94 | private MenuFragment fMenu; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 95 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 96 | private boolean mBound = false; |
| 97 | private ISipService service; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 98 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 99 | private CharSequence mDrawerTitle; |
| 100 | private CharSequence mTitle; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 101 | |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 102 | // AccountSelectionAdapter mAdapter; |
| 103 | // private Spinner spinnerAccounts; |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 104 | |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 105 | public static final int REQUEST_CODE_PREFERENCES = 1; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 106 | private static final int REQUEST_CODE_CALL = 2; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 107 | |
alision | 0b55383 | 2013-05-30 09:31:06 -0400 | [diff] [blame] | 108 | RelativeLayout mSliderButton; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 109 | CustomSlidingDrawer mDrawer; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 110 | private DrawerLayout mDrawerLayout; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 111 | private ActionBarDrawerToggle mDrawerToggle; |
| 112 | /** |
| 113 | * The {@link ViewPager} that will host the section contents. |
| 114 | */ |
| 115 | ViewPager mViewPager; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 116 | |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 117 | CallReceiver callReceiver; |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 118 | |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 119 | private TabHost mTabHost; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 120 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 121 | // public SFLPhoneHome extends Activity implements ActionBar.TabListener, OnClickListener |
| 122 | |
| 123 | /* called before activity is killed, e.g. rotation */ |
| 124 | @Override |
| 125 | protected void onSaveInstanceState(Bundle bundle) { |
| 126 | super.onSaveInstanceState(bundle); |
| 127 | for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { |
| 128 | try { |
| 129 | getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getItem(i)); |
| 130 | } catch (IllegalStateException e) { |
| 131 | Log.e(TAG, "fragment=" + mSectionsPagerAdapter.getItem(i)); |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | getFragmentManager().putFragment(bundle, "ContactsListFragment", mContactsFragment); |
| 136 | Log.w(TAG, "onSaveInstanceState()"); |
| 137 | } |
| 138 | |
| 139 | @Override |
| 140 | public void onCreate(Bundle savedInstanceState) { |
| 141 | super.onCreate(savedInstanceState); |
| 142 | |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 143 | callReceiver = new CallReceiver(this); |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 144 | |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 145 | // String libraryPath = getApplicationInfo().dataDir + "/lib"; |
| 146 | // Log.i(TAG, libraryPath); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 147 | |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 148 | setContentView(R.layout.activity_sflphone_home); |
| 149 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 150 | // Bind to LocalService |
| 151 | if (!mBound) { |
| 152 | Log.i(TAG, "onStart: Binding service..."); |
| 153 | Intent intent = new Intent(this, SipService.class); |
| 154 | bindService(intent, mConnection, Context.BIND_AUTO_CREATE); |
| 155 | } |
| 156 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 157 | if (mContactsFragment == null) { |
| 158 | mContactsFragment = new ContactListFragment(); |
| 159 | Log.w(TAG, "Recreated mContactListFragment=" + mContactsFragment); |
| 160 | getFragmentManager().beginTransaction().replace(R.id.contacts_frame, mContactsFragment).commit(); |
| 161 | } |
alision | 2ec64f9 | 2013-06-17 17:28:58 -0400 | [diff] [blame] | 162 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 163 | mDrawer = (CustomSlidingDrawer) findViewById(R.id.custom_sliding_drawer); |
alision | 7297bdb | 2013-05-21 11:56:55 -0400 | [diff] [blame] | 164 | |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 165 | mContactsFragment.setHandleView((RelativeLayout) findViewById(R.id.slider_button)); |
alision | 7297bdb | 2013-05-21 11:56:55 -0400 | [diff] [blame] | 166 | |
| 167 | mDrawer.setmTrackHandle(findViewById(R.id.handle_title)); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 168 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 169 | // Set up the ViewPager with the sections adapter. |
| 170 | mViewPager = (ViewPager) findViewById(R.id.pager); |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 171 | mViewPager.setPageTransformer(true, new ZoomOutPageTransformer(0.7f)); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 172 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 173 | mTitle = mDrawerTitle = getTitle(); |
| 174 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 175 | |
alision | 0b55383 | 2013-05-30 09:31:06 -0400 | [diff] [blame] | 176 | // set a custom shadow that overlays the main content when the drawer opens |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 177 | mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 178 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 179 | getActionBar().setDisplayHomeAsUpEnabled(true); |
| 180 | getActionBar().setHomeButtonEnabled(true); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 181 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 182 | mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ |
| 183 | mDrawerLayout, /* DrawerLayout object */ |
| 184 | R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ |
| 185 | R.string.drawer_open, /* "open drawer" description for accessibility */ |
| 186 | R.string.drawer_close /* "close drawer" description for accessibility */ |
| 187 | ) { |
alision | 0b55383 | 2013-05-30 09:31:06 -0400 | [diff] [blame] | 188 | @Override |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 189 | public void onDrawerClosed(View view) { |
| 190 | getActionBar().setTitle(mTitle); |
| 191 | invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() |
| 192 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 193 | |
alision | 0b55383 | 2013-05-30 09:31:06 -0400 | [diff] [blame] | 194 | @Override |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 195 | public void onDrawerOpened(View drawerView) { |
| 196 | getActionBar().setTitle(mDrawerTitle); |
| 197 | invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() |
| 198 | } |
| 199 | }; |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 200 | |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 201 | mTabHost = (TabHost) findViewById(android.R.id.tabhost); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 202 | mDrawerLayout.setDrawerListener(mDrawerToggle); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 203 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 204 | mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { |
| 205 | @Override |
| 206 | public void onPageSelected(int position) { |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 207 | mTabHost.setCurrentTab(position); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 208 | } |
| 209 | }); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 210 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 211 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 212 | |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 213 | private void initialiseTabHost(Bundle args) { |
| 214 | |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 215 | mTabHost.setup(); |
| 216 | TabInfo tabInfo = null; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 217 | SFLPhoneHomeActivity |
| 218 | .AddTab(this, |
| 219 | this.mTabHost, |
| 220 | this.mTabHost.newTabSpec("Tab1").setIndicator(mSectionsPagerAdapter.getPageTitle(0), |
| 221 | getResources().getDrawable(mSectionsPagerAdapter.getIconOf(0))), (tabInfo = new TabInfo("Tab1", |
| 222 | DialingFragment.class, args))); |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 223 | this.mapTabInfo.put(tabInfo.tag, tabInfo); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 224 | SFLPhoneHomeActivity.AddTab( |
| 225 | this, |
| 226 | this.mTabHost, |
| 227 | this.mTabHost.newTabSpec("Tab2").setIndicator(mSectionsPagerAdapter.getPageTitle(1), |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 228 | getResources().getDrawable(mSectionsPagerAdapter.getIconOf(1))), (tabInfo = new TabInfo("Tab2", HomeFragment.class, args))); |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 229 | this.mapTabInfo.put(tabInfo.tag, tabInfo); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 230 | SFLPhoneHomeActivity |
| 231 | .AddTab(this, |
| 232 | this.mTabHost, |
| 233 | this.mTabHost.newTabSpec("Tab3").setIndicator(mSectionsPagerAdapter.getPageTitle(2), |
| 234 | getResources().getDrawable(mSectionsPagerAdapter.getIconOf(2))), (tabInfo = new TabInfo("Tab3", |
| 235 | HistoryFragment.class, args))); |
alision | 3c5c2a9 | 2013-05-30 09:50:47 -0400 | [diff] [blame] | 236 | this.mapTabInfo.put(tabInfo.tag, tabInfo); |
| 237 | |
| 238 | mTabHost.setOnTabChangedListener(new OnTabChangeListener() { |
| 239 | |
| 240 | @Override |
| 241 | public void onTabChanged(String tabId) { |
| 242 | int pos = mTabHost.getCurrentTab(); |
| 243 | mViewPager.setCurrentItem(pos); |
| 244 | |
| 245 | } |
| 246 | }); |
| 247 | } |
| 248 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 249 | @Override |
| 250 | protected void onStart() { |
| 251 | Log.i(TAG, "onStart"); |
| 252 | super.onStart(); |
| 253 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 254 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 255 | /* user gets back to the activity, e.g. through task manager */ |
| 256 | @Override |
| 257 | protected void onRestart() { |
| 258 | super.onRestart(); |
| 259 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 260 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 261 | /* activity gets back to the foreground and user input */ |
| 262 | @Override |
| 263 | protected void onResume() { |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 264 | super.onResume(); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 265 | IntentFilter intentFilter = new IntentFilter(); |
| 266 | intentFilter.addAction(CallManagerCallBack.INCOMING_CALL); |
| 267 | intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT); |
| 268 | intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED); |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 269 | registerReceiver(callReceiver, intentFilter); |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 270 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 271 | } |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 272 | |
alision | bd45a82 | 2013-06-06 17:35:35 -0400 | [diff] [blame] | 273 | private boolean isClosing = false; |
| 274 | private Timer t = new Timer(); |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 275 | |
alision | bd45a82 | 2013-06-06 17:35:35 -0400 | [diff] [blame] | 276 | @Override |
| 277 | public void onBackPressed() { |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 278 | |
| 279 | if (getActionBar().getCustomView() != null) { |
alision | 2ec64f9 | 2013-06-17 17:28:58 -0400 | [diff] [blame] | 280 | getActionBar().setDisplayShowCustomEnabled(false); |
| 281 | getActionBar().setCustomView(null); |
| 282 | // Display all the contacts again |
| 283 | getLoaderManager().restartLoader(LoaderConstants.CONTACT_LOADER, null, mContactsFragment); |
| 284 | return; |
| 285 | } |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 286 | |
alision | bd45a82 | 2013-06-06 17:35:35 -0400 | [diff] [blame] | 287 | if (mDrawer.isOpened()) { |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 288 | mDrawer.animateClose(); |
alision | bd45a82 | 2013-06-06 17:35:35 -0400 | [diff] [blame] | 289 | return; |
| 290 | } |
alision | 2ec64f9 | 2013-06-17 17:28:58 -0400 | [diff] [blame] | 291 | |
alision | bd45a82 | 2013-06-06 17:35:35 -0400 | [diff] [blame] | 292 | if (isClosing) { |
| 293 | super.onBackPressed(); |
| 294 | t.cancel(); |
| 295 | finish(); |
| 296 | } else { |
| 297 | |
| 298 | t.schedule(new TimerTask() { |
| 299 | @Override |
| 300 | public void run() { |
| 301 | isClosing = false; |
| 302 | } |
| 303 | }, 3000); |
| 304 | Toast.makeText(this, getResources().getString(R.string.close_msg), Toast.LENGTH_SHORT).show(); |
| 305 | isClosing = true; |
| 306 | } |
| 307 | } |
alision | e2a38e1 | 2013-04-25 14:20:20 -0400 | [diff] [blame] | 308 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 309 | /* activity no more in foreground */ |
| 310 | @Override |
| 311 | protected void onPause() { |
| 312 | super.onPause(); |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 313 | unregisterReceiver(callReceiver); |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 314 | try { |
| 315 | service.createNotification(); |
| 316 | |
| 317 | } catch (RemoteException e) { |
| 318 | Log.e(TAG, e.toString()); |
| 319 | } |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 320 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 321 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 322 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 323 | /* activity is no longer visible */ |
| 324 | @Override |
| 325 | protected void onStop() { |
| 326 | super.onStop(); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 327 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 328 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 329 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 330 | /* activity finishes itself or is being killed by the system */ |
| 331 | @Override |
| 332 | protected void onDestroy() { |
| 333 | /* stop the service, if no other bound user, no need to check if it is running */ |
| 334 | if (mBound) { |
| 335 | Log.i(TAG, "onDestroy: Unbinding service..."); |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 336 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 337 | unbindService(mConnection); |
| 338 | mBound = false; |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 339 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 340 | } |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 341 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 342 | super.onDestroy(); |
| 343 | } |
alision | 73424b6 | 2013-04-26 11:49:18 -0400 | [diff] [blame] | 344 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 345 | public void launchCallActivity(SipCall infos) { |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 346 | Log.i(TAG, "Launch Call Activity"); |
| 347 | Bundle bundle = new Bundle(); |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 348 | ArrayList<SipCall> tmp = new ArrayList<SipCall>(); |
| 349 | tmp.add(infos); |
| 350 | bundle.putParcelableArrayList("CallsInfo", tmp); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 351 | Intent intent = new Intent().setClass(this, CallActivity.class); |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 352 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 353 | intent.putExtras(bundle); |
| 354 | startActivityForResult(intent, REQUEST_CODE_CALL); |
| 355 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 356 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 357 | /** Defines callbacks for service binding, passed to bindService() */ |
| 358 | private ServiceConnection mConnection = new ServiceConnection() { |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 359 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 360 | @Override |
| 361 | public void onServiceConnected(ComponentName className, IBinder binder) { |
| 362 | service = ISipService.Stub.asInterface(binder); |
alision | e2a38e1 | 2013-04-25 14:20:20 -0400 | [diff] [blame] | 363 | |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 364 | try { |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 365 | |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 366 | fMenu = new MenuFragment(); |
| 367 | getFragmentManager().beginTransaction().replace(R.id.left_drawer, fMenu).commit(); |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 368 | mSectionsPagerAdapter = new SectionsPagerAdapter(SFLPhoneHomeActivity.this, getFragmentManager()); |
| 369 | initialiseTabHost(null); |
| 370 | mViewPager.setAdapter(mSectionsPagerAdapter); |
| 371 | mTabHost.setCurrentTab(1); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 372 | service.destroyNotification(); |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 373 | // mAdapter = new AccountSelectionAdapter(SFLPhoneHomeActivity.this, service, new ArrayList<Account>()); |
| 374 | // spinnerAccounts.setAdapter(mAdapter); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 375 | } catch (RemoteException e) { |
| 376 | Log.e(TAG, e.toString()); |
| 377 | } |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 378 | mBound = true; |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 379 | Log.d(TAG, "Service connected service=" + service); |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 380 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 381 | } |
alision | 5f89963 | 2013-04-22 17:26:56 -0400 | [diff] [blame] | 382 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 383 | @Override |
| 384 | public void onServiceDisconnected(ComponentName arg0) { |
alision | 5f89963 | 2013-04-22 17:26:56 -0400 | [diff] [blame] | 385 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 386 | mBound = false; |
| 387 | Log.d(TAG, "Service disconnected service=" + service); |
| 388 | } |
| 389 | }; |
alision | 5f89963 | 2013-04-22 17:26:56 -0400 | [diff] [blame] | 390 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 391 | @Override |
| 392 | public boolean onOptionsItemSelected(MenuItem item) { |
| 393 | Log.i(TAG, "onOptionsItemSelected " + item.getItemId()); |
alision | 5f89963 | 2013-04-22 17:26:56 -0400 | [diff] [blame] | 394 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 395 | if (mDrawerToggle.onOptionsItemSelected(item)) { |
| 396 | return true; |
| 397 | } |
alision | 5f89963 | 2013-04-22 17:26:56 -0400 | [diff] [blame] | 398 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 399 | return super.onOptionsItemSelected(item); |
| 400 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 401 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 402 | @Override |
| 403 | public void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 404 | super.onActivityResult(requestCode, resultCode, data); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 405 | |
| 406 | switch (requestCode) { |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 407 | case REQUEST_CODE_PREFERENCES: |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 408 | Log.w(TAG, "In Activity"); |
| 409 | fMenu.updateAllAccounts(); |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 410 | break; |
| 411 | case REQUEST_CODE_CALL: |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 412 | Log.w(TAG, "Result out of CallActivity"); |
alision | 1005ba1 | 2013-06-19 13:52:44 -0400 | [diff] [blame] | 413 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 414 | break; |
| 415 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 416 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 417 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 418 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 419 | @Override |
| 420 | public void onCallSelected(SipCall c) { |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 421 | launchCallActivity(c); |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 422 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 423 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 424 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 425 | @Override |
| 426 | public ISipService getService() { |
| 427 | return service; |
| 428 | } |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 429 | |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 430 | /** |
| 431 | * Interface implemented to handle incoming events |
| 432 | */ |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 433 | @Override |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 434 | public void incomingCall(Intent call) { |
| 435 | Toast.makeText(this, "New Call incoming", Toast.LENGTH_LONG).show(); |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 436 | SipCall infos = call.getParcelableExtra("newcall"); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 437 | |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 438 | // mCallElementList.addCall(infos); |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 439 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 440 | launchCallActivity(infos); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 441 | |
| 442 | } |
| 443 | |
| 444 | @Override |
| 445 | public void callStateChanged(Intent callState) { |
| 446 | Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate"); |
| 447 | String cID = b.getString("CallID"); |
| 448 | String state = b.getString("State"); |
| 449 | Log.i(TAG, "callStateChanged" + cID + " " + state); |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 450 | // mCallElementList.updateCall(cID, state); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 451 | |
| 452 | } |
| 453 | |
| 454 | @Override |
| 455 | public void incomingText(Intent msg) { |
| 456 | Bundle b = msg.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext"); |
| 457 | b.getString("CallID"); |
| 458 | String from = b.getString("From"); |
| 459 | String mess = b.getString("Msg"); |
| 460 | Toast.makeText(getApplicationContext(), "text from " + from + " : " + mess, Toast.LENGTH_LONG).show(); |
| 461 | } |
| 462 | |
| 463 | @Override |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 464 | public void onContactSelected(final CallContact c) { |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 465 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 466 | Thread launcher = new Thread(new Runnable() { |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 467 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 468 | final String[] CONTACTS_PHONES_PROJECTION = new String[] { Phone.NUMBER, Phone.TYPE }; |
| 469 | final String[] CONTACTS_SIP_PROJECTION = new String[] { SipAddress.SIP_ADDRESS, SipAddress.TYPE }; |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 470 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 471 | @Override |
| 472 | public void run() { |
| 473 | SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance(); |
| 474 | try { |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 475 | callBuilder.startCallCreation().setAccountID(service.getAccountList().get(1).toString()) |
| 476 | .setCallType(SipCall.state.CALL_TYPE_OUTGOING); |
| 477 | Cursor cPhones = getContentResolver().query(Phone.CONTENT_URI, CONTACTS_PHONES_PROJECTION, Phone.CONTACT_ID + " =" + c.getId(), |
| 478 | null, null); |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 479 | |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 480 | while (cPhones.moveToNext()) { |
| 481 | c.addPhoneNumber(cPhones.getString(cPhones.getColumnIndex(Phone.NUMBER)), cPhones.getInt(cPhones.getColumnIndex(Phone.TYPE))); |
| 482 | } |
| 483 | cPhones.close(); |
| 484 | |
| 485 | Cursor cSip = getContentResolver().query(Phone.CONTENT_URI, CONTACTS_SIP_PROJECTION, Phone.CONTACT_ID + "=" + c.getId(), null, |
| 486 | null); |
| 487 | |
| 488 | while (cSip.moveToNext()) { |
| 489 | c.addSipNumber(cSip.getString(cSip.getColumnIndex(SipAddress.SIP_ADDRESS)), cSip.getInt(cSip.getColumnIndex(SipAddress.TYPE))); |
| 490 | } |
| 491 | cSip.close(); |
| 492 | callBuilder.setContact(c); |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 493 | launchCallActivity(callBuilder.build()); |
| 494 | } catch (RemoteException e1) { |
| 495 | Log.e(TAG, e1.toString()); |
| 496 | } catch (Exception e) { |
| 497 | Log.e(TAG, e.toString()); |
| 498 | } |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 499 | |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 500 | } |
| 501 | }); |
| 502 | launcher.start(); |
| 503 | mDrawer.close(); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 504 | |
| 505 | } |
| 506 | |
| 507 | @Override |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 508 | public void onCallDialed(String to) { |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 509 | |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 510 | SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance(); |
alision | 907bde7 | 2013-06-20 14:40:37 -0400 | [diff] [blame] | 511 | callBuilder.startCallCreation().setAccountID(fMenu.getSelectedAccount().getAccountID()).setCallType(SipCall.state.CALL_TYPE_OUTGOING); |
| 512 | callBuilder.setContact(CallContact.ContactBuilder.buildUnknownContact(to)); |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 513 | |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 514 | try { |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 515 | launchCallActivity(callBuilder.build()); |
alision | fde875f | 2013-05-28 17:01:54 -0400 | [diff] [blame] | 516 | } catch (Exception e) { |
| 517 | Log.e(TAG, e.toString()); |
| 518 | } |
alision | 84813a1 | 2013-05-27 17:40:39 -0400 | [diff] [blame] | 519 | |
alision | 9f7a6ec | 2013-05-24 16:26:26 -0400 | [diff] [blame] | 520 | } |
alision | 371b77e | 2013-04-23 14:51:26 -0400 | [diff] [blame] | 521 | |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 522 | @Override |
| 523 | public void onContactDragged() { |
| 524 | |
| 525 | mDrawer.close(); |
alision | 2cb9956 | 2013-05-30 17:02:20 -0400 | [diff] [blame] | 526 | mTabHost.setCurrentTab(1); |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 527 | |
| 528 | } |
| 529 | |
| 530 | private HashMap<String, TabInfo> mapTabInfo = new HashMap<String, SFLPhoneHomeActivity.TabInfo>(); |
| 531 | |
| 532 | /** |
| 533 | * A simple factory that returns dummy views to the Tabhost |
| 534 | * |
| 535 | * @author mwho |
| 536 | */ |
| 537 | class TabFactory implements TabContentFactory { |
| 538 | |
| 539 | private final Context mContext; |
| 540 | |
| 541 | /** |
| 542 | * @param context |
| 543 | */ |
| 544 | public TabFactory(Context context) { |
| 545 | mContext = context; |
| 546 | } |
| 547 | |
| 548 | /** |
| 549 | * (non-Javadoc) |
| 550 | * |
| 551 | * @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String) |
| 552 | */ |
| 553 | public View createTabContent(String tag) { |
| 554 | View v = new View(mContext); |
| 555 | v.setMinimumWidth(0); |
| 556 | v.setMinimumHeight(0); |
| 557 | return v; |
| 558 | } |
| 559 | |
| 560 | } |
| 561 | |
| 562 | /** |
| 563 | * |
| 564 | * @author mwho Maintains extrinsic info of a tab's construct |
| 565 | */ |
| 566 | private class TabInfo { |
| 567 | private String tag; |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 568 | |
| 569 | TabInfo(String tag, Class<?> clazz, Bundle args) { |
| 570 | this.tag = tag; |
alision | d45da71 | 2013-05-30 09:18:49 -0400 | [diff] [blame] | 571 | } |
| 572 | |
| 573 | } |
| 574 | |
| 575 | private static void AddTab(SFLPhoneHomeActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) { |
| 576 | // Attach a Tab view factory to the spec |
| 577 | tabSpec.setContent(activity.new TabFactory(activity)); |
| 578 | tabHost.addTab(tabSpec); |
| 579 | } |
| 580 | |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 581 | @Override |
| 582 | public void openDrawer() { |
alision | 55c36cb | 2013-06-14 14:57:38 -0400 | [diff] [blame] | 583 | mDrawer.animateOpen(); |
alision | 58356b7 | 2013-06-03 17:13:36 -0400 | [diff] [blame] | 584 | } |
| 585 | |
alision | 806e18e | 2013-06-21 15:30:17 -0400 | [diff] [blame] | 586 | @Override |
| 587 | public void confCreated(Intent intent) { |
| 588 | // TODO Auto-generated method stub |
| 589 | |
| 590 | } |
| 591 | |
| 592 | @Override |
| 593 | public void confRemoved(Intent intent) { |
| 594 | // TODO Auto-generated method stub |
| 595 | |
| 596 | } |
| 597 | |
| 598 | @Override |
| 599 | public void confChanged(Intent intent) { |
| 600 | // TODO Auto-generated method stub |
| 601 | |
| 602 | } |
| 603 | |
alision | f76de3b | 2013-04-16 15:35:22 -0400 | [diff] [blame] | 604 | } |