Merge "Fixes a bug when using the prediction row view and changing screen orientation." into ub-launcher3-master
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index 72ad69b..320d287 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -543,6 +543,9 @@
     }
 
     private void setupHeader() {
+        if (mFloatingHeaderHandler == null) {
+            return;
+        }
         mHeader.setVisibility(View.VISIBLE);
         int contentHeight = mLauncher.getDeviceProfile().allAppsCellHeightPx;
         if (!mUsingTabs) {
diff --git a/src/com/android/launcher3/allapps/PredictionRowView.java b/src/com/android/launcher3/allapps/PredictionRowView.java
index 45ef6c1..ea91770 100644
--- a/src/com/android/launcher3/allapps/PredictionRowView.java
+++ b/src/com/android/launcher3/allapps/PredictionRowView.java
@@ -68,7 +68,10 @@
      * Sets the number of apps per row.
      */
     public void setNumAppsPerRow(int numPredictedAppsPerRow) {
-        mNumPredictedAppsPerRow = numPredictedAppsPerRow;
+        if (mNumPredictedAppsPerRow != numPredictedAppsPerRow) {
+            mNumPredictedAppsPerRow = numPredictedAppsPerRow;
+            onAppsUpdated();
+        }
     }
 
     /**