diff options
author | Winson Chung <winsonc@google.com> | 2010-11-11 16:34:41 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2010-11-11 17:20:48 -0800 |
commit | bbc60d8e79416e37cbede55c159bf6aaa6c171d5 (patch) | |
tree | a5e6177b9f5e96bdaff0c17092f6df84451d9e3b | |
parent | 580e27748137ff08599aa719d106b31215a28353 (diff) | |
download | android_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
-rw-r--r-- | res/anim/paged_view_click_feedback.xml | 4 | ||||
-rw-r--r-- | res/values-xlarge/config.xml | 4 | ||||
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/CustomizePagedView.java | 1 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher2/PagedView.java | 15 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 7 |
8 files changed, 35 insertions, 18 deletions
diff --git a/res/anim/paged_view_click_feedback.xml b/res/anim/paged_view_click_feedback.xml index 786d9744a..d1e6e2360 100644 --- a/res/anim/paged_view_click_feedback.xml +++ b/res/anim/paged_view_click_feedback.xml @@ -16,8 +16,8 @@ <alpha xmlns:android="http://schemas.android.com/apk/res/android" android:fromAlpha="1.0" - android:toAlpha="0.65" - android:duration="100" + android:toAlpha="0.5" + android:duration="75" android:fillAfter="true" android:repeatCount="1" android:repeatMode="reverse" /> diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml index 6a566799a..a54528e11 100644 --- a/res/values-xlarge/config.xml +++ b/res/values-xlarge/config.xml @@ -5,6 +5,10 @@ <!-- NB: This should be less than the workspaceShrinkTime as they happen together. --> <integer name="config_allAppsZoomInTime">350</integer> + <!-- Duration in milliseconds of the transition between tabs in the all apps/customize + tray --> + <integer name="config_tabTransitionTime">100</integer> + <!-- Duration in milliseconds of the all apps zoom-out animation --> <!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. --> <integer name="config_allAppsZoomOutTime">350</integer> 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); |