summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-11-11 16:34:41 -0800
committerWinson Chung <winsonc@google.com>2010-11-11 17:20:48 -0800
commitbbc60d8e79416e37cbede55c159bf6aaa6c171d5 (patch)
treea5e6177b9f5e96bdaff0c17092f6df84451d9e3b /src/com
parent580e27748137ff08599aa719d106b31215a28353 (diff)
downloadandroid_packages_apps_Trebuchet-bbc60d8e79416e37cbede55c159bf6aaa6c171d5.tar.gz
android_packages_apps_Trebuchet-bbc60d8e79416e37cbede55c159bf6aaa6c171d5.tar.bz2
android_packages_apps_Trebuchet-bbc60d8e79416e37cbede55c159bf6aaa6c171d5.zip
Fixing various small bugs with launcher
- Items added from customization tray add from top left now - Fixing issue where wallpaper tab was not showing - Workaround for the extra pixel line showing in homescreen drag icons - Speeding up animations for tab transitions and clicking Change-Id: I865531bb4cf896320a9e2ff6cef08bed221a2294
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/AllAppsTabbed.java3
-rw-r--r--src/com/android/launcher2/CellLayout.java16
-rw-r--r--src/com/android/launcher2/CustomizePagedView.java1
-rw-r--r--src/com/android/launcher2/Launcher.java3
-rw-r--r--src/com/android/launcher2/PagedView.java15
-rw-r--r--src/com/android/launcher2/Workspace.java7
6 files changed, 29 insertions, 16 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index e0ff1a854..a6e21b9d7 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -76,7 +76,8 @@ public class AllAppsTabbed extends TabHost implements AllAppsView {
setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// animate the changing of the tab content by fading pages in and out
- final int duration = 150;
+ final Resources res = getResources();
+ final int duration = res.getInteger(R.integer.config_tabTransitionTime);
final float alpha = mAllApps.getAlpha();
ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mAllApps, "alpha", alpha, 0.0f).
setDuration(duration);
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 63871a7fe..e34010189 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -1038,15 +1038,15 @@ public class CellLayout extends ViewGroup implements Dimmable {
final int countY = mCountY;
final boolean[][] occupied = mOccupied;
- for (int x = 0; x < countX - (spanX - 1); x++) {
+ for (int y = 0; y < countY - (spanY - 1); y++) {
inner:
- for (int y = 0; y < countY - (spanY - 1); y++) {
+ for (int x = 0; x < countX - (spanX - 1); x++) {
for (int i = 0; i < spanX; i++) {
for (int j = 0; j < spanY; j++) {
if (occupied[x + i][y + j]) {
- // small optimization: we can skip to below the row we just found
+ // small optimization: we can skip to after the column we just found
// an occupied cell
- y += j;
+ x += i;
continue inner;
}
}
@@ -1154,15 +1154,15 @@ public class CellLayout extends ViewGroup implements Dimmable {
endY = Math.min(endY, intersectY + (spanY - 1) + (spanY == 1 ? 1 : 0));
}
- for (int x = startX; x < endX; x++) {
+ for (int y = startY; y < endY && !foundCell; y++) {
inner:
- for (int y = startY; y < endY; y++) {
+ for (int x = startX; x < endX; x++) {
for (int i = 0; i < spanX; i++) {
for (int j = 0; j < spanY; j++) {
if (mOccupied[x + i][y + j]) {
- // small optimization: we can skip to below the row we just found
+ // small optimization: we can skip to after the column we just found
// an occupied cell
- y += j;
+ x += i;
continue inner;
}
}
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 14b242945..1763a00f6 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -289,6 +289,7 @@ public class CustomizePagedView extends PagedView
public void setCustomizationFilter(CustomizationType filterType) {
mCustomizationType = filterType;
setCurrentPage(0);
+ updateCurrentPageScroll();
invalidatePageData();
// End the current choice mode so that we don't carry selections across tabs
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 81e1847ff..37c2b415e 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -316,7 +316,8 @@ public final class Launcher extends Activity
mHomeCustomizationDrawer.setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// animate the changing of the tab content by fading pages in and out
- final int duration = 150;
+ final Resources res = getResources();
+ final int duration = res.getInteger(R.integer.config_tabTransitionTime);
final float alpha = mCustomizePagedView.getAlpha();
ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mCustomizePagedView,
"alpha", alpha, 0.0f);
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 70746b38b..109696c0a 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -245,6 +245,17 @@ public abstract class PagedView extends ViewGroup {
}
/**
+ * Updates the scroll of the current page immediately to its final scroll position. We use this
+ * in CustomizePagedView to allow tabs to share the same PagedView while resetting the scroll of
+ * the previous tab page.
+ */
+ protected void updateCurrentPageScroll() {
+ int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
+ scrollTo(newX, 0);
+ mScroller.setFinalX(newX);
+ }
+
+ /**
* Sets the current page.
*/
void setCurrentPage(int currentPage) {
@@ -256,9 +267,7 @@ public abstract class PagedView extends ViewGroup {
}
mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
- int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
- scrollTo(newX, 0);
- mScroller.setFinalX(newX);
+ updateCurrentPageScroll();
invalidate();
notifyPageSwitchListener();
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e79b8e806..3823cc1c0 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1046,8 +1046,8 @@ public class Workspace extends SmoothPagedView
// For a TextView, adjust the clip rect so that we don't include the text label
if (v instanceof TextView) {
- final int iconHeight = ((TextView) v).getCompoundPaddingTop()
- clipRect.bottom = clipRect.top + iconHeight;
+ final TextView tv = (TextView) v;
+ clipRect.bottom = clipRect.top + tv.getCompoundPaddingTop() - 1;
}
// Draw the View into the bitmap.
@@ -1844,7 +1844,8 @@ public class Workspace extends SmoothPagedView
if (view == null) {
cellLayout.onDragExit();
} else {
- mTargetCell = findNearestVacantArea(x, y, 1, 1, null, cellLayout, mTargetCell);
+ mTargetCell = new int[]{x, y};
+ cellLayout.findCellForSpan(mTargetCell, 1, 1);
addInScreen(view, indexOfChild(cellLayout), mTargetCell[0],
mTargetCell[1], info.spanX, info.spanY, insertAtFirst);
cellLayout.onDropChild(view);