use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.
the class SearchManagerTest method testStopSearchIdempotent.
/**
* Tests that stopSearch() can be called when the search UI is not visible and can be
* called multiple times without startSearch() in between.
*/
public void testStopSearchIdempotent() throws Exception {
SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
assertNotNull(searchManager);
searchManager.stopSearch();
searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false);
searchManager.stopSearch();
searchManager.stopSearch();
}
use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.
the class SearchManagerTest method testStartSearchIdempotent.
/**
* Tests that startSearch() can be called multiple times without stopSearch()
* in between.
*/
public void testStartSearchIdempotent() throws Exception {
SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
assertNotNull(searchManager);
searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false);
searchManager.startSearch(null, false, SEARCHABLE_ACTIVITY, null, false);
searchManager.stopSearch();
}
use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.
the class SearchManagerTest method testSearchManagerAvailable.
/**
* The goal of this test is to confirm that we can obtain
* a search manager at any time, and that for any given context,
* it is a singleton.
*/
@LargeTest
public void testSearchManagerAvailable() {
SearchManager searchManager1 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
assertNotNull(searchManager1);
SearchManager searchManager2 = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
assertNotNull(searchManager2);
assertSame(searchManager1, searchManager2);
}
use of android.app.SearchManager in project HumaneApp by Ganesh1010.
the class MapActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater mi = getMenuInflater();
mi.inflate(R.menu.menu_map, menu);
MenuItem searchViewItem = menu.findItem(R.id.action_search);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) searchViewItem.getActionView();
searchView.setQueryHint("Search for your Location...");
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setSubmitButtonEnabled(true);
// Do not iconify the widget; expand it by defaul
searchView.setIconifiedByDefault(false);
SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
public boolean onQueryTextChange(String newText) {
return true;
}
public boolean onQueryTextSubmit(String query) {
onMapSearch(query);
return true;
}
};
searchView.setOnQueryTextListener(queryTextListener);
return true;
}
use of android.app.SearchManager in project android_frameworks_base by DirtyUnicorns.
the class AssistManager method startAssistActivity.
private void startAssistActivity(Bundle args, @NonNull ComponentName assistComponent) {
if (!mBar.isDeviceProvisioned()) {
return;
}
// Close Recent Apps if needed
mBar.animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_SEARCH_PANEL | CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL);
boolean structureEnabled = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.ASSIST_STRUCTURE_ENABLED, 1, UserHandle.USER_CURRENT) != 0;
final Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE)).getAssistIntent(structureEnabled);
if (intent == null) {
return;
}
intent.setComponent(assistComponent);
intent.putExtras(args);
if (structureEnabled) {
showDisclosure();
}
try {
final ActivityOptions opts = ActivityOptions.makeCustomAnimation(mContext, R.anim.search_launch_enter, R.anim.search_launch_exit);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
AsyncTask.execute(new Runnable() {
@Override
public void run() {
mContext.startActivityAsUser(intent, opts.toBundle(), new UserHandle(UserHandle.USER_CURRENT));
}
});
} catch (ActivityNotFoundException e) {
Log.w(TAG, "Activity not found for " + intent.getAction());
}
}
Aggregations