From e47f55c30b9c24f01f2be861247c92f17fbe4a61 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 11 Nov 2009 19:21:22 -0800 Subject: [PATCH] Improve desktop scrolling from the previews switcher. Change-Id: Iee05120b4363c07294f665f45f561e9d9361ccaa --- src/com/android/launcher2/Launcher.java | 4 +--- src/com/android/launcher2/Workspace.java | 9 +++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index 4ce73f6848..0150af240d 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -50,7 +50,6 @@ import android.os.Handler; import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; -import android.os.SystemClock; import android.provider.LiveFolders; import android.text.Selection; import android.text.SpannableStringBuilder; @@ -1519,7 +1518,6 @@ public final class Launcher extends Activity for (int i = 0; i < count; i++) { ((ImageView) group.getChildAt(i)).setImageDrawable(null); } - ArrayList bitmaps = (ArrayList) v.getTag(R.id.icon); for (Bitmap bitmap : bitmaps) bitmap.recycle(); @@ -1647,7 +1645,7 @@ public final class Launcher extends Activity public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { - mWorkspace.snapToScreen((Integer) v.getTag()); + mWorkspace.snapToScreen((Integer) v.getTag()); } } } diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index b70c342218..d07f1b9935 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -28,9 +28,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Parcelable; import android.os.Parcel; -import android.os.SystemClock; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -48,6 +46,7 @@ import java.util.ArrayList; * A workspace is meant to be used with a fixed width only. */ public class Workspace extends ViewGroup implements DropTarget, DragSource, DragScroller { + @SuppressWarnings({"UnusedDeclaration"}) private static final String TAG = "Launcher.Workspace"; private static final int INVALID_SCREEN = -1; @@ -942,17 +941,19 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag } void snapToScreen(int whichScreen) { - if (!mScroller.isFinished()) return; + //if (!mScroller.isFinished()) return; whichScreen = Math.max(0, Math.min(whichScreen, getChildCount() - 1)); clearVacantCache(); enableChildrenCache(mCurrentScreen, whichScreen); - final int screenDelta = Math.abs(whichScreen - mCurrentScreen); mNextScreen = whichScreen; + + mPreviousIndicator.setLevel(mNextScreen); + mNextIndicator.setLevel(mNextScreen); View focusedChild = getFocusedChild(); if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {