use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class NotificationStackScrollLayout method getChildAtPosition.
@Override
public View getChildAtPosition(MotionEvent ev) {
View child = getChildAtPosition(ev.getX(), ev.getY());
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
ExpandableNotificationRow parent = row.getNotificationParent();
if (parent != null && parent.areChildrenExpanded() && (parent.areGutsExposed() || mGearExposedView == parent || (parent.getNotificationChildren().size() == 1 && parent.isClearable()))) {
// In this case the group is expanded and showing the gear for the
// group, further interaction should apply to the group, not any
// child notifications so we use the parent of the child. We also do the same
// if we only have a single child.
child = parent;
}
}
return child;
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class StackScrollAlgorithm method getNotificationChildrenStates.
private void getNotificationChildrenStates(StackScrollState resultState, StackScrollAlgorithmState algorithmState) {
int childCount = algorithmState.visibleChildren.size();
for (int i = 0; i < childCount; i++) {
ExpandableView v = algorithmState.visibleChildren.get(i);
if (v instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) v;
row.getChildrenStates(resultState);
}
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class StackScrollAlgorithm method updateHeadsUpStates.
private void updateHeadsUpStates(StackScrollState resultState, StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
int childCount = algorithmState.visibleChildren.size();
ExpandableNotificationRow topHeadsUpEntry = null;
for (int i = 0; i < childCount; i++) {
View child = algorithmState.visibleChildren.get(i);
if (!(child instanceof ExpandableNotificationRow)) {
break;
}
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
if (!row.isHeadsUp()) {
break;
}
StackViewState childState = resultState.getViewStateForView(row);
if (topHeadsUpEntry == null) {
topHeadsUpEntry = row;
childState.location = StackViewState.LOCATION_FIRST_HUN;
}
boolean isTopEntry = topHeadsUpEntry == row;
float unmodifiedEndLocation = childState.yTranslation + childState.height;
if (mIsExpanded) {
// Ensure that the heads up is always visible even when scrolled off
clampHunToTop(ambientState, row, childState);
clampHunToMaxTranslation(ambientState, row, childState);
}
if (row.isPinned()) {
childState.yTranslation = Math.max(childState.yTranslation, 0);
childState.height = Math.max(row.getIntrinsicHeight(), childState.height);
StackViewState topState = resultState.getViewStateForView(topHeadsUpEntry);
if (!isTopEntry && (!mIsExpanded || unmodifiedEndLocation < topState.yTranslation + topState.height)) {
// Ensure that a headsUp doesn't vertically extend further than the heads-up at
// the top most z-position
childState.height = row.getIntrinsicHeight();
childState.yTranslation = topState.yTranslation + topState.height - childState.height;
}
}
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class StackScrollState method resetViewStates.
public void resetViewStates() {
int numChildren = mHostView.getChildCount();
for (int i = 0; i < numChildren; i++) {
ExpandableView child = (ExpandableView) mHostView.getChildAt(i);
resetViewState(child);
// handling reset for child notifications
if (child instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) child;
List<ExpandableNotificationRow> children = row.getNotificationChildren();
if (row.isSummaryWithChildren() && children != null) {
for (ExpandableNotificationRow childRow : children) {
resetViewState(childRow);
}
}
}
}
}
use of com.android.systemui.statusbar.ExpandableNotificationRow in project android_frameworks_base by DirtyUnicorns.
the class StackScrollState method applyState.
/**
* Applies a {@link StackViewState} to an {@link ExpandableView}.
*
* @return whether the state was applied correctly
*/
public boolean applyState(ExpandableView view, StackViewState state) {
if (state == null) {
Log.wtf(CHILD_NOT_FOUND_TAG, "No child state was found when applying this state " + "to the hostView");
return false;
}
if (state.gone) {
return false;
}
applyViewState(view, state);
int height = view.getActualHeight();
int newHeight = state.height;
// apply height
if (height != newHeight) {
view.setActualHeight(newHeight, false);
}
float shadowAlpha = view.getShadowAlpha();
float newShadowAlpha = state.shadowAlpha;
// apply shadowAlpha
if (shadowAlpha != newShadowAlpha) {
view.setShadowAlpha(newShadowAlpha);
}
// apply dimming
view.setDimmed(state.dimmed, false);
// apply hiding sensitive
view.setHideSensitive(state.hideSensitive, false, /* animated */
0, /* delay */
0);
// apply speed bump state
view.setBelowSpeedBump(state.belowSpeedBump);
// apply dark
view.setDark(state.dark, false, /* animate */
0);
// apply clipping
float oldClipTopAmount = view.getClipTopAmount();
if (oldClipTopAmount != state.clipTopAmount) {
view.setClipTopAmount(state.clipTopAmount);
}
if (view instanceof ExpandableNotificationRow) {
ExpandableNotificationRow row = (ExpandableNotificationRow) view;
if (state.isBottomClipped) {
row.setClipToActualHeight(true);
}
row.applyChildrenState(this);
}
return true;
}
Aggregations