From eeacd56cc922632bf087a7fd7a20ebe5b7a5ca04 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 10 Oct 2012 18:47:33 -0700 Subject: [PATCH] Remove unnecessary allocations during draw Bug #7327799 Change-Id: Ic3a18fb9d850f2c692dcb187a206c61dfa8108a4 --- src/com/android/launcher2/Workspace.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 6350c8480d..4940ae0b1b 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -254,6 +254,13 @@ public class Workspace extends SmoothPagedView private float[] mNewRotationYs; private float mTransitionProgress; + private final Runnable mBindPages = new Runnable() { + @Override + public void run() { + mLauncher.getModel().bindRemainingSynchronousPages(); + } + }; + /** * Used to inflate the Workspace from XML. * @@ -1292,12 +1299,7 @@ public class Workspace extends SmoothPagedView super.onDraw(canvas); // Call back to LauncherModel to finish binding after the first draw - post(new Runnable() { - @Override - public void run() { - mLauncher.getModel().bindRemainingSynchronousPages(); - } - }); + post(mBindPages); } boolean isDrawingBackgroundGradient() {