diff options
Diffstat (limited to 'src/com/android/launcher2')
-rw-r--r-- | src/com/android/launcher2/DragLayer.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 20 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 22 |
3 files changed, 27 insertions, 31 deletions
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java index 73901d338..51e3f2531 100644 --- a/src/com/android/launcher2/DragLayer.java +++ b/src/com/android/launcher2/DragLayer.java @@ -17,31 +17,15 @@ package com.android.launcher2; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Matrix; -import android.graphics.Rect; -import android.graphics.RectF; -import android.graphics.Paint; -import android.graphics.PorterDuffColorFilter; -import android.graphics.PorterDuff; -import android.os.Vibrator; -import android.os.SystemClock; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; -import android.view.View; -import android.view.ViewGroup; import android.view.KeyEvent; -import android.view.inputmethod.InputMethodManager; import android.widget.FrameLayout; /** * A ViewGroup that coordinated dragging across its dscendants */ public class DragLayer extends FrameLayout { - private static final String TAG = "Launcher.DragLayer"; - DragController mDragController; /** diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index be1ee67bc..738793b6d 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -65,11 +65,11 @@ import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; +import android.widget.ImageView; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; import java.util.ArrayList; -import java.util.Map.Entry; import java.util.HashMap; import java.io.DataOutputStream; import java.io.FileNotFoundException; @@ -550,10 +550,10 @@ public final class Launcher extends Activity mHandleView = (HandleView) findViewById(R.id.all_apps_button); mHandleView.setLauncher(this); mHandleView.setOnClickListener(this); - /* TODO - TransitionDrawable handleIcon = (TransitionDrawable) mHandleView.getDrawable(); - handleIocon.setCrossFadeEnabled(true); - */ + + Drawable previous = ((ImageView) dragLayer.findViewById(R.id.previous_screen)).getDrawable(); + Drawable next = ((ImageView) dragLayer.findViewById(R.id.next_screen)).getDrawable(); + mWorkspace.setIndicators(previous, next); workspace.setOnLongClickListener(this); workspace.setDragController(dragController); @@ -572,6 +572,16 @@ public final class Launcher extends Activity dragController.addDropTarget(deleteZone); } + @SuppressWarnings({"UnusedDeclaration"}) + public void previousScreen(View v) { + mWorkspace.scrollLeft(); + } + + @SuppressWarnings({"UnusedDeclaration"}) + public void nextScreen(View v) { + mWorkspace.scrollRight(); + } + /** * Creates a view representing a shortcut. * diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index a14a11f20..d7b20fb7f 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -108,6 +108,9 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag int mDrawerContentHeight; int mDrawerContentWidth; + private Drawable mPreviousIndicator; + private Drawable mNextIndicator; + /** * Used to inflate the Workspace from XML. * @@ -462,6 +465,8 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag postInvalidate(); } else if (mNextScreen != INVALID_SCREEN) { mCurrentScreen = Math.max(0, Math.min(mNextScreen, getChildCount() - 1)); + mPreviousIndicator.setLevel(mCurrentScreen); + mNextIndicator.setLevel(mCurrentScreen); Launcher.setScreen(mCurrentScreen); mNextScreen = INVALID_SCREEN; clearChildrenCache(); @@ -543,14 +548,6 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag if (restore) { canvas.restoreToCount(restoreCount); } - - onDrawScrollBars(canvas); - } - - @Override - protected int computeHorizontalScrollRange() { - final int count = getChildCount(); - return count == 0 ? getWidth() : (getChildAt(count - 1)).getRight(); } private float mScale = 1.0f; @@ -794,7 +791,6 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag void enableChildrenCache(int fromScreen, int toScreen) { if (fromScreen > toScreen) { - int temp = fromScreen; fromScreen = toScreen; toScreen = fromScreen; } @@ -805,7 +801,6 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag toScreen = Math.min(toScreen, count - 1); for (int i = fromScreen; i <= toScreen; i++) { - // Log.d("TAG", "enablingChildrenCache: " + i); final CellLayout layout = (CellLayout) getChildAt(i); layout.setChildrenDrawnWithCacheEnabled(true); layout.setChildrenDrawingCacheEnabled(true); @@ -1392,6 +1387,13 @@ public class Workspace extends ViewGroup implements DropTarget, DragSource, Drag getChildAt(mDefaultScreen).requestFocus(); } + void setIndicators(Drawable previous, Drawable next) { + mPreviousIndicator = previous; + mNextIndicator = next; + previous.setLevel(mCurrentScreen); + next.setLevel(mCurrentScreen); + } + public static class SavedState extends BaseSavedState { int currentScreen = -1; |