Merge "Animate height of tracked hun during shade transition." into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
7e4b3fda29
@@ -27,7 +27,6 @@ import android.view.ViewGroup;
|
|||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
import com.android.systemui.animation.Interpolators;
|
import com.android.systemui.animation.Interpolators;
|
||||||
import com.android.systemui.statusbar.NotificationShelf;
|
import com.android.systemui.statusbar.NotificationShelf;
|
||||||
import com.android.systemui.statusbar.notification.dagger.SilentHeader;
|
|
||||||
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
import com.android.systemui.statusbar.notification.row.ActivatableNotificationView;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
|
||||||
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
import com.android.systemui.statusbar.notification.row.ExpandableView;
|
||||||
@@ -37,9 +36,9 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Algorithm of the {@link com.android.systemui.statusbar.notification.stack
|
* The Algorithm of the
|
||||||
* .NotificationStackScrollLayout} which can be queried for {@link com.android.systemui.statusbar
|
* {@link com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout} which can
|
||||||
* .stack.StackScrollState}
|
* be queried for {@link StackScrollAlgorithmState}
|
||||||
*/
|
*/
|
||||||
public class StackScrollAlgorithm {
|
public class StackScrollAlgorithm {
|
||||||
|
|
||||||
@@ -96,7 +95,7 @@ public class StackScrollAlgorithm {
|
|||||||
|
|
||||||
// First we reset the view states to their default values.
|
// First we reset the view states to their default values.
|
||||||
resetChildViewStates();
|
resetChildViewStates();
|
||||||
initAlgorithmState(mHostView, algorithmState, ambientState);
|
initAlgorithmState(algorithmState, ambientState);
|
||||||
updatePositionsForState(algorithmState, ambientState);
|
updatePositionsForState(algorithmState, ambientState);
|
||||||
updateZValuesForState(algorithmState, ambientState);
|
updateZValuesForState(algorithmState, ambientState);
|
||||||
updateHeadsUpStates(algorithmState, ambientState);
|
updateHeadsUpStates(algorithmState, ambientState);
|
||||||
@@ -216,19 +215,18 @@ public class StackScrollAlgorithm {
|
|||||||
/**
|
/**
|
||||||
* Initialize the algorithm state like updating the visible children.
|
* Initialize the algorithm state like updating the visible children.
|
||||||
*/
|
*/
|
||||||
private void initAlgorithmState(ViewGroup hostView, StackScrollAlgorithmState state,
|
private void initAlgorithmState(StackScrollAlgorithmState state, AmbientState ambientState) {
|
||||||
AmbientState ambientState) {
|
|
||||||
state.scrollY = ambientState.getScrollY();
|
state.scrollY = ambientState.getScrollY();
|
||||||
state.mCurrentYPosition = -state.scrollY;
|
state.mCurrentYPosition = -state.scrollY;
|
||||||
state.mCurrentExpandedYPosition = -state.scrollY;
|
state.mCurrentExpandedYPosition = -state.scrollY;
|
||||||
|
|
||||||
//now init the visible children and update paddings
|
//now init the visible children and update paddings
|
||||||
int childCount = hostView.getChildCount();
|
int childCount = mHostView.getChildCount();
|
||||||
state.visibleChildren.clear();
|
state.visibleChildren.clear();
|
||||||
state.visibleChildren.ensureCapacity(childCount);
|
state.visibleChildren.ensureCapacity(childCount);
|
||||||
int notGoneIndex = 0;
|
int notGoneIndex = 0;
|
||||||
for (int i = 0; i < childCount; i++) {
|
for (int i = 0; i < childCount; i++) {
|
||||||
ExpandableView v = (ExpandableView) hostView.getChildAt(i);
|
ExpandableView v = (ExpandableView) mHostView.getChildAt(i);
|
||||||
if (v.getVisibility() != View.GONE) {
|
if (v.getVisibility() != View.GONE) {
|
||||||
if (v == ambientState.getShelf()) {
|
if (v == ambientState.getShelf()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -237,7 +235,7 @@ public class StackScrollAlgorithm {
|
|||||||
if (v instanceof ExpandableNotificationRow) {
|
if (v instanceof ExpandableNotificationRow) {
|
||||||
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
|
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
|
||||||
|
|
||||||
// handle the notgoneIndex for the children as well
|
// handle the notGoneIndex for the children as well
|
||||||
List<ExpandableNotificationRow> children = row.getAttachedChildren();
|
List<ExpandableNotificationRow> children = row.getAttachedChildren();
|
||||||
if (row.isSummaryWithChildren() && children != null) {
|
if (row.isSummaryWithChildren() && children != null) {
|
||||||
for (ExpandableNotificationRow childRow : children) {
|
for (ExpandableNotificationRow childRow : children) {
|
||||||
@@ -407,22 +405,25 @@ public class StackScrollAlgorithm {
|
|||||||
final boolean noSpaceForFooter = footerEnd > ambientState.getStackEndHeight();
|
final boolean noSpaceForFooter = footerEnd > ambientState.getStackEndHeight();
|
||||||
((FooterView.FooterViewState) viewState).hideContent =
|
((FooterView.FooterViewState) viewState).hideContent =
|
||||||
shadeClosed || isShelfShowing || noSpaceForFooter;
|
shadeClosed || isShelfShowing || noSpaceForFooter;
|
||||||
|
} else {
|
||||||
} else if (view != ambientState.getTrackedHeadsUpRow()) {
|
if (view != ambientState.getTrackedHeadsUpRow()) {
|
||||||
if (ambientState.isExpansionChanging()) {
|
if (ambientState.isExpansionChanging()) {
|
||||||
// Show all views. Views below the shelf will later be clipped (essentially hidden)
|
// Show all views. Views below the shelf will later be clipped (essentially
|
||||||
// in NotificationShelf.
|
// hidden) in NotificationShelf.
|
||||||
viewState.hidden = false;
|
viewState.hidden = false;
|
||||||
viewState.inShelf = algorithmState.firstViewInShelf != null
|
viewState.inShelf = algorithmState.firstViewInShelf != null
|
||||||
&& i >= algorithmState.visibleChildren.indexOf(
|
&& i >= algorithmState.visibleChildren.indexOf(
|
||||||
algorithmState.firstViewInShelf);
|
algorithmState.firstViewInShelf);
|
||||||
} else if (ambientState.getShelf() != null) {
|
} else if (ambientState.getShelf() != null) {
|
||||||
// When pulsing (incoming notification on AOD), innerHeight is 0; clamp all
|
// When pulsing (incoming notification on AOD), innerHeight is 0; clamp all
|
||||||
// to shelf start, thereby hiding all notifications (except the first one, which we
|
// to shelf start, thereby hiding all notifications (except the first one, which
|
||||||
// later unhide in updatePulsingState)
|
// we later unhide in updatePulsingState)
|
||||||
final int stackBottom = !ambientState.isShadeExpanded() || ambientState.isDozing()
|
final int stackBottom =
|
||||||
? ambientState.getInnerHeight() : (int) ambientState.getStackHeight();
|
!ambientState.isShadeExpanded() || ambientState.isDozing()
|
||||||
final int shelfStart = stackBottom - ambientState.getShelf().getIntrinsicHeight();
|
? ambientState.getInnerHeight()
|
||||||
|
: (int) ambientState.getStackHeight();
|
||||||
|
final int shelfStart =
|
||||||
|
stackBottom - ambientState.getShelf().getIntrinsicHeight();
|
||||||
viewState.yTranslation = Math.min(viewState.yTranslation, shelfStart);
|
viewState.yTranslation = Math.min(viewState.yTranslation, shelfStart);
|
||||||
if (viewState.yTranslation >= shelfStart) {
|
if (viewState.yTranslation >= shelfStart) {
|
||||||
viewState.hidden = !view.isExpandAnimationRunning()
|
viewState.hidden = !view.isExpandAnimationRunning()
|
||||||
@@ -432,6 +433,7 @@ public class StackScrollAlgorithm {
|
|||||||
viewState.headsUpIsVisible = false;
|
viewState.headsUpIsVisible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clip height of view right before shelf.
|
// Clip height of view right before shelf.
|
||||||
viewState.height = (int) (getMaxAllowedChildHeight(view) * expansionFraction);
|
viewState.height = (int) (getMaxAllowedChildHeight(view) * expansionFraction);
|
||||||
@@ -485,7 +487,7 @@ public class StackScrollAlgorithm {
|
|||||||
View previousChild) {
|
View previousChild) {
|
||||||
return sectionProvider.beginsSection(child, previousChild)
|
return sectionProvider.beginsSection(child, previousChild)
|
||||||
&& visibleIndex > 0
|
&& visibleIndex > 0
|
||||||
&& !(previousChild instanceof SilentHeader)
|
&& !(previousChild instanceof SectionHeaderView)
|
||||||
&& !(child instanceof FooterView);
|
&& !(child instanceof FooterView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +698,7 @@ public class StackScrollAlgorithm {
|
|||||||
this.mIsExpanded = isExpanded;
|
this.mIsExpanded = isExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StackScrollAlgorithmState {
|
public static class StackScrollAlgorithmState {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The scroll position of the algorithm (absolute scrolling).
|
* The scroll position of the algorithm (absolute scrolling).
|
||||||
|
|||||||
Reference in New Issue
Block a user