Improve desktop scrolling from the previews switcher.
Change-Id: Iee05120b4363c07294f665f45f561e9d9361ccaa
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 4ce73f6..0150af2 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -50,7 +50,6 @@
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 @@
for (int i = 0; i < count; i++) {
((ImageView) group.getChildAt(i)).setImageDrawable(null);
}
-
ArrayList<Bitmap> bitmaps = (ArrayList<Bitmap>) v.getTag(R.id.icon);
for (Bitmap bitmap : bitmaps) bitmap.recycle();
@@ -1647,7 +1645,7 @@
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 b70c342..d07f1b9 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -28,9 +28,7 @@
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 @@
* 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 @@
}
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)) {