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

Commit e55bc444 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Media doesn't clip based on shade footer" into tm-qpr-dev am: 39e905c3

parents fe16fe6f 39e905c3
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -757,7 +757,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
        return ShadeInterpolation.getContentAlpha(progress);
        return ShadeInterpolation.getContentAlpha(progress);
    }
    }


    private void updateQsBounds() {
    @VisibleForTesting
    void updateQsBounds() {
        if (mLastQSExpansion == 1.0f) {
        if (mLastQSExpansion == 1.0f) {
            // Fully expanded, let's set the layout bounds as clip bounds. This is necessary because
            // Fully expanded, let's set the layout bounds as clip bounds. This is necessary because
            // it's a scrollview and otherwise wouldn't be clipped. However, we set the horizontal
            // it's a scrollview and otherwise wouldn't be clipped. However, we set the horizontal
@@ -773,9 +774,10 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
        mQSPanelScrollView.getLocationOnScreen(mLocationTemp);
        mQSPanelScrollView.getLocationOnScreen(mLocationTemp);
        int left = mLocationTemp[0];
        int left = mLocationTemp[0];
        int top = mLocationTemp[1];
        int top = mLocationTemp[1];
        mQsMediaHost.getCurrentClipping().set(left, top, left + getView().getMeasuredWidth(),
        mQsMediaHost.getCurrentClipping().set(left, top,
                left + getView().getMeasuredWidth(),
                top + mQSPanelScrollView.getMeasuredHeight()
                top + mQSPanelScrollView.getMeasuredHeight()
                        - mQSPanelScrollView.getPaddingBottom());
                        - mQSPanelController.getPaddingBottom());
    }
    }


    private boolean headerWillBeAnimating() {
    private boolean headerWillBeAnimating() {
+4 −0
Original line number Original line Diff line number Diff line
@@ -239,5 +239,9 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
    public boolean isBouncerInTransit() {
    public boolean isBouncerInTransit() {
        return mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit();
        return mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit();
    }
    }

    public int getPaddingBottom() {
        return mView.getPaddingBottom();
    }
}
}
+18 −0
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import static com.android.systemui.statusbar.StatusBarState.SHADE;


import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertThat;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -450,6 +451,23 @@ public class QSFragmentTest extends SysuiBaseFragmentTest {
        verify(mQSPanelController).setListening(true, true);
        verify(mQSPanelController).setListening(true, true);
    }
    }


    @Test
    public void testUpdateQSBounds_setMediaClipCorrectly() {
        QSFragment fragment = resumeAndGetFragment();
        disableSplitShade();

        Rect mediaHostClip = new Rect();
        when(mQSPanelController.getPaddingBottom()).thenReturn(50);
        setLocationOnScreen(mQSPanelScrollView, 25);
        when(mQSPanelScrollView.getMeasuredHeight()).thenReturn(200);
        when(mQSMediaHost.getCurrentClipping()).thenReturn(mediaHostClip);

        fragment.updateQsBounds();

        assertEquals(25, mediaHostClip.top);
        assertEquals(175, mediaHostClip.bottom);
    }

    @Override
    @Override
    protected Fragment instantiate(Context context, String className, Bundle arguments) {
    protected Fragment instantiate(Context context, String className, Bundle arguments) {
        MockitoAnnotations.initMocks(this);
        MockitoAnnotations.initMocks(this);