mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Add HomeTransitionListener to launcher.
Fixes: 279514548
Bug: 284474103
Bug: 306053414
Flag: LEGACY ENABLE_HOME_TRANSITION_LISTENER DISABLED
Test: App launch -> Hotseat -> Taskbar stashes
Transluscent app launch and launcher still visible -> No change
Going home -> Hotseat visible
Change-Id: I6db5253ada3e3b37dfae124f3ee88a9805804fb8
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.launcher3;
|
||||
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.wm.shell.transition.IHomeTransitionListener;
|
||||
|
||||
/**
|
||||
* Controls launcher response to home activity visibility changing.
|
||||
*/
|
||||
public class HomeTransitionController {
|
||||
|
||||
private final QuickstepLauncher mLauncher;
|
||||
@Nullable private IHomeTransitionListener mHomeTransitionListener;
|
||||
|
||||
public HomeTransitionController(QuickstepLauncher launcher) {
|
||||
mLauncher = launcher;
|
||||
}
|
||||
|
||||
public void registerHomeTransitionListener() {
|
||||
mHomeTransitionListener = new IHomeTransitionListener.Stub() {
|
||||
@Override
|
||||
public void onHomeVisibilityChanged(boolean isVisible) {
|
||||
MAIN_EXECUTOR.execute(() -> {
|
||||
if (mLauncher.getTaskbarUIController() != null) {
|
||||
mLauncher.getTaskbarUIController().onLauncherVisibilityChanged(isVisible);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).setHomeTransitionListener(mHomeTransitionListener);
|
||||
}
|
||||
|
||||
public void unregisterHomeTransitionListener() {
|
||||
SystemUiProxy.INSTANCE.get(mLauncher).setHomeTransitionListener(null);
|
||||
mHomeTransitionListener = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user