blob: 74546d5756f0e19da140e516bee3a102c6734fbe [file] [log] [blame]
Chiao Cheng94b10b52012-08-17 16:59:12 -07001/*
Yorke Leec3766332013-07-31 11:13:16 -07002 * Copyright (C) 2013 The Android Open Source Project
Chiao Cheng94b10b52012-08-17 16:59:12 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.dialer;
18
Yorke Leec3766332013-07-31 11:13:16 -070019import android.animation.Animator;
20import android.animation.Animator.AnimatorListener;
21import android.animation.AnimatorListenerAdapter;
Chiao Cheng94b10b52012-08-17 16:59:12 -070022import android.app.Activity;
Christine Chen9c1e0652013-05-23 15:40:19 -070023import android.app.backup.BackupManager;
Chiao Cheng94b10b52012-08-17 16:59:12 -070024import android.app.Fragment;
25import android.app.FragmentManager;
26import android.app.FragmentTransaction;
Chiao Cheng073b5cf2012-12-07 11:36:00 -080027import android.content.ActivityNotFoundException;
Chiao Cheng94b10b52012-08-17 16:59:12 -070028import android.content.Context;
29import android.content.Intent;
30import android.content.SharedPreferences;
Yorke Leec3766332013-07-31 11:13:16 -070031import android.content.res.Resources;
Chiao Cheng94b10b52012-08-17 16:59:12 -070032import android.net.Uri;
33import android.os.Bundle;
34import android.os.RemoteException;
35import android.os.ServiceManager;
Chiao Cheng94b10b52012-08-17 16:59:12 -070036import android.provider.CallLog.Calls;
Yorke Leec3766332013-07-31 11:13:16 -070037import android.provider.ContactsContract;
Chiao Cheng94b10b52012-08-17 16:59:12 -070038import android.provider.ContactsContract.Contacts;
39import android.provider.ContactsContract.Intents.UI;
Yorke Leec3766332013-07-31 11:13:16 -070040import android.provider.Settings;
41import android.speech.RecognizerIntent;
42import android.support.v4.app.NavUtils;
43import android.telephony.TelephonyManager;
44import android.text.Editable;
Chiao Cheng94b10b52012-08-17 16:59:12 -070045import android.text.TextUtils;
Yorke Leec3766332013-07-31 11:13:16 -070046import android.text.TextWatcher;
Chiao Cheng94b10b52012-08-17 16:59:12 -070047import android.util.Log;
48import android.view.Menu;
Chiao Cheng94b10b52012-08-17 16:59:12 -070049import android.view.MenuItem;
Chiao Cheng94b10b52012-08-17 16:59:12 -070050import android.view.View;
Chiao Cheng94b10b52012-08-17 16:59:12 -070051import android.view.View.OnFocusChangeListener;
52import android.view.ViewConfiguration;
Chiao Cheng94b10b52012-08-17 16:59:12 -070053import android.view.inputmethod.InputMethodManager;
Yorke Leec3766332013-07-31 11:13:16 -070054import android.widget.AbsListView.OnScrollListener;
55import android.widget.EditText;
56import android.widget.ImageView;
Chiao Cheng94b10b52012-08-17 16:59:12 -070057import android.widget.PopupMenu;
58import android.widget.SearchView;
59import android.widget.SearchView.OnCloseListener;
60import android.widget.SearchView.OnQueryTextListener;
Chiao Cheng073b5cf2012-12-07 11:36:00 -080061import android.widget.Toast;
Chiao Cheng94b10b52012-08-17 16:59:12 -070062
Chiao Cheng9d4f3b22012-09-05 16:00:16 -070063import com.android.contacts.common.CallUtil;
Chiao Cheng603ff682012-10-24 15:18:40 -070064import com.android.contacts.common.activity.TransactionSafeActivity;
Yorke Leec3766332013-07-31 11:13:16 -070065import com.android.contacts.common.dialog.ClearFrequentsDialog;
66import com.android.contacts.common.interactions.ImportExportDialogFragment;
Chiao Cheng1429f1a2012-11-01 16:35:28 -070067import com.android.contacts.common.list.ContactListItemView;
Chiao Cheng8efbcf92012-12-04 17:43:02 -080068import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
69import com.android.contacts.common.list.PhoneNumberPickerFragment;
Yorke Leec3766332013-07-31 11:13:16 -070070import com.android.dialer.calllog.CallLogActivity;
Yorke Leefce269a2013-08-12 11:56:04 -070071import com.android.dialer.database.DialerDatabaseHelper;
Yorke Leef74011e2013-08-02 11:30:30 -070072import com.android.dialer.dialpad.DialpadFragment;
Yorke Leec3766332013-07-31 11:13:16 -070073import com.android.dialer.dialpad.SmartDialNameMatcher;
Yorke Leefce269a2013-08-12 11:56:04 -070074import com.android.dialer.dialpad.SmartDialPrefix;
Chiao Cheng1429f1a2012-11-01 16:35:28 -070075import com.android.dialer.interactions.PhoneNumberInteraction;
Yorke Lee8dd62002013-08-08 15:57:20 -070076import com.android.dialer.list.AllContactsActivity;
Yorke Lee8898cd02013-08-08 10:24:27 -070077import com.android.dialer.list.PhoneFavoriteFragment;
Yorke Leec3766332013-07-31 11:13:16 -070078import com.android.dialer.list.OnListFragmentScrolledListener;
Yorke Leec3766332013-07-31 11:13:16 -070079import com.android.dialer.list.SmartDialSearchFragment;
Chiao Cheng94b10b52012-08-17 16:59:12 -070080import com.android.internal.telephony.ITelephony;
81
Yorke Leec3766332013-07-31 11:13:16 -070082import java.util.ArrayList;
83
Chiao Cheng94b10b52012-08-17 16:59:12 -070084/**
Chiao Cheng94b10b52012-08-17 16:59:12 -070085 * The dialer tab's title is 'phone', a more common name (see strings.xml).
86 */
Yorke Leec3766332013-07-31 11:13:16 -070087public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener,
Yorke Leef74011e2013-08-02 11:30:30 -070088 DialpadFragment.OnDialpadQueryChangedListener, PopupMenu.OnMenuItemClickListener,
Yorke Leec3766332013-07-31 11:13:16 -070089 OnListFragmentScrolledListener,
Yorke Lee8898cd02013-08-08 10:24:27 -070090 PhoneFavoriteFragment.OnPhoneFavoriteFragmentStartedListener,
Yorke Lee8dd62002013-08-08 15:57:20 -070091 DialpadFragment.OnDialpadFragmentStartedListener,
92 PhoneFavoriteFragment.OnShowAllContactsListener {
Chiao Cheng94b10b52012-08-17 16:59:12 -070093 private static final String TAG = "DialtactsActivity";
94
95 public static final boolean DEBUG = false;
96
Yorke Leef74011e2013-08-02 11:30:30 -070097 public static final String SHARED_PREFS_NAME = "com.android.dialer_preferences";
98
Chiao Cheng94b10b52012-08-17 16:59:12 -070099 /** Used to open Call Setting */
100 private static final String PHONE_PACKAGE = "com.android.phone";
101 private static final String CALL_SETTINGS_CLASS_NAME =
102 "com.android.phone.CallFeaturesSetting";
Chiao Cheng94b10b52012-08-17 16:59:12 -0700103 /** @see #getCallOrigin() */
104 private static final String CALL_ORIGIN_DIALTACTS =
105 "com.android.dialer.DialtactsActivity";
106
Yorke Leeef2b7382013-08-09 17:39:25 -0700107 private static final String KEY_IN_SEARCH_UI = "in_search_ui";
108 private static final String KEY_SEARCH_QUERY = "search_query";
109 private static final String KEY_FIRST_LAUNCH = "first_launch";
110
Yorke Leec3766332013-07-31 11:13:16 -0700111 private static final String TAG_DIALPAD_FRAGMENT = "dialpad";
112 private static final String TAG_REGULAR_SEARCH_FRAGMENT = "search";
113 private static final String TAG_SMARTDIAL_SEARCH_FRAGMENT = "smartdial";
114 private static final String TAG_FAVORITES_FRAGMENT = "favorites";
Yorke Leec3766332013-07-31 11:13:16 -0700115
Chiao Cheng94b10b52012-08-17 16:59:12 -0700116 /**
117 * Just for backward compatibility. Should behave as same as {@link Intent#ACTION_DIAL}.
118 */
119 private static final String ACTION_TOUCH_DIALER = "com.android.phone.action.TOUCH_DIALER";
120
Chiao Cheng94b10b52012-08-17 16:59:12 -0700121 private static final int SUBACTIVITY_ACCOUNT_FILTER = 1;
122
Yorke Leec3766332013-07-31 11:13:16 -0700123 private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700124
125 private String mFilterText;
126
Yorke Leec3766332013-07-31 11:13:16 -0700127 /**
128 * The main fragment displaying the user's favorites and frequent contacts
129 */
Yorke Lee8898cd02013-08-08 10:24:27 -0700130 private PhoneFavoriteFragment mPhoneFavoriteFragment;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700131
132 /**
Yorke Leec3766332013-07-31 11:13:16 -0700133 * Fragment containing the dialpad that slides into view
Chiao Cheng94b10b52012-08-17 16:59:12 -0700134 */
Yorke Leef74011e2013-08-02 11:30:30 -0700135 private DialpadFragment mDialpadFragment;
Yorke Leec3766332013-07-31 11:13:16 -0700136
137 /**
138 * Fragment for searching phone numbers using the alphanumeric keyboard.
139 */
Yorke Lee8898cd02013-08-08 10:24:27 -0700140 private SearchFragment mRegularSearchFragment;
Yorke Leec3766332013-07-31 11:13:16 -0700141
142 /**
143 * Fragment for searching phone numbers using the dialpad.
144 */
145 private SmartDialSearchFragment mSmartDialSearchFragment;
146
Yorke Leec3766332013-07-31 11:13:16 -0700147 private View mMenuButton;
148 private View mCallHistoryButton;
149 private View mDialpadButton;
150
151 // Padding view used to shift the fragments up when the dialpad is shown.
152 private View mBottomPaddingView;
153
Chiao Cheng94b10b52012-08-17 16:59:12 -0700154 /**
155 * True when this Activity is in its search UI (with a {@link SearchView} and
156 * {@link PhoneNumberPickerFragment}).
157 */
158 private boolean mInSearchUi;
Yorke Leeef2b7382013-08-09 17:39:25 -0700159 /**
160 * True when this activity has been launched for the first time.
161 */
Yorke Lee98702de2013-08-06 12:03:32 -0700162 private boolean mFirstLaunch;
Yorke Leec3766332013-07-31 11:13:16 -0700163 private View mSearchViewContainer;
164 private View mSearchViewCloseButton;
165 private View mVoiceSearchButton;
166 private EditText mSearchView;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700167
Yorke Leeef2b7382013-08-09 17:39:25 -0700168 private String mSearchQuery;
169
Yorke Leefce269a2013-08-12 11:56:04 -0700170 private DialerDatabaseHelper mDialerDatabaseHelper;
171
Chiao Cheng94b10b52012-08-17 16:59:12 -0700172 /**
173 * Listener used when one of phone numbers in search UI is selected. This will initiate a
174 * phone call using the phone number.
175 */
176 private final OnPhoneNumberPickerActionListener mPhoneNumberPickerActionListener =
177 new OnPhoneNumberPickerActionListener() {
178 @Override
179 public void onPickPhoneNumberAction(Uri dataUri) {
180 // Specify call-origin so that users will see the previous tab instead of
181 // CallLog screen (search UI will be automatically exited).
182 PhoneNumberInteraction.startInteractionForPhoneCall(
Yorke Leec3766332013-07-31 11:13:16 -0700183 DialtactsActivity.this, dataUri, getCallOrigin());
Yorke Leef6673d32013-08-23 15:34:17 -0700184 hideDialpadAndSearchUi();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700185 }
186
187 @Override
Jay Shrauner31a760b2013-07-26 09:34:49 -0700188 public void onCallNumberDirectly(String phoneNumber) {
189 Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin());
190 startActivity(intent);
Yorke Leef6673d32013-08-23 15:34:17 -0700191 hideDialpadAndSearchUi();
Jay Shrauner31a760b2013-07-26 09:34:49 -0700192 }
193
194 @Override
Chiao Cheng94b10b52012-08-17 16:59:12 -0700195 public void onShortcutIntentCreated(Intent intent) {
196 Log.w(TAG, "Unsupported intent has come (" + intent + "). Ignoring.");
197 }
198
199 @Override
200 public void onHomeInActionBarSelected() {
201 exitSearchUi();
202 }
203 };
204
205 /**
206 * Listener used to send search queries to the phone search fragment.
207 */
Yorke Leec3766332013-07-31 11:13:16 -0700208 private final TextWatcher mPhoneSearchQueryTextListener = new TextWatcher() {
209 @Override
210 public void beforeTextChanged(CharSequence s, int start, int count, int after) {
211 }
212
213 @Override
214 public void onTextChanged(CharSequence s, int start, int before, int count) {
Yorke Leec3766332013-07-31 11:13:16 -0700215 final String newText = s.toString();
Yorke Leeef2b7382013-08-09 17:39:25 -0700216 if (newText.equals(mSearchQuery)) {
217 // If the query hasn't changed (perhaps due to activity being destroyed
218 // and restored, or user launching the same DIAL intent twice), then there is
219 // no need to do anything here.
220 return;
221 }
222 mSearchQuery = newText;
223 if (DEBUG) {
224 Log.d(TAG, "onTextChange for mSearchView called with new query: " + s);
225 }
226 final boolean smartDialSearch = isDialpadShowing();
227
Yorke Leec3766332013-07-31 11:13:16 -0700228 // Show search result with non-empty text. Show a bare list otherwise.
229 if (TextUtils.isEmpty(newText) && mInSearchUi) {
230 exitSearchUi();
231 mSearchViewCloseButton.setVisibility(View.GONE);
232 return;
233 } else if (!TextUtils.isEmpty(newText) && !mInSearchUi) {
Yorke Leeef2b7382013-08-09 17:39:25 -0700234 enterSearchUi(smartDialSearch, newText);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700235 }
236
Yorke Leeef2b7382013-08-09 17:39:25 -0700237 if (smartDialSearch && mSmartDialSearchFragment != null) {
238 mSmartDialSearchFragment.setQueryString(newText, false);
239 } else if (mRegularSearchFragment != null) {
Yorke Leec3766332013-07-31 11:13:16 -0700240 mRegularSearchFragment.setQueryString(newText, false);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700241 }
Yorke Leec3766332013-07-31 11:13:16 -0700242 mSearchViewCloseButton.setVisibility(View.VISIBLE);
243 return;
244 }
245
246 @Override
247 public void afterTextChanged(Editable s) {
248 }
Chiao Cheng94b10b52012-08-17 16:59:12 -0700249 };
250
Yorke Leec3766332013-07-31 11:13:16 -0700251 private boolean isDialpadShowing() {
252 return mDialpadFragment != null && mDialpadFragment.isVisible();
253 }
Chiao Cheng94b10b52012-08-17 16:59:12 -0700254
255 @Override
Yorke Leec3766332013-07-31 11:13:16 -0700256 protected void onCreate(Bundle savedInstanceState) {
257 super.onCreate(savedInstanceState);
Yorke Lee98702de2013-08-06 12:03:32 -0700258 mFirstLaunch = true;
259
Chiao Cheng94b10b52012-08-17 16:59:12 -0700260 final Intent intent = getIntent();
261 fixIntent(intent);
262
Yorke Lee8898cd02013-08-08 10:24:27 -0700263 setContentView(R.layout.dialtacts_activity);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700264
Yorke Leec3766332013-07-31 11:13:16 -0700265 getActionBar().hide();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700266
Yorke Leeef2b7382013-08-09 17:39:25 -0700267 // Add the favorites fragment, and the dialpad fragment, but only if savedInstanceState
268 // is null. Otherwise the fragment manager takes care of recreating these fragments.
Yorke Leec3766332013-07-31 11:13:16 -0700269 if (savedInstanceState == null) {
Yorke Leeef2b7382013-08-09 17:39:25 -0700270 final PhoneFavoriteFragment phoneFavoriteFragment = new PhoneFavoriteFragment();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700271
Yorke Leec3766332013-07-31 11:13:16 -0700272 final FragmentTransaction ft = getFragmentManager().beginTransaction();
Yorke Leeef2b7382013-08-09 17:39:25 -0700273 ft.add(R.id.dialtacts_frame, phoneFavoriteFragment, TAG_FAVORITES_FRAGMENT);
274 ft.add(R.id.dialtacts_container, new DialpadFragment(), TAG_DIALPAD_FRAGMENT);
Yorke Leec3766332013-07-31 11:13:16 -0700275 ft.commit();
Yorke Leeef2b7382013-08-09 17:39:25 -0700276 } else {
277 mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY);
278 mInSearchUi = savedInstanceState.getBoolean(KEY_IN_SEARCH_UI);
279 mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700280 }
281
Yorke Leec3766332013-07-31 11:13:16 -0700282 mBottomPaddingView = findViewById(R.id.dialtacts_bottom_padding);
283 prepareSearchView();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700284
Chiao Cheng94b10b52012-08-17 16:59:12 -0700285 if (UI.FILTER_CONTACTS_ACTION.equals(intent.getAction())
Yorke Leec3766332013-07-31 11:13:16 -0700286 && savedInstanceState == null) {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700287 setupFilterText(intent);
288 }
Yorke Leefce269a2013-08-12 11:56:04 -0700289
290 mDialerDatabaseHelper = DialerDatabaseHelper.getInstance(this);
291 SmartDialPrefix.initializeNanpSettings(this);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700292 }
293
294 @Override
Yorke Leec3766332013-07-31 11:13:16 -0700295 protected void onResume() {
296 super.onResume();
Yorke Lee98702de2013-08-06 12:03:32 -0700297 if (mFirstLaunch) {
298 displayFragment(getIntent());
299 }
300 mFirstLaunch = false;
Yorke Leefce269a2013-08-12 11:56:04 -0700301 mDialerDatabaseHelper.startSmartDialUpdateThread();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700302 }
303
304 @Override
Yorke Leeef2b7382013-08-09 17:39:25 -0700305 protected void onSaveInstanceState(Bundle outState) {
306 super.onSaveInstanceState(outState);
307 outState.putString(KEY_SEARCH_QUERY, mSearchQuery);
308 outState.putBoolean(KEY_IN_SEARCH_UI, mInSearchUi);
309 outState.putBoolean(KEY_FIRST_LAUNCH, mFirstLaunch);
310 }
311
312 @Override
Yorke Leec3766332013-07-31 11:13:16 -0700313 public void onAttachFragment(Fragment fragment) {
Yorke Leeef2b7382013-08-09 17:39:25 -0700314 if (fragment instanceof DialpadFragment) {
315 mDialpadFragment = (DialpadFragment) fragment;
Yorke Leec3766332013-07-31 11:13:16 -0700316 final FragmentTransaction transaction = getFragmentManager().beginTransaction();
Yorke Leeef2b7382013-08-09 17:39:25 -0700317 transaction.hide(mDialpadFragment);
Yorke Leec3766332013-07-31 11:13:16 -0700318 transaction.commit();
Yorke Leeef2b7382013-08-09 17:39:25 -0700319 } else if (fragment instanceof SmartDialSearchFragment) {
320 mSmartDialSearchFragment = (SmartDialSearchFragment) fragment;
Yorke Lee63ea4cd2013-08-12 11:04:47 -0700321 mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(
322 mPhoneNumberPickerActionListener);
Yorke Leeef2b7382013-08-09 17:39:25 -0700323 } else if (fragment instanceof SearchFragment) {
324 mRegularSearchFragment = (SearchFragment) fragment;
Yorke Lee63ea4cd2013-08-12 11:04:47 -0700325 mRegularSearchFragment.setOnPhoneNumberPickerActionListener(
326 mPhoneNumberPickerActionListener);
Yorke Leeef2b7382013-08-09 17:39:25 -0700327 } else if (fragment instanceof PhoneFavoriteFragment) {
328 mPhoneFavoriteFragment = (PhoneFavoriteFragment) fragment;
Yorke Lee5781afe2013-08-12 11:12:59 -0700329 mPhoneFavoriteFragment.setListener(mPhoneFavoriteListener);
Yorke Leec3766332013-07-31 11:13:16 -0700330 }
Yorke Leec3766332013-07-31 11:13:16 -0700331 }
332
333 @Override
Yorke Leec3766332013-07-31 11:13:16 -0700334 public boolean onMenuItemClick(MenuItem item) {
335 switch (item.getItemId()) {
336 case R.id.menu_import_export:
337 // We hard-code the "contactsAreAvailable" argument because doing it properly would
338 // involve querying a {@link ProviderStatusLoader}, which we don't want to do right
339 // now in Dialtacts for (potential) performance reasons. Compare with how it is
340 // done in {@link PeopleActivity}.
341 ImportExportDialogFragment.show(getFragmentManager(), true,
Yorke Leef74011e2013-08-02 11:30:30 -0700342 DialtactsActivity.class);
Yorke Leec3766332013-07-31 11:13:16 -0700343 return true;
344 case R.id.menu_clear_frequents:
345 ClearFrequentsDialog.show(getFragmentManager());
346 return true;
347 case R.id.add_contact:
348 try {
349 startActivity(new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI));
350 } catch (ActivityNotFoundException e) {
351 Toast toast = Toast.makeText(this,
352 R.string.add_contact_not_available,
353 Toast.LENGTH_SHORT);
354 toast.show();
355 }
356 return true;
357 case R.id.menu_call_settings:
Yorke Leef74011e2013-08-02 11:30:30 -0700358 final Intent settingsIntent = DialtactsActivity.getCallSettingsIntent();
Yorke Leec3766332013-07-31 11:13:16 -0700359 startActivity(settingsIntent);
360 }
361 return false;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700362 }
363
364 @Override
365 public void onClick(View view) {
366 switch (view.getId()) {
Yorke Leec3766332013-07-31 11:13:16 -0700367 case R.id.overflow_menu: {
368 final PopupMenu popupMenu = new PopupMenu(DialtactsActivity.this, view);
369 final Menu menu = popupMenu.getMenu();
Yorke Lee8898cd02013-08-08 10:24:27 -0700370 popupMenu.inflate(R.menu.dialtacts_options);
Yorke Leef420a532013-08-09 15:16:10 -0700371 final MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents);
Yorke Lee0d391b42013-08-09 17:27:00 -0700372 clearFrequents.setVisible(mPhoneFavoriteFragment.hasFrequents());
Yorke Leec3766332013-07-31 11:13:16 -0700373 popupMenu.setOnMenuItemClickListener(this);
374 popupMenu.show();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700375 break;
376 }
Yorke Leec3766332013-07-31 11:13:16 -0700377 case R.id.dialpad_button:
378 showDialpadFragment(true);
379 break;
380 case R.id.call_history_on_dialpad_button:
381 case R.id.call_history_button:
Yorke Leef420a532013-08-09 15:16:10 -0700382 // Use explicit CallLogActivity intent instead of ACTION_VIEW +
383 // CONTENT_TYPE, so that we always open our call log from our dialer
Yorke Leec3766332013-07-31 11:13:16 -0700384 final Intent intent = new Intent(this, CallLogActivity.class);
385 startActivity(intent);
386 break;
387 case R.id.search_close_button:
388 // Clear the search field
389 if (!TextUtils.isEmpty(mSearchView.getText())) {
390 mSearchView.setText("");
Chiao Cheng94b10b52012-08-17 16:59:12 -0700391 }
392 break;
Yorke Leec3766332013-07-31 11:13:16 -0700393 case R.id.voice_search_button:
394 final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
395 startActivityForResult(voiceIntent, ACTIVITY_REQUEST_CODE_VOICE_SEARCH);
396 break;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700397 default: {
398 Log.wtf(TAG, "Unexpected onClick event from " + view);
399 break;
400 }
401 }
402 }
403
Yorke Leec3766332013-07-31 11:13:16 -0700404 @Override
405 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
406 if (requestCode == ACTIVITY_REQUEST_CODE_VOICE_SEARCH) {
407 if (resultCode == RESULT_OK) {
408 final ArrayList<String> matches = data.getStringArrayListExtra(
409 RecognizerIntent.EXTRA_RESULTS);
410 if (matches.size() > 0) {
411 final String match = matches.get(0);
412 mSearchView.setText(match);
413 } else {
414 Log.e(TAG, "Voice search - nothing heard");
415 }
416 } else {
417 Log.e(TAG, "Voice search failed");
418 }
419 }
420 super.onActivityResult(requestCode, resultCode, data);
421 }
Chiao Cheng94b10b52012-08-17 16:59:12 -0700422
Yorke Leec3766332013-07-31 11:13:16 -0700423 private void showDialpadFragment(boolean animate) {
Yorke Leeea695cb2013-08-09 11:02:26 -0700424 mDialpadFragment.setAdjustTranslationForAnimation(animate);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700425 final FragmentTransaction ft = getFragmentManager().beginTransaction();
Yorke Leec3766332013-07-31 11:13:16 -0700426 if (animate) {
427 ft.setCustomAnimations(R.anim.slide_in, 0);
Yorke Leeea695cb2013-08-09 11:02:26 -0700428 } else {
429 mDialpadFragment.setYFraction(0);
Yorke Leec3766332013-07-31 11:13:16 -0700430 }
431 ft.show(mDialpadFragment);
432 ft.commit();
433 }
Chiao Cheng94b10b52012-08-17 16:59:12 -0700434
Yorke Leef6673d32013-08-23 15:34:17 -0700435 private void hideDialpadFragment(boolean animate, boolean clearDialpad) {
436 if (mDialpadFragment == null) return;
437 if (clearDialpad) {
438 mDialpadFragment.clearDialpad();
439 }
440 if (!mDialpadFragment.isVisible()) return;
Yorke Leeea695cb2013-08-09 11:02:26 -0700441 mDialpadFragment.setAdjustTranslationForAnimation(animate);
Yorke Leec3766332013-07-31 11:13:16 -0700442 final FragmentTransaction ft = getFragmentManager().beginTransaction();
443 if (animate) {
444 ft.setCustomAnimations(0, R.anim.slide_out);
445 }
446 ft.hide(mDialpadFragment);
447 ft.commit();
448 }
449
Chiao Cheng94b10b52012-08-17 16:59:12 -0700450 private void prepareSearchView() {
Yorke Leec3766332013-07-31 11:13:16 -0700451 mSearchViewContainer = findViewById(R.id.search_view_container);
452 mSearchViewCloseButton = findViewById(R.id.search_close_button);
453 mSearchViewCloseButton.setOnClickListener(this);
454 mVoiceSearchButton = findViewById(R.id.voice_search_button);
455 mVoiceSearchButton.setOnClickListener(this);
456 mSearchView = (EditText) findViewById(R.id.search_view);
457 mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener);
458 mSearchView.setHint(getString(R.string.dialer_hint_find_contact));
459 mSearchView.setOnFocusChangeListener(new OnFocusChangeListener() {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700460 @Override
461 public void onFocusChange(View view, boolean hasFocus) {
462 if (hasFocus) {
463 showInputMethod(view.findFocus());
464 }
465 }
466 });
Chiao Cheng94b10b52012-08-17 16:59:12 -0700467 }
468
Yorke Leec3766332013-07-31 11:13:16 -0700469 final AnimatorListener mHideListener = new AnimatorListenerAdapter() {
470 @Override
471 public void onAnimationEnd(Animator animation) {
472 mSearchViewContainer.setVisibility(View.GONE);
473 }
474 };
Chiao Cheng94b10b52012-08-17 16:59:12 -0700475
Yorke Lee311969c2013-08-26 06:31:11 -0700476 private void hideDialpadAndSearchUi() {
477 if (mInSearchUi) {
478 exitSearchUi();
479 }
480 hideDialpadFragment(false, true);
481 }
482
Yorke Leec3766332013-07-31 11:13:16 -0700483 public void hideSearchBar() {
484 hideSearchBar(true);
Christine Chen9c1e0652013-05-23 15:40:19 -0700485 }
486
Yorke Leec3766332013-07-31 11:13:16 -0700487 public void hideSearchBar(boolean shiftView) {
488 if (shiftView) {
489 mSearchViewContainer.animate().cancel();
490 mSearchViewContainer.setAlpha(1);
491 mSearchViewContainer.setTranslationY(0);
492 mSearchViewContainer.animate().withLayer().alpha(0).translationY(-mSearchView.getHeight())
493 .setDuration(200).setListener(mHideListener);
494
Yorke Leeef2b7382013-08-09 17:39:25 -0700495 if (mPhoneFavoriteFragment == null || mPhoneFavoriteFragment.getView() == null) {
496 mBottomPaddingView.setVisibility(View.VISIBLE);
497 return;
498 }
499
Yorke Leec3766332013-07-31 11:13:16 -0700500 mPhoneFavoriteFragment.getView().animate().withLayer()
501 .translationY(-mSearchViewContainer.getHeight()).setDuration(200).setListener(
502 new AnimatorListenerAdapter() {
503 @Override
504 public void onAnimationEnd(Animator animation) {
505 mBottomPaddingView.setVisibility(View.VISIBLE);
Yorke Leeef2b7382013-08-09 17:39:25 -0700506 if (mPhoneFavoriteFragment.getView() != null) {
507 mPhoneFavoriteFragment.getView().setTranslationY(0);
508 }
Yorke Leec3766332013-07-31 11:13:16 -0700509 }
510 });
511 } else {
512 mSearchViewContainer.setTranslationY(-mSearchView.getHeight());
513 }
514 }
515
516 public void showSearchBar() {
Yorke Leeef2b7382013-08-09 17:39:25 -0700517
518
Yorke Leec3766332013-07-31 11:13:16 -0700519 mSearchViewContainer.animate().cancel();
520 mSearchViewContainer.setAlpha(0);
521 mSearchViewContainer.setTranslationY(-mSearchViewContainer.getHeight());
522 mSearchViewContainer.animate().withLayer().alpha(1).translationY(0).setDuration(200)
523 .setListener(new AnimatorListenerAdapter() {
524 @Override
525 public void onAnimationStart(Animator animation) {
526 mSearchViewContainer.setVisibility(View.VISIBLE);
527 }
528 });
529
Yorke Leeef2b7382013-08-09 17:39:25 -0700530 // If the favorites fragment hasn't been fully created before the dialpad fragment
531 // is hidden (i.e. onResume), don't bother animating
532 if (mPhoneFavoriteFragment == null || mPhoneFavoriteFragment.getView() == null) {
533 mBottomPaddingView.setVisibility(View.GONE);
534 return;
535 }
Yorke Leec3766332013-07-31 11:13:16 -0700536 mPhoneFavoriteFragment.getView().setTranslationY(-mSearchViewContainer.getHeight());
537 mPhoneFavoriteFragment.getView().animate().withLayer().translationY(0).setDuration(200)
538 .setListener(
539 new AnimatorListenerAdapter() {
540 @Override
541 public void onAnimationStart(Animator animation) {
542 mBottomPaddingView.setVisibility(View.GONE);
543 }
544 });
545 }
546
547
548 public void setupFakeActionBarItemsForFavoritesFragment() {
549 mMenuButton = findViewById(R.id.overflow_menu);
550 if (mMenuButton != null) {
551 mMenuButton.setOnClickListener(this);
552 }
553
554 mCallHistoryButton = findViewById(R.id.call_history_button);
555 // mCallHistoryButton.setMinimumWidth(fakeMenuItemWidth);
556 mCallHistoryButton.setOnClickListener(this);
557
558 mDialpadButton = findViewById(R.id.dialpad_button);
559 // DialpadButton.setMinimumWidth(fakeMenuItemWidth);
560 mDialpadButton.setOnClickListener(this);
561 }
562
563 public void setupFakeActionBarItemsForDialpadFragment() {
564 final View callhistoryButton = findViewById(R.id.call_history_on_dialpad_button);
565 callhistoryButton.setOnClickListener(this);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700566 }
567
568 private void fixIntent(Intent intent) {
569 // This should be cleaned up: the call key used to send an Intent
570 // that just said to go to the recent calls list. It now sends this
571 // abstract action, but this class hasn't been rewritten to deal with it.
572 if (Intent.ACTION_CALL_BUTTON.equals(intent.getAction())) {
573 intent.setDataAndType(Calls.CONTENT_URI, Calls.CONTENT_TYPE);
574 intent.putExtra("call_key", true);
575 setIntent(intent);
576 }
577 }
578
Chiao Cheng94b10b52012-08-17 16:59:12 -0700579 /**
580 * Returns true if the intent is due to hitting the green send key (hardware call button:
581 * KEYCODE_CALL) while in a call.
582 *
583 * @param intent the intent that launched this activity
584 * @param recentCallsRequest true if the intent is requesting to view recent calls
585 * @return true if the intent is due to hitting the green send key while in a call
586 */
Yorke Leec3766332013-07-31 11:13:16 -0700587 private boolean isSendKeyWhileInCall(Intent intent, boolean recentCallsRequest) {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700588 // If there is a call in progress go to the call screen
589 if (recentCallsRequest) {
590 final boolean callKey = intent.getBooleanExtra("call_key", false);
591
592 try {
593 ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
594 if (callKey && phone != null && phone.showCallScreen()) {
595 return true;
596 }
597 } catch (RemoteException e) {
598 Log.e(TAG, "Failed to handle send while in call", e);
599 }
600 }
601
602 return false;
603 }
604
605 /**
606 * Sets the current tab based on the intent's request type
607 *
608 * @param intent Intent that contains information about which tab should be selected
609 */
Yorke Leec3766332013-07-31 11:13:16 -0700610 private void displayFragment(Intent intent) {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700611 // If we got here by hitting send and we're in call forward along to the in-call activity
612 boolean recentCallsRequest = Calls.CONTENT_TYPE.equals(intent.resolveType(
613 getContentResolver()));
614 if (isSendKeyWhileInCall(intent, recentCallsRequest)) {
615 finish();
616 return;
617 }
618
Yorke Lee98702de2013-08-06 12:03:32 -0700619 if (mDialpadFragment != null && (phoneIsInUse() || isDialIntent(intent))) {
Yorke Leec3766332013-07-31 11:13:16 -0700620 mDialpadFragment.setStartedFromNewIntent(true);
Yorke Leeea695cb2013-08-09 11:02:26 -0700621 showDialpadFragment(false);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700622 }
Chiao Cheng94b10b52012-08-17 16:59:12 -0700623 }
624
625 @Override
626 public void onNewIntent(Intent newIntent) {
627 setIntent(newIntent);
628 fixIntent(newIntent);
Yorke Leec3766332013-07-31 11:13:16 -0700629 displayFragment(newIntent);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700630 final String action = newIntent.getAction();
Yorke Leec3766332013-07-31 11:13:16 -0700631
Chiao Cheng94b10b52012-08-17 16:59:12 -0700632 invalidateOptionsMenu();
633 }
634
635 /** Returns true if the given intent contains a phone number to populate the dialer with */
636 private boolean isDialIntent(Intent intent) {
637 final String action = intent.getAction();
638 if (Intent.ACTION_DIAL.equals(action) || ACTION_TOUCH_DIALER.equals(action)) {
639 return true;
640 }
641 if (Intent.ACTION_VIEW.equals(action)) {
642 final Uri data = intent.getData();
Chiao Cheng9d4f3b22012-09-05 16:00:16 -0700643 if (data != null && CallUtil.SCHEME_TEL.equals(data.getScheme())) {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700644 return true;
645 }
646 }
647 return false;
648 }
649
650 /**
651 * Returns an appropriate call origin for this Activity. May return null when no call origin
652 * should be used (e.g. when some 3rd party application launched the screen. Call origin is
653 * for remembering the tab in which the user made a phone call, so the external app's DIAL
654 * request should not be counted.)
655 */
656 public String getCallOrigin() {
657 return !isDialIntent(getIntent()) ? CALL_ORIGIN_DIALTACTS : null;
658 }
659
660 /**
661 * Retrieves the filter text stored in {@link #setupFilterText(Intent)}.
662 * This text originally came from a FILTER_CONTACTS_ACTION intent received
663 * by this activity. The stored text will then be cleared after after this
664 * method returns.
665 *
666 * @return The stored filter text
667 */
668 public String getAndClearFilterText() {
669 String filterText = mFilterText;
670 mFilterText = null;
671 return filterText;
672 }
673
674 /**
675 * Stores the filter text associated with a FILTER_CONTACTS_ACTION intent.
676 * This is so child activities can check if they are supposed to display a filter.
677 *
678 * @param intent The intent received in {@link #onNewIntent(Intent)}
679 */
680 private void setupFilterText(Intent intent) {
681 // If the intent was relaunched from history, don't apply the filter text.
682 if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
683 return;
684 }
685 String filter = intent.getStringExtra(UI.FILTER_TEXT_EXTRA_KEY);
686 if (filter != null && filter.length() > 0) {
687 mFilterText = filter;
688 }
689 }
690
Yorke Lee8898cd02013-08-08 10:24:27 -0700691 private final PhoneFavoriteFragment.Listener mPhoneFavoriteListener =
692 new PhoneFavoriteFragment.Listener() {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700693 @Override
694 public void onContactSelected(Uri contactUri) {
695 PhoneNumberInteraction.startInteractionForPhoneCall(
Yorke Leec3766332013-07-31 11:13:16 -0700696 DialtactsActivity.this, contactUri, getCallOrigin());
Chiao Cheng94b10b52012-08-17 16:59:12 -0700697 }
698
699 @Override
700 public void onCallNumberDirectly(String phoneNumber) {
Chiao Cheng9d4f3b22012-09-05 16:00:16 -0700701 Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin());
Chiao Cheng94b10b52012-08-17 16:59:12 -0700702 startActivity(intent);
703 }
704 };
705
Yorke Leec3766332013-07-31 11:13:16 -0700706 /* TODO krelease: This is only relevant for phones that have a hard button search key (i.e.
707 * Nexus S). Supporting it is a little more tricky because of the dialpad fragment might
708 * be showing when the search key is pressed so there is more state management involved.
Chiao Cheng94b10b52012-08-17 16:59:12 -0700709
710 @Override
711 public void startSearch(String initialQuery, boolean selectInitialQuery,
712 Bundle appSearchData, boolean globalSearch) {
Yorke Leec3766332013-07-31 11:13:16 -0700713 if (mRegularSearchFragment != null && mRegularSearchFragment.isAdded() && !globalSearch) {
Chiao Cheng94b10b52012-08-17 16:59:12 -0700714 if (mInSearchUi) {
715 if (mSearchView.hasFocus()) {
716 showInputMethod(mSearchView.findFocus());
717 } else {
718 mSearchView.requestFocus();
719 }
720 } else {
721 enterSearchUi();
722 }
723 } else {
724 super.startSearch(initialQuery, selectInitialQuery, appSearchData, globalSearch);
725 }
Yorke Leec3766332013-07-31 11:13:16 -0700726 }*/
Chiao Cheng94b10b52012-08-17 16:59:12 -0700727
728 private void showInputMethod(View view) {
Yorke Leec3766332013-07-31 11:13:16 -0700729 final InputMethodManager imm = (InputMethodManager) getSystemService(
730 Context.INPUT_METHOD_SERVICE);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700731 if (imm != null) {
Yorke Leec3766332013-07-31 11:13:16 -0700732 imm.showSoftInput(view, 0);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700733 }
734 }
735
736 private void hideInputMethod(View view) {
Yorke Leec3766332013-07-31 11:13:16 -0700737 final InputMethodManager imm = (InputMethodManager) getSystemService(
738 Context.INPUT_METHOD_SERVICE);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700739 if (imm != null && view != null) {
740 imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
741 }
742 }
743
744 /**
Yorke Leec3766332013-07-31 11:13:16 -0700745 * Shows the search fragment
Chiao Cheng94b10b52012-08-17 16:59:12 -0700746 */
Yorke Leeef2b7382013-08-09 17:39:25 -0700747 private void enterSearchUi(boolean smartDialSearch, String query) {
Yorke Lee34bdf872013-08-15 14:11:50 -0700748 if (getFragmentManager().isDestroyed()) {
749 // Weird race condition where fragment is doing work after the activity is destroyed
750 // due to talkback being on (b/10209937). Just return since we can't do any
751 // constructive here.
752 return;
753 }
754
Yorke Leeef2b7382013-08-09 17:39:25 -0700755 if (DEBUG) {
756 Log.d(TAG, "Entering search UI - smart dial " + smartDialSearch);
757 }
758 final String tag = smartDialSearch ? TAG_SMARTDIAL_SEARCH_FRAGMENT :
759 TAG_REGULAR_SEARCH_FRAGMENT;
760
Yorke Leec3766332013-07-31 11:13:16 -0700761 final FragmentTransaction transaction = getFragmentManager().beginTransaction();
762 transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700763
Yorke Leeef2b7382013-08-09 17:39:25 -0700764 SearchFragment fragment;
765
766 transaction.remove(mPhoneFavoriteFragment);
767 fragment = (SearchFragment) getFragmentManager().findFragmentByTag(tag);
768 if (fragment == null) {
769 if (smartDialSearch) {
770 fragment = new SmartDialSearchFragment();
771 } else {
772 fragment = new SearchFragment();
773 }
774 transaction.replace(R.id.dialtacts_frame, fragment, tag);
775 } else {
776 transaction.attach(fragment);
777 }
778
779 transaction.addToBackStack(null);
780 fragment.setQueryString(query, false);
781 transaction.commit();
Yorke Leec3766332013-07-31 11:13:16 -0700782 mInSearchUi = true;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700783 }
784
785 /**
Yorke Leec3766332013-07-31 11:13:16 -0700786 * Hides the search fragment
Chiao Cheng94b10b52012-08-17 16:59:12 -0700787 */
Yorke Leec3766332013-07-31 11:13:16 -0700788 private void exitSearchUi() {
Yorke Leeef2b7382013-08-09 17:39:25 -0700789 getFragmentManager().popBackStack();
Yorke Leec3766332013-07-31 11:13:16 -0700790 mInSearchUi = false;
Chiao Cheng94b10b52012-08-17 16:59:12 -0700791 }
792
793 /** Returns an Intent to launch Call Settings screen */
794 public static Intent getCallSettingsIntent() {
795 final Intent intent = new Intent(Intent.ACTION_MAIN);
796 intent.setClassName(PHONE_PACKAGE, CALL_SETTINGS_CLASS_NAME);
797 intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
798 return intent;
799 }
800
801 @Override
Yorke Leec3766332013-07-31 11:13:16 -0700802 public void onBackPressed() {
Yorke Leeef2b7382013-08-09 17:39:25 -0700803 if (mDialpadFragment != null && mDialpadFragment.isVisible()) {
Yorke Leef6673d32013-08-23 15:34:17 -0700804 hideDialpadFragment(true, false);
Yorke Leec3766332013-07-31 11:13:16 -0700805 } else if (mInSearchUi) {
806 mSearchView.setText(null);
Yorke Leef6673d32013-08-23 15:34:17 -0700807 mDialpadFragment.clearDialpad();
Yorke Leec3766332013-07-31 11:13:16 -0700808 } else if (isTaskRoot()) {
809 // Instead of stopping, simply push this to the back of the stack.
810 // This is only done when running at the top of the stack;
811 // otherwise, we have been launched by someone else so need to
812 // allow the user to go back to the caller.
813 moveTaskToBack(false);
814 } else {
815 super.onBackPressed();
Chiao Cheng94b10b52012-08-17 16:59:12 -0700816 }
Yorke Leec3766332013-07-31 11:13:16 -0700817 }
818
819 @Override
820 public void onDialpadQueryChanged(String query) {
821 final String normalizedQuery = SmartDialNameMatcher.normalizeNumber(query,
822 SmartDialNameMatcher.LATIN_SMART_DIAL_MAP);
823 if (!TextUtils.equals(mSearchView.getText(), normalizedQuery)) {
Yorke Leeef2b7382013-08-09 17:39:25 -0700824 if (DEBUG) {
825 Log.d(TAG, "onDialpadQueryChanged - new query: " + query);
826 }
827 if (mDialpadFragment == null || !mDialpadFragment.isVisible()) {
828 // This callback can happen if the dialpad fragment is recreated because of
829 // activity destruction. In that case, don't update the search view because
830 // that would bring the user back to the search fragment regardless of the
831 // previous state of the application. Instead, just return here and let the
832 // fragment manager correctly figure out whatever fragment was last displayed.
833 return;
834 }
Yorke Leec3766332013-07-31 11:13:16 -0700835 mSearchView.setText(normalizedQuery);
Chiao Cheng94b10b52012-08-17 16:59:12 -0700836 }
837 }
Yorke Leec3766332013-07-31 11:13:16 -0700838
839 @Override
840 public void onListFragmentScrollStateChange(int scrollState) {
841 if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
Yorke Leef6673d32013-08-23 15:34:17 -0700842 hideDialpadFragment(true, false);
Yorke Leec3766332013-07-31 11:13:16 -0700843 hideInputMethod(getCurrentFocus());
844 }
845 }
846
847 @Override
848 public void onPhoneFavoriteFragmentStarted() {
849 setupFakeActionBarItemsForFavoritesFragment();
850 }
851
852 @Override
853 public void onDialpadFragmentStarted() {
854 setupFakeActionBarItemsForDialpadFragment();
855 }
856
857 private boolean phoneIsInUse() {
858 final TelephonyManager tm = (TelephonyManager) getSystemService(
859 Context.TELEPHONY_SERVICE);
860 return tm.getCallState() != TelephonyManager.CALL_STATE_IDLE;
861 }
Yorke Lee8dd62002013-08-08 15:57:20 -0700862
863 @Override
864 public void onShowAllContacts() {
865 final Intent intent = new Intent(this, AllContactsActivity.class);
866 startActivity(intent);
867 }
Chiao Cheng94b10b52012-08-17 16:59:12 -0700868}