diff options
author | Yvonne Wong <ywong@cyngn.com> | 2015-11-30 15:32:16 -0800 |
---|---|---|
committer | Yvonne Wong <ywong@cyngn.com> | 2015-11-30 15:32:16 -0800 |
commit | fe70926e116fca0d84b3642aae3fe6c68d6c7264 (patch) | |
tree | ff7d77fd2fa683807b85f580a45f231d6f6c2433 /src/com/android/launcher3/SearchDropTargetBar.java | |
parent | b3de38c976eeb5a8c4b5c1b0d68d9c84253d3187 (diff) | |
download | android_packages_apps_Trebuchet-fe70926e116fca0d84b3642aae3fe6c68d6c7264.tar.gz android_packages_apps_Trebuchet-fe70926e116fca0d84b3642aae3fe6c68d6c7264.tar.bz2 android_packages_apps_Trebuchet-fe70926e116fca0d84b3642aae3fe6c68d6c7264.zip |
Reimplement CM Settings Overview Panel in the new Launcher Part 2
- Enables hiding the search bar from the workspace
- Adds a reload launcher flag to reload only during onResume or newIntent if needed
Change-Id: I0feb279f9003b268b5a129cef40d3665787ee451
Diffstat (limited to 'src/com/android/launcher3/SearchDropTargetBar.java')
-rw-r--r-- | src/com/android/launcher3/SearchDropTargetBar.java | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/src/com/android/launcher3/SearchDropTargetBar.java b/src/com/android/launcher3/SearchDropTargetBar.java index 772a334b9..182d741ae 100644 --- a/src/com/android/launcher3/SearchDropTargetBar.java +++ b/src/com/android/launcher3/SearchDropTargetBar.java @@ -64,6 +64,7 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D private static final AccelerateInterpolator sAccelerateInterpolator = new AccelerateInterpolator(); + private Launcher mLauncher; private State mState = State.SEARCH_BAR; @Thunk View mQSB; @Thunk View mDropTargetBar; @@ -84,6 +85,8 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D } public void setup(Launcher launcher, DragController dragController) { + mLauncher = launcher; + dragController.addDragListener(this); dragController.setFlingToDeleteDropTarget(mDeleteDropTarget); @@ -134,24 +137,39 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D }); } + public void setupQsb(Launcher launcher) { + mLauncher = launcher; + mQSB = launcher.getOrCreateQsbBar(); + } + public void setQsbSearchBar(View qsb) { + float alpha = 1f; + int visibility = View.VISIBLE; + if (mQSB != null) { + alpha = mQSB.getAlpha(); + visibility = mQSB.getVisibility(); + } + mQSB = qsb; if (mQSB != null) { - // Update the search ber animation + mQSB.setAlpha(alpha); + mQSB.setVisibility(visibility); + + // Update the search bar animation mQSBSearchBarAnimator = new LauncherViewPropertyAnimator(mQSB); mQSBSearchBarAnimator.setInterpolator(sAccelerateInterpolator); mQSBSearchBarAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { // Ensure that the view is visible for the animation - if (mQSB != null) { + if (mQSB != null && isSearchBarVisible()) { mQSB.setVisibility(View.VISIBLE); } } @Override public void onAnimationEnd(Animator animation) { - if (mQSB != null) { + if (mQSB != null && isSearchBarVisible()) { AlphaUpdateListener.updateVisibility(mQSB, mAccessibilityEnabled); } } @@ -173,9 +191,10 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D AccessibilityManager am = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); mAccessibilityEnabled = am.isEnabled(); - - animateViewAlpha(mQSBSearchBarAnimator, mQSB, newState.getSearchBarAlpha(), - duration); + if (mLauncher.getDeviceProfile().searchBarVisible) { + animateViewAlpha(mQSBSearchBarAnimator, mQSB, newState.getSearchBarAlpha(), + duration); + } animateViewAlpha(mDropTargetBarAnimator, mDropTargetBar, newState.getDropTargetBarAlpha(), duration); } @@ -245,8 +264,15 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D } } + public boolean isSearchBarVisible() { + if (mLauncher != null) { + return mLauncher.getDeviceProfile().searchBarVisible; + } + return true; + } + public void enableAccessibleDrag(boolean enable) { - if (mQSB != null) { + if (mQSB != null && isSearchBarVisible()) { mQSB.setVisibility(enable ? View.GONE : View.VISIBLE); } mInfoDropTarget.enableAccessibleDrag(enable); |