mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-11 06:44:00 +00:00
@@ -1,7 +1,9 @@
|
||||
package app.lawnchair.nexuslauncher
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import android.os.Bundle
|
||||
import app.lawnchair.FeedBridge
|
||||
import app.lawnchair.LawnchairLauncher
|
||||
import app.lawnchair.preferences2.PreferenceManager2
|
||||
@@ -76,32 +78,30 @@ class OverlayCallbackImpl(private val mLauncher: LawnchairLauncher) :
|
||||
mClient.hideOverlay(duration)
|
||||
}
|
||||
|
||||
// override fun startSearch(config: ByteArray?, extras: Bundle?): Boolean = false
|
||||
//
|
||||
// override fun onActivityCreated(activity: Activity, bundle: Bundle?) = Unit
|
||||
//
|
||||
// override fun onActivityStarted(activity: Activity) {
|
||||
// mClient.onStart()
|
||||
// }
|
||||
//
|
||||
// override fun onActivityResumed(activity: Activity) {
|
||||
// mClient.onResume()
|
||||
// }
|
||||
//
|
||||
// override fun onActivityPaused(activity: Activity) {
|
||||
// mClient.onPause()
|
||||
// }
|
||||
//
|
||||
// override fun onActivityStopped(activity: Activity) {
|
||||
// mClient.onStop()
|
||||
// }
|
||||
//
|
||||
// override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) = Unit
|
||||
//
|
||||
// override fun onActivityDestroyed(activity: Activity) {
|
||||
// mClient.onDestroy()
|
||||
// mClient.mDestroyed = true
|
||||
// }
|
||||
override fun onActivityCreated(activity: Activity, bundle: Bundle?) = Unit
|
||||
|
||||
override fun onActivityStarted(activity: Activity) {
|
||||
mClient.onStart()
|
||||
}
|
||||
|
||||
override fun onActivityResumed(activity: Activity) {
|
||||
mClient.onResume()
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
mClient.onPause()
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {
|
||||
mClient.onStop()
|
||||
}
|
||||
|
||||
override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) = Unit
|
||||
|
||||
override fun onActivityDestroyed(activity: Activity) {
|
||||
mClient.onDestroy()
|
||||
mClient.mDestroyed = true
|
||||
}
|
||||
|
||||
override fun onOverlayScrollChanged(progress: Float) {
|
||||
mLauncherOverlayCallbacks?.onOverlayScrollChanged(progress)
|
||||
|
||||
@@ -165,7 +165,6 @@ import androidx.annotation.StringRes;
|
||||
import androidx.annotation.UiThread;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.os.BuildCompat;
|
||||
//import androidx.window.embedding.RuleController;
|
||||
|
||||
import com.android.launcher3.DropTarget.DragObject;
|
||||
import com.android.launcher3.accessibility.LauncherAccessibilityDelegate;
|
||||
@@ -718,7 +717,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
private void switchOverlay(Supplier<LauncherOverlayManager> overlaySupplier) {
|
||||
if (mOverlayManager != null) {
|
||||
mOverlayManager.onActivityDestroyed();
|
||||
mOverlayManager.onActivityDestroyed(this);
|
||||
}
|
||||
mOverlayManager = overlaySupplier.get();
|
||||
if (getRootView().isAttachedToWindow()) {
|
||||
@@ -1103,7 +1102,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
if (mDeferOverlayCallbacks) {
|
||||
checkIfOverlayStillDeferred();
|
||||
} else {
|
||||
mOverlayManager.onActivityStopped();
|
||||
mOverlayManager.onActivityStopped(this);
|
||||
}
|
||||
hideKeyboard();
|
||||
logStopAndResume(false /* isResume */);
|
||||
@@ -1119,7 +1118,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
TraceHelper.INSTANCE.beginSection(ON_START_EVT);
|
||||
super.onStart();
|
||||
if (!mDeferOverlayCallbacks) {
|
||||
mOverlayManager.onActivityStarted();
|
||||
mOverlayManager.onActivityStarted(this);
|
||||
}
|
||||
|
||||
mAppWidgetHolder.setActivityStarted(true);
|
||||
@@ -1210,15 +1209,15 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
// Move the client to the correct state. Calling the same method twice is no-op.
|
||||
if (isStarted()) {
|
||||
mOverlayManager.onActivityStarted();
|
||||
mOverlayManager.onActivityStarted(this);
|
||||
}
|
||||
if (hasBeenResumed()) {
|
||||
mOverlayManager.onActivityResumed();
|
||||
mOverlayManager.onActivityResumed(this);
|
||||
} else {
|
||||
mOverlayManager.onActivityPaused();
|
||||
mOverlayManager.onActivityPaused(this);
|
||||
}
|
||||
if (!isStarted()) {
|
||||
mOverlayManager.onActivityStopped();
|
||||
mOverlayManager.onActivityStopped(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1324,7 +1323,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
if (mDeferOverlayCallbacks) {
|
||||
scheduleDeferredCheck();
|
||||
} else {
|
||||
mOverlayManager.onActivityResumed();
|
||||
mOverlayManager.onActivityResumed(this);
|
||||
}
|
||||
|
||||
DragView.removeAllViews(this);
|
||||
@@ -1342,7 +1341,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
mDropTargetBar.animateToVisibility(false);
|
||||
|
||||
if (!mDeferOverlayCallbacks) {
|
||||
mOverlayManager.onActivityPaused();
|
||||
mOverlayManager.onActivityPaused(this);
|
||||
}
|
||||
mAppWidgetHolder.setActivityResumed(false);
|
||||
}
|
||||
@@ -1868,7 +1867,7 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
// a color
|
||||
// changes while launcher is still loading.
|
||||
getRootView().getViewTreeObserver().removeOnPreDrawListener(mOnInitialBindListener);
|
||||
mOverlayManager.onActivityDestroyed();
|
||||
mOverlayManager.onActivityDestroyed(this);
|
||||
}
|
||||
|
||||
public LauncherAccessibilityDelegate getAccessibilityDelegate() {
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
*/
|
||||
package com.android.systemui.plugins.shared;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -22,7 +25,7 @@ import java.io.PrintWriter;
|
||||
/**
|
||||
* Interface to control the overlay on Launcher
|
||||
*/
|
||||
public interface LauncherOverlayManager {
|
||||
public interface LauncherOverlayManager extends Application.ActivityLifecycleCallbacks {
|
||||
|
||||
default void onDeviceProvideChanged() { }
|
||||
|
||||
@@ -39,21 +42,32 @@ public interface LauncherOverlayManager {
|
||||
|
||||
default void hideOverlay(int duration) { }
|
||||
|
||||
default void onActivityStarted() { }
|
||||
default boolean startSearch(byte[] config, Bundle extras) {
|
||||
return false;
|
||||
}
|
||||
|
||||
default void onActivityResumed() { }
|
||||
@Override
|
||||
default void onActivityCreated(Activity activity, Bundle bundle) { }
|
||||
|
||||
default void onActivityPaused() { }
|
||||
@Override
|
||||
default void onActivityStarted(Activity activity) { }
|
||||
|
||||
default void onActivityStopped() { }
|
||||
@Override
|
||||
default void onActivityResumed(Activity activity) { }
|
||||
|
||||
default void onActivityDestroyed() { }
|
||||
@Override
|
||||
default void onActivityPaused(Activity activity) { }
|
||||
|
||||
/**
|
||||
* @deprecated use LauncherOverlayTouchProxy directly
|
||||
*/
|
||||
@Deprecated
|
||||
interface LauncherOverlay extends LauncherOverlayTouchProxy {
|
||||
@Override
|
||||
default void onActivityStopped(Activity activity) { }
|
||||
|
||||
@Override
|
||||
default void onActivitySaveInstanceState(Activity activity, Bundle bundle) { }
|
||||
|
||||
@Override
|
||||
default void onActivityDestroyed(Activity activity) { }
|
||||
|
||||
interface LauncherOverlay extends LauncherOverlayTouchProxy{
|
||||
|
||||
/**
|
||||
* Touch interaction leading to overscroll has begun
|
||||
|
||||
Reference in New Issue
Block a user