Moving the QSB to the workspace grid.
The QSB will only be resent on the first screen of the workspace covering the full width of the first row. If will not be movable. The first screen of the workspace will not be movable. The searchDropTargetBar no longer contains the QSB (it can be renamed in aseparate cl). Refactoring all QSB related logic by moving it to a custom view inflated only using xml. Change-Id: Icb4fd6eb855df1af15f685961c38351bf4fd4f4a
This commit is contained in:
@@ -18,10 +18,7 @@ package com.android.launcher3;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.app.SearchManager;
|
||||
import android.app.WallpaperManager;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -602,39 +599,6 @@ public final class Utilities {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a widget with category {@link AppWidgetProviderInfo#WIDGET_CATEGORY_SEARCHBOX}
|
||||
* provided by the same package which is set to be global search activity.
|
||||
* If widgetCategory is not supported, or no such widget is found, returns the first widget
|
||||
* provided by the package.
|
||||
*/
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||
public static AppWidgetProviderInfo getSearchWidgetProvider(Context context) {
|
||||
SearchManager searchManager =
|
||||
(SearchManager) context.getSystemService(Context.SEARCH_SERVICE);
|
||||
ComponentName searchComponent = searchManager.getGlobalSearchActivity();
|
||||
if (searchComponent == null) return null;
|
||||
String providerPkg = searchComponent.getPackageName();
|
||||
|
||||
AppWidgetProviderInfo defaultWidgetForSearchPackage = null;
|
||||
|
||||
AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
|
||||
for (AppWidgetProviderInfo info : appWidgetManager.getInstalledProviders()) {
|
||||
if (info.provider.getPackageName().equals(providerPkg)) {
|
||||
if (ATLEAST_JB_MR1) {
|
||||
if ((info.widgetCategory & AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX) != 0) {
|
||||
return info;
|
||||
} else if (defaultWidgetForSearchPackage == null) {
|
||||
defaultWidgetForSearchPackage = info;
|
||||
}
|
||||
} else {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultWidgetForSearchPackage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compresses the bitmap to a byte array for serialization.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user