summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Dubroy <dubroy@google.com>2010-11-03 22:12:02 -0700
committerPatrick Dubroy <dubroy@google.com>2010-11-03 22:12:53 -0700
commit0207c522472d7252f146f4d39efa456ca5248c6b (patch)
treea0b88663607df39ebea5e2fc9722afea51e2b677
parent68846fdce6c01bbe474bd0c8307e1ccaac161cbc (diff)
downloadandroid_packages_apps_Trebuchet-0207c522472d7252f146f4d39efa456ca5248c6b.tar.gz
android_packages_apps_Trebuchet-0207c522472d7252f146f4d39efa456ca5248c6b.tar.bz2
android_packages_apps_Trebuchet-0207c522472d7252f146f4d39efa456ca5248c6b.zip
Draw glow along screen edge when dragging in portrait.
-rw-r--r--res/drawable/page_hover_left.9.pngbin0 -> 413 bytes
-rw-r--r--res/drawable/page_hover_right.9.pngbin0 -> 415 bytes
-rw-r--r--res/values-xlarge-port/dimens.xml4
-rw-r--r--src/com/android/launcher2/CellLayout.java4
-rw-r--r--src/com/android/launcher2/Workspace.java32
5 files changed, 36 insertions, 4 deletions
diff --git a/res/drawable/page_hover_left.9.png b/res/drawable/page_hover_left.9.png
new file mode 100644
index 000000000..5d5e0c811
--- /dev/null
+++ b/res/drawable/page_hover_left.9.png
Binary files differ
diff --git a/res/drawable/page_hover_right.9.png b/res/drawable/page_hover_right.9.png
new file mode 100644
index 000000000..1545bfefa
--- /dev/null
+++ b/res/drawable/page_hover_right.9.png
Binary files differ
diff --git a/res/values-xlarge-port/dimens.xml b/res/values-xlarge-port/dimens.xml
index b60635b0d..baa31aace 100644
--- a/res/values-xlarge-port/dimens.xml
+++ b/res/values-xlarge-port/dimens.xml
@@ -15,6 +15,10 @@
-->
<resources>
+ <!-- the area at the edge of the screen that makes the workspace go left
+ or right while you're dragging. -->
+ <dimen name="scroll_zone">40dp</dimen>
+
<!-- Width/height gap overrides for the workspace -->
<dimen name="workspace_width_gap">0dp</dimen>
<dimen name="workspace_height_gap">32dp</dimen>
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 66d5cb500..11c0c1822 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -327,6 +327,10 @@ public class CellLayout extends ViewGroup implements Dimmable {
}
}
+ public boolean getHover() {
+ return mHover;
+ }
+
public void drawChildren(Canvas canvas) {
super.dispatchDraw(canvas);
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 4679c645d..df3d2de52 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -605,6 +605,30 @@ public class Workspace extends SmoothPagedView
} else {
super.dispatchDraw(canvas);
+ final int width = getWidth();
+ final int height = getHeight();
+
+ // In portrait orientation, draw the glowing edge when dragging to adjacent screens
+ if (mInScrollArea && (height > width)) {
+ final int pageHeight = getChildAt(0).getHeight();
+
+ // This determines the height of the glowing edge: 90% of the page height
+ final int padding = (int) ((height - pageHeight) * 0.5f + pageHeight * 0.1f);
+
+ final CellLayout leftPage = (CellLayout) getChildAt(mCurrentPage - 1);
+ final CellLayout rightPage = (CellLayout) getChildAt(mCurrentPage + 1);
+
+ if (leftPage != null && leftPage.getHover()) {
+ final Drawable d = getResources().getDrawable(R.drawable.page_hover_left);
+ d.setBounds(mScrollX, padding, mScrollX + d.getIntrinsicWidth(), height - padding);
+ d.draw(canvas);
+ } else if (rightPage != null && rightPage.getHover()) {
+ final Drawable d = getResources().getDrawable(R.drawable.page_hover_right);
+ d.setBounds(mScrollX + width - d.getIntrinsicWidth(), padding, mScrollX + width, height - padding);
+ d.draw(canvas);
+ }
+ }
+
if (mDropView != null) {
// We are animating an item that was just dropped on the home screen.
// Render its View in the current animation position.
@@ -1909,11 +1933,11 @@ public class Workspace extends SmoothPagedView
final int screen = getCurrentPage() + ((direction == DragController.SCROLL_LEFT) ? -1 : 1);
if (0 <= screen && screen < getChildCount()) {
((CellLayout) getChildAt(screen)).setHover(true);
- }
- if (mDragTargetLayout != null) {
- mDragTargetLayout.onDragExit();
- mDragTargetLayout = null;
+ if (mDragTargetLayout != null) {
+ mDragTargetLayout.onDragExit();
+ mDragTargetLayout = null;
+ }
}
}
}