Removing buildLayer call on workspace pages.
> buildLayer was followed by setLayerType(NONE) which was causing the
layer to get destroyed immediately and hece was never useful.
> Also removing mAnimatingViewIntoPlace as after setting this to true
updateChildLayer was never being called.
Change-Id: I08a6da25de002247c956308973f1675c0e61e15c
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index f835748..d92b934 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -355,10 +355,6 @@
mShortcutsAndWidgets.setLayerType(hasLayer ? LAYER_TYPE_HARDWARE : LAYER_TYPE_NONE, sPaint);
}
- public void buildHardwareLayer() {
- mShortcutsAndWidgets.buildLayer();
- }
-
public void setCellDimensions(int width, int height) {
mFixedCellWidth = mCellWidth = width;
mFixedCellHeight = mCellHeight = height;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 3a8d260..5d63694 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -74,7 +74,6 @@
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
@@ -302,14 +301,6 @@
// simply unregister this runnable.
private Runnable mExitSpringLoadedModeRunnable;
- @Thunk final Runnable mBuildLayersRunnable = new Runnable() {
- public void run() {
- if (mWorkspace != null) {
- mWorkspace.buildPageHardwareLayers();
- }
- }
- };
-
// Activity result which needs to be processed after workspace has loaded.
private ActivityResultInfo mPendingActivityResult;
/**
@@ -961,6 +952,8 @@
mLauncherCallbacks.onResume();
}
+ clearTypedText();
+
TraceHelper.endSection("ON_RESUME");
}
@@ -1467,44 +1460,6 @@
}
}
- public void onWindowVisibilityChanged(int visibility) {
- // The following code used to be in onResume, but it turns out onResume is called when
- // you're in All Apps and click home to go to the workspace. onWindowVisibilityChanged
- // is a more appropriate event to handle
- if (visibility == View.VISIBLE) {
- if (!mWorkspaceLoading) {
- final ViewTreeObserver observer = mWorkspace.getViewTreeObserver();
- // We want to let Launcher draw itself at least once before we force it to build
- // layers on all the workspace pages, so that transitioning to Launcher from other
- // apps is nice and speedy.
- observer.addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
- private boolean mStarted = false;
- public void onDraw() {
- if (mStarted) return;
- mStarted = true;
- // We delay the layer building a bit in order to give
- // other message processing a time to run. In particular
- // this avoids a delay in hiding the IME if it was
- // currently shown, because doing that may involve
- // some communication back with the app.
- mWorkspace.postDelayed(mBuildLayersRunnable, 500);
- final ViewTreeObserver.OnDrawListener listener = this;
- mWorkspace.post(new Runnable() {
- public void run() {
- if (mWorkspace != null &&
- mWorkspace.getViewTreeObserver() != null) {
- mWorkspace.getViewTreeObserver().
- removeOnDrawListener(listener);
- }
- }
- });
- }
- });
- }
- clearTypedText();
- }
- }
-
public DragLayer getDragLayer() {
return mDragLayer;
}
@@ -1689,7 +1644,6 @@
super.onDestroy();
unregisterReceiver(mReceiver);
- mWorkspace.removeCallbacks(mBuildLayersRunnable);
mWorkspace.removeFolderListeners();
// Stop callbacks from LauncherModel
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index c82731f..430e0aa 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -228,7 +228,6 @@
private State mState = State.NORMAL;
private boolean mIsSwitchingState = false;
- boolean mAnimatingViewIntoPlace = false;
boolean mChildrenLayersEnabled = true;
private boolean mStripScreensOnPageStopMoving = false;
@@ -406,7 +405,7 @@
}
}
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
mLauncher.lockScreenOrientation();
mLauncher.onInteractionBegin();
// Prevent any Un/InstallShortcutReceivers from updating the db while we are dragging
@@ -459,7 +458,7 @@
removeExtraEmptyScreen(true, mDragSourceInternal != null);
}
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
mLauncher.unlockScreenOrientation(false);
// Re-enable any Un/InstallShortcutReceiver and now process any queued items
@@ -1016,10 +1015,6 @@
|| (mTransitionProgress > FINISHED_SWITCHING_STATE_TRANSITION_PROGRESS);
}
- protected void onWindowVisibilityChanged (int visibility) {
- mLauncher.onWindowVisibilityChanged(visibility);
- }
-
@Override
public boolean dispatchUnhandledMove(View focused, int direction) {
if (workspaceInModalState() || !isFinishedSwitchingState()) {
@@ -1109,12 +1104,12 @@
protected void onPageBeginTransition() {
super.onPageBeginTransition();
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
}
protected void onPageEndTransition() {
super.onPageEndTransition();
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
if (mDragController.isDragging()) {
if (workspaceInModalState()) {
@@ -1494,9 +1489,9 @@
return mState == State.NORMAL || mState == State.SPRING_LOADED;
}
- @Thunk void updateChildrenLayersEnabled(boolean force) {
+ private void updateChildrenLayersEnabled() {
boolean small = mState == State.OVERVIEW || mIsSwitchingState;
- boolean enableChildrenLayers = force || small || mAnimatingViewIntoPlace || isPageInTransition();
+ boolean enableChildrenLayers = small || isPageInTransition();
if (enableChildrenLayers != mChildrenLayersEnabled) {
mChildrenLayersEnabled = enableChildrenLayers;
@@ -1562,19 +1557,6 @@
}
}
- public void buildPageHardwareLayers() {
- // force layers to be enabled just for the call to buildLayer
- updateChildrenLayersEnabled(true);
- if (getWindowToken() != null) {
- final int childCount = getChildCount();
- for (int i = 0; i < childCount; i++) {
- CellLayout cl = (CellLayout) getChildAt(i);
- cl.buildHardwareLayer();
- }
- }
- updateChildrenLayersEnabled(false);
- }
-
protected void onWallpaperTap(MotionEvent ev) {
final int[] position = mTempXY;
getLocationOnScreen(position);
@@ -1773,12 +1755,12 @@
}
invalidate(); // This will call dispatchDraw(), which calls getVisiblePages().
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
}
public void onEndStateTransition() {
mIsSwitchingState = false;
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
mForceDrawAdjacentPages = false;
mTransitionProgress = 1;
}
@@ -2262,16 +2244,6 @@
}
final CellLayout parent = (CellLayout) cell.getParent().getParent();
- // Prepare it to be animated into its new position
- // This must be called after the view has been re-parented
- final Runnable onCompleteRunnable = new Runnable() {
- @Override
- public void run() {
- mAnimatingViewIntoPlace = false;
- updateChildrenLayersEnabled(false);
- }
- };
- mAnimatingViewIntoPlace = true;
if (d.dragView.hasDrawn()) {
if (droppedOnOriginalCellDuringTransition) {
// Animate the item to its original position, while simultaneously exiting
@@ -2290,12 +2262,11 @@
if (isWidget) {
int animationType = resizeOnDrop ? ANIMATE_INTO_POSITION_AND_RESIZE :
ANIMATE_INTO_POSITION_AND_DISAPPEAR;
- animateWidgetDrop(info, parent, d.dragView,
- onCompleteRunnable, animationType, cell, false);
+ animateWidgetDrop(info, parent, d.dragView, null, animationType, cell, false);
} else {
int duration = snapScreen < 0 ? -1 : ADJACENT_SCREEN_DROP_DURATION;
mLauncher.getDragLayer().animateViewIntoPosition(d.dragView, cell, duration,
- onCompleteRunnable, this);
+ null, this);
}
} else {
d.deferDragViewCleanupPostAnimation = false;
@@ -3147,7 +3118,7 @@
// hardware layers on children are enabled on startup, but should be disabled until
// needed
- updateChildrenLayersEnabled(false);
+ updateChildrenLayersEnabled();
}
/**