use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
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 DirtyUnicorns.
the class NotificationStackScrollLayout method scrollTo.
@Override
public boolean scrollTo(View v) {
ExpandableView expandableView = (ExpandableView) v;
int positionInLinearLayout = getPositionInLinearLayout(v);
int targetScroll = targetScrollForView(expandableView, positionInLinearLayout);
int outOfViewScroll = positionInLinearLayout + expandableView.getIntrinsicHeight();
// that it is not visible anymore.
if (mOwnScrollY < targetScroll || outOfViewScroll < mOwnScrollY) {
mScroller.startScroll(mScrollX, mOwnScrollY, 0, targetScroll - mOwnScrollY);
mDontReportNextOverScroll = true;
postInvalidateOnAnimation();
return true;
}
return false;
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class NotificationStackScrollLayout method changeViewPosition.
/**
* Change the position of child to a new location
*
* @param child the view to change the position for
* @param newIndex the new index
*/
public void changeViewPosition(View child, int newIndex) {
int currentIndex = indexOfChild(child);
if (child != null && child.getParent() == this && currentIndex != newIndex) {
mChangePositionInProgress = true;
((ExpandableView) child).setChangingPosition(true);
removeView(child);
addView(child, newIndex);
((ExpandableView) child).setChangingPosition(false);
mChangePositionInProgress = false;
if (mIsExpanded && mAnimationsEnabled && child.getVisibility() != View.GONE) {
mChildrenChangingPositions.add(child);
mNeedsAnimation = true;
}
}
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class NotificationStackScrollLayout method getFirstChildIntrinsicHeight.
public int getFirstChildIntrinsicHeight() {
final ExpandableView firstChild = getFirstChildNotGone();
int firstChildMinHeight = firstChild != null ? firstChild.getIntrinsicHeight() : mEmptyShadeView != null ? mEmptyShadeView.getIntrinsicHeight() : mCollapsedSize;
if (mOwnScrollY > 0) {
firstChildMinHeight = Math.max(firstChildMinHeight - mOwnScrollY, mCollapsedSize);
}
return firstChildMinHeight;
}
use of com.android.systemui.statusbar.ExpandableView in project android_frameworks_base by DirtyUnicorns.
the class NotificationStackScrollLayout method getClosestChildAtRawPosition.
public ExpandableView getClosestChildAtRawPosition(float touchX, float touchY) {
getLocationOnScreen(mTempInt2);
float localTouchY = touchY - mTempInt2[1];
ExpandableView closestChild = null;
float minDist = Float.MAX_VALUE;
// find the view closest to the location, accounting for GONE views
final int count = getChildCount();
for (int childIdx = 0; childIdx < count; childIdx++) {
ExpandableView slidingChild = (ExpandableView) getChildAt(childIdx);
if (slidingChild.getVisibility() == GONE || slidingChild instanceof StackScrollerDecorView) {
continue;
}
float childTop = slidingChild.getTranslationY();
float top = childTop + slidingChild.getClipTopAmount();
float bottom = childTop + slidingChild.getActualHeight();
float dist = Math.min(Math.abs(top - localTouchY), Math.abs(bottom - localTouchY));
if (dist < minDist) {
closestChild = slidingChild;
minDist = dist;
}
}
return closestChild;
}
Aggregations