Cleaning up the overlay interface
Removing some unnecessary and unused methods
Bug: 25993953
Change-Id: I4d715cdee04eb7b0ebef673d885a4258c521ff1f
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 406a6f5..8c203f3 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -212,10 +212,6 @@
private boolean mIsSafeModeEnabled;
- LauncherOverlayCallbacks mLauncherOverlayCallbacks = new LauncherOverlayCallbacksImpl();
- LauncherOverlay mLauncherOverlay;
- InsettableFrameLayout mLauncherOverlayContainer;
-
static final int APPWIDGET_HOST_ID = 1024;
public static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300;
private static final int ON_ACTIVITY_RESULT_ANIMATION_DELAY = 500;
@@ -495,13 +491,6 @@
if (mLauncherCallbacks != null) {
mLauncherCallbacks.onCreate(savedInstanceState);
- if (mLauncherCallbacks.hasLauncherOverlay()) {
- ViewStub stub = (ViewStub) findViewById(R.id.launcher_overlay_stub);
- mLauncherOverlayContainer = (InsettableFrameLayout) stub.inflate();
- mLauncherOverlay = mLauncherCallbacks.setLauncherOverlayView(
- mLauncherOverlayContainer, mLauncherOverlayCallbacks);
- mWorkspace.setLauncherOverlay(mLauncherOverlay);
- }
}
if (shouldShowIntroScreen()) {
@@ -531,6 +520,16 @@
}
}
+ /**
+ * Call this after onCreate to set or clear overlay.
+ */
+ public void setLauncherOverlay(LauncherOverlay overlay) {
+ if (overlay != null) {
+ overlay.setOverlayCallbacks(new LauncherOverlayCallbacksImpl());
+ }
+ mWorkspace.setLauncherOverlay(overlay);
+ }
+
public boolean setLauncherCallbacks(LauncherCallbacks callbacks) {
mLauncherCallbacks = callbacks;
mLauncherCallbacks.setLauncherSearchCallback(new Launcher.LauncherSearchCallbacks() {
@@ -878,8 +877,7 @@
* @return the new screen, or screenId if it exists
*/
private long ensurePendingDropLayoutExists(long screenId) {
- CellLayout dropLayout =
- (CellLayout) mWorkspace.getScreenWithId(screenId);
+ CellLayout dropLayout = mWorkspace.getScreenWithId(screenId);
if (dropLayout == null) {
// it's possible that the add screen was removed because it was
// empty and a re-bind occurred
@@ -1117,10 +1115,10 @@
public void onScrollSettled();
/**
- * This method can be called by the Launcher in order to force the LauncherOverlay
- * to exit fully immersive mode.
+ * Called when the launcher is ready to use the overlay
+ * @param callbacks A set of callbacks provided by Launcher in relation to the overlay
*/
- public void forceExitFullImmersion();
+ public void setOverlayCallbacks(LauncherOverlayCallbacks callbacks);
}
public interface LauncherSearchCallbacks {
@@ -1136,51 +1134,11 @@
}
public interface LauncherOverlayCallbacks {
- /**
- * This method indicates whether a call to {@link #enterFullImmersion()} will succeed,
- * however it doesn't modify any state within the launcher.
- */
- public boolean canEnterFullImmersion();
- /**
- * Should be called to tell Launcher that the LauncherOverlay will take over interaction,
- * eg. by occupying the full screen and handling all touch events.
- *
- * @return true if Launcher allows the LauncherOverlay to become fully immersive. In this
- * case, Launcher will modify any necessary state and assumes the overlay is
- * handling all interaction. If false, the LauncherOverlay should cancel any
- *
- */
- public boolean enterFullImmersion();
-
- /**
- * Must be called when exiting fully immersive mode. Indicates to Launcher that it has
- * full control over UI and state.
- */
- public void exitFullImmersion();
}
class LauncherOverlayCallbacksImpl implements LauncherOverlayCallbacks {
- @Override
- public boolean canEnterFullImmersion() {
- return mState == State.WORKSPACE;
- }
-
- @Override
- public boolean enterFullImmersion() {
- if (mState == State.WORKSPACE) {
- // When fully immersed, disregard any touches which fall through.
- mDragLayer.setBlockTouch(true);
- return true;
- }
- return false;
- }
-
- @Override
- public void exitFullImmersion() {
- mDragLayer.setBlockTouch(false);
- }
}
protected boolean hasSettings() {
@@ -4606,9 +4564,6 @@
if (introScreen != null) {
mDragLayer.showOverlayView(introScreen);
}
- if (mLauncherOverlayContainer != null) {
- mLauncherOverlayContainer.setVisibility(View.INVISIBLE);
- }
}
public void dismissIntroScreen() {
@@ -4620,17 +4575,11 @@
@Override
public void run() {
mDragLayer.dismissOverlayView();
- if (mLauncherOverlayContainer != null) {
- mLauncherOverlayContainer.setVisibility(View.VISIBLE);
- }
showFirstRunClings();
}
}, ACTIVITY_START_DELAY);
} else {
mDragLayer.dismissOverlayView();
- if (mLauncherOverlayContainer != null) {
- mLauncherOverlayContainer.setVisibility(View.VISIBLE);
- }
showFirstRunClings();
}
changeWallpaperVisiblity(true);