mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 00:06:47 +00:00
Fix flash when switching from app window to snapshot.
- If there is any delay in launcher draw, then we will finish the transition and hide the app window before launcher has had a chance to draw the task view with the updated snapshot. Change-Id: I81c5b467f32520fd7474bde0e89819336292e84f
This commit is contained in:
@@ -49,9 +49,16 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
}
|
||||
|
||||
public void attachTo(Launcher launcher) {
|
||||
attachTo(launcher, launcher.getWorkspace(), true /* waitForLoadAnimation */);
|
||||
}
|
||||
|
||||
public void attachTo(Launcher launcher, View attachedView, boolean waitForLoadAnimation) {
|
||||
mLauncher = launcher;
|
||||
mAttachedView = launcher.getWorkspace();
|
||||
mAttachedView = attachedView;
|
||||
mAttachedView.addOnAttachStateChangeListener(this);
|
||||
if (!waitForLoadAnimation) {
|
||||
mLoadAnimationCompleted = true;
|
||||
}
|
||||
|
||||
attachObserver();
|
||||
}
|
||||
@@ -74,7 +81,7 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(View v) { }
|
||||
public void onViewDetachedFromWindow(View v) {}
|
||||
|
||||
@Override
|
||||
public void onDraw() {
|
||||
@@ -101,10 +108,7 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
// Post the pending tasks after both onDraw and onLoadAnimationCompleted have been called.
|
||||
if (mLoadAnimationCompleted && mFirstDrawCompleted && !mCompleted) {
|
||||
mIsExecuting = true;
|
||||
for (final Runnable r : mTasks) {
|
||||
mExecutor.execute(r);
|
||||
}
|
||||
markCompleted();
|
||||
runAllTasks();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,4 +125,15 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
}
|
||||
LauncherModel.setWorkerPriority(Process.THREAD_PRIORITY_DEFAULT);
|
||||
}
|
||||
|
||||
protected boolean isCompleted() {
|
||||
return mCompleted;
|
||||
}
|
||||
|
||||
protected void runAllTasks() {
|
||||
for (final Runnable r : mTasks) {
|
||||
mExecutor.execute(r);
|
||||
}
|
||||
markCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user