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
This commit is contained in:
Winson Chung
2010-11-11 16:34:41 -08:00
parent 580e277481
commit bbc60d8e79
8 changed files with 35 additions and 18 deletions

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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);

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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);

View File

@@ -244,6 +244,17 @@ public abstract class PagedView extends ViewGroup {
return getWidth();
}
/**
* 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.
*/
@@ -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();

View File

@@ -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);