am 84d2d10d: am efaee761: am 083c715d: Merge "Show the microphone when the search box is opened from browser" into froyo
This commit is contained in:
@@ -123,6 +123,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
|||||||
// that modifies the contents of the text field. But if the user then edits
|
// that modifies the contents of the text field. But if the user then edits
|
||||||
// the suggestion, the resulting string is saved.
|
// the suggestion, the resulting string is saved.
|
||||||
private String mUserQuery;
|
private String mUserQuery;
|
||||||
|
// The query passed in when opening the SearchDialog. Used in the browser
|
||||||
|
// case to determine whether the user has edited the query.
|
||||||
|
private String mInitialQuery;
|
||||||
|
|
||||||
// A weak map of drawables we've gotten from other packages, so we don't load them
|
// A weak map of drawables we've gotten from other packages, so we don't load them
|
||||||
// more than once.
|
// more than once.
|
||||||
@@ -253,6 +256,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInitialQuery = initialQuery == null ? "" : initialQuery;
|
||||||
// finally, load the user's initial text (which may trigger suggestions)
|
// finally, load the user's initial text (which may trigger suggestions)
|
||||||
setUserQuery(initialQuery);
|
setUserQuery(initialQuery);
|
||||||
if (selectInitialQuery) {
|
if (selectInitialQuery) {
|
||||||
@@ -329,6 +333,7 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
|||||||
mAppSearchData = null;
|
mAppSearchData = null;
|
||||||
mSearchable = null;
|
mSearchable = null;
|
||||||
mUserQuery = null;
|
mUserQuery = null;
|
||||||
|
mInitialQuery = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -687,13 +692,16 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
|||||||
if (mSearchable == null) {
|
if (mSearchable == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateWidgetState();
|
|
||||||
if (!mSearchAutoComplete.isPerformingCompletion()) {
|
if (!mSearchAutoComplete.isPerformingCompletion()) {
|
||||||
// The user changed the query, remember it.
|
// The user changed the query, remember it.
|
||||||
mUserQuery = s == null ? "" : s.toString();
|
mUserQuery = s == null ? "" : s.toString();
|
||||||
}
|
}
|
||||||
|
updateWidgetState();
|
||||||
// Always want to show the microphone if the context is voice.
|
// Always want to show the microphone if the context is voice.
|
||||||
|
// Also show the microphone if this is a browser search and the
|
||||||
|
// query matches the initial query.
|
||||||
updateVoiceButton(mSearchAutoComplete.isEmpty()
|
updateVoiceButton(mSearchAutoComplete.isEmpty()
|
||||||
|
|| (isBrowserSearch() && mInitialQuery.equals(mUserQuery))
|
||||||
|| (mAppSearchData != null && mAppSearchData.getBoolean(
|
|| (mAppSearchData != null && mAppSearchData.getBoolean(
|
||||||
SearchManager.CONTEXT_IS_VOICE)));
|
SearchManager.CONTEXT_IS_VOICE)));
|
||||||
}
|
}
|
||||||
@@ -724,8 +732,9 @@ public class SearchDialog extends Dialog implements OnItemClickListener, OnItemS
|
|||||||
// enable the button if we have one or more non-space characters
|
// enable the button if we have one or more non-space characters
|
||||||
boolean enabled = !mSearchAutoComplete.isEmpty();
|
boolean enabled = !mSearchAutoComplete.isEmpty();
|
||||||
if (isBrowserSearch()) {
|
if (isBrowserSearch()) {
|
||||||
// In the browser, we hide the search button when there is no text
|
// In the browser, we hide the search button when there is no text,
|
||||||
if (enabled) {
|
// or if the text matches the initial query.
|
||||||
|
if (enabled && !mInitialQuery.equals(mUserQuery)) {
|
||||||
mSearchAutoComplete.setBackgroundResource(
|
mSearchAutoComplete.setBackgroundResource(
|
||||||
com.android.internal.R.drawable.textfield_search);
|
com.android.internal.R.drawable.textfield_search);
|
||||||
mGoButton.setVisibility(View.VISIBLE);
|
mGoButton.setVisibility(View.VISIBLE);
|
||||||
|
|||||||
Reference in New Issue
Block a user