summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-06-30 17:05:14 -0700
committerAdam Cohen <adamcohen@google.com>2011-06-30 17:22:07 -0700
commit0e4857c302da6adbd45231d7a8bae0289fa33250 (patch)
tree8b3099321c2e70701a0652246cd811d365f62c90 /src
parent6a0f57dfafced837a2a282d8feec28d5418be3b9 (diff)
downloadandroid_packages_apps_Trebuchet-0e4857c302da6adbd45231d7a8bae0289fa33250.tar.gz
android_packages_apps_Trebuchet-0e4857c302da6adbd45231d7a8bae0289fa33250.tar.bz2
android_packages_apps_Trebuchet-0e4857c302da6adbd45231d7a8bae0289fa33250.zip
Fixing small folder bugs
-> Issue 4972348 -> Center folder when it extends beyond the workspace Change-Id: Id5551d17d595151bfd27122e1fd4ddfeab7dbf40
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/Folder.java6
-rw-r--r--src/com/android/launcher2/Workspace.java10
2 files changed, 13 insertions, 3 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java
index da859cb8e..89e4603da 100644
--- a/src/com/android/launcher2/Folder.java
+++ b/src/com/android/launcher2/Folder.java
@@ -744,6 +744,12 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL
int left = Math.min(Math.max(0, centeredLeft), parentWidth - width);
int top = Math.min(Math.max(0, centeredTop), parentHeight - height);
+ if (width >= parentWidth) {
+ left = (parentWidth - width) / 2;
+ }
+ if (height >= parentHeight) {
+ top = (parentHeight - height) / 2;
+ }
int folderPivotX = width / 2 + (centeredLeft - left);
int folderPivotY = height / 2 + (centeredTop - top);
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e53768d5b..dd1e8ec12 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1980,8 +1980,7 @@ public class Workspace extends SmoothPagedView
v.getDrawingRect(clipRect);
// For a TextView, adjust the clip rect so that we don't include the text label
- if (v instanceof FolderIcon) {
- } else if (v instanceof BubbleTextView) {
+ if (v instanceof BubbleTextView) {
final BubbleTextView tv = (BubbleTextView) v;
clipRect.bottom = tv.getExtendedPaddingTop() - (int) BubbleTextView.PADDING_V +
tv.getLayout().getLineTop(0);
@@ -1989,6 +1988,8 @@ public class Workspace extends SmoothPagedView
final TextView tv = (TextView) v;
clipRect.bottom = tv.getExtendedPaddingTop() - tv.getCompoundDrawablePadding() +
tv.getLayout().getLineTop(0);
+ } else if (v instanceof FolderIcon) {
+ clipRect.bottom = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
}
// Draw the View into the bitmap.
@@ -2118,13 +2119,16 @@ public class Workspace extends SmoothPagedView
final int screenY = (int) mTempXY[1] + (child.getHeight() - bmpHeight) / 2;
Rect dragRect = null;
- if ((child instanceof BubbleTextView) && !(child instanceof FolderIcon)) {
+ if (child instanceof BubbleTextView) {
int iconSize = getResources().getDimensionPixelSize(R.dimen.app_icon_size);
int top = child.getPaddingTop();
int left = (bmpWidth - iconSize) / 2;
int right = left + iconSize;
int bottom = top + iconSize;
dragRect = new Rect(left, top, right, bottom);
+ } else if (child instanceof FolderIcon) {
+ int previewSize = getResources().getDimensionPixelSize(R.dimen.folder_preview_size);
+ dragRect = new Rect(0, 0, child.getWidth(), previewSize);
}
mLauncher.lockScreenOrientation();