Merge "Moving side-page indicators to DragLayer to ensure it draws above hotseat gradient. (Bug 5117499)" into jb-dev

This commit is contained in:
Winson Chung
2012-04-27 15:06:04 -07:00
committed by Android (Google) Code Review
4 changed files with 60 additions and 37 deletions
+5 -35
View File
@@ -38,6 +38,8 @@ import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
import android.graphics.Region.Op;
import android.graphics.drawable.Drawable;
@@ -1313,38 +1315,6 @@ public class Workspace extends SmoothPagedView
return (mBackground != null && mBackgroundAlpha > 0.0f && mDrawBackground);
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (mInScrollArea && !LauncherApplication.isScreenLarge()) {
final int width = getWidth();
final int height = getHeight();
final int pageHeight = getChildAt(0).getHeight();
// Set the height of the outline to be the height of the page
final int offset = (height - pageHeight - getPaddingTop() - getPaddingBottom()) / 2;
final int paddingTop = getPaddingTop() + offset;
final int paddingBottom = getPaddingBottom() + offset;
final int page = (mNextPage != INVALID_PAGE ? mNextPage : mCurrentPage);
final CellLayout leftPage = (CellLayout) getChildAt(page - 1);
final CellLayout rightPage = (CellLayout) getChildAt(page + 1);
if (leftPage != null && leftPage.getIsDragOverlapping()) {
final Drawable d = getResources().getDrawable(R.drawable.page_hover_left_holo);
d.setBounds(getScrollX(), paddingTop, getScrollX() + d.getIntrinsicWidth(),
height - paddingBottom);
d.draw(canvas);
} else if (rightPage != null && rightPage.getIsDragOverlapping()) {
final Drawable d = getResources().getDrawable(R.drawable.page_hover_right_holo);
d.setBounds(getScrollX() + width - d.getIntrinsicWidth(), paddingTop,
getScrollX() + width, height - paddingBottom);
d.draw(canvas);
}
}
}
@Override
protected boolean onRequestFocusInDescendants(int direction, Rect previouslyFocusedRect) {
if (!mLauncher.isAllAppsVisible()) {
@@ -1564,7 +1534,7 @@ public class Workspace extends SmoothPagedView
AnimatorSet anim = animated ? new AnimatorSet() : null;
// Stop any scrolling, move to the current page right away
setCurrentPage((mNextPage != INVALID_PAGE) ? mNextPage : mCurrentPage);
setCurrentPage(getNextPage());
final State oldState = mState;
final boolean oldStateIsNormal = (oldState == State.NORMAL);
@@ -3289,7 +3259,7 @@ public class Workspace extends SmoothPagedView
* screen while a scroll is in progress.
*/
public CellLayout getCurrentDropLayout() {
return (CellLayout) getChildAt(mNextPage == INVALID_PAGE ? mCurrentPage : mNextPage);
return (CellLayout) getChildAt(getNextPage());
}
/**
@@ -3441,7 +3411,7 @@ public class Workspace extends SmoothPagedView
if (!isSmall() && !mIsSwitchingState) {
mInScrollArea = true;
final int page = (mNextPage != INVALID_PAGE ? mNextPage : mCurrentPage) +
final int page = getNextPage() +
(direction == DragController.SCROLL_LEFT ? -1 : 1);
// We always want to exit the current layout to ensure parity of enter / exit