Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8246a143 authored by Mac Duy Hai's avatar Mac Duy Hai
Browse files

Shortcut show/hideSearchBar with new conditions.

This is effectively a revert of:
https://googleplex-android-review.googlesource.com/374556

With the new rules, we won't shortcut if:
 - the search bar is in an opposite visibility OR
 - a non-animated change has been requested AND there
   is an ongoing animation.

This makes sure that showSearchBar(false) called after
showSearchBar(true) is not ignored.

Bug: 11105305
Bug: 11237729
Change-Id: I92668dfac072e62506b2872e8bfbe9f707c9cc69
parent b6d33df9
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -138,6 +138,8 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
     * Shows and hides the search bar.
     * Shows and hides the search bar.
     */
     */
    public void showSearchBar(boolean animated) {
    public void showSearchBar(boolean animated) {
        boolean needToCancelOngoingAnimation = mQSBSearchBarAnim.isRunning() && !animated;
        if (!mIsSearchBarHidden && !needToCancelOngoingAnimation) return;
        if (animated) {
        if (animated) {
            prepareStartAnimation(mQSBSearchBar);
            prepareStartAnimation(mQSBSearchBar);
            mQSBSearchBarAnim.reverse();
            mQSBSearchBarAnim.reverse();
@@ -152,6 +154,8 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
        mIsSearchBarHidden = false;
        mIsSearchBarHidden = false;
    }
    }
    public void hideSearchBar(boolean animated) {
    public void hideSearchBar(boolean animated) {
        boolean needToCancelOngoingAnimation = mQSBSearchBarAnim.isRunning() && !animated;
        if (mIsSearchBarHidden && !needToCancelOngoingAnimation) return;
        if (animated) {
        if (animated) {
            prepareStartAnimation(mQSBSearchBar);
            prepareStartAnimation(mQSBSearchBar);
            mQSBSearchBarAnim.start();
            mQSBSearchBarAnim.start();