Adding listener support for color extraction changes
Changing the apps-search layout to use theme attribute instead of hard
coded layout id

Bug: 37616877
Change-Id: Iae601758303f83a2774635f0d88f74d99fc643c3
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c96c2a7..25995dd 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -212,6 +212,8 @@
     private static int NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS = 5;
     @Thunk static int NEW_APPS_ANIMATION_DELAY = 500;
 
+    private final ExtractedColors mExtractedColors = new ExtractedColors();
+
     @Thunk Workspace mWorkspace;
     private View mLauncherView;
     @Thunk DragLayer mDragLayer;
@@ -260,7 +262,6 @@
     private LauncherModel mModel;
     private ModelWriter mModelWriter;
     private IconCache mIconCache;
-    private ExtractedColors mExtractedColors;
     private LauncherAccessibilityDelegate mAccessibilityDelegate;
     private Handler mHandler = new Handler();
     private boolean mIsResumeFromActionScreenOff;
@@ -392,11 +393,10 @@
         // LauncherModel load.
         mPaused = false;
 
-        mLauncherView = getLayoutInflater().inflate(R.layout.launcher, null);
+        mLauncherView = LayoutInflater.from(this).inflate(R.layout.launcher, null);
 
         setupViews();
         mDeviceProfile.layout(this, false /* notifyListeners */);
-        mExtractedColors = new ExtractedColors();
         loadExtractedColorsAndColorItems();
 
         mPopupDataProvider = new PopupDataProvider(this);
@@ -465,12 +465,7 @@
     @Override
     public void onExtractedColorsChanged() {
         loadExtractedColorsAndColorItems();
-        if (mAllAppsController != null) {
-            mAllAppsController.onExtractedColorsChanged();
-        }
-        if (mLauncherCallbacks != null) {
-            mLauncherCallbacks.onExtractedColorsChanged();
-        }
+        mExtractedColors.notifyChange();
     }
 
     public ExtractedColors getExtractedColors() {