summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-08-04 16:14:13 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-04 16:14:13 -0700
commit02765c94268d7dc3531c87a638a184a3b481ad40 (patch)
treeec93521963249345489e0bc1cf3a1f7b52291b8e /src
parent7bdb25a9894970da74248c9cdc606d0e1ba05c99 (diff)
parentea359c6aee44c0fe3bb94f7002c3b49208b32b7f (diff)
downloadandroid_packages_apps_Trebuchet-02765c94268d7dc3531c87a638a184a3b481ad40.tar.gz
android_packages_apps_Trebuchet-02765c94268d7dc3531c87a638a184a3b481ad40.tar.bz2
android_packages_apps_Trebuchet-02765c94268d7dc3531c87a638a184a3b481ad40.zip
Merge "Grid spacing fixes"
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/BubbleTextView.java8
-rw-r--r--src/com/android/launcher2/DragLayer.java5
-rw-r--r--src/com/android/launcher2/PagedView.java3
-rw-r--r--src/com/android/launcher2/Workspace.java32
4 files changed, 26 insertions, 22 deletions
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index bd3a4bde5..08f337e0d 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -93,10 +93,10 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setColor(bubbleColor);
mBubbleColorAlpha = Color.alpha(bubbleColor) / 255.0f;
- mFocusedOutlineColor = res.getColor(R.color.workspace_item_focused_outline_color);
- mFocusedGlowColor = res.getColor(R.color.workspace_item_focused_glow_color);
- mPressedOutlineColor = res.getColor(R.color.workspace_item_pressed_outline_color);
- mPressedGlowColor = res.getColor(R.color.workspace_item_pressed_glow_color);
+ mFocusedOutlineColor = res.getColor(android.R.color.holo_blue_light);
+ mFocusedGlowColor = res.getColor(android.R.color.holo_blue_light);
+ mPressedOutlineColor = res.getColor(android.R.color.holo_blue_light);
+ mPressedGlowColor = res.getColor(android.R.color.holo_blue_light);
setShadowLayer(SHADOW_LARGE_RADIUS, 0.0f, SHADOW_Y_OFFSET, SHADOW_LARGE_COLOUR);
}
diff --git a/src/com/android/launcher2/DragLayer.java b/src/com/android/launcher2/DragLayer.java
index 7fbde5471..d0d4bad6e 100644
--- a/src/com/android/launcher2/DragLayer.java
+++ b/src/com/android/launcher2/DragLayer.java
@@ -375,6 +375,11 @@ public class DragLayer extends FrameLayout {
toY -= (dragView.getHeight() - (int) Math.round(scale * d.getIntrinsicHeight())) / 2;
// Center in the x coordinate about the target's drawable
toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
+ } else if (child instanceof FolderIcon) {
+ // Account for holographic blur padding on the drag view
+ toY -= HolographicOutlineHelper.MAX_OUTER_BLUR_RADIUS / 2;
+ // Center in the x coordinate about the target's drawable
+ toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2;
} else {
toY -= (Math.round(scale * (dragView.getHeight() - child.getMeasuredHeight()))) / 2;
toX -= (Math.round(scale * (dragView.getMeasuredWidth()
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 48360feb1..24feb4148 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -432,6 +432,7 @@ public abstract class PagedView extends ViewGroup {
int maxChildHeight = 0;
final int verticalPadding = mPaddingTop + mPaddingBottom;
+ final int horizontalPadding = mPaddingLeft + mPaddingRight;
// The children are given the same width and height as the workspace
@@ -458,7 +459,7 @@ public abstract class PagedView extends ViewGroup {
}
final int childWidthMeasureSpec =
- MeasureSpec.makeMeasureSpec(widthSize, childWidthMode);
+ MeasureSpec.makeMeasureSpec(widthSize - horizontalPadding, childWidthMode);
final int childHeightMeasureSpec =
MeasureSpec.makeMeasureSpec(heightSize - verticalPadding, childHeightMode);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index b411fbbb3..ce3aad4fb 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1949,7 +1949,7 @@ public class Workspace extends SmoothPagedView
* Responsibility for the bitmap is transferred to the caller.
*/
public Bitmap createDragBitmap(View v, Canvas canvas, int padding) {
- final int outlineColor = getResources().getColor(R.color.drag_outline_color);
+ final int outlineColor = getResources().getColor(android.R.color.holo_blue_light);
Bitmap b;
if (v instanceof TextView) {
@@ -1974,7 +1974,7 @@ public class Workspace extends SmoothPagedView
* Responsibility for the bitmap is transferred to the caller.
*/
private Bitmap createDragOutline(View v, Canvas canvas, int padding) {
- final int outlineColor = getResources().getColor(R.color.drag_outline_color);
+ final int outlineColor = getResources().getColor(android.R.color.holo_blue_light);
final Bitmap b = Bitmap.createBitmap(
v.getWidth() + padding, v.getHeight() + padding, Bitmap.Config.ARGB_8888);
@@ -1990,7 +1990,7 @@ public class Workspace extends SmoothPagedView
* Responsibility for the bitmap is transferred to the caller.
*/
private Bitmap createDragOutline(Bitmap orig, Canvas canvas, int padding, int w, int h) {
- final int outlineColor = getResources().getColor(R.color.drag_outline_color);
+ final int outlineColor = getResources().getColor(android.R.color.holo_blue_light);
final Bitmap b = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
canvas.setBitmap(b);
@@ -2020,7 +2020,7 @@ public class Workspace extends SmoothPagedView
*/
private Bitmap createExternalDragOutline(Canvas canvas, int padding) {
Resources r = getResources();
- final int outlineColor = r.getColor(R.color.drag_outline_color);
+ final int outlineColor = r.getColor(android.R.color.holo_blue_light);
final int iconWidth = r.getDimensionPixelSize(R.dimen.workspace_cell_width);
final int iconHeight = r.getDimensionPixelSize(R.dimen.workspace_cell_height);
final int rectRadius = r.getDimensionPixelSize(R.dimen.external_drop_icon_rect_radius);
@@ -2274,17 +2274,7 @@ public class Workspace extends SmoothPagedView
} else if (mDragInfo != null) {
final View cell = mDragInfo.cell;
- boolean continueDrop = true;
- if (mLauncher.isHotseatLayout(mDragTargetLayout) && d.dragInfo instanceof ItemInfo) {
- ItemInfo info = (ItemInfo) d.dragInfo;
- if (info.spanX > 1 || info.spanY > 1) {
- continueDrop = false;
- Toast.makeText(getContext(), R.string.invalid_hotseat_item,
- Toast.LENGTH_SHORT).show();
- }
- }
-
- if (continueDrop && dropTargetLayout != null) {
+ if (dropTargetLayout != null) {
// Move internally
boolean hasMovedLayouts = (getParentCellLayoutForView(cell) != dropTargetLayout);
boolean hasMovedIntoHotseat = mLauncher.isHotseatLayout(dropTargetLayout);
@@ -2788,6 +2778,14 @@ public class Workspace extends SmoothPagedView
return res;
}
+ private boolean isDragWidget(DragObject d) {
+ return (d.dragInfo instanceof LauncherAppWidgetInfo ||
+ d.dragInfo instanceof PendingAddWidgetInfo);
+ }
+ private boolean isExternalDragWidget(DragObject d) {
+ return d.dragSource != this && isDragWidget(d);
+ }
+
public void onDragOver(DragObject d) {
// Skip drag over events while we are dragging over side pages
if (mInScrollArea) return;
@@ -2804,7 +2802,7 @@ public class Workspace extends SmoothPagedView
// Identify whether we have dragged over a side page
if (isSmall()) {
- if (mLauncher.getHotseat() != null) {
+ if (mLauncher.getHotseat() != null && !isExternalDragWidget(d)) {
mLauncher.getHotseat().getHitRect(r);
if (r.contains(d.x, d.y)) {
layout = mLauncher.getHotseat().getLayout();
@@ -2841,7 +2839,7 @@ public class Workspace extends SmoothPagedView
}
} else {
// Test to see if we are over the hotseat otherwise just use the current page
- if (mLauncher.getHotseat() != null) {
+ if (mLauncher.getHotseat() != null && !isDragWidget(d)) {
mLauncher.getHotseat().getHitRect(r);
if (r.contains(d.x, d.y)) {
layout = mLauncher.getHotseat().getLayout();