use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class NotificationStackScrollLayout method getPositionInLinearLayout.
private int getPositionInLinearLayout(View requestedView) {
ExpandableNotificationRow childInGroup = null;
ExpandableNotificationRow requestedRow = null;
if (isChildInGroup(requestedView)) {
// We're asking for a child in a group. Calculate the position of the parent first,
// then within the parent.
childInGroup = (ExpandableNotificationRow) requestedView;
requestedView = requestedRow = childInGroup.getNotificationParent();
}
int position = 0;
float previousIncreasedAmount = 0.0f;
for (int i = 0; i < getChildCount(); i++) {
ExpandableView child = (ExpandableView) getChildAt(i);
boolean notGone = child.getVisibility() != View.GONE;
if (notGone) {
float increasedPaddingAmount = child.getIncreasedPaddingAmount();
if (position != 0) {
position += (int) NotificationUtils.interpolate(mPaddingBetweenElements, mIncreasedPaddingBetweenElements, Math.max(previousIncreasedAmount, increasedPaddingAmount));
}
previousIncreasedAmount = increasedPaddingAmount;
}
if (child == requestedView) {
if (requestedRow != null) {
position += requestedRow.getPositionOfChild(childInGroup);
}
return position;
}
if (notGone) {
position += getIntrinsicHeight(child);
}
}
return 0;
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class NotificationStackScrollLayout method onChildDismissed.
@Override
public void onChildDismissed(View v) {
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
if (!row.isDismissed()) {
handleChildDismissed(v);
}
ViewGroup transientContainer = row.getTransientContainer();
if (transientContainer != null) {
transientContainer.removeTransientView(v);
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class NotificationChildrenContainer method onMeasure.
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int ownMaxHeight = mMaxNotificationHeight;
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
boolean hasFixedHeight = heightMode == MeasureSpec.EXACTLY;
boolean isHeightLimited = heightMode == MeasureSpec.AT_MOST;
int size = MeasureSpec.getSize(heightMeasureSpec);
if (hasFixedHeight || isHeightLimited) {
ownMaxHeight = Math.min(ownMaxHeight, size);
}
int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST);
int width = MeasureSpec.getSize(widthMeasureSpec);
if (mOverflowNumber != null) {
mOverflowNumber.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), newHeightSpec);
}
int dividerHeightSpec = MeasureSpec.makeMeasureSpec(mDividerHeight, MeasureSpec.EXACTLY);
int height = mNotificationHeaderMargin + mNotificatonTopPadding;
int childCount = Math.min(mChildren.size(), NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED);
int collapsedChildren = getMaxAllowedVisibleChildren(true);
int overflowIndex = childCount > collapsedChildren ? collapsedChildren - 1 : -1;
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
// We need to measure all children even the GONE ones, such that the heights are
// calculated correctly as they are used to calculate how many we can fit on the screen.
boolean isOverflow = i == overflowIndex;
child.setSingleLineWidthIndention(isOverflow && mOverflowNumber != null ? mOverflowNumber.getMeasuredWidth() : 0);
child.measure(widthMeasureSpec, newHeightSpec);
// layout the divider
View divider = mDividers.get(i);
divider.measure(widthMeasureSpec, dividerHeightSpec);
if (child.getVisibility() != GONE) {
height += child.getMeasuredHeight() + mDividerHeight;
}
}
mRealHeight = height;
if (heightMode != MeasureSpec.UNSPECIFIED) {
height = Math.min(height, size);
}
if (mNotificationHeader != null) {
int headerHeightSpec = MeasureSpec.makeMeasureSpec(mHeaderHeight, MeasureSpec.EXACTLY);
mNotificationHeader.measure(widthMeasureSpec, headerHeightSpec);
}
setMeasuredDimension(width, height);
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class NotificationChildrenContainer method startAnimationToState.
public void startAnimationToState(StackScrollState state, StackStateAnimator stateAnimator, long baseDelay, long duration) {
int childCount = mChildren.size();
ViewState tmpState = new ViewState();
float expandFraction = getGroupExpandFraction();
final boolean dividersVisible = mUserLocked || mNotificationParent.isGroupExpansionChanging();
for (int i = childCount - 1; i >= 0; i--) {
ExpandableNotificationRow child = mChildren.get(i);
StackViewState viewState = state.getViewStateForView(child);
stateAnimator.startStackAnimations(child, viewState, state, -1, baseDelay);
// layout the divider
View divider = mDividers.get(i);
tmpState.initFrom(divider);
tmpState.yTranslation = viewState.yTranslation - mDividerHeight;
float alpha = mChildrenExpanded && viewState.alpha != 0 ? 0.5f : 0;
if (mUserLocked && viewState.alpha != 0) {
alpha = NotificationUtils.interpolate(0, 0.5f, Math.min(viewState.alpha, expandFraction));
}
tmpState.hidden = !dividersVisible;
tmpState.alpha = alpha;
stateAnimator.startViewAnimations(divider, tmpState, baseDelay, duration);
// There is no fake shadow to be drawn on the children
child.setFakeShadowIntensity(0.0f, 0.0f, 0, 0);
}
if (mOverflowNumber != null) {
if (mNeverAppliedGroupState) {
float alpha = mGroupOverFlowState.alpha;
mGroupOverFlowState.alpha = 0;
state.applyViewState(mOverflowNumber, mGroupOverFlowState);
mGroupOverFlowState.alpha = alpha;
mNeverAppliedGroupState = false;
}
stateAnimator.startViewAnimations(mOverflowNumber, mGroupOverFlowState, baseDelay, duration);
}
if (mNotificationHeader != null) {
state.applyViewState(mNotificationHeader, mHeaderViewState);
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class NotificationChildrenContainer method getIntrinsicHeight.
/**
* @return the intrinsic height with a number of children given
* in @param maxAllowedVisibleChildren
*/
private int getIntrinsicHeight(float maxAllowedVisibleChildren) {
int intrinsicHeight = mNotificationHeaderMargin;
int visibleChildren = 0;
int childCount = mChildren.size();
boolean firstChild = true;
float expandFactor = 0;
if (mUserLocked) {
expandFactor = getGroupExpandFraction();
}
for (int i = 0; i < childCount; i++) {
if (visibleChildren >= maxAllowedVisibleChildren) {
break;
}
if (!firstChild) {
if (mUserLocked) {
intrinsicHeight += NotificationUtils.interpolate(mChildPadding, mDividerHeight, expandFactor);
} else {
intrinsicHeight += mChildrenExpanded ? mDividerHeight : mChildPadding;
}
} else {
if (mUserLocked) {
intrinsicHeight += NotificationUtils.interpolate(0, mNotificatonTopPadding + mDividerHeight, expandFactor);
} else {
intrinsicHeight += mChildrenExpanded ? mNotificatonTopPadding + mDividerHeight : 0;
}
firstChild = false;
}
ExpandableNotificationRow child = mChildren.get(i);
intrinsicHeight += child.getIntrinsicHeight();
visibleChildren++;
}
if (mUserLocked) {
intrinsicHeight += NotificationUtils.interpolate(mCollapsedBottompadding, 0.0f, expandFactor);
} else if (!mChildrenExpanded) {
intrinsicHeight += mCollapsedBottompadding;
}
return intrinsicHeight;
}
Aggregations