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