am a7af4a3d: am e47f55c3: Improve desktop scrolling from the previews switcher.

Merge commit 'a7af4a3d60bc3be1138688e3237339b43b1f150e' into eclair-mr2-plus-aosp

* commit 'a7af4a3d60bc3be1138688e3237339b43b1f150e':
  Improve desktop scrolling from the previews switcher.
This commit is contained in:
Romain Guy
2009-11-12 00:01:47 -08:00
committed by Android Git Automerger
2 changed files with 6 additions and 7 deletions
+1 -3
View File
@@ -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<Bitmap> bitmaps = (ArrayList<Bitmap>) 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());
}
}
}
+5 -4
View File
@@ -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)) {