use of com.android.systemui.statusbar.ExpandableView in project platform_frameworks_base by android.
the class NotificationStackScrollLayout method getBottomMostNotificationBottom.
public float getBottomMostNotificationBottom() {
final int count = getChildCount();
float max = 0;
for (int childIdx = 0; childIdx < count; childIdx++) {
ExpandableView child = (ExpandableView) getChildAt(childIdx);
if (child.getVisibility() == GONE) {
continue;
}
float bottom = child.getTranslationY() + child.getActualHeight();
if (bottom > max) {
max = bottom;
}
}
return max + getStackTranslation();
}
use of com.android.systemui.statusbar.ExpandableView in project platform_frameworks_base by android.
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;
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by ResurrectionRemix.
the class NotificationStackScrollLayout method setHideSensitive.
public void setHideSensitive(boolean hideSensitive, boolean animate) {
if (hideSensitive != mAmbientState.isHideSensitive()) {
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
ExpandableView v = (ExpandableView) getChildAt(i);
v.setHideSensitiveForIntrinsicHeight(hideSensitive);
}
mAmbientState.setHideSensitive(hideSensitive);
if (animate && mAnimationsEnabled) {
mHideSensitiveNeedsAnimation = true;
mNeedsAnimation = true;
}
requestChildrenUpdate();
}
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by ResurrectionRemix.
the class NotificationStackScrollLayout method getBottomMostNotificationBottom.
public float getBottomMostNotificationBottom() {
final int count = getChildCount();
float max = 0;
for (int childIdx = 0; childIdx < count; childIdx++) {
ExpandableView child = (ExpandableView) getChildAt(childIdx);
if (child.getVisibility() == GONE) {
continue;
}
float bottom = child.getTranslationY() + child.getActualHeight();
if (bottom > max) {
max = bottom;
}
}
return max + getStackTranslation();
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by ResurrectionRemix.
the class NotificationStackScrollLayout method updateContentHeight.
private void updateContentHeight() {
int height = 0;
float previousIncreasedAmount = 0.0f;
for (int i = 0; i < getChildCount(); i++) {
ExpandableView expandableView = (ExpandableView) getChildAt(i);
if (expandableView.getVisibility() != View.GONE) {
float increasedPaddingAmount = expandableView.getIncreasedPaddingAmount();
if (height != 0) {
height += (int) NotificationUtils.interpolate(mPaddingBetweenElements, mIncreasedPaddingBetweenElements, Math.max(previousIncreasedAmount, increasedPaddingAmount));
}
previousIncreasedAmount = increasedPaddingAmount;
height += expandableView.getIntrinsicHeight();
}
}
mContentHeight = height + mTopPadding;
updateScrollability();
}
Aggregations