Merge "Fixed the positioning of the media panel after reinflation" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-05-28 00:33:39 +00:00
committed by Android (Google) Code Review

View File

@@ -94,6 +94,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
private int mState; private int mState;
private QSContainerImplController mQSContainerImplController; private QSContainerImplController mQSContainerImplController;
private int[] mTmpLocation = new int[2]; private int[] mTmpLocation = new int[2];
private int mLastViewHeight;
private float mLastHeaderTranslation;
@Inject @Inject
public QSFragment(RemoteInputQuickSettingsDisabler remoteInputQsDisabler, public QSFragment(RemoteInputQuickSettingsDisabler remoteInputQsDisabler,
@@ -148,6 +150,13 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
setHost(mHost); setHost(mHost);
mStatusBarStateController.addCallback(this); mStatusBarStateController.addCallback(this);
onStateChanged(mStatusBarStateController.getState()); onStateChanged(mStatusBarStateController.getState());
view.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
boolean sizeChanged = (oldTop - oldBottom) != (top - bottom);
if (sizeChanged) {
setQsExpansion(mLastQSExpansion, mLastQSExpansion);
}
});
} }
@Override @Override
@@ -374,11 +383,15 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
? translationScaleY * mHeader.getHeight() ? translationScaleY * mHeader.getHeight()
: headerTranslation); : headerTranslation);
} }
if (expansion == mLastQSExpansion && mLastKeyguardAndExpanded == onKeyguardAndExpanded) { int currentHeight = getView().getHeight();
mLastHeaderTranslation = headerTranslation;
if (expansion == mLastQSExpansion && mLastKeyguardAndExpanded == onKeyguardAndExpanded
&& mLastViewHeight == currentHeight) {
return; return;
} }
mLastQSExpansion = expansion; mLastQSExpansion = expansion;
mLastKeyguardAndExpanded = onKeyguardAndExpanded; mLastKeyguardAndExpanded = onKeyguardAndExpanded;
mLastViewHeight = currentHeight;
boolean fullyExpanded = expansion == 1; boolean fullyExpanded = expansion == 1;
int heightDiff = mQSPanel.getBottom() - mHeader.getBottom() + mHeader.getPaddingBottom(); int heightDiff = mQSPanel.getBottom() - mHeader.getBottom() + mHeader.getPaddingBottom();