mirror of
https://gitlab.com/ultrasonic/ultrasonic.git
synced 2025-05-03 17:11:33 +03:00
Fixed searched text not visible for voice search
This commit is contained in:
parent
81ce23bafd
commit
09c8c56f59
@ -178,14 +178,13 @@ public class SearchFragment extends Fragment {
|
|||||||
|
|
||||||
registerForContextMenu(list);
|
registerForContextMenu(list);
|
||||||
|
|
||||||
// Fragment was started with a query, try to execute search right away
|
// Fragment was started with a query (e.g. from voice search), try to execute search right away
|
||||||
Bundle arguments = getArguments();
|
Bundle arguments = getArguments();
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
String query = arguments.getString(Constants.INTENT_EXTRA_NAME_QUERY);
|
String query = arguments.getString(Constants.INTENT_EXTRA_NAME_QUERY);
|
||||||
boolean autoPlay = arguments.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);
|
boolean autoPlay = arguments.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);
|
||||||
|
|
||||||
if (query != null)
|
if (query != null) {
|
||||||
{
|
|
||||||
mergeAdapter = new MergeAdapter();
|
mergeAdapter = new MergeAdapter();
|
||||||
list.setAdapter(mergeAdapter);
|
list.setAdapter(mergeAdapter);
|
||||||
search(query, autoPlay);
|
search(query, autoPlay);
|
||||||
@ -202,14 +201,21 @@ public class SearchFragment extends Fragment {
|
|||||||
Activity activity = getActivity();
|
Activity activity = getActivity();
|
||||||
if (activity == null) return;
|
if (activity == null) return;
|
||||||
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
|
SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE);
|
||||||
Bundle arguments = getArguments();
|
|
||||||
final boolean autoPlay = arguments != null && arguments.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);
|
|
||||||
|
|
||||||
inflater.inflate(R.menu.search, menu);
|
inflater.inflate(R.menu.search, menu);
|
||||||
MenuItem searchItem = menu.findItem(R.id.search_item);
|
MenuItem searchItem = menu.findItem(R.id.search_item);
|
||||||
final SearchView searchView = (SearchView) searchItem.getActionView();
|
final SearchView searchView = (SearchView) searchItem.getActionView();
|
||||||
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
|
searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
|
||||||
|
|
||||||
|
Bundle arguments = getArguments();
|
||||||
|
final boolean autoPlay = arguments != null && arguments.getBoolean(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false);
|
||||||
|
String query = arguments == null? null : arguments.getString(Constants.INTENT_EXTRA_NAME_QUERY);
|
||||||
|
// If started with a query, enter it to the searchView
|
||||||
|
if (query != null) {
|
||||||
|
searchView.setQuery(query, false);
|
||||||
|
searchView.clearFocus();
|
||||||
|
}
|
||||||
|
|
||||||
searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
|
searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onSuggestionSelect(int position) { return true; }
|
public boolean onSuggestionSelect(int position) { return true; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user