New position indicators and icons for Launcher2.

Change-Id: Id444943a3cc2e9db78733614141cbe2be837fdbf
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 73901d3..51e3f25 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 be1ee67..738793b 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -65,11 +65,11 @@
 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 @@
         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 @@
         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 a14a11f..d7b20fb 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -108,6 +108,9 @@
     int mDrawerContentHeight;
     int mDrawerContentWidth;
 
+    private Drawable mPreviousIndicator;
+    private Drawable mNextIndicator;
+
     /**
      * Used to inflate the Workspace from XML.
      *
@@ -462,6 +465,8 @@
             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 @@
         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 @@
 
     void enableChildrenCache(int fromScreen, int toScreen) {
         if (fromScreen > toScreen) {
-            int temp = fromScreen;
             fromScreen = toScreen;
             toScreen = fromScreen;
         }
@@ -805,7 +801,6 @@
         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 @@
         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;