Removing DeferredHandler and using a simple Handler to post callbacks
DeferredHandler was added when we were posting each icon separately, to prevent starvation. But since then we have moved to binding batct items during bind. Also fixing waitForIdle not waiting the second time. waitForIdle was using a global variable to maintain state, and was not waiting properly when its called the second time before binding deep shortcuts Original Change-Id: I9c1289cb3bfb74f86e53ec7ac6dd76bb39666b2d Change-Id: I9e6b3ae65fbd3aec3a46092efc5249c4525efedf
This commit is contained in:
1 parent
7adec0ea5b
commit
b265ba7449
9 files changed
+136
-233
No files matched your search
@@ -16,12 +16,10 @@
|
||||
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnAttachStateChangeListener;
|
||||
import android.view.ViewTreeObserver.OnDrawListener;
|
||||
|
||||
import com.android.launcher3.DeferredHandler;
|
||||
import com.android.launcher3.Launcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -34,7 +32,7 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
OnAttachStateChangeListener {
|
||||
|
||||
private final ArrayList<Runnable> mTasks = new ArrayList<>();
|
||||
private final DeferredHandler mHandler;
|
||||
private final Executor mExecutor;
|
||||
|
||||
private Launcher mLauncher;
|
||||
private View mAttachedView;
|
||||
@@ -43,8 +41,8 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
private boolean mLoadAnimationCompleted;
|
||||
private boolean mFirstDrawCompleted;
|
||||
|
||||
public ViewOnDrawExecutor(DeferredHandler handler) {
|
||||
mHandler = handler;
|
||||
public ViewOnDrawExecutor(Executor executor) {
|
||||
mExecutor = executor;
|
||||
}
|
||||
|
||||
public void attachTo(Launcher launcher) {
|
||||
@@ -92,7 +90,7 @@ public class ViewOnDrawExecutor implements Executor, OnDrawListener, Runnable,
|
||||
// Post the pending tasks after both onDraw and onLoadAnimationCompleted have been called.
|
||||
if (mLoadAnimationCompleted && mFirstDrawCompleted && !mCompleted) {
|
||||
for (final Runnable r : mTasks) {
|
||||
mHandler.post(r);
|
||||
mExecutor.execute(r);
|
||||
}
|
||||
markCompleted();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user