summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java76
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java21
6 files changed, 47 insertions, 95 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
index b6d4dedfe6f7..7d480bad3f51 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java
@@ -505,15 +505,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
private void setImageViewAnimationRunning(ImageView imageView, boolean running) {
if (imageView != null) {
Drawable drawable = imageView.getDrawable();
- if (drawable instanceof AnimationDrawable) {
- AnimationDrawable animationDrawable = (AnimationDrawable) drawable;
+ if (drawable instanceof AnimationDrawable animationDrawable) {
if (running) {
animationDrawable.start();
} else {
animationDrawable.stop();
}
- } else if (drawable instanceof AnimatedVectorDrawable) {
- AnimatedVectorDrawable animationDrawable = (AnimatedVectorDrawable) drawable;
+ } else if (drawable instanceof AnimatedVectorDrawable animationDrawable) {
if (running) {
animationDrawable.start();
} else {
@@ -3414,8 +3412,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
@Override
protected boolean childNeedsClipping(View child) {
- if (child instanceof NotificationContentView) {
- NotificationContentView contentView = (NotificationContentView) child;
+ if (child instanceof NotificationContentView contentView) {
if (isClippingNeeded()) {
return true;
} else if (hasRoundedCorner()
@@ -3497,8 +3494,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
@Override
public void applyToView(View view) {
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
if (row.isExpandAnimationRunning()) {
return;
}
@@ -3518,8 +3514,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
@Override
protected void onYTranslationAnimationFinished(View view) {
super.onYTranslationAnimationFinished(view);
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
if (row.isHeadsUpAnimatingAway()) {
row.setHeadsUpAnimatingAway(false);
}
@@ -3528,8 +3523,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
@Override
public void animateTo(View child, AnimationProperties properties) {
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
if (row.isExpandAnimationRunning()) {
return;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
index 49674d603509..c4d266ed2f17 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableView.java
@@ -676,8 +676,7 @@ public abstract class ExpandableView extends FrameLayout implements Dumpable, Ro
mViewState.headsUpIsVisible = false;
// handling reset for child notifications
- if (this instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) this;
+ if (this instanceof ExpandableNotificationRow row) {
List<ExpandableNotificationRow> children = row.getAttachedChildren();
if (row.isSummaryWithChildren() && children != null) {
for (ExpandableNotificationRow childRow : children) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
index 0236fc265add..45b9c269b61c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationChildrenContainer.java
@@ -869,8 +869,7 @@ public class NotificationChildrenContainer extends ViewGroup
Path clipPath = mChildClipPath;
if (clipPath != null) {
final float translation;
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow notificationRow = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow notificationRow) {
translation = notificationRow.getTranslation();
} else {
translation = child.getTranslationX();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
index 85e63e58bc7a..7bf4207e79a1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java
@@ -992,8 +992,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() != View.GONE
- && child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ && child instanceof ExpandableNotificationRow row) {
if ((row.isPinned() || row.isHeadsUpAnimatingAway()) && row.getTranslation() < 0
&& row.getProvider().shouldShowGutsOnSnapOpen()) {
top = Math.min(top, row.getTranslationY());
@@ -1128,10 +1127,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
for (int i = 0; i < n; i++) {
View view = getChildAt(i);
if (view.getVisibility() == View.GONE
- || !(view instanceof ExpandableNotificationRow)) {
+ || !(view instanceof ExpandableNotificationRow row)) {
continue;
}
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
currentIndex++;
boolean beforeSpeedBump;
if (mHighPriorityBeforeSpeedBump) {
@@ -1768,16 +1766,14 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
public static boolean isPinnedHeadsUp(View v) {
- if (v instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (v instanceof ExpandableNotificationRow row) {
return row.isHeadsUp() && row.isPinned();
}
return false;
}
private boolean isHeadsUp(View v) {
- if (v instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (v instanceof ExpandableNotificationRow row) {
return row.isHeadsUp();
}
return false;
@@ -1819,8 +1815,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if ((bottom - top >= mMinInteractionHeight || !requireMinHeight)
&& touchY >= top && touchY <= bottom && touchX >= left && touchX <= right) {
- if (slidingChild instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) slidingChild;
+ if (slidingChild instanceof ExpandableNotificationRow row) {
NotificationEntry entry = row.getEntry();
if (!mIsExpanded && row.isHeadsUp() && row.isPinned()
&& mTopHeadsUpEntry.getRow() != row
@@ -2363,8 +2358,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
float rowTranslation = child.getTranslationY();
if (rowTranslation >= translationY) {
return child;
- } else if (!ignoreChildren && child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ } else if (!ignoreChildren && child instanceof ExpandableNotificationRow row) {
if (row.isSummaryWithChildren() && row.areChildrenExpanded()) {
List<ExpandableNotificationRow> notificationChildren =
row.getAttachedChildren();
@@ -2885,8 +2879,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
private void focusNextViewIfFocused(View view) {
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
if (row.shouldRefocusOnDismiss()) {
View nextView = row.getChildAfterViewWhenDismissed();
if (nextView == null) {
@@ -3034,8 +3027,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
private int getIntrinsicHeight(View view) {
- if (view instanceof ExpandableView) {
- ExpandableView expandableView = (ExpandableView) view;
+ if (view instanceof ExpandableView expandableView) {
return expandableView.getIntrinsicHeight();
}
return view.getHeight();
@@ -3125,8 +3117,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
generateAddAnimation(child, false /* fromMoreCard */);
updateAnimationState(child);
updateChronometerForChild(child);
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
row.setDismissUsingRowTranslationX(mDismissUsingRowTranslationX);
}
@@ -3195,8 +3186,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
private void updateAnimationState(boolean running, View child) {
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
row.setAnimationRunning(running);
}
}
@@ -3391,8 +3381,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
// we need to know the view after this one
float removedTranslation = child.getTranslationY();
boolean ignoreChildren = true;
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
if (row.isRemoved() && row.wasChildInGroupWhenRemoved()) {
removedTranslation = row.getTranslationWhenRemoved();
ignoreChildren = false;
@@ -3434,8 +3423,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private void generatePositionChangeEvents() {
for (ExpandableView child : mChildrenChangingPositions) {
Integer duration = null;
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
if (row.getEntry().isMarkedForUserTriggeredMovement()) {
duration = StackStateAnimator.ANIMATION_DURATION_PRIORITY_CHANGE;
row.getEntry().markForUserTriggeredMovement(false);
@@ -4119,8 +4107,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private void clearUserLockedViews() {
for (int i = 0; i < getChildCount(); i++) {
ExpandableView child = getChildAtIndex(i);
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
row.setUserLocked(false);
}
}
@@ -4134,8 +4121,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
);
for (int i = 0; i < getChildCount(); i++) {
ExpandableView child = getChildAtIndex(i);
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
clearTemporaryViewsInGroup(
/* viewGroup = */ row.getChildrenContainer(),
/* reason = */ "clearTemporaryViewsInGroup(row.getChildrenContainer())"
@@ -4220,8 +4206,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
void updateChronometerForChild(View child) {
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
row.setChronometerRunning(mIsExpanded);
}
}
@@ -4260,8 +4245,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
private void updateScrollPositionOnExpandInBottom(ExpandableView view) {
- if (view instanceof ExpandableNotificationRow && !onKeyguard()) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row && !onKeyguard()) {
// TODO: once we're recycling this will need to check the adapter position of the child
if (row.isUserLocked() && row != getFirstChildNotGone()) {
if (row.isSummaryWithChildren()) {
@@ -4320,8 +4304,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
private void clearHeadsUpDisappearRunning() {
for (int i = 0; i < getChildCount(); i++) {
View view = getChildAt(i);
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
row.setHeadsUpAnimatingAway(false);
if (row.isSummaryWithChildren()) {
for (ExpandableNotificationRow child : row.getAttachedChildren()) {
@@ -5203,8 +5186,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
View swipedView = mSwipeHelper.getSwipedView();
pw.println("Swiped view: " + swipedView);
- if (swipedView instanceof ExpandableView) {
- ExpandableView expandableView = (ExpandableView) swipedView;
+ if (swipedView instanceof ExpandableView expandableView) {
expandableView.dump(pw, args);
}
});
@@ -5287,8 +5269,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (view instanceof SectionHeaderView && silentSectionWillBeGone) {
return true;
}
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
if (isVisible(row) && includeChildInClearAll(row, selection)) {
return true;
}
@@ -5314,9 +5295,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
if (shouldHideParent(view, selection)) {
viewsToHide.add(view);
}
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
-
+ if (view instanceof ExpandableNotificationRow parent) {
if (isChildrenVisible(parent)) {
for (ExpandableNotificationRow child : parent.getAttachedChildren()) {
if (isVisible(child) && includeChildInClearAll(child, selection)) {
@@ -5336,10 +5315,9 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
for (int i = 0; i < childCount; i++) {
final View view = getChildAt(i);
- if (!(view instanceof ExpandableNotificationRow)) {
+ if (!(view instanceof ExpandableNotificationRow parent)) {
continue;
}
- ExpandableNotificationRow parent = (ExpandableNotificationRow) view;
if (includeChildInClearAll(parent, selection)) {
viewsToRemove.add(parent);
}
@@ -5978,8 +5956,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
mSwipeHelper.forceResetSwipeState(child);
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow childRow = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow childRow) {
List<ExpandableNotificationRow> grandchildren = childRow.getAttachedChildren();
if (grandchildren != null) {
for (ExpandableNotificationRow grandchild : grandchildren) {
@@ -6265,8 +6242,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
static boolean canChildBeDismissed(View v) {
- if (v instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (v instanceof ExpandableNotificationRow row) {
if (row.areGutsExposed() || !row.getEntry().hasFinishedInitialization()) {
return false;
}
@@ -6276,8 +6252,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
}
static boolean canChildBeCleared(View v) {
- if (v instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (v instanceof ExpandableNotificationRow row) {
if (row.areGutsExposed() || !row.getEntry().hasFinishedInitialization()) {
return false;
}
@@ -6372,8 +6347,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
/* Only ever called as a consequence of an expansion gesture in the shade. */
@Override
public void setUserExpandedChild(View v, boolean userExpanded) {
- if (v instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (v instanceof ExpandableNotificationRow row) {
if (userExpanded && onKeyguard()) {
// Due to a race when locking the screen while touching, a notification may be
// expanded even after we went back to keyguard. An example of this happens if
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
index d2fca8fca837..cd47c59e34f2 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java
@@ -405,8 +405,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
if (!mAllowLongPress) {
return;
}
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
mMetricsLogger.write(row.getEntry().getSbn().getLogMaker()
.setCategory(MetricsEvent.ACTION_TOUCH_GEAR)
.setType(MetricsEvent.TYPE_ACTION)
@@ -426,8 +425,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
@Override
public void onMenuShown(View row) {
- if (row instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow notificationRow = (ExpandableNotificationRow) row;
+ if (row instanceof ExpandableNotificationRow notificationRow) {
mMetricsLogger.write(notificationRow.getEntry().getSbn().getLogMaker()
.setCategory(MetricsEvent.ACTION_REVEAL_GEAR)
.setType(MetricsEvent.TYPE_ACTION));
@@ -492,10 +490,9 @@ public class NotificationStackScrollLayoutController implements Dumpable {
*/
@Override
public void onChildDismissed(View view) {
- if (!(view instanceof ActivatableNotificationView)) {
+ if (!(view instanceof ActivatableNotificationView row)) {
return;
}
- ActivatableNotificationView row = (ActivatableNotificationView) view;
if (!row.isDismissed()) {
handleChildViewDismissed(view);
}
@@ -519,8 +516,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
if (mView.getClearAllInProgress()) {
return;
}
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) view;
+ if (view instanceof ExpandableNotificationRow row) {
if (row.isHeadsUp()) {
mHeadsUpManager.addSwipedOutNotification(
row.getEntry().getSbn().getKey());
@@ -551,8 +547,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
ev.getY(),
true /* requireMinHeight */,
false /* ignoreDecors */);
- if (child instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
+ if (child instanceof ExpandableNotificationRow row) {
ExpandableNotificationRow parent = row.getNotificationParent();
if (parent != null && parent.areChildrenExpanded()
&& (parent.areGutsExposed()
@@ -582,8 +577,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
@Override
public void onChildSnappedBack(View animView, float targetLeft) {
mView.onSwipeEnd();
- if (animView instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) animView;
+ if (animView instanceof ExpandableNotificationRow row) {
if (row.isPinned() && !canChildBeDismissed(row)
&& row.getEntry().getSbn().getNotification().fullScreenIntent
== null) {
@@ -1980,8 +1974,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
// Check if we need to clear any snooze leavebehinds
if (guts != null && !NotificationSwipeHelper.isTouchInView(ev, guts)
- && guts.getGutsContent() instanceof NotificationSnooze) {
- NotificationSnooze ns = (NotificationSnooze) guts.getGutsContent();
+ && guts.getGutsContent() instanceof NotificationSnooze ns) {
if ((ns.isExpanded() && isCancelOrUp)
|| (!horizontalSwipeWantsIt && scrollerWantsIt)) {
// If the leavebehind is expanded we clear it on the next up event, otherwise we
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
index 06ca9a50bb6d..763867bb9153 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithm.java
@@ -229,8 +229,7 @@ public class StackScrollAlgorithm {
public static void logView(View view, String s) {
String viewString = "";
- if (view instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = ((ExpandableNotificationRow) view);
+ if (view instanceof ExpandableNotificationRow row) {
if (row.getEntry() == null) {
viewString = "ExpandableNotificationRow has null NotificationEntry";
} else {
@@ -264,8 +263,7 @@ public class StackScrollAlgorithm {
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;
+ if (v instanceof ExpandableNotificationRow row) {
row.updateChildrenStates();
}
}
@@ -376,8 +374,7 @@ public class StackScrollAlgorithm {
continue;
}
notGoneIndex = updateNotGoneIndex(state, notGoneIndex, v);
- if (v instanceof ExpandableNotificationRow) {
- ExpandableNotificationRow row = (ExpandableNotificationRow) v;
+ if (v instanceof ExpandableNotificationRow row) {
// handle the notGoneIndex for the children as well
List<ExpandableNotificationRow> children = row.getAttachedChildren();
@@ -508,10 +505,9 @@ public class StackScrollAlgorithm {
private boolean hasNonClearableNotifs(StackScrollAlgorithmState algorithmState) {
for (int i = 0; i < algorithmState.visibleChildren.size(); i++) {
View child = algorithmState.visibleChildren.get(i);
- if (!(child instanceof ExpandableNotificationRow)) {
+ if (!(child instanceof ExpandableNotificationRow row)) {
continue;
}
- final ExpandableNotificationRow row = (ExpandableNotificationRow) child;
if (!row.canViewBeCleared()) {
return true;
}
@@ -715,10 +711,9 @@ public class StackScrollAlgorithm {
ExpandableNotificationRow pulsingRow = null;
for (int i = 0; i < childCount; i++) {
View child = algorithmState.visibleChildren.get(i);
- if (!(child instanceof ExpandableNotificationRow)) {
+ if (!(child instanceof ExpandableNotificationRow row)) {
continue;
}
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
if (!row.showingPulsing() || (i == 0 && ambientState.isPulseExpanding())) {
continue;
}
@@ -760,10 +755,9 @@ public class StackScrollAlgorithm {
ExpandableNotificationRow topHeadsUpEntry = null;
for (int i = 0; i < childCount; i++) {
View child = algorithmState.visibleChildren.get(i);
- if (!(child instanceof ExpandableNotificationRow)) {
+ if (!(child instanceof ExpandableNotificationRow row)) {
continue;
}
- ExpandableNotificationRow row = (ExpandableNotificationRow) child;
if (!(row.isHeadsUp() || row.isHeadsUpAnimatingAway())) {
continue;
}
@@ -897,8 +891,7 @@ public class StackScrollAlgorithm {
}
protected int getMaxAllowedChildHeight(View child) {
- if (child instanceof ExpandableView) {
- ExpandableView expandableView = (ExpandableView) child;
+ if (child instanceof ExpandableView expandableView) {
return expandableView.getIntrinsicHeight();
}
return child == null ? mCollapsedSize : child.getHeight();