use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class StackScrollAlgorithm method getNotificationChildrenStates.
private void getNotificationChildrenStates(StackScrollState resultState, StackScrollAlgorithmState algorithmState) {
int childCount = algorithmState.visibleChildren.size();
for (int i = 0; i < childCount; i++) {
ExpandableView v = algorithmState.visibleChildren.get(i);
if (v instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
row.getChildrenStates(resultState);
}
}
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class StackScrollAlgorithm method updateZValuesForState.
/**
* Calculate the Z positions for all children based on the number of items in both stacks and
* save it in the resultState
* @param resultState The result state to update the zTranslation values
* @param algorithmState The state in which the current pass of the algorithm is currently in
* @param ambientState The ambient state of the algorithm
*/
private void updateZValuesForState(StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
int childCount = algorithmState.visibleChildren.size();
float childrenOnTop = 0.0f;
for (int i = childCount - 1; i >= 0; i--) {
ExpandableView child = algorithmState.visibleChildren.get(i);
StackViewState childViewState = resultState.getViewStateForView(child);
if (i > (childCount - 1 - algorithmState.itemsInBottomStack)) {
// We are in the bottom stack
float numItemsAbove = i - (childCount - 1 - algorithmState.itemsInBottomStack);
float zSubtraction;
if (numItemsAbove <= 1.0f) {
float factor = 0.2f;
// Lets fade in slower to the threshold to make the shadow fade in look nicer
if (numItemsAbove <= factor) {
zSubtraction = FakeShadowView.SHADOW_SIBLING_TRESHOLD * numItemsAbove * (1.0f / factor);
} else {
zSubtraction = FakeShadowView.SHADOW_SIBLING_TRESHOLD + (numItemsAbove - factor) * (1.0f / (1.0f - factor)) * (mZDistanceBetweenElements - FakeShadowView.SHADOW_SIBLING_TRESHOLD);
}
} else {
zSubtraction = numItemsAbove * mZDistanceBetweenElements;
}
childViewState.zTranslation = mZBasicHeight - zSubtraction;
} else if (child.mustStayOnScreen() && childViewState.yTranslation < ambientState.getTopPadding() + ambientState.getStackTranslation()) {
if (childrenOnTop != 0.0f) {
childrenOnTop++;
} else {
float overlap = ambientState.getTopPadding() + ambientState.getStackTranslation() - childViewState.yTranslation;
childrenOnTop += Math.min(1.0f, overlap / childViewState.height);
}
childViewState.zTranslation = mZBasicHeight + childrenOnTop * mZDistanceBetweenElements;
} else {
childViewState.zTranslation = mZBasicHeight;
}
}
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class StackScrollState method resetViewStates.
public void resetViewStates() {
int numChildren = mHostView.getChildCount();
for (int i = 0; i < numChildren; i++) {
ExpandableView child = (ExpandableView) mHostView.getChildAt(i);
resetViewState(child);
// handling reset for child notifications
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
List<ExpandableNotificationRow> children = row.getNotificationChildren();
if (row.isSummaryWithChildren() && children != null) {
for (ExpandableNotificationRow childRow : children) {
resetViewState(childRow);
}
}
}
}
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class StackScrollState method apply.
/**
* Apply the properties saved in {@link #mStateMap} to the children of the {@link #mHostView}.
* The properties are only applied if they effectively changed.
*/
public void apply() {
int numChildren = mHostView.getChildCount();
for (int i = 0; i < numChildren; i++) {
ExpandableView child = (ExpandableView) mHostView.getChildAt(i);
StackViewState state = mStateMap.get(child);
if (!applyState(child, state)) {
continue;
}
if (child instanceof DismissView) {
DismissView dismissView = (DismissView) child;
boolean visible = state.clipTopAmount < mClearAllTopPadding;
dismissView.performVisibilityAnimation(visible && !dismissView.willBeGone());
} else if (child instanceof EmptyShadeView) {
EmptyShadeView emptyShadeView = (EmptyShadeView) child;
boolean visible = state.clipTopAmount <= 0;
emptyShadeView.performVisibilityAnimation(visible && !emptyShadeView.willBeGone());
}
}
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class StackStateAnimator method findLastNotAddedIndex.
private int findLastNotAddedIndex(StackScrollState finalState) {
int childCount = mHostLayout.getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
final ExpandableView child = (ExpandableView) mHostLayout.getChildAt(i);
StackViewState viewState = finalState.getViewStateForView(child);
if (viewState == null || child.getVisibility() == View.GONE) {
continue;
}
if (!mNewAddChildren.contains(child)) {
return viewState.notGoneIndex;
}
}
return -1;
}
Aggregations