6
Ich schreibe einen Launcher und möchte eine Suche als Overlay statt als Vollbild in der Google App öffnen können.Globale Suche als Overlay öffnen
Bisher finde ich nur einen Weg, um die Suche in dem Google App im Vollbildmodus zu öffnen, wie folgt (aus AOSP Launcher3 Quellcode):
public static boolean openSearch(Context context) {
SearchManager searchManager = (SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity();
if (globalSearchActivity == null) {
Timber.w("No global search activity found.");
return false;
}
Intent intent = new Intent(android.app.SearchManager.INTENT_ACTION_GLOBAL_SEARCH);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setComponent(globalSearchActivity);
Bundle appSearchData = new Bundle();
appSearchData.putString("source", "launcher-search");
intent.putExtra(android.app.SearchManager.APP_DATA, appSearchData);
intent.putExtra(android.app.SearchManager.QUERY, "");
intent.putExtra(android.app.SearchManager.EXTRA_SELECT_QUERY, true);
try {
context.startActivity(intent);
return true;
} catch (ActivityNotFoundException ex) {
Timber.w("Global search activity not found: %s", globalSearchActivity);
return false;
}
}
Ich weiß, es ist möglich, weil andere Trägersysteme wie Nova und Action-Launcher geschafft, es zu tun ...