summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/DeviceProfile.java7
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/SearchDropTargetBar.java14
-rw-r--r--src/com/android/launcher3/Workspace.java1
4 files changed, 26 insertions, 2 deletions
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 8bba13c9d..866e0ac90 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -614,12 +614,17 @@ public class DeviceProfile {
bounds.set(desiredWorkspaceLeftRightMarginPx - defaultWidgetPadding.left,
getSearchBarTopOffset(),
availableWidthPx - (desiredWorkspaceLeftRightMarginPx -
- defaultWidgetPadding.right), searchBarVisible ? searchBarSpaceHeightPx : edgeMarginPx);
+ defaultWidgetPadding.right),
+ edgeMarginPx + (searchBarVisible ? searchBarSpaceHeightPx : 0));
}
}
return bounds;
}
+ boolean shouldAnimQSBWithWorkspace() {
+ return !isLandscape && !isTablet();
+ }
+
/** Returns the bounds of the workspace page indicators. */
Rect getWorkspacePageIndicatorBounds(Rect insets) {
Rect workspacePadding = getWorkspacePadding();
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1dafd1245..bada6ba13 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -5250,6 +5250,12 @@ public class Launcher extends Activity
mGrid.layoutSearchBar(this);
}
+ public void bindSearchBar() {
+ if (mSearchDropTargetBar != null) {
+ mSearchDropTargetBar.setQsbSearchBar(getQsbBar());
+ }
+ }
+
/**
* Add the icons for all apps.
*
diff --git a/src/com/android/launcher3/SearchDropTargetBar.java b/src/com/android/launcher3/SearchDropTargetBar.java
index e17ac0e3d..8f5c5ec2f 100644
--- a/src/com/android/launcher3/SearchDropTargetBar.java
+++ b/src/com/android/launcher3/SearchDropTargetBar.java
@@ -21,6 +21,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
@@ -59,6 +60,10 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
public SearchDropTargetBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+
+ // Ensure a minimal height while view is finishing to inflate
+ final Resources res = context.getResources();
+ mBarHeight = res.getDimensionPixelSize(R.dimen.dynamic_grid_search_bar_height);
}
public void setup(Launcher launcher, DragController dragController) {
@@ -86,11 +91,18 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
alpha = mQSBSearchBar.getAlpha();
visibility = mQSBSearchBar.getVisibility();
}
+ if (mQSBSearchBarAnim != null) {
+ // Revert the current animation before swap it
+ mQSBSearchBarAnim.reverse();
+ }
mQSBSearchBar = qsb;
if (mQSBSearchBar != null) {
mQSBSearchBar.setAlpha(alpha);
mQSBSearchBar.setVisibility(visibility);
- if (mEnableDropDownDropTargets) {
+ if (!mLauncher.isSearchBarEnabled() && mLauncher.mGrid.shouldAnimQSBWithWorkspace()) {
+ mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mLauncher.getWorkspace(),
+ "translationY", 0, mBarHeight);
+ } else if (mEnableDropDownDropTargets) {
mQSBSearchBarAnim = LauncherAnimUtils.ofFloat(mQSBSearchBar, "translationY", 0,
-mBarHeight);
} else {
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index ad045ccf4..71407b9fc 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2256,6 +2256,7 @@ public class Workspace extends SmoothPagedView
State finalState = Workspace.State.OVERVIEW;
if (!enable) {
finalState = Workspace.State.NORMAL;
+ mLauncher.bindSearchBar();
}
Animator workspaceAnim = getChangeStateAnimation(finalState, animated, 0, snapPage);