use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by crdroidandroid.
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 crdroidandroid.
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;
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by crdroidandroid.
the class NotificationStackScrollLayout method isBelowLastNotification.
public boolean isBelowLastNotification(float touchX, float touchY) {
int childCount = getChildCount();
for (int i = childCount - 1; i >= 0; i--) {
ExpandableView child = (ExpandableView) getChildAt(i);
if (child.getVisibility() != View.GONE) {
float childTop = child.getY();
if (childTop > touchY) {
// we are above a notification entirely let's abort
return false;
}
boolean belowChild = touchY > childTop + child.getActualHeight();
if (child == mDismissView) {
if (!belowChild && !mDismissView.isOnEmptySpace(touchX - mDismissView.getX(), touchY - childTop)) {
// We clicked on the dismiss button
return false;
}
} else if (child == mEmptyShadeView) {
// We arrived at the empty shade view, for which we accept all clicks
return true;
} else if (!belowChild) {
// We are on a child
return false;
}
}
}
return touchY > mTopPadding + mStackTranslation;
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by crdroidandroid.
the class NotificationStackScrollLayout method updateScrollStateForAddedChildren.
private void updateScrollStateForAddedChildren() {
if (mChildrenToAddAnimated.isEmpty()) {
return;
}
for (int i = 0; i < getChildCount(); i++) {
ExpandableView child = (ExpandableView) getChildAt(i);
if (mChildrenToAddAnimated.contains(child)) {
int startingPosition = getPositionInLinearLayout(child);
int padding = child.getIncreasedPaddingAmount() == 1.0f ? mIncreasedPaddingBetweenElements : mPaddingBetweenElements;
int childHeight = getIntrinsicHeight(child) + padding;
if (startingPosition < mOwnScrollY) {
// This child starts off screen, so let's keep it offscreen to keep the others visible
setOwnScrollY(mOwnScrollY + childHeight);
}
}
}
clampScrollPosition();
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by crdroidandroid.
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;
}
Aggregations