Merge "Fix logging successful search events" into ub-contactsdialer-i-dev
diff --git a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
index 458c223..f4d244e 100644
--- a/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
+++ b/src/com/android/contacts/list/DefaultContactBrowseListFragment.java
@@ -94,6 +94,7 @@
private static final String TAG = "DefaultListFragment";
private static final String ENABLE_DEBUG_OPTIONS_HIDDEN_CODE = "debug debug!";
private static final String KEY_DELETION_IN_PROGRESS = "deletionInProgress";
+ private static final String KEY_SEARCH_RESULT_CLICKED = "search_result_clicked";
private static final int ACTIVITY_REQUEST_CODE_SHARE = 0;
@@ -149,6 +150,8 @@
*/
private boolean mDisableOptionItemSelected;
+ private boolean mSearchResultClicked;
+
private ActionBarAdapter mActionBarAdapter;
private PeopleActivity mActivity;
private ContactsRequest mContactsRequest;
@@ -250,6 +253,22 @@
setHasOptionsMenu(true);
}
+ /**
+ * Whether a search result was clicked by the user. Tracked so that we can distinguish
+ * between exiting the search mode after a result was clicked from exiting w/o clicking
+ * any search result.
+ */
+ public boolean wasSearchResultClicked() {
+ return mSearchResultClicked;
+ }
+
+ /**
+ * Resets whether a search result was clicked by the user to false.
+ */
+ public void resetSearchResultClicked() {
+ mSearchResultClicked = false;
+ }
+
@Override
public CursorLoader createCursorLoader(Context context) {
return new FavoritesAndContactsLoader(context);
@@ -371,6 +390,11 @@
if (getAdapter().isDisplayingCheckBoxes()) {
super.onItemClick(position, id);
return;
+ } else {
+ if (isSearchMode()) {
+ mSearchResultClicked = true;
+ Logger.logSearchEvent(createSearchStateForSearchResultClick(position));
+ }
}
viewContact(position, uri, getAdapter().isEnterpriseContact(position));
}
@@ -648,8 +672,11 @@
setCheckBoxListListener(new CheckBoxListListener());
setOnContactListActionListener(new ContactBrowserActionListener());
- if (savedInstanceState != null && savedInstanceState.getBoolean(KEY_DELETION_IN_PROGRESS)) {
- deleteSelectedContacts();
+ if (savedInstanceState != null) {
+ if (savedInstanceState.getBoolean(KEY_DELETION_IN_PROGRESS)) {
+ deleteSelectedContacts();
+ }
+ mSearchResultClicked = savedInstanceState.getBoolean(KEY_SEARCH_RESULT_CLICKED);
}
setDirectorySearchMode();
@@ -1183,6 +1210,7 @@
}
mDisableOptionItemSelected = true;
outState.putBoolean(KEY_DELETION_IN_PROGRESS, mIsDeletionInProgress);
+ outState.putBoolean(KEY_SEARCH_RESULT_CLICKED, mSearchResultClicked);
}
@Override
diff --git a/src/com/android/contacts/list/MultiSelectContactsListFragment.java b/src/com/android/contacts/list/MultiSelectContactsListFragment.java
index 67c937c..61e92b8 100644
--- a/src/com/android/contacts/list/MultiSelectContactsListFragment.java
+++ b/src/com/android/contacts/list/MultiSelectContactsListFragment.java
@@ -68,31 +68,12 @@
private static final String EXTRA_KEY_SELECTED_CONTACTS = "selected_contacts";
- private static final String KEY_SEARCH_RESULT_CLICKED = "search_result_clicked";
-
private OnCheckBoxListActionListener mCheckBoxListListener;
- private boolean mSearchResultClicked;
public void setCheckBoxListListener(OnCheckBoxListActionListener checkBoxListListener) {
mCheckBoxListListener = checkBoxListListener;
}
- /**
- * Whether a search result was clicked by the user. Tracked so that we can distinguish
- * between exiting the search mode after a result was clicked from exiting w/o clicking
- * any search result.
- */
- public boolean wasSearchResultClicked() {
- return mSearchResultClicked;
- }
-
- /**
- * Resets whether a search result was clicked by the user to false.
- */
- public void resetSearchResultClicked() {
- mSearchResultClicked = false;
- }
-
public void setAnimateOnLoad(boolean shouldAnimate) {
mAnimateOnLoad = shouldAnimate;
}
@@ -119,7 +100,6 @@
final TreeSet<Long> selectedContactIds = (TreeSet<Long>)
savedInstanceState.getSerializable(EXTRA_KEY_SELECTED_CONTACTS);
getAdapter().setSelectedContactIds(selectedContactIds);
- mSearchResultClicked = savedInstanceState.getBoolean(KEY_SEARCH_RESULT_CLICKED);
}
}
@@ -149,7 +129,6 @@
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable(EXTRA_KEY_SELECTED_CONTACTS, getSelectedContactIds());
- outState.putBoolean(KEY_SEARCH_RESULT_CLICKED, mSearchResultClicked);
}
public void displayCheckBoxes(boolean displayCheckBoxes) {
@@ -204,11 +183,6 @@
}
if (getAdapter().isDisplayingCheckBoxes()) {
getAdapter().toggleSelectionOfContactId(contactId);
- } else {
- if (isSearchMode()) {
- mSearchResultClicked = true;
- Logger.logSearchEvent(createSearchStateForSearchResultClick(position));
- }
}
if (mCheckBoxListListener != null && getAdapter().getSelectedContactIds().size() == 0) {
mCheckBoxListListener.onStopDisplayingCheckBoxes();