catch CrossWindowBlurListeners.getInstance() no method not found

This commit is contained in:
MrSluffy
2024-12-02 08:33:39 +08:00
parent 0b22694aa9
commit a0ff30bf2a
3 changed files with 20 additions and 12 deletions

View File

@@ -276,7 +276,7 @@ class LawnchairLauncher : QuickstepLauncher() {
ActivityOptions.makeBasic()
}
if (Utilities.ATLEAST_T) {
options.setSplashScreenStyle(splashScreenStyle)
options.splashScreenStyle = splashScreenStyle
}
Utilities.allowBGLaunch(options)
@@ -287,11 +287,11 @@ class LawnchairLauncher : QuickstepLauncher() {
return runCatching {
super.getActivityLaunchOptions(v, item)
}.getOrElse {
getActivityLaunchOptionsDefault(v, item)
getActivityLaunchOptionsDefault(v)
}
}
private fun getActivityLaunchOptionsDefault(v: View?, item: ItemInfo?): ActivityOptionsWrapper {
private fun getActivityLaunchOptionsDefault(v: View?): ActivityOptionsWrapper {
var left = 0
var top = 0
var width = v!!.measuredWidth
@@ -302,7 +302,7 @@ class LawnchairLauncher : QuickstepLauncher() {
if (icon != null) {
val bounds = icon.bounds
left = (width - bounds.width()) / 2
top = v.getPaddingTop()
top = v.paddingTop
width = bounds.width()
height = bounds.height()
}
@@ -316,9 +316,7 @@ class LawnchairLauncher : QuickstepLauncher() {
height,
),
)
options.setLaunchDisplayId(
if (v != null && v.display != null) v.display.displayId else Display.DEFAULT_DISPLAY,
)
options.launchDisplayId = if (v.display != null) v.display.displayId else Display.DEFAULT_DISPLAY
val callback = RunnableList()
return ActivityOptionsWrapper(options, callback)
}

View File

@@ -2203,8 +2203,12 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener
private static class LaunchDepthController extends DepthController {
LaunchDepthController(QuickstepLauncher launcher) {
super(launcher);
setCrossWindowBlursEnabled(
CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
try {
setCrossWindowBlursEnabled(
CrossWindowBlurListeners.getInstance().isCrossWindowBlurEnabled());
} catch (Throwable t) {
// ignore
}
// Make sure that the starting value matches the current depth set by the main
// controller.
stateDepth.setValue(launcher.getDepthController().stateDepth.getValue());

View File

@@ -90,9 +90,11 @@ public class DepthController extends BaseDepthController implements StateHandler
mOnAttachListener = new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View view) {
if (LawnchairQuickstepCompat.ATLEAST_S) {
try {
CrossWindowBlurListeners.getInstance().addListener(mLauncher.getMainExecutor(),
mCrossWindowBlurListener);
} catch (Throwable t) {
// Ignore
}
mLauncher.getScrimView().addOpaquenessListener(mOpaquenessListener);
@@ -127,8 +129,12 @@ public class DepthController extends BaseDepthController implements StateHandler
}
private void removeSecondaryListeners() {
if (mCrossWindowBlurListener != null && LawnchairQuickstepCompat.ATLEAST_S) {
CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener);
if (mCrossWindowBlurListener != null) {
try {
CrossWindowBlurListeners.getInstance().removeListener(mCrossWindowBlurListener);
} catch (Throwable t) {
// Ignore
}
}
if (mOpaquenessListener != null) {
mLauncher.getScrimView().removeOpaquenessListener(mOpaquenessListener);