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

Commit 2076e191 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

Merge "Fixed an issue where media could become invisible" into sc-dev am: b1fe28e2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15216093

Change-Id: I47691706fffd235f1ea364420b74cac6e792d57c
parents aec85f81 b1fe28e2
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -140,9 +140,11 @@ public class QSAnimator implements Callback, PageListener, Listener, OnLayoutCha
        updateAnimators();
        updateAnimators();
    }
    }



    /**
    public void onQsScrollingChanged() {
     * Request an update to the animators. This will update them lazily next time the position
        // Lazily update animators whenever the scrolling changes
     * is changed.
     */
    public void requestAnimatorUpdate() {
        mNeedsAnimatorUpdate = true;
        mNeedsAnimatorUpdate = true;
    }
    }


+9 −1
Original line number Original line Diff line number Diff line
@@ -173,7 +173,7 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
        mQSPanelScrollView.setOnScrollChangeListener(
        mQSPanelScrollView.setOnScrollChangeListener(
                (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
                (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
                    // Lazily update animators whenever the scrolling changes
                    // Lazily update animators whenever the scrolling changes
                    mQSAnimator.onQsScrollingChanged();
                    mQSAnimator.requestAnimatorUpdate();
                    mHeader.setExpandedScrollAmount(scrollY);
                    mHeader.setExpandedScrollAmount(scrollY);
                    if (mScrollListener != null) {
                    if (mScrollListener != null) {
                        mScrollListener.onQsPanelScrollChanged(scrollY);
                        mScrollListener.onQsPanelScrollChanged(scrollY);
@@ -215,6 +215,14 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
                        setQsExpansion(mLastQSExpansion, mLastHeaderTranslation);
                        setQsExpansion(mLastQSExpansion, mLastHeaderTranslation);
                    }
                    }
                });
                });
        mQSPanelController.setUsingHorizontalLayoutChangeListener(
                () -> {
                    // The hostview may be faded out in the horizontal layout. Let's make sure to
                    // reset the alpha when switching layouts. This is fine since the animator will
                    // update the alpha if it's not supposed to be 1.0f
                    mQSPanelController.getMediaHost().getHostView().setAlpha(1.0f);
                    mQSAnimator.requestAnimatorUpdate();
                });
    }
    }


    @Override
    @Override
+20 −0
Original line number Original line Diff line number Diff line
@@ -103,6 +103,9 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr


    private boolean mUsingHorizontalLayout;
    private boolean mUsingHorizontalLayout;


    @Nullable
    private Runnable mUsingHorizontalLayoutChangedListener;

    protected QSPanelControllerBase(
    protected QSPanelControllerBase(
            T view,
            T view,
            QSTileHost host,
            QSTileHost host,
@@ -135,6 +138,13 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
        mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), "");
        mQSLogger.logAllTilesChangeListening(mView.isListening(), mView.getDumpableTag(), "");
    }
    }


    /**
     * @return the media host for this panel
     */
    public MediaHost getMediaHost() {
        return mMediaHost;
    }

    @Override
    @Override
    protected void onViewAttached() {
    protected void onViewAttached() {
        mQsTileRevealController = createTileRevealController();
        mQsTileRevealController = createTileRevealController();
@@ -303,6 +313,9 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
            mUsingHorizontalLayout = horizontal;
            mUsingHorizontalLayout = horizontal;
            mView.setUsingHorizontalLayout(mUsingHorizontalLayout, mMediaHost.getHostView(), force);
            mView.setUsingHorizontalLayout(mUsingHorizontalLayout, mMediaHost.getHostView(), force);
            updateMediaDisappearParameters();
            updateMediaDisappearParameters();
            if (mUsingHorizontalLayoutChangedListener != null) {
                mUsingHorizontalLayoutChangedListener.run();
            }
            return true;
            return true;
        }
        }
        return false;
        return false;
@@ -386,6 +399,13 @@ public abstract class QSPanelControllerBase<T extends QSPanel> extends ViewContr
        mMediaVisibilityChangedListener = listener;
        mMediaVisibilityChangedListener = listener;
    }
    }


    /**
     * Add a listener when the horizontal layout changes
     */
    public void setUsingHorizontalLayoutChangeListener(Runnable listener) {
        mUsingHorizontalLayoutChangedListener = listener;
    }

    /** */
    /** */
    public static final class TileRecord extends QSPanel.Record {
    public static final class TileRecord extends QSPanel.Record {
        public QSTile tile;
        public QSTile tile;