Separate some elements to set visibility separately

Added entries for:
- All apps header extra content
- Hotseat extra content

Change-Id: I47c4ccfe3b54fd47cbbee88698ed045611e3e92d
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index d5a2120..6185844 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -46,9 +46,11 @@
      * Note that workspace is not included here as in that case, we animate individual pages
      */
     public static final int NONE = 0;
-    public static final int HOTSEAT = 1 << 0;
-    public static final int ALL_APPS_HEADER = 1 << 1;
-    public static final int ALL_APPS_CONTENT = 1 << 2;
+    public static final int HOTSEAT_ICONS = 1 << 0;
+    public static final int HOTSEAT_EXTRA = 1 << 1; // e.g. a search box
+    public static final int ALL_APPS_HEADER = 1 << 2;
+    public static final int ALL_APPS_HEADER_EXTRA = 1 << 3; // e.g. app predictions
+    public static final int ALL_APPS_CONTENT = 1 << 4;
 
     protected static final int FLAG_SHOW_SCRIM = 1 << 0;
     protected static final int FLAG_MULTI_PAGE = 1 << 1;
@@ -193,7 +195,10 @@
     }
 
     public int getVisibleElements(Launcher launcher) {
-        return HOTSEAT;
+        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
+            return HOTSEAT_ICONS;
+        }
+        return HOTSEAT_ICONS | HOTSEAT_EXTRA;
     }
 
     /**
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 63c1181..66ea4d4 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -18,16 +18,10 @@
 
 import static com.android.launcher3.LauncherAnimUtils.DRAWABLE_ALPHA;
 import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
-import static com.android.launcher3.LauncherState.HOTSEAT;
+import static com.android.launcher3.LauncherState.HOTSEAT_EXTRA;
+import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
 import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
-import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
 
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.TimeInterpolator;
-import android.animation.ValueAnimator;
-import android.util.Property;
 import android.view.View;
 
 import com.android.launcher3.LauncherState.PageAlphaProvider;
@@ -36,6 +30,7 @@
 import com.android.launcher3.anim.Interpolators;
 import com.android.launcher3.anim.PropertySetter;
 import com.android.launcher3.graphics.ViewScrim;
+import com.android.launcher3.uioverrides.UiFactory;
 
 /**
  * Manages the animations between each of the workspace states.
@@ -85,11 +80,14 @@
                 scaleAndTranslation[2], Interpolators.ZOOM_IN);
 
         int elements = state.getVisibleElements(mLauncher);
-        float hotseatAlpha = (elements & HOTSEAT) != 0 ? 1 : 0;
-        propertySetter.setViewAlpha(mLauncher.getHotseat(), hotseatAlpha,
+        float hotseatIconsAlpha = (elements & HOTSEAT_ICONS) != 0 ? 1 : 0;
+        float hotseatExtraAlpha = (elements & HOTSEAT_EXTRA) != 0 ? 1 : 0;
+        propertySetter.setViewAlpha(mLauncher.getHotseat().getLayout(), hotseatIconsAlpha,
                 pageAlphaProvider.interpolator);
+        propertySetter.setViewAlpha(UiFactory.getHotseatExtraContent(mLauncher.getHotseat()),
+                hotseatExtraAlpha, pageAlphaProvider.interpolator);
         propertySetter.setViewAlpha(mLauncher.getWorkspace().getPageIndicator(),
-                hotseatAlpha, pageAlphaProvider.interpolator);
+                hotseatIconsAlpha, pageAlphaProvider.interpolator);
 
         // Set scrim
         propertySetter.setFloat(ViewScrim.get(mWorkspace), ViewScrim.PROGRESS,
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index bf8f531..fbd23d1 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -2,6 +2,7 @@
 
 import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT;
 import static com.android.launcher3.LauncherState.ALL_APPS_HEADER;
+import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
 import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
 import static com.android.launcher3.anim.Interpolators.LINEAR;
 import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
@@ -179,12 +180,13 @@
     private void setAlphas(LauncherState toState, PropertySetter setter) {
         int visibleElements = toState.getVisibleElements(mLauncher);
         boolean hasHeader = (visibleElements & ALL_APPS_HEADER) != 0;
+        boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0;
         boolean hasContent = (visibleElements & ALL_APPS_CONTENT) != 0;
 
         setter.setViewAlpha(mAppsView.getSearchView(), hasHeader ? 1 : 0, LINEAR);
         setter.setViewAlpha(mAppsView.getContentView(), hasContent ? 1 : 0, LINEAR);
         setter.setViewAlpha(mAppsView.getScrollBar(), hasContent ? 1 : 0, LINEAR);
-        mAppsView.getFloatingHeaderView().setContentVisibility(hasHeader, hasContent, setter);
+        mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasContent, setter);
     }
 
     public AnimatorListenerAdapter getProgressAnimatorListener() {
diff --git a/src/com/android/launcher3/anim/PropertySetter.java b/src/com/android/launcher3/anim/PropertySetter.java
index 51580b1..1f11f7e 100644
--- a/src/com/android/launcher3/anim/PropertySetter.java
+++ b/src/com/android/launcher3/anim/PropertySetter.java
@@ -32,8 +32,10 @@
     public static final PropertySetter NO_ANIM_PROPERTY_SETTER = new PropertySetter();
 
     public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) {
-        view.setAlpha(alpha);
-        AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view.getContext()));
+        if (view != null) {
+            view.setAlpha(alpha);
+            AlphaUpdateListener.updateVisibility(view, isAccessibilityEnabled(view.getContext()));
+        }
     }
 
     public <T> void setFloat(T target, Property<T, Float> property, float value,
@@ -58,7 +60,7 @@
 
         @Override
         public void setViewAlpha(View view, float alpha, TimeInterpolator interpolator) {
-            if (view.getAlpha() == alpha) {
+            if (view == null || view.getAlpha() == alpha) {
                 return;
             }
             ObjectAnimator anim = ObjectAnimator.ofFloat(view, View.ALPHA, alpha);