Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 1 | /* |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 2 | * Copyright (C) 2013 The Android Open Source Project |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 3 | * |
| 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 | |
| 17 | package com.android.dialer; |
| 18 | |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 19 | import android.animation.LayoutTransition; |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 20 | import android.app.ActionBar; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 21 | import android.app.Activity; |
| 22 | import android.app.Fragment; |
| 23 | import android.app.FragmentManager; |
| 24 | import android.app.FragmentTransaction; |
Chiao Cheng | 073b5cf | 2012-12-07 11:36:00 -0800 | [diff] [blame] | 25 | import android.content.ActivityNotFoundException; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 26 | import android.content.Context; |
| 27 | import android.content.Intent; |
Yorke Lee | da0f904 | 2013-12-05 14:25:51 -0800 | [diff] [blame] | 28 | import android.content.pm.PackageManager; |
| 29 | import android.content.pm.ResolveInfo; |
Yorke Lee | 33932ff | 2014-04-16 13:34:32 -0700 | [diff] [blame] | 30 | import android.content.res.TypedArray; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 31 | import android.net.Uri; |
| 32 | import android.os.Bundle; |
| 33 | import android.os.RemoteException; |
| 34 | import android.os.ServiceManager; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 35 | import android.provider.ContactsContract.Contacts; |
Yorke Lee | e142481 | 2013-09-04 18:24:48 -0700 | [diff] [blame] | 36 | import android.provider.ContactsContract.Intents; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 37 | import android.speech.RecognizerIntent; |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 38 | import android.support.v4.view.ViewPager; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 39 | import android.telephony.TelephonyManager; |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 40 | import android.text.Editable; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 41 | import android.text.TextUtils; |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 42 | import android.text.TextWatcher; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 43 | import android.util.Log; |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 44 | import android.view.DragEvent; |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 45 | import android.view.KeyEvent; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 46 | import android.view.Menu; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 47 | import android.view.MenuItem; |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 48 | import android.view.MotionEvent; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 49 | import android.view.View; |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 50 | import android.view.View.OnDragListener; |
Yorke Lee | c7b2a0e | 2014-05-20 17:21:25 -0700 | [diff] [blame] | 51 | import android.view.View.OnTouchListener; |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 52 | import android.view.animation.AccelerateInterpolator; |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 53 | import android.view.animation.Animation; |
| 54 | import android.view.animation.Animation.AnimationListener; |
| 55 | import android.view.animation.AnimationUtils; |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 56 | import android.view.animation.DecelerateInterpolator; |
| 57 | import android.view.animation.Interpolator; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 58 | import android.view.inputmethod.InputMethodManager; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 59 | import android.widget.AbsListView.OnScrollListener; |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 60 | import android.widget.EditText; |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 61 | import android.widget.ImageButton; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 62 | import android.widget.PopupMenu; |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 63 | import android.widget.RelativeLayout; |
Chiao Cheng | 073b5cf | 2012-12-07 11:36:00 -0800 | [diff] [blame] | 64 | import android.widget.Toast; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 65 | |
Chiao Cheng | 9d4f3b2 | 2012-09-05 16:00:16 -0700 | [diff] [blame] | 66 | import com.android.contacts.common.CallUtil; |
Chiao Cheng | 603ff68 | 2012-10-24 15:18:40 -0700 | [diff] [blame] | 67 | import com.android.contacts.common.activity.TransactionSafeActivity; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 68 | import com.android.contacts.common.dialog.ClearFrequentsDialog; |
| 69 | import com.android.contacts.common.interactions.ImportExportDialogFragment; |
Chiao Cheng | 8efbcf9 | 2012-12-04 17:43:02 -0800 | [diff] [blame] | 70 | import com.android.contacts.common.list.OnPhoneNumberPickerActionListener; |
Andrew Lee | 4cbc973 | 2014-04-24 14:38:58 -0700 | [diff] [blame] | 71 | import com.android.contacts.common.util.ViewUtil; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 72 | import com.android.dialer.calllog.CallLogActivity; |
Yorke Lee | fce269a | 2013-08-12 11:56:04 -0700 | [diff] [blame] | 73 | import com.android.dialer.database.DialerDatabaseHelper; |
Yorke Lee | f74011e | 2013-08-02 11:30:30 -0700 | [diff] [blame] | 74 | import com.android.dialer.dialpad.DialpadFragment; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 75 | import com.android.dialer.dialpad.SmartDialNameMatcher; |
Yorke Lee | fce269a | 2013-08-12 11:56:04 -0700 | [diff] [blame] | 76 | import com.android.dialer.dialpad.SmartDialPrefix; |
Chiao Cheng | 1429f1a | 2012-11-01 16:35:28 -0700 | [diff] [blame] | 77 | import com.android.dialer.interactions.PhoneNumberInteraction; |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 78 | import com.android.dialer.list.DragDropController; |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 79 | import com.android.dialer.list.ListsFragment; |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 80 | import com.android.dialer.list.OnDragDropListener; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 81 | import com.android.dialer.list.OnListFragmentScrolledListener; |
Yorke Lee | d999b71 | 2014-04-23 15:10:58 -0700 | [diff] [blame] | 82 | import com.android.dialer.list.SpeedDialFragment; |
Yorke Lee | efb2d9c | 2014-04-18 14:05:01 -0700 | [diff] [blame] | 83 | import com.android.dialer.list.PhoneFavoriteSquareTileView; |
Jay Shrauner | 2e5b34b | 2013-08-29 10:52:40 -0700 | [diff] [blame] | 84 | import com.android.dialer.list.RegularSearchFragment; |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 85 | import com.android.dialer.list.RemoveView; |
Jay Shrauner | 2e5b34b | 2013-08-29 10:52:40 -0700 | [diff] [blame] | 86 | import com.android.dialer.list.SearchFragment; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 87 | import com.android.dialer.list.SmartDialSearchFragment; |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 88 | import com.android.dialer.widget.SearchEditTextLayout; |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 89 | import com.android.dialer.widget.SearchEditTextLayout.OnBackButtonClickedListener; |
Yorke Lee | 0baa98b | 2013-08-22 10:55:16 -0700 | [diff] [blame] | 90 | import com.android.dialerbind.DatabaseHelperManager; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 91 | import com.android.internal.telephony.ITelephony; |
| 92 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 93 | import java.util.ArrayList; |
Yorke Lee | da0f904 | 2013-12-05 14:25:51 -0800 | [diff] [blame] | 94 | import java.util.List; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 95 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 96 | /** |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 97 | * The dialer tab's title is 'phone', a more common name (see strings.xml). |
| 98 | */ |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 99 | public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener, |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 100 | DialpadFragment.OnDialpadQueryChangedListener, |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 101 | OnListFragmentScrolledListener, |
Ihab Awad | 526c0b8 | 2014-02-27 12:55:36 -0800 | [diff] [blame] | 102 | DialpadFragment.HostInterface, |
Yorke Lee | 6a1461a | 2014-04-21 16:27:14 -0700 | [diff] [blame] | 103 | ListsFragment.HostInterface, |
Yorke Lee | d999b71 | 2014-04-23 15:10:58 -0700 | [diff] [blame] | 104 | SpeedDialFragment.HostInterface, |
Andrew Lee | 752956e | 2014-05-15 11:43:38 -0700 | [diff] [blame] | 105 | OnDragDropListener, |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 106 | OnPhoneNumberPickerActionListener, |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 107 | PopupMenu.OnMenuItemClickListener, |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 108 | ViewPager.OnPageChangeListener { |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 109 | private static final String TAG = "DialtactsActivity"; |
| 110 | |
Ihab Awad | 526c0b8 | 2014-02-27 12:55:36 -0800 | [diff] [blame] | 111 | public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 112 | |
Yorke Lee | f74011e | 2013-08-02 11:30:30 -0700 | [diff] [blame] | 113 | public static final String SHARED_PREFS_NAME = "com.android.dialer_preferences"; |
| 114 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 115 | /** Used to open Call Setting */ |
| 116 | private static final String PHONE_PACKAGE = "com.android.phone"; |
| 117 | private static final String CALL_SETTINGS_CLASS_NAME = |
| 118 | "com.android.phone.CallFeaturesSetting"; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 119 | /** @see #getCallOrigin() */ |
| 120 | private static final String CALL_ORIGIN_DIALTACTS = |
| 121 | "com.android.dialer.DialtactsActivity"; |
| 122 | |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 123 | private static final String KEY_IN_REGULAR_SEARCH_UI = "in_regular_search_ui"; |
| 124 | private static final String KEY_IN_DIALPAD_SEARCH_UI = "in_dialpad_search_ui"; |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 125 | private static final String KEY_SEARCH_QUERY = "search_query"; |
| 126 | private static final String KEY_FIRST_LAUNCH = "first_launch"; |
| 127 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 128 | private static final String TAG_DIALPAD_FRAGMENT = "dialpad"; |
| 129 | private static final String TAG_REGULAR_SEARCH_FRAGMENT = "search"; |
| 130 | private static final String TAG_SMARTDIAL_SEARCH_FRAGMENT = "smartdial"; |
| 131 | private static final String TAG_FAVORITES_FRAGMENT = "favorites"; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 132 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 133 | /** |
| 134 | * Just for backward compatibility. Should behave as same as {@link Intent#ACTION_DIAL}. |
| 135 | */ |
| 136 | private static final String ACTION_TOUCH_DIALER = "com.android.phone.action.TOUCH_DIALER"; |
| 137 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 138 | private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 139 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 140 | private static final int ANIMATION_DURATION = 250; |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 141 | |
Andrew Lee | 0c66770 | 2014-05-12 14:31:45 -0700 | [diff] [blame] | 142 | private RelativeLayout parentLayout; |
| 143 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 144 | /** |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 145 | * Fragment containing the dialpad that slides into view |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 146 | */ |
Yorke Lee | f74011e | 2013-08-02 11:30:30 -0700 | [diff] [blame] | 147 | private DialpadFragment mDialpadFragment; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 148 | |
| 149 | /** |
| 150 | * Fragment for searching phone numbers using the alphanumeric keyboard. |
| 151 | */ |
Jay Shrauner | 2e5b34b | 2013-08-29 10:52:40 -0700 | [diff] [blame] | 152 | private RegularSearchFragment mRegularSearchFragment; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 153 | |
| 154 | /** |
| 155 | * Fragment for searching phone numbers using the dialpad. |
| 156 | */ |
| 157 | private SmartDialSearchFragment mSmartDialSearchFragment; |
| 158 | |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 159 | /** |
| 160 | * Fragment containing the speed dial list, recents list, and all contacts list. |
| 161 | */ |
| 162 | private ListsFragment mListsFragment; |
| 163 | |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 164 | private View mFloatingActionButtonContainer; |
| 165 | private ImageButton mFloatingActionButton; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 166 | |
Yorke Lee | 33932ff | 2014-04-16 13:34:32 -0700 | [diff] [blame] | 167 | private int mActionBarHeight; |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 168 | private boolean mInDialpadSearch; |
| 169 | private boolean mInRegularSearch; |
Yorke Lee | 8e5c8b1 | 2013-10-01 14:37:55 -0700 | [diff] [blame] | 170 | private boolean mClearSearchOnPause; |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 171 | private boolean mIsDialpadShown; |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 172 | |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 173 | /** |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 174 | * The position of the currently selected tab in the attached {@link ListsFragment}. |
| 175 | */ |
| 176 | private int mCurrentTabPosition = 0; |
| 177 | |
| 178 | /** |
Yorke Lee | 35127cd | 2013-09-10 14:09:29 -0700 | [diff] [blame] | 179 | * True if the dialpad is only temporarily showing due to being in call |
| 180 | */ |
| 181 | private boolean mInCallDialpadUp; |
| 182 | |
| 183 | /** |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 184 | * True when this activity has been launched for the first time. |
| 185 | */ |
Yorke Lee | 98702de | 2013-08-06 12:03:32 -0700 | [diff] [blame] | 186 | private boolean mFirstLaunch; |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 187 | |
Yorke Lee | 3c9e7cd | 2014-04-16 11:37:21 -0700 | [diff] [blame] | 188 | /** |
| 189 | * Search query to be applied to the SearchView in the ActionBar once |
| 190 | * onCreateOptionsMenu has been called. |
| 191 | */ |
| 192 | private String mPendingSearchViewQuery; |
| 193 | |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 194 | private EditText mSearchView; |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 195 | private View mVoiceSearchButton; |
Yorke Lee | ec489fb | 2014-05-19 15:39:27 -0700 | [diff] [blame] | 196 | private SearchEditTextLayout mSearchEditTextLayout; |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 197 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 198 | /** |
| 199 | * View that contains the "Remove" dialog that shows up when the user long presses a contact. |
| 200 | * If the user releases a contact when hovering on top of this, the contact is unfavorited and |
| 201 | * removed from the speed dial list. |
| 202 | */ |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 203 | private View mRemoveViewContainer; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 204 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 205 | final Interpolator hideActionBarInterpolator = new AccelerateInterpolator(1.5f); |
| 206 | final Interpolator showActionBarInterpolator = new DecelerateInterpolator(1.5f); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 207 | private String mSearchQuery; |
| 208 | |
Yorke Lee | fce269a | 2013-08-12 11:56:04 -0700 | [diff] [blame] | 209 | private DialerDatabaseHelper mDialerDatabaseHelper; |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 210 | private DragDropController mDragDropController; |
Yorke Lee | fce269a | 2013-08-12 11:56:04 -0700 | [diff] [blame] | 211 | |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 212 | private class OptionsPopupMenu extends PopupMenu { |
| 213 | public OptionsPopupMenu(Context context, View anchor) { |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 214 | super(context, anchor); |
| 215 | } |
| 216 | |
| 217 | @Override |
| 218 | public void show() { |
| 219 | final Menu menu = getMenu(); |
| 220 | final MenuItem clearFrequents = menu.findItem(R.id.menu_clear_frequents); |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 221 | clearFrequents.setVisible(mListsFragment != null && |
| 222 | mListsFragment.getSpeedDialFragment() != null && |
| 223 | mListsFragment.getSpeedDialFragment().hasFrequents()); |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 224 | super.show(); |
| 225 | } |
| 226 | } |
| 227 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 228 | /** |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 229 | * Listener that listens to drag events and sends their x and y coordinates to a |
| 230 | * {@link DragDropController}. |
| 231 | */ |
| 232 | private class LayoutOnDragListener implements OnDragListener { |
| 233 | @Override |
| 234 | public boolean onDrag(View v, DragEvent event) { |
| 235 | if (event.getAction() == DragEvent.ACTION_DRAG_LOCATION) { |
| 236 | mDragDropController.handleDragHovered(v, (int) event.getX(), |
| 237 | (int) event.getY()); |
| 238 | } |
| 239 | return true; |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | /** |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 244 | * Listener used to send search queries to the phone search fragment. |
| 245 | */ |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 246 | private final TextWatcher mPhoneSearchQueryTextListener = new TextWatcher() { |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 247 | @Override |
| 248 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| 249 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 250 | |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 251 | @Override |
| 252 | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| 253 | final String newText = s.toString(); |
| 254 | if (newText.equals(mSearchQuery)) { |
| 255 | // If the query hasn't changed (perhaps due to activity being destroyed |
| 256 | // and restored, or user launching the same DIAL intent twice), then there is |
| 257 | // no need to do anything here. |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 258 | return; |
| 259 | } |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 260 | mSearchQuery = newText; |
| 261 | if (DEBUG) { |
| 262 | Log.d(TAG, "onTextChange for mSearchView called with new query: " + newText); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 263 | } |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 264 | |
Andrew Lee | 90374a7 | 2014-05-16 15:01:09 -0700 | [diff] [blame] | 265 | // Show search fragment only when the query string is changed to non-empty text. |
| 266 | if (!TextUtils.isEmpty(newText)) { |
| 267 | // Call enterSearchUi only if we are switching search modes, or showing a search |
| 268 | // fragment for the first time. |
| 269 | final boolean sameSearchMode = (mIsDialpadShown && mInDialpadSearch) || |
| 270 | (!mIsDialpadShown && mInRegularSearch); |
| 271 | if (!sameSearchMode) { |
| 272 | enterSearchUi(mIsDialpadShown, mSearchQuery); |
| 273 | } |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 274 | } |
| 275 | |
| 276 | if (mIsDialpadShown && mSmartDialSearchFragment != null) { |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 277 | mSmartDialSearchFragment.setQueryString(mSearchQuery, false /* delaySelection */); |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 278 | } else if (mRegularSearchFragment != null) { |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 279 | mRegularSearchFragment.setQueryString(mSearchQuery, false /* delaySelection */); |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 280 | } |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | @Override |
| 284 | public void afterTextChanged(Editable s) { |
| 285 | } |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 286 | }; |
| 287 | |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 288 | |
| 289 | /** |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 290 | * Open the search UI when the user clicks on the search box. |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 291 | */ |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 292 | private final View.OnClickListener mSearchViewOnClickListener = new View.OnClickListener() { |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 293 | @Override |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 294 | public void onClick(View v) { |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 295 | if (!isInSearchUi()) { |
| 296 | enterSearchUi(false /* smartDialSearch */, mSearchView.getText().toString()); |
| 297 | } |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 298 | } |
| 299 | }; |
| 300 | |
| 301 | /** |
| 302 | * If the search term is empty and the user closes the soft keyboard, close the search UI. |
| 303 | */ |
| 304 | private final View.OnKeyListener mSearchEditTextLayoutListener = new View.OnKeyListener() { |
| 305 | @Override |
| 306 | public boolean onKey(View v, int keyCode, KeyEvent event) { |
| 307 | if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN && |
| 308 | TextUtils.isEmpty(mSearchView.getText().toString())) { |
Yorke Lee | c7b2a0e | 2014-05-20 17:21:25 -0700 | [diff] [blame] | 309 | maybeExitSearchUi(); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 310 | } |
| 311 | return false; |
| 312 | } |
| 313 | }; |
| 314 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 315 | @Override |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 316 | protected void onCreate(Bundle savedInstanceState) { |
| 317 | super.onCreate(savedInstanceState); |
Yorke Lee | 98702de | 2013-08-06 12:03:32 -0700 | [diff] [blame] | 318 | mFirstLaunch = true; |
| 319 | |
Yorke Lee | 8898cd0 | 2013-08-08 10:24:27 -0700 | [diff] [blame] | 320 | setContentView(R.layout.dialtacts_activity); |
Yorke Lee | 9e91bb0 | 2014-03-05 17:50:50 -0800 | [diff] [blame] | 321 | getWindow().setBackgroundDrawable(null); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 322 | |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 323 | final ActionBar actionBar = getActionBar(); |
| 324 | actionBar.setCustomView(R.layout.search_edittext); |
| 325 | actionBar.setDisplayShowCustomEnabled(true); |
Yorke Lee | bcef940 | 2014-05-21 15:33:00 -0700 | [diff] [blame^] | 326 | actionBar.setBackgroundDrawable(null); |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 327 | |
Yorke Lee | ec489fb | 2014-05-19 15:39:27 -0700 | [diff] [blame] | 328 | mSearchEditTextLayout = (SearchEditTextLayout) actionBar.getCustomView(); |
| 329 | mSearchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener); |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 330 | |
Yorke Lee | ec489fb | 2014-05-19 15:39:27 -0700 | [diff] [blame] | 331 | mSearchView = (EditText) mSearchEditTextLayout.findViewById(R.id.search_view); |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 332 | mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 333 | mVoiceSearchButton = mSearchEditTextLayout.findViewById(R.id.voice_search_button); |
| 334 | mSearchEditTextLayout.findViewById(R.id.search_box_start_search).setOnClickListener( |
| 335 | mSearchViewOnClickListener); |
| 336 | mSearchEditTextLayout.setOnBackButtonClickedListener(new OnBackButtonClickedListener() { |
| 337 | @Override |
| 338 | public void onBackButtonClicked() { |
| 339 | onBackPressed(); |
| 340 | } |
| 341 | }); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 342 | |
Yorke Lee | ec489fb | 2014-05-19 15:39:27 -0700 | [diff] [blame] | 343 | ImageButton optionsMenuButton = (ImageButton) mSearchEditTextLayout.findViewById( |
| 344 | R.id.dialtacts_options_menu_button); |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 345 | optionsMenuButton.setOnClickListener(this); |
| 346 | final OptionsPopupMenu optionsMenu = buildOptionsMenu(optionsMenuButton); |
| 347 | optionsMenuButton.setOnTouchListener(optionsMenu.getDragToOpenListener()); |
| 348 | |
Yorke Lee | 33932ff | 2014-04-16 13:34:32 -0700 | [diff] [blame] | 349 | final TypedArray styledAttributes = getTheme().obtainStyledAttributes( |
| 350 | new int[] { android.R.attr.actionBarSize }); |
| 351 | mActionBarHeight = (int) styledAttributes.getDimension(0, 0); |
| 352 | styledAttributes.recycle(); |
| 353 | |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 354 | // Add the favorites fragment, and the dialpad fragment, but only if savedInstanceState |
| 355 | // is null. Otherwise the fragment manager takes care of recreating these fragments. |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 356 | if (savedInstanceState == null) { |
Ihab Awad | 526c0b8 | 2014-02-27 12:55:36 -0800 | [diff] [blame] | 357 | getFragmentManager().beginTransaction() |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 358 | .add(R.id.dialtacts_frame, new ListsFragment(), TAG_FAVORITES_FRAGMENT) |
Ihab Awad | 526c0b8 | 2014-02-27 12:55:36 -0800 | [diff] [blame] | 359 | .add(R.id.dialtacts_container, new DialpadFragment(), TAG_DIALPAD_FRAGMENT) |
| 360 | .commit(); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 361 | } else { |
| 362 | mSearchQuery = savedInstanceState.getString(KEY_SEARCH_QUERY); |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 363 | mInRegularSearch = savedInstanceState.getBoolean(KEY_IN_REGULAR_SEARCH_UI); |
| 364 | mInDialpadSearch = savedInstanceState.getBoolean(KEY_IN_DIALPAD_SEARCH_UI); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 365 | mFirstLaunch = savedInstanceState.getBoolean(KEY_FIRST_LAUNCH); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Andrew Lee | 0c66770 | 2014-05-12 14:31:45 -0700 | [diff] [blame] | 368 | parentLayout = (RelativeLayout) findViewById(R.id.dialtacts_mainlayout); |
| 369 | parentLayout.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); |
| 370 | parentLayout.setOnDragListener(new LayoutOnDragListener()); |
| 371 | |
Yorke Lee | c7b2a0e | 2014-05-20 17:21:25 -0700 | [diff] [blame] | 372 | setupActivityOverlay(); |
| 373 | |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 374 | mFloatingActionButtonContainer = findViewById(R.id.floating_action_button_container); |
| 375 | ViewUtil.setupFloatingActionButton(mFloatingActionButtonContainer, getResources()); |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 376 | |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 377 | mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button); |
| 378 | mFloatingActionButton.setOnClickListener(this); |
Ihab Awad | 526c0b8 | 2014-02-27 12:55:36 -0800 | [diff] [blame] | 379 | |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 380 | mRemoveViewContainer = findViewById(R.id.remove_view_container); |
Yorke Lee | b0d1976 | 2014-03-05 14:43:28 -0800 | [diff] [blame] | 381 | |
Yorke Lee | 0baa98b | 2013-08-22 10:55:16 -0700 | [diff] [blame] | 382 | mDialerDatabaseHelper = DatabaseHelperManager.getDatabaseHelper(this); |
Yorke Lee | fce269a | 2013-08-12 11:56:04 -0700 | [diff] [blame] | 383 | SmartDialPrefix.initializeNanpSettings(this); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 384 | } |
| 385 | |
Yorke Lee | c7b2a0e | 2014-05-20 17:21:25 -0700 | [diff] [blame] | 386 | private void setupActivityOverlay() { |
| 387 | final View activityOverlay = findViewById(R.id.activity_overlay); |
| 388 | activityOverlay.setOnTouchListener(new OnTouchListener() { |
| 389 | @Override |
| 390 | public boolean onTouch(View v, MotionEvent event) { |
| 391 | if (!mIsDialpadShown) { |
| 392 | maybeExitSearchUi(); |
| 393 | } |
| 394 | return false; |
| 395 | } |
| 396 | }); |
| 397 | } |
| 398 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 399 | @Override |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 400 | protected void onResume() { |
| 401 | super.onResume(); |
Yorke Lee | 98702de | 2013-08-06 12:03:32 -0700 | [diff] [blame] | 402 | if (mFirstLaunch) { |
| 403 | displayFragment(getIntent()); |
Yorke Lee | 35127cd | 2013-09-10 14:09:29 -0700 | [diff] [blame] | 404 | } else if (!phoneIsInUse() && mInCallDialpadUp) { |
| 405 | hideDialpadFragment(false, true); |
| 406 | mInCallDialpadUp = false; |
Yorke Lee | 98702de | 2013-08-06 12:03:32 -0700 | [diff] [blame] | 407 | } |
| 408 | mFirstLaunch = false; |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 409 | prepareVoiceSearchButton(); |
Yorke Lee | fce269a | 2013-08-12 11:56:04 -0700 | [diff] [blame] | 410 | mDialerDatabaseHelper.startSmartDialUpdateThread(); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | @Override |
Yorke Lee | 8e5c8b1 | 2013-10-01 14:37:55 -0700 | [diff] [blame] | 414 | protected void onPause() { |
| 415 | if (mClearSearchOnPause) { |
| 416 | hideDialpadAndSearchUi(); |
| 417 | mClearSearchOnPause = false; |
| 418 | } |
| 419 | super.onPause(); |
| 420 | } |
| 421 | |
| 422 | @Override |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 423 | protected void onSaveInstanceState(Bundle outState) { |
| 424 | super.onSaveInstanceState(outState); |
| 425 | outState.putString(KEY_SEARCH_QUERY, mSearchQuery); |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 426 | outState.putBoolean(KEY_IN_REGULAR_SEARCH_UI, mInRegularSearch); |
| 427 | outState.putBoolean(KEY_IN_DIALPAD_SEARCH_UI, mInDialpadSearch); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 428 | outState.putBoolean(KEY_FIRST_LAUNCH, mFirstLaunch); |
| 429 | } |
| 430 | |
| 431 | @Override |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 432 | public void onAttachFragment(Fragment fragment) { |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 433 | if (fragment instanceof DialpadFragment) { |
| 434 | mDialpadFragment = (DialpadFragment) fragment; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 435 | final FragmentTransaction transaction = getFragmentManager().beginTransaction(); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 436 | transaction.hide(mDialpadFragment); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 437 | transaction.commit(); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 438 | } else if (fragment instanceof SmartDialSearchFragment) { |
| 439 | mSmartDialSearchFragment = (SmartDialSearchFragment) fragment; |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 440 | mSmartDialSearchFragment.setOnPhoneNumberPickerActionListener(this); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 441 | } else if (fragment instanceof SearchFragment) { |
Jay Shrauner | 2e5b34b | 2013-08-29 10:52:40 -0700 | [diff] [blame] | 442 | mRegularSearchFragment = (RegularSearchFragment) fragment; |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 443 | mRegularSearchFragment.setOnPhoneNumberPickerActionListener(this); |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 444 | } else if (fragment instanceof ListsFragment) { |
| 445 | mListsFragment = (ListsFragment) fragment; |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 446 | mListsFragment.addOnPageChangeListener(this); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 447 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 448 | } |
| 449 | |
Alon Albert | b453e5b | 2013-09-10 15:54:23 -0700 | [diff] [blame] | 450 | protected void handleMenuSettings() { |
| 451 | openTelephonySetting(this); |
| 452 | } |
| 453 | |
| 454 | public static void openTelephonySetting(Activity activity) { |
| 455 | final Intent settingsIntent = getCallSettingsIntent(); |
| 456 | activity.startActivity(settingsIntent); |
| 457 | } |
| 458 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 459 | @Override |
| 460 | public void onClick(View view) { |
| 461 | switch (view.getId()) { |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 462 | case R.id.floating_action_button: |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 463 | if (!mIsDialpadShown) { |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 464 | mInCallDialpadUp = false; |
| 465 | showDialpadFragment(true); |
| 466 | } else { |
| 467 | // Dial button was pressed; tell the Dialpad fragment |
| 468 | mDialpadFragment.dialButtonPressed(); |
| 469 | } |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 470 | break; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 471 | case R.id.search_close_button: |
| 472 | // Clear the search field |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 473 | if (!TextUtils.isEmpty(mSearchView.getText())) { |
Yorke Lee | 2eafb7a | 2013-09-10 14:34:01 -0700 | [diff] [blame] | 474 | mDialpadFragment.clearDialpad(); |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 475 | mSearchView.setText(null); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 476 | } |
| 477 | break; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 478 | case R.id.voice_search_button: |
Yorke Lee | da0f904 | 2013-12-05 14:25:51 -0800 | [diff] [blame] | 479 | try { |
| 480 | startActivityForResult(new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), |
| 481 | ACTIVITY_REQUEST_CODE_VOICE_SEARCH); |
| 482 | } catch (ActivityNotFoundException e) { |
| 483 | Toast.makeText(DialtactsActivity.this, R.string.voice_search_not_available, |
| 484 | Toast.LENGTH_SHORT).show(); |
| 485 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 486 | break; |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 487 | case R.id.dialtacts_options_menu_button: |
| 488 | buildOptionsMenu(view).show(); |
| 489 | break; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 490 | default: { |
| 491 | Log.wtf(TAG, "Unexpected onClick event from " + view); |
| 492 | break; |
| 493 | } |
| 494 | } |
| 495 | } |
| 496 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 497 | @Override |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 498 | public boolean onMenuItemClick(MenuItem item) { |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 499 | switch (item.getItemId()) { |
| 500 | case R.id.menu_history: |
Yorke Lee | 6a1461a | 2014-04-21 16:27:14 -0700 | [diff] [blame] | 501 | showCallHistory(); |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 502 | break; |
| 503 | case R.id.menu_add_contact: |
| 504 | try { |
| 505 | startActivity(new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI)); |
| 506 | } catch (ActivityNotFoundException e) { |
| 507 | Toast toast = Toast.makeText(this, |
| 508 | R.string.add_contact_not_available, |
| 509 | Toast.LENGTH_SHORT); |
| 510 | toast.show(); |
| 511 | } |
| 512 | break; |
| 513 | case R.id.menu_import_export: |
| 514 | // We hard-code the "contactsAreAvailable" argument because doing it properly would |
| 515 | // involve querying a {@link ProviderStatusLoader}, which we don't want to do right |
| 516 | // now in Dialtacts for (potential) performance reasons. Compare with how it is |
| 517 | // done in {@link PeopleActivity}. |
| 518 | ImportExportDialogFragment.show(getFragmentManager(), true, |
| 519 | DialtactsActivity.class); |
| 520 | return true; |
| 521 | case R.id.menu_clear_frequents: |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 522 | ClearFrequentsDialog.show(getFragmentManager()); |
| 523 | return true; |
| 524 | case R.id.menu_call_settings: |
| 525 | handleMenuSettings(); |
| 526 | return true; |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 527 | } |
| 528 | return false; |
| 529 | } |
| 530 | |
| 531 | @Override |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 532 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 533 | if (requestCode == ACTIVITY_REQUEST_CODE_VOICE_SEARCH) { |
| 534 | if (resultCode == RESULT_OK) { |
| 535 | final ArrayList<String> matches = data.getStringArrayListExtra( |
| 536 | RecognizerIntent.EXTRA_RESULTS); |
| 537 | if (matches.size() > 0) { |
| 538 | final String match = matches.get(0); |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 539 | mSearchView.setText(match); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 540 | } else { |
| 541 | Log.e(TAG, "Voice search - nothing heard"); |
| 542 | } |
| 543 | } else { |
| 544 | Log.e(TAG, "Voice search failed"); |
| 545 | } |
| 546 | } |
| 547 | super.onActivityResult(requestCode, resultCode, data); |
| 548 | } |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 549 | |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 550 | /** |
| 551 | * Initiates a fragment transaction to show the dialpad fragment. Animations and other visual |
| 552 | * updates are handled by a callback which is invoked after the dialpad fragment is shown. |
| 553 | * @see #onDialpadShown |
| 554 | */ |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 555 | private void showDialpadFragment(boolean animate) { |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 556 | if (mIsDialpadShown) { |
| 557 | return; |
| 558 | } |
| 559 | mIsDialpadShown = true; |
Andrew Lee | cdfa6c6 | 2014-05-06 15:33:35 -0700 | [diff] [blame] | 560 | mDialpadFragment.setAnimate(animate); |
| 561 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 562 | final FragmentTransaction ft = getFragmentManager().beginTransaction(); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 563 | ft.show(mDialpadFragment); |
| 564 | ft.commit(); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 565 | |
| 566 | if (!isInSearchUi()) { |
| 567 | enterSearchUi(true /* isSmartDial */, mSearchQuery); |
| 568 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 569 | } |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 570 | |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 571 | /** |
| 572 | * Callback from child DialpadFragment when the dialpad is shown. |
| 573 | */ |
| 574 | public void onDialpadShown() { |
| 575 | updateFloatingActionButton(); |
| 576 | if (mDialpadFragment.getAnimate()) { |
| 577 | Animation slideIn = AnimationUtils.loadAnimation(this, R.anim.slide_in); |
| 578 | mDialpadFragment.getView().startAnimation(slideIn); |
| 579 | } else { |
| 580 | mDialpadFragment.setYFraction(0); |
| 581 | } |
| 582 | |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 583 | updateSearchFragmentPosition(); |
| 584 | getActionBar().hide(); |
| 585 | } |
| 586 | |
| 587 | /** |
| 588 | * Initiates animations and other visual updates to hide the dialpad. The fragment is hidden in |
| 589 | * a callback after the hide animation ends. |
| 590 | * @see #commitDialpadFragmentHide |
| 591 | */ |
Yorke Lee | ca19504 | 2013-09-25 16:29:38 -0700 | [diff] [blame] | 592 | public void hideDialpadFragment(boolean animate, boolean clearDialpad) { |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 593 | if (mDialpadFragment == null) { |
| 594 | return; |
| 595 | } |
Yorke Lee | f6673d3 | 2013-08-23 15:34:17 -0700 | [diff] [blame] | 596 | if (clearDialpad) { |
| 597 | mDialpadFragment.clearDialpad(); |
| 598 | } |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 599 | if (!mIsDialpadShown) { |
| 600 | return; |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 601 | } |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 602 | mIsDialpadShown = false; |
| 603 | mDialpadFragment.setAnimate(animate); |
| 604 | |
Andrew Lee | dbe9a8c | 2014-05-16 15:18:40 -0700 | [diff] [blame] | 605 | updateSearchFragmentPosition(); |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 606 | updateFloatingActionButton(); |
| 607 | if (animate) { |
| 608 | Animation slideOut = AnimationUtils.loadAnimation(this, R.anim.slide_out); |
| 609 | slideOut.setAnimationListener(new ActivityAnimationListener() { |
| 610 | @Override |
| 611 | public void onAnimationEnd(Animation animation) { |
| 612 | commitDialpadFragmentHide(); |
| 613 | } |
| 614 | }); |
| 615 | mDialpadFragment.getView().startAnimation(slideOut); |
| 616 | } else { |
| 617 | commitDialpadFragmentHide(); |
| 618 | } |
| 619 | |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 620 | mListsFragment.maybeShowActionBar(); |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 621 | |
Andrew Lee | d4cde83 | 2014-05-16 15:56:48 -0700 | [diff] [blame] | 622 | if (isInSearchUi()) { |
Andrew Lee | 44e3daf | 2014-05-19 14:28:16 -0700 | [diff] [blame] | 623 | if (TextUtils.isEmpty(mSearchQuery)) { |
| 624 | exitSearchUi(); |
Andrew Lee | 44e3daf | 2014-05-19 14:28:16 -0700 | [diff] [blame] | 625 | } |
Andrew Lee | d4cde83 | 2014-05-16 15:56:48 -0700 | [diff] [blame] | 626 | } |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 627 | } |
| 628 | |
| 629 | /** |
| 630 | * Finishes hiding the dialpad fragment after any animations are completed. |
| 631 | */ |
| 632 | private void commitDialpadFragmentHide() { |
| 633 | final FragmentTransaction ft = getFragmentManager().beginTransaction(); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 634 | ft.hide(mDialpadFragment); |
| 635 | ft.commit(); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 636 | } |
| 637 | |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 638 | private void updateSearchFragmentPosition() { |
| 639 | int translationValue = mIsDialpadShown ? -mActionBarHeight : 0; |
| 640 | SearchFragment fragment = null; |
Andrew Lee | dbe9a8c | 2014-05-16 15:18:40 -0700 | [diff] [blame] | 641 | if (mSmartDialSearchFragment != null && mSmartDialSearchFragment.isVisible()) { |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 642 | fragment = mSmartDialSearchFragment; |
Andrew Lee | dbe9a8c | 2014-05-16 15:18:40 -0700 | [diff] [blame] | 643 | } else if (mRegularSearchFragment != null && mRegularSearchFragment.isVisible()) { |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 644 | fragment = mRegularSearchFragment; |
| 645 | } |
| 646 | if (fragment != null && fragment.isVisible()) { |
| 647 | fragment.getView().animate().translationY(translationValue) |
| 648 | .setInterpolator(hideActionBarInterpolator).setDuration(ANIMATION_DURATION); |
| 649 | } |
| 650 | } |
| 651 | |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 652 | private boolean isInSearchUi() { |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 653 | return mInDialpadSearch || mInRegularSearch; |
| 654 | } |
| 655 | |
| 656 | private void setNotInSearchUi() { |
| 657 | mInDialpadSearch = false; |
| 658 | mInRegularSearch = false; |
| 659 | } |
| 660 | |
Yorke Lee | 311969c | 2013-08-26 06:31:11 -0700 | [diff] [blame] | 661 | private void hideDialpadAndSearchUi() { |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 662 | mSearchView.setText(null); |
Yorke Lee | 311969c | 2013-08-26 06:31:11 -0700 | [diff] [blame] | 663 | hideDialpadFragment(false, true); |
| 664 | } |
| 665 | |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 666 | private void hideInputMethod(View view) { |
| 667 | final InputMethodManager imm = (InputMethodManager) getSystemService( |
| 668 | Context.INPUT_METHOD_SERVICE); |
| 669 | if (imm != null && view != null) { |
| 670 | imm.hideSoftInputFromWindow(view.getWindowToken(), 0); |
| 671 | } |
| 672 | } |
| 673 | |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 674 | private void prepareVoiceSearchButton() { |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 675 | final Intent voiceIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); |
| 676 | if (canIntentBeHandled(voiceIntent)) { |
| 677 | mVoiceSearchButton.setVisibility(View.VISIBLE); |
| 678 | mVoiceSearchButton.setOnClickListener(this); |
| 679 | } else { |
| 680 | mVoiceSearchButton.setVisibility(View.GONE); |
| 681 | } |
| 682 | } |
| 683 | |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 684 | private OptionsPopupMenu buildOptionsMenu(View invoker) { |
| 685 | final OptionsPopupMenu popupMenu = new OptionsPopupMenu(this, invoker); |
| 686 | popupMenu.inflate(R.menu.dialtacts_options); |
| 687 | popupMenu.setOnMenuItemClickListener(this); |
| 688 | return popupMenu; |
| 689 | } |
| 690 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 691 | @Override |
| 692 | public boolean onCreateOptionsMenu(Menu menu) { |
Yorke Lee | 3c9e7cd | 2014-04-16 11:37:21 -0700 | [diff] [blame] | 693 | if (mPendingSearchViewQuery != null) { |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 694 | mSearchView.setText(mPendingSearchViewQuery); |
Yorke Lee | 3c9e7cd | 2014-04-16 11:37:21 -0700 | [diff] [blame] | 695 | mPendingSearchViewQuery = null; |
| 696 | } |
Andrew Lee | e74a10e | 2014-05-16 14:31:40 -0700 | [diff] [blame] | 697 | return false; |
Ihab Awad | fb00cb8 | 2014-03-18 16:19:00 -0700 | [diff] [blame] | 698 | } |
| 699 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 700 | /** |
| 701 | * Returns true if the intent is due to hitting the green send key (hardware call button: |
| 702 | * KEYCODE_CALL) while in a call. |
| 703 | * |
| 704 | * @param intent the intent that launched this activity |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 705 | * @return true if the intent is due to hitting the green send key while in a call |
| 706 | */ |
Yorke Lee | 62e995c | 2014-03-28 10:02:56 -0700 | [diff] [blame] | 707 | private boolean isSendKeyWhileInCall(Intent intent) { |
| 708 | // If there is a call in progress and the user launched the dialer by hitting the call |
| 709 | // button, go straight to the in-call screen. |
| 710 | final boolean callKey = Intent.ACTION_CALL_BUTTON.equals(intent.getAction()); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 711 | |
Yorke Lee | 62e995c | 2014-03-28 10:02:56 -0700 | [diff] [blame] | 712 | try { |
| 713 | ITelephony phone = ITelephony.Stub.asInterface(ServiceManager.checkService("phone")); |
| 714 | if (callKey && phone != null && phone.showCallScreen()) { |
| 715 | return true; |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 716 | } |
Yorke Lee | 62e995c | 2014-03-28 10:02:56 -0700 | [diff] [blame] | 717 | } catch (RemoteException e) { |
| 718 | Log.e(TAG, "Failed to handle send while in call", e); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 719 | } |
| 720 | |
| 721 | return false; |
| 722 | } |
| 723 | |
| 724 | /** |
| 725 | * Sets the current tab based on the intent's request type |
| 726 | * |
| 727 | * @param intent Intent that contains information about which tab should be selected |
| 728 | */ |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 729 | private void displayFragment(Intent intent) { |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 730 | // If we got here by hitting send and we're in call forward along to the in-call activity |
Yorke Lee | 62e995c | 2014-03-28 10:02:56 -0700 | [diff] [blame] | 731 | if (isSendKeyWhileInCall(intent)) { |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 732 | finish(); |
| 733 | return; |
| 734 | } |
| 735 | |
Yorke Lee | 669b608 | 2013-09-17 15:43:38 -0700 | [diff] [blame] | 736 | if (mDialpadFragment != null) { |
| 737 | final boolean phoneIsInUse = phoneIsInUse(); |
| 738 | if (phoneIsInUse || isDialIntent(intent)) { |
| 739 | mDialpadFragment.setStartedFromNewIntent(true); |
| 740 | if (phoneIsInUse && !mDialpadFragment.isVisible()) { |
| 741 | mInCallDialpadUp = true; |
| 742 | } |
| 743 | showDialpadFragment(false); |
Yorke Lee | 35127cd | 2013-09-10 14:09:29 -0700 | [diff] [blame] | 744 | } |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 745 | } |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 746 | } |
| 747 | |
| 748 | @Override |
| 749 | public void onNewIntent(Intent newIntent) { |
| 750 | setIntent(newIntent); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 751 | displayFragment(newIntent); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 752 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 753 | invalidateOptionsMenu(); |
| 754 | } |
| 755 | |
| 756 | /** Returns true if the given intent contains a phone number to populate the dialer with */ |
| 757 | private boolean isDialIntent(Intent intent) { |
| 758 | final String action = intent.getAction(); |
| 759 | if (Intent.ACTION_DIAL.equals(action) || ACTION_TOUCH_DIALER.equals(action)) { |
| 760 | return true; |
| 761 | } |
| 762 | if (Intent.ACTION_VIEW.equals(action)) { |
| 763 | final Uri data = intent.getData(); |
Chiao Cheng | 9d4f3b2 | 2012-09-05 16:00:16 -0700 | [diff] [blame] | 764 | if (data != null && CallUtil.SCHEME_TEL.equals(data.getScheme())) { |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 765 | return true; |
| 766 | } |
| 767 | } |
| 768 | return false; |
| 769 | } |
| 770 | |
| 771 | /** |
| 772 | * Returns an appropriate call origin for this Activity. May return null when no call origin |
| 773 | * should be used (e.g. when some 3rd party application launched the screen. Call origin is |
| 774 | * for remembering the tab in which the user made a phone call, so the external app's DIAL |
| 775 | * request should not be counted.) |
| 776 | */ |
| 777 | public String getCallOrigin() { |
| 778 | return !isDialIntent(getIntent()) ? CALL_ORIGIN_DIALTACTS : null; |
| 779 | } |
| 780 | |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 781 | /** |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 782 | * Shows the search fragment |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 783 | */ |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 784 | private void enterSearchUi(boolean smartDialSearch, String query) { |
Andrew Lee | 90374a7 | 2014-05-16 15:01:09 -0700 | [diff] [blame] | 785 | if (getFragmentManager().isDestroyed()) { |
Yorke Lee | 34bdf87 | 2013-08-15 14:11:50 -0700 | [diff] [blame] | 786 | // Weird race condition where fragment is doing work after the activity is destroyed |
| 787 | // due to talkback being on (b/10209937). Just return since we can't do any |
| 788 | // constructive here. |
| 789 | return; |
| 790 | } |
| 791 | |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 792 | if (DEBUG) { |
| 793 | Log.d(TAG, "Entering search UI - smart dial " + smartDialSearch); |
| 794 | } |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 795 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 796 | final FragmentTransaction transaction = getFragmentManager().beginTransaction(); |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 797 | if (mInDialpadSearch && mSmartDialSearchFragment != null) { |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 798 | transaction.remove(mSmartDialSearchFragment); |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 799 | } else if (mInRegularSearch && mRegularSearchFragment != null) { |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 800 | transaction.remove(mRegularSearchFragment); |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 801 | } |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 802 | |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 803 | final String tag; |
| 804 | if (smartDialSearch) { |
| 805 | tag = TAG_SMARTDIAL_SEARCH_FRAGMENT; |
| 806 | } else { |
| 807 | tag = TAG_REGULAR_SEARCH_FRAGMENT; |
| 808 | } |
| 809 | mInDialpadSearch = smartDialSearch; |
| 810 | mInRegularSearch = !smartDialSearch; |
| 811 | |
Andrew Lee | 752956e | 2014-05-15 11:43:38 -0700 | [diff] [blame] | 812 | SearchFragment fragment = (SearchFragment) getFragmentManager().findFragmentByTag(tag); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 813 | transaction.setCustomAnimations(android.R.animator.fade_in, 0); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 814 | if (fragment == null) { |
| 815 | if (smartDialSearch) { |
| 816 | fragment = new SmartDialSearchFragment(); |
| 817 | } else { |
Jay Shrauner | 2e5b34b | 2013-08-29 10:52:40 -0700 | [diff] [blame] | 818 | fragment = new RegularSearchFragment(); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 819 | } |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 820 | transaction.add(R.id.dialtacts_frame, fragment, tag); |
| 821 | } else { |
| 822 | transaction.show(fragment); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 823 | } |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 824 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 825 | // DialtactsActivity will provide the options menu |
| 826 | fragment.setHasOptionsMenu(false); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 827 | fragment.setShowEmptyListForNullQuery(true); |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 828 | fragment.setQueryString(query, false /* delaySelection */); |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 829 | transaction.commit(); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 830 | |
| 831 | mListsFragment.getView().animate().alpha(0).withLayer(); |
Yorke Lee | ec489fb | 2014-05-19 15:39:27 -0700 | [diff] [blame] | 832 | mSearchEditTextLayout.animateExpandOrCollapse(true); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 833 | } |
| 834 | |
| 835 | /** |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 836 | * Hides the search fragment |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 837 | */ |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 838 | private void exitSearchUi() { |
Yorke Lee | 3487db7 | 2013-09-26 17:12:06 -0700 | [diff] [blame] | 839 | // See related bug in enterSearchUI(); |
| 840 | if (getFragmentManager().isDestroyed()) { |
| 841 | return; |
| 842 | } |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 843 | |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 844 | mSearchView.setText(null); |
| 845 | mDialpadFragment.clearDialpad(); |
Yorke Lee | b207f8a | 2013-08-29 18:51:06 -0700 | [diff] [blame] | 846 | setNotInSearchUi(); |
Yorke Lee | 7eccf45 | 2014-03-14 12:52:42 -0700 | [diff] [blame] | 847 | |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 848 | final FragmentTransaction transaction = getFragmentManager().beginTransaction(); |
| 849 | transaction.setCustomAnimations(0, android.R.animator.fade_out); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 850 | if (mSmartDialSearchFragment != null) { |
| 851 | transaction.remove(mSmartDialSearchFragment); |
Yorke Lee | 7eccf45 | 2014-03-14 12:52:42 -0700 | [diff] [blame] | 852 | } |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 853 | if (mRegularSearchFragment != null) { |
| 854 | transaction.remove(mRegularSearchFragment); |
| 855 | } |
| 856 | transaction.commit(); |
| 857 | |
| 858 | mListsFragment.getView().animate().alpha(1).withLayer(); |
Yorke Lee | ec489fb | 2014-05-19 15:39:27 -0700 | [diff] [blame] | 859 | mSearchEditTextLayout.animateExpandOrCollapse(false); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 860 | } |
| 861 | |
| 862 | /** Returns an Intent to launch Call Settings screen */ |
| 863 | public static Intent getCallSettingsIntent() { |
| 864 | final Intent intent = new Intent(Intent.ACTION_MAIN); |
| 865 | intent.setClassName(PHONE_PACKAGE, CALL_SETTINGS_CLASS_NAME); |
| 866 | intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| 867 | return intent; |
| 868 | } |
| 869 | |
| 870 | @Override |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 871 | public void onBackPressed() { |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 872 | if (mIsDialpadShown) { |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 873 | if (TextUtils.isEmpty(mSearchQuery)) { |
| 874 | exitSearchUi(); |
| 875 | } |
Yorke Lee | f6673d3 | 2013-08-23 15:34:17 -0700 | [diff] [blame] | 876 | hideDialpadFragment(true, false); |
Andrew Lee | b190384 | 2014-05-15 16:11:24 -0700 | [diff] [blame] | 877 | } else if (isInSearchUi()) { |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 878 | exitSearchUi(); |
Yorke Lee | 11ca39e | 2014-05-19 20:31:37 -0700 | [diff] [blame] | 879 | hideInputMethod(parentLayout); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 880 | } else { |
| 881 | super.onBackPressed(); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 882 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 883 | } |
| 884 | |
Yorke Lee | c7b2a0e | 2014-05-20 17:21:25 -0700 | [diff] [blame] | 885 | /** |
| 886 | * @return True if the search UI was exited, false otherwise |
| 887 | */ |
| 888 | private boolean maybeExitSearchUi() { |
| 889 | if (isInSearchUi() && TextUtils.isEmpty(mSearchQuery)) { |
| 890 | exitSearchUi(); |
| 891 | hideInputMethod(parentLayout); |
| 892 | return true; |
| 893 | } |
| 894 | return false; |
| 895 | } |
| 896 | |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 897 | @Override |
| 898 | public void onDialpadQueryChanged(String query) { |
Yorke Lee | 4663587 | 2014-04-11 11:20:15 -0700 | [diff] [blame] | 899 | if (mSmartDialSearchFragment != null) { |
| 900 | mSmartDialSearchFragment.setAddToContactNumber(query); |
| 901 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 902 | final String normalizedQuery = SmartDialNameMatcher.normalizeNumber(query, |
| 903 | SmartDialNameMatcher.LATIN_SMART_DIAL_MAP); |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 904 | |
| 905 | if (!TextUtils.equals(mSearchView.getText(), normalizedQuery)) { |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 906 | if (DEBUG) { |
| 907 | Log.d(TAG, "onDialpadQueryChanged - new query: " + query); |
| 908 | } |
| 909 | if (mDialpadFragment == null || !mDialpadFragment.isVisible()) { |
| 910 | // This callback can happen if the dialpad fragment is recreated because of |
| 911 | // activity destruction. In that case, don't update the search view because |
| 912 | // that would bring the user back to the search fragment regardless of the |
| 913 | // previous state of the application. Instead, just return here and let the |
| 914 | // fragment manager correctly figure out whatever fragment was last displayed. |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 915 | if (!TextUtils.isEmpty(normalizedQuery)) { |
| 916 | mPendingSearchViewQuery = normalizedQuery; |
| 917 | } |
Yorke Lee | ef2b738 | 2013-08-09 17:39:25 -0700 | [diff] [blame] | 918 | return; |
| 919 | } |
Yorke Lee | 53a2230 | 2014-04-29 18:13:46 -0700 | [diff] [blame] | 920 | mSearchView.setText(normalizedQuery); |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 921 | } |
| 922 | } |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 923 | |
| 924 | @Override |
| 925 | public void onListFragmentScrollStateChange(int scrollState) { |
| 926 | if (scrollState == OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) { |
Yorke Lee | f6673d3 | 2013-08-23 15:34:17 -0700 | [diff] [blame] | 927 | hideDialpadFragment(true, false); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 928 | hideInputMethod(getCurrentFocus()); |
| 929 | } |
| 930 | } |
| 931 | |
| 932 | @Override |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 933 | public void onListFragmentScroll(int firstVisibleItem, int visibleItemCount, |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 934 | int totalItemCount) { |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 935 | // TODO: No-op for now. This should eventually show/hide the actionBar based on |
| 936 | // interactions with the ListsFragments. |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 937 | } |
| 938 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 939 | @Override |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 940 | public void setFloatingActionButtonVisible(boolean visible) { |
| 941 | mFloatingActionButtonContainer.setVisibility(visible ? View.VISIBLE : View.GONE); |
Yorke Lee | c376633 | 2013-07-31 11:13:16 -0700 | [diff] [blame] | 942 | } |
| 943 | |
| 944 | private boolean phoneIsInUse() { |
| 945 | final TelephonyManager tm = (TelephonyManager) getSystemService( |
| 946 | Context.TELEPHONY_SERVICE); |
| 947 | return tm.getCallState() != TelephonyManager.CALL_STATE_IDLE; |
| 948 | } |
Yorke Lee | 8dd6200 | 2013-08-08 15:57:20 -0700 | [diff] [blame] | 949 | |
Yorke Lee | e142481 | 2013-09-04 18:24:48 -0700 | [diff] [blame] | 950 | public static Intent getAddNumberToContactIntent(CharSequence text) { |
| 951 | final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); |
| 952 | intent.putExtra(Intents.Insert.PHONE, text); |
| 953 | intent.setType(Contacts.CONTENT_ITEM_TYPE); |
| 954 | return intent; |
| 955 | } |
| 956 | |
Yorke Lee | da0f904 | 2013-12-05 14:25:51 -0800 | [diff] [blame] | 957 | private boolean canIntentBeHandled(Intent intent) { |
| 958 | final PackageManager packageManager = getPackageManager(); |
| 959 | final List<ResolveInfo> resolveInfo = packageManager.queryIntentActivities(intent, |
| 960 | PackageManager.MATCH_DEFAULT_ONLY); |
| 961 | return resolveInfo != null && resolveInfo.size() > 0; |
| 962 | } |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 963 | |
Yorke Lee | 6a1461a | 2014-04-21 16:27:14 -0700 | [diff] [blame] | 964 | @Override |
| 965 | public void showCallHistory() { |
| 966 | // Use explicit CallLogActivity intent instead of ACTION_VIEW + |
| 967 | // CONTENT_TYPE, so that we always open our call log from our dialer |
| 968 | final Intent intent = new Intent(this, CallLogActivity.class); |
| 969 | startActivity(intent); |
| 970 | } |
| 971 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 972 | /** |
| 973 | * Called when the user has long-pressed a contact tile to start a drag operation. |
| 974 | */ |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 975 | @Override |
Yorke Lee | efb2d9c | 2014-04-18 14:05:01 -0700 | [diff] [blame] | 976 | public void onDragStarted(int x, int y, PhoneFavoriteSquareTileView view) { |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 977 | getActionBar().hide(); |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 978 | mRemoveViewContainer.setVisibility(View.VISIBLE); |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 979 | } |
| 980 | |
| 981 | @Override |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 982 | public void onDragHovered(int x, int y, PhoneFavoriteSquareTileView view) { |
| 983 | } |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 984 | |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 985 | /** |
| 986 | * Called when the user has released a contact tile after long-pressing it. |
| 987 | */ |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 988 | @Override |
| 989 | public void onDragFinished(int x, int y) { |
Yorke Lee | 86e21f7 | 2014-04-02 16:49:38 -0700 | [diff] [blame] | 990 | getActionBar().show(); |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 991 | mRemoveViewContainer.setVisibility(View.GONE); |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 992 | } |
| 993 | |
| 994 | @Override |
| 995 | public void onDroppedOnRemove() {} |
| 996 | |
| 997 | /** |
Yorke Lee | d999b71 | 2014-04-23 15:10:58 -0700 | [diff] [blame] | 998 | * Allows the SpeedDialFragment to attach the drag controller to mRemoveViewContainer |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 999 | * once it has been attached to the activity. |
| 1000 | */ |
| 1001 | @Override |
| 1002 | public void setDragDropController(DragDropController dragController) { |
Yorke Lee | 2826619 | 2014-05-01 10:05:52 -0700 | [diff] [blame] | 1003 | mDragDropController = dragController; |
| 1004 | ((RemoveView) findViewById(R.id.remove_view)) |
| 1005 | .setDragDropController(dragController); |
Yorke Lee | 3cefcc6 | 2014-01-16 11:26:46 -0800 | [diff] [blame] | 1006 | } |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 1007 | |
| 1008 | @Override |
| 1009 | public void onPickPhoneNumberAction(Uri dataUri) { |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 1010 | // Specify call-origin so that users will see the previous tab instead of |
| 1011 | // CallLog screen (search UI will be automatically exited). |
| 1012 | PhoneNumberInteraction.startInteractionForPhoneCall( |
Andrew Lee | 99a570c | 2014-05-15 14:18:50 -0700 | [diff] [blame] | 1013 | DialtactsActivity.this, dataUri, getCallOrigin()); |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 1014 | mClearSearchOnPause = true; |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 1015 | } |
| 1016 | |
| 1017 | @Override |
| 1018 | public void onCallNumberDirectly(String phoneNumber) { |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 1019 | Intent intent = CallUtil.getCallIntent(phoneNumber, getCallOrigin()); |
| 1020 | startActivity(intent); |
| 1021 | mClearSearchOnPause = true; |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 1022 | } |
| 1023 | |
| 1024 | @Override |
| 1025 | public void onShortcutIntentCreated(Intent intent) { |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 1026 | Log.w(TAG, "Unsupported intent has come (" + intent + "). Ignoring."); |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 1027 | } |
| 1028 | |
| 1029 | @Override |
| 1030 | public void onHomeInActionBarSelected() { |
Yorke Lee | 4e28c1d | 2014-05-13 15:38:10 -0700 | [diff] [blame] | 1031 | exitSearchUi(); |
Yorke Lee | e00c9fe | 2014-04-12 12:42:06 -0700 | [diff] [blame] | 1032 | } |
Yorke Lee | 33932ff | 2014-04-16 13:34:32 -0700 | [diff] [blame] | 1033 | |
| 1034 | public int getActionBarHeight() { |
| 1035 | return mActionBarHeight; |
| 1036 | } |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1037 | |
| 1038 | @Override |
| 1039 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { |
| 1040 | |
| 1041 | } |
| 1042 | |
| 1043 | @Override |
| 1044 | public void onPageSelected(int position) { |
| 1045 | mCurrentTabPosition = position; |
Yorke Lee | c61d454 | 2014-05-01 10:43:24 -0700 | [diff] [blame] | 1046 | // If the dialpad is showing, the floating action button should always be middle aligned. |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 1047 | if (!mIsDialpadShown) { |
Yorke Lee | c61d454 | 2014-05-01 10:43:24 -0700 | [diff] [blame] | 1048 | alignFloatingActionButtonByTab(mCurrentTabPosition); |
| 1049 | } |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1050 | } |
| 1051 | |
| 1052 | @Override |
| 1053 | public void onPageScrollStateChanged(int state) { |
| 1054 | } |
| 1055 | |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 1056 | private void updateFloatingActionButton() { |
| 1057 | if (mIsDialpadShown) { |
| 1058 | mFloatingActionButton.setImageResource(R.drawable.fab_ic_call); |
| 1059 | mFloatingActionButton.setContentDescription( |
| 1060 | getResources().getString(R.string.description_dial_button)); |
Andrew Lee | c4643f7 | 2014-05-15 11:27:39 -0700 | [diff] [blame] | 1061 | alignFloatingActionButtonMiddle(); |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 1062 | } else { |
| 1063 | mFloatingActionButton.setImageResource(R.drawable.fab_ic_dial); |
| 1064 | mFloatingActionButton.setContentDescription( |
| 1065 | getResources().getString(R.string.action_menu_dialpad_button)); |
Andrew Lee | c4643f7 | 2014-05-15 11:27:39 -0700 | [diff] [blame] | 1066 | alignFloatingActionButtonByTab(mCurrentTabPosition); |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 1067 | } |
| 1068 | } |
| 1069 | |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1070 | private void alignFloatingActionButtonByTab(int position) { |
| 1071 | if (position == ListsFragment.TAB_INDEX_SPEED_DIAL) { |
| 1072 | alignFloatingActionButtonMiddle(); |
| 1073 | } else { |
| 1074 | alignFloatingActionButtonRight(); |
| 1075 | } |
| 1076 | } |
| 1077 | |
| 1078 | private void alignFloatingActionButtonRight() { |
| 1079 | final RelativeLayout.LayoutParams params = |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 1080 | (RelativeLayout.LayoutParams) mFloatingActionButtonContainer.getLayoutParams(); |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1081 | params.removeRule(RelativeLayout.CENTER_HORIZONTAL); |
| 1082 | params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 1083 | mFloatingActionButtonContainer.setLayoutParams(params); |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1084 | } |
| 1085 | |
| 1086 | private void alignFloatingActionButtonMiddle() { |
| 1087 | final RelativeLayout.LayoutParams params = |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 1088 | (RelativeLayout.LayoutParams) mFloatingActionButtonContainer.getLayoutParams(); |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1089 | params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT); |
| 1090 | params.addRule(RelativeLayout.CENTER_HORIZONTAL); |
Andrew Lee | a73e189 | 2014-05-13 13:21:16 -0700 | [diff] [blame] | 1091 | mFloatingActionButtonContainer.setLayoutParams(params); |
Yorke Lee | cc4660d | 2014-04-24 11:22:57 -0700 | [diff] [blame] | 1092 | } |
Andrew Lee | 2a58ab8 | 2014-05-15 02:16:04 -0700 | [diff] [blame] | 1093 | |
| 1094 | /** |
| 1095 | * Convenience class which implements AnimationListener interface as null-op methods. |
| 1096 | */ |
| 1097 | private class ActivityAnimationListener implements AnimationListener { |
| 1098 | @Override |
| 1099 | public void onAnimationStart(Animation animation) { |
| 1100 | } |
| 1101 | |
| 1102 | @Override |
| 1103 | public void onAnimationEnd(Animation animation) { |
| 1104 | } |
| 1105 | |
| 1106 | @Override |
| 1107 | public void onAnimationRepeat(Animation animation) { |
| 1108 | } |
| 1109 | } |
Chiao Cheng | 94b10b5 | 2012-08-17 16:59:12 -0700 | [diff] [blame] | 1110 | } |