Merge "Always have QS expanded on split shade"

This commit is contained in:
Lucas Dupin
2021-12-06 16:24:20 +00:00
committed by Android (Google) Code Review
6 changed files with 41 additions and 22 deletions

View File

@@ -112,6 +112,15 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
mPageToRestore = savedInstanceState.getInt(CURRENT_PAGE, -1);
}
@Override
public int getTilesHeight() {
TileLayout tileLayout = mPages.get(getCurrentItem());
if (tileLayout == null) {
return 0;
}
return tileLayout.getTilesHeight();
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);

View File

@@ -377,23 +377,24 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
}
private void updateQsState() {
final boolean expandVisually = mQsExpanded || mStackScrollerOverscrolling
final boolean expanded = mQsExpanded || mInSplitShade;
final boolean expandVisually = expanded || mStackScrollerOverscrolling
|| mHeaderAnimating;
mQSPanelController.setExpanded(mQsExpanded);
mQSDetail.setExpanded(mQsExpanded);
mQSPanelController.setExpanded(expanded);
mQSDetail.setExpanded(expanded);
boolean keyguardShowing = isKeyguardState();
mHeader.setVisibility((mQsExpanded || !keyguardShowing || mHeaderAnimating
mHeader.setVisibility((expanded || !keyguardShowing || mHeaderAnimating
|| mShowCollapsedOnKeyguard)
? View.VISIBLE
: View.INVISIBLE);
mHeader.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard)
|| (mQsExpanded && !mStackScrollerOverscrolling), mQuickQSPanelController);
mFooter.setVisibility(!mQsDisabled && (mQsExpanded || !keyguardShowing || mHeaderAnimating
|| (expanded && !mStackScrollerOverscrolling), mQuickQSPanelController);
mFooter.setVisibility(!mQsDisabled && (expanded || !keyguardShowing || mHeaderAnimating
|| mShowCollapsedOnKeyguard)
? View.VISIBLE
: View.INVISIBLE);
mFooter.setExpanded((keyguardShowing && !mHeaderAnimating && !mShowCollapsedOnKeyguard)
|| (mQsExpanded && !mStackScrollerOverscrolling));
|| (expanded && !mStackScrollerOverscrolling));
mQSPanelController.setVisibility(
!mQsDisabled && expandVisually ? View.VISIBLE : View.INVISIBLE);
}
@@ -405,7 +406,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
}
private void updateShowCollapsedOnKeyguard() {
boolean showCollapsed = mBypassController.getBypassEnabled() || mTransitioningToFullShade;
boolean showCollapsed = mBypassController.getBypassEnabled()
|| (mTransitioningToFullShade && !mInSplitShade);
if (showCollapsed != mShowCollapsedOnKeyguard) {
mShowCollapsedOnKeyguard = showCollapsed;
updateQsState();
@@ -485,6 +487,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
public void setInSplitShade(boolean inSplitShade) {
mInSplitShade = inSplitShade;
mQSAnimator.setTranslateWhileExpanding(inSplitShade);
updateShowCollapsedOnKeyguard();
updateQsState();
}
@Override
@@ -503,7 +507,8 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
public void setQsExpansion(float expansion, float panelExpansionFraction,
float proposedTranslation, float squishinessFraction) {
float headerTranslation = mTransitioningToFullShade ? 0 : proposedTranslation;
float progress = mTransitioningToFullShade ? mFullShadeProgress : panelExpansionFraction;
float progress = mTransitioningToFullShade || mState == StatusBarState.KEYGUARD
? mFullShadeProgress : panelExpansionFraction;
setAlphaAnimationProgress(mInSplitShade ? progress : 1);
mContainer.setExpansion(expansion);
final float translationScaleY = (mInSplitShade

View File

@@ -258,13 +258,8 @@ public class QSPanel extends LinearLayout implements Tunable {
}
private void updateViewPositions() {
if (!(mTileLayout instanceof TileLayout)) {
return;
}
TileLayout layout = (TileLayout) mTileLayout;
// Adjust view positions based on tile squishing
int tileHeightOffset = layout.getTilesHeight() - layout.getHeight();
int tileHeightOffset = mTileLayout.getTilesHeight() - mTileLayout.getHeight();
boolean move = false;
for (int i = 0; i < getChildCount(); i++) {
@@ -787,6 +782,12 @@ public class QSPanel extends LinearLayout implements Tunable {
/** */
void setListening(boolean listening, UiEventLogger uiEventLogger);
/** */
int getHeight();
/** */
int getTilesHeight();
/**
* Sets a size modifier for the tile. Where 0 means collapsed, and 1 expanded.
*/

View File

@@ -275,6 +275,7 @@ public class TileLayout extends ViewGroup implements QSTileLayout {
return Math.max(mColumns * mRows, 1);
}
@Override
public int getTilesHeight() {
return mLastTileBottom + getPaddingBottom();
}

View File

@@ -174,7 +174,7 @@ class LockscreenShadeTransitionController @Inject constructor(
internal fun canDragDown(): Boolean {
return (statusBarStateController.state == StatusBarState.KEYGUARD ||
nsslController.isInLockedDownShade()) &&
qS.isFullyCollapsed
(qS.isFullyCollapsed || useSplitShade)
}
/**
@@ -285,7 +285,7 @@ class LockscreenShadeTransitionController @Inject constructor(
internal val isDragDownAnywhereEnabled: Boolean
get() = (statusBarStateController.getState() == StatusBarState.KEYGUARD &&
!keyguardBypassController.bypassEnabled &&
qS.isFullyCollapsed)
(qS.isFullyCollapsed || useSplitShade))
/**
* The amount in pixels that the user has dragged down.

View File

@@ -2392,11 +2392,14 @@ public class NotificationPanelViewController extends PanelViewController {
private void updateQsExpansion() {
if (mQs == null) return;
float qsExpansionFraction = computeQsExpansionFraction();
float squishiness = mNotificationStackScrollLayoutController
.getNotificationSquishinessFraction();
mQs.setQsExpansion(qsExpansionFraction, getExpandedFraction(), getHeaderTranslation(),
mQsExpandImmediate || mQsExpanded ? 1f : squishiness);
final float squishiness =
mQsExpandImmediate || mQsExpanded ? 1f : mNotificationStackScrollLayoutController
.getNotificationSquishinessFraction();
final float qsExpansionFraction = computeQsExpansionFraction();
final float adjustedExpansionFraction = mShouldUseSplitNotificationShade
? 1f : computeQsExpansionFraction();
mQs.setQsExpansion(adjustedExpansionFraction, getExpandedFraction(), getHeaderTranslation(),
squishiness);
mSplitShadeHeaderController.setQsExpandedFraction(qsExpansionFraction);
mMediaHierarchyManager.setQsExpansion(qsExpansionFraction);
int qsPanelBottomY = calculateQsBottomPosition(qsExpansionFraction);