Refactoring all apps search to support external search bar.

- Adding support for an external search bar that can be used
  to search a container view.  This adds a new interface
  AllAppsSearchController which manages the external search
  bar.  Each controller will have its own search implementation
  which means that we no longer need a common AppSearchManager
  interface.
- Removing elevation controller as we no longer have a builtin
  search bar in all apps
- Refactoring container view insets so that they behave
  the same in all containers.
- Refactoring apps view to ensure that we only update the number
  of columns with the available width
- Cleaning up LauncherCallbacks interface

Bug: 20127840
Bug: 21494973

Change-Id: I710b8e18196961d77d8a29f0c345531d480936fe
This commit is contained in:
Winson Chung
2015-06-04 17:18:17 -07:00
parent e89cf793ab
commit ef7f874a88
29 changed files with 1087 additions and 1064 deletions

View File

@@ -235,11 +235,10 @@ public class AlphabeticalAppsList {
private int mNumAppsPerRow;
private int mNumPredictedAppsPerRow;
public AlphabeticalAppsList(Context context, int numAppsPerRow, int numPredictedAppsPerRow) {
public AlphabeticalAppsList(Context context) {
mLauncher = (Launcher) context;
mIndexer = new AlphabeticIndexCompat(context);
mAppNameComparator = new AppNameComparator(context);
setNumAppsPerRow(numAppsPerRow, numPredictedAppsPerRow);
}
/**
@@ -249,10 +248,6 @@ public class AlphabeticalAppsList {
mAdapterChangedCallback = cb;
}
public SimpleAppSearchManagerImpl newSimpleAppSearchManager() {
return new SimpleAppSearchManagerImpl(mApps);
}
/**
* Sets the number of apps per row. Used only for AppsContainerView.SECTIONED_GRID_COALESCED.
*/
@@ -269,7 +264,7 @@ public class AlphabeticalAppsList {
mNumAppsPerRow = numAppsPerRow;
mNumPredictedAppsPerRow = numPredictedAppsPerRow;
onAppsUpdated();
updateAdapterItems();
}
/**
@@ -279,6 +274,13 @@ public class AlphabeticalAppsList {
mAdapter = adapter;
}
/**
* Returns all the apps.
*/
public List<AppInfo> getApps() {
return mApps;
}
/**
* Returns sections of all the current filtered applications.
*/
@@ -597,6 +599,11 @@ public class AlphabeticalAppsList {
* Merges multiple sections to reduce visual raggedness.
*/
private void mergeSections() {
// Ignore merging until we have a valid row size
if (mNumAppsPerRow == 0) {
return;
}
// Go through each section and try and merge some of the sections
if (AllAppsContainerView.GRID_MERGE_SECTIONS && !hasFilter()) {
int sectionAppCount = 0;