mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1202196 Add UI Telemetry for search history items.r=mfinkle
This commit is contained in:
parent
71e89e6c6e
commit
d92eaa1d67
@ -98,8 +98,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
if (v == mUserEnteredView) {
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, "user");
|
||||
} else {
|
||||
final String extras = "engine." + (String) v.getTag();
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, extras);
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, (String) v.getTag());
|
||||
}
|
||||
mSearchListener.onSearch(mSearchEngine, suggestion);
|
||||
}
|
||||
@ -184,7 +183,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
mEditSuggestionListener = listener;
|
||||
}
|
||||
|
||||
private void bindSuggestionView(String suggestion, boolean animate, int recycledSuggestionCount, Integer previousSuggestionChildIndex, boolean isUserSavedSearch){
|
||||
private void bindSuggestionView(String suggestion, boolean animate, int recycledSuggestionCount, Integer previousSuggestionChildIndex, boolean isUserSavedSearch, String telemetryTag){
|
||||
final View suggestionItem;
|
||||
|
||||
// Reuse suggestion views from recycled view, if possible.
|
||||
@ -197,8 +196,7 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
suggestionItem.setOnClickListener(mClickListener);
|
||||
suggestionItem.setOnLongClickListener(mLongClickListener);
|
||||
|
||||
// Store the position of the suggestion for telemetry.
|
||||
suggestionItem.setTag(String.valueOf(previousSuggestionChildIndex));
|
||||
suggestionItem.setTag(telemetryTag);
|
||||
|
||||
mSuggestionView.addView(suggestionItem);
|
||||
}
|
||||
@ -227,9 +225,13 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
try {
|
||||
if (c.moveToFirst()) {
|
||||
final int searchColumn = c.getColumnIndexOrThrow(SearchHistory.QUERY);
|
||||
final int historyStartIndex = suggestionCounter;
|
||||
do {
|
||||
final String savedSearch = c.getString(searchColumn);
|
||||
bindSuggestionView(savedSearch, animate, recycledSuggestionCount, suggestionCounter, true);
|
||||
// suggestionCounter counts all suggestions (from history and the search engine)
|
||||
// but we want the relative position of the history item in telemetry
|
||||
String telemetryTag = "history." + (suggestionCounter - historyStartIndex);
|
||||
bindSuggestionView(savedSearch, animate, recycledSuggestionCount, suggestionCounter, true, telemetryTag);
|
||||
++suggestionCounter;
|
||||
} while (c.moveToNext());
|
||||
}
|
||||
@ -266,12 +268,13 @@ class SearchEngineRow extends AnimatedHeightLayout {
|
||||
}
|
||||
}
|
||||
int suggestionCounter = 0;
|
||||
// Apply Search Engine's suggestions
|
||||
for (String suggestion : mSearchEngine.getSuggestions()) {
|
||||
if (suggestionCounter == limit) {
|
||||
break;
|
||||
}
|
||||
bindSuggestionView(suggestion, animate, recycledSuggestionCount, suggestionCounter, false);
|
||||
// Since the search engine suggestions are listed first, we can use suggestionCounter to get their relative positions for telemetry
|
||||
String telemetryTag = "engine." + suggestionCounter;
|
||||
bindSuggestionView(suggestion, animate, recycledSuggestionCount, suggestionCounter, false, telemetryTag);
|
||||
++suggestionCounter;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user