use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.
the class NotificationChildrenContainer method setActualHeight.
public void setActualHeight(int actualHeight) {
if (!mUserLocked) {
return;
}
mActualHeight = actualHeight;
float fraction = getGroupExpandFraction();
int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true);
int childCount = mChildren.size();
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
float childHeight = child.isExpanded(true) ? child.getMaxExpandHeight() : child.getShowingLayout().getMinHeight(true);
if (i < maxAllowedVisibleChildren) {
float singleLineHeight = child.getShowingLayout().getMinHeight(false);
child.setActualHeight((int) NotificationUtils.interpolate(singleLineHeight, childHeight, fraction), false);
} else {
child.setActualHeight((int) childHeight, false);
}
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.
the class NotificationChildrenContainer method getMaxContentHeight.
public int getMaxContentHeight() {
int maxContentHeight = mNotificationHeaderMargin + mNotificatonTopPadding;
int visibleChildren = 0;
int childCount = mChildren.size();
for (int i = 0; i < childCount; i++) {
if (visibleChildren >= NUMBER_OF_CHILDREN_WHEN_CHILDREN_EXPANDED) {
break;
}
ExpandableNotificationRow child = mChildren.get(i);
float childHeight = child.isExpanded(true) ? child.getMaxExpandHeight() : child.getShowingLayout().getMinHeight(true);
maxContentHeight += childHeight;
visibleChildren++;
}
if (visibleChildren > 0) {
maxContentHeight += visibleChildren * mDividerHeight;
}
return maxContentHeight;
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.
the class NotificationChildrenContainer method getVisibleChildrenExpandHeight.
private int getVisibleChildrenExpandHeight() {
int intrinsicHeight = mNotificationHeaderMargin + mNotificatonTopPadding + mDividerHeight;
int visibleChildren = 0;
int childCount = mChildren.size();
int maxAllowedVisibleChildren = getMaxAllowedVisibleChildren(true);
for (int i = 0; i < childCount; i++) {
if (visibleChildren >= maxAllowedVisibleChildren) {
break;
}
ExpandableNotificationRow child = mChildren.get(i);
float childHeight = child.isExpanded(true) ? child.getMaxExpandHeight() : child.getShowingLayout().getMinHeight(true);
intrinsicHeight += childHeight;
visibleChildren++;
}
return intrinsicHeight;
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.
the class NotificationChildrenContainer method setUserLocked.
public void setUserLocked(boolean userLocked) {
mUserLocked = userLocked;
int childCount = mChildren.size();
for (int i = 0; i < childCount; i++) {
ExpandableNotificationRow child = mChildren.get(i);
child.setUserLocked(userLocked);
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by AOSPA.
the class HeadsUpTouchHelper method onInterceptTouchEvent.
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (!mTouchingHeadsUpView && event.getActionMasked() != MotionEvent.ACTION_DOWN) {
return false;
}
int pointerIndex = event.findPointerIndex(mTrackingPointer);
if (pointerIndex < 0) {
pointerIndex = 0;
mTrackingPointer = event.getPointerId(pointerIndex);
}
final float x = event.getX(pointerIndex);
final float y = event.getY(pointerIndex);
switch(event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
mInitialTouchY = y;
mInitialTouchX = x;
setTrackingHeadsUp(false);
ExpandableView child = mStackScroller.getChildAtRawPosition(x, y);
mTouchingHeadsUpView = false;
if (child instanceof ExpandableNotificationRow) {
mPickedChild = (ExpandableNotificationRow) child;
mTouchingHeadsUpView = !mStackScroller.isExpanded() && mPickedChild.isHeadsUp() && mPickedChild.isPinned();
}
break;
case MotionEvent.ACTION_POINTER_UP:
final int upPointer = event.getPointerId(event.getActionIndex());
if (mTrackingPointer == upPointer) {
// gesture is ongoing, find a new pointer to track
final int newIndex = event.getPointerId(0) != upPointer ? 0 : 1;
mTrackingPointer = event.getPointerId(newIndex);
mInitialTouchX = event.getX(newIndex);
mInitialTouchY = event.getY(newIndex);
}
break;
case MotionEvent.ACTION_MOVE:
final float h = y - mInitialTouchY;
if (mTouchingHeadsUpView && Math.abs(h) > mTouchSlop && Math.abs(h) > Math.abs(x - mInitialTouchX)) {
setTrackingHeadsUp(true);
mCollapseSnoozes = h < 0;
mInitialTouchX = x;
mInitialTouchY = y;
int expandedHeight = mPickedChild.getActualHeight();
mPanel.setPanelScrimMinFraction((float) expandedHeight / mPanel.getMaxPanelHeight());
mPanel.startExpandMotion(x, y, true, /* startTracking */
expandedHeight);
// This call needs to be after the expansion start otherwise we will get a
// flicker of one frame as it's not expanded yet.
mHeadsUpManager.unpinAll();
mPanel.clearNotificationEffects();
return true;
}
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
if (mPickedChild != null && mTouchingHeadsUpView) {
// We may swallow this click if the heads up just came in.
if (mHeadsUpManager.shouldSwallowClick(mPickedChild.getStatusBarNotification().getKey())) {
endMotion();
return true;
}
}
endMotion();
break;
}
return false;
}
Aggregations