<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" />
<!-- 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>
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);
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;
}
}
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;
}
}
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
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);
}
/**
+ * 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) {
}
mCurrentPage = Math.max(0, Math.min(currentPage, getPageCount() - 1));
- int newX = getChildOffset(mCurrentPage) - getRelativeChildOffset(mCurrentPage);
- scrollTo(newX, 0);
- mScroller.setFinalX(newX);
+ updateCurrentPageScroll();
invalidate();
notifyPageSwitchListener();
// 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.
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);