Messaging: Let there be lambdas

Change-Id: Iee1fc46c92ea9159abb10d92d34baee937bdee0c
This commit is contained in:
Michael W
2024-12-26 14:55:12 +01:00
parent c1b4aa4dfe
commit d43b6ff1c4
84 changed files with 991 additions and 1697 deletions
@@ -112,12 +112,8 @@ public class PopupTransitionAnimation extends Animation {
}
private final StringBuilder mEvents = new StringBuilder();
private final Runnable mCleanupRunnable = new Runnable() {
@Override
public void run() {
private final Runnable mCleanupRunnable = () ->
LogUtil.w(LogUtil.BUGLE_TAG, "PopupTransitionAnimation: " + mEvents);
}
};
/**
* Ensures the animation is ready before starting the animation.
@@ -210,17 +206,14 @@ public class PopupTransitionAnimation extends Animation {
mViewToAnimate.setVisibility(View.VISIBLE);
// Delay dismissing the popup window to let mViewToAnimate draw under it and reduce the
// flash
ThreadUtil.getMainThreadHandler().post(new Runnable() {
@Override
public void run() {
try {
mPopupWindow.dismiss();
} catch (IllegalArgumentException e) {
// PopupWindow.dismiss() will fire an IllegalArgumentException if the activity
// has already ended while we were animating
}
ThreadUtil.getMainThreadHandler().removeCallbacks(mCleanupRunnable);
ThreadUtil.getMainThreadHandler().post(() -> {
try {
mPopupWindow.dismiss();
} catch (IllegalArgumentException e) {
// PopupWindow.dismiss() will fire an IllegalArgumentException if the activity
// has already ended while we were animating
}
ThreadUtil.getMainThreadHandler().removeCallbacks(mCleanupRunnable);
});
}
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -168,17 +169,14 @@ public class ViewGroupItemVerticalExplodeAnimation {
expandLayer.animate().scaleY(scale)
.setDuration(mDuration)
.setInterpolator(UiUtils.EASE_IN_INTERPOLATOR)
.withEndAction(new Runnable() {
@Override
public void run() {
// Clean up the views added to overlay on animation finish.
overlay.remove(shadowContainerLayer);
mViewToAnimate.setBackground(oldBackground);
if (mViewBitmap != null) {
mViewBitmap.recycle();
}
.withEndAction(() -> {
// Clean up the views added to overlay on animation finish.
overlay.remove(shadowContainerLayer);
mViewToAnimate.setBackground(oldBackground);
if (mViewBitmap != null) {
mViewBitmap.recycle();
}
});
});
}
}
}