Пример #1
0
  @Override
  protected void dispatchDraw(Canvas canvas) {
    super.dispatchDraw(canvas);

    if (mInScrollArea && !LauncherApplication.isScreenLarge()) {
      Workspace workspace = mLauncher.getWorkspace();
      int width = workspace.getWidth();
      Rect childRect = new Rect();
      getDescendantRectRelativeToSelf(workspace.getChildAt(0), childRect);

      int page = workspace.getNextPage();
      final boolean isRtl = isLayoutDirectionRtl();
      CellLayout leftPage = (CellLayout) workspace.getChildAt(isRtl ? page + 1 : page - 1);
      CellLayout rightPage = (CellLayout) workspace.getChildAt(isRtl ? page - 1 : page + 1);

      if (leftPage != null && leftPage.getIsDragOverlapping()) {
        mLeftHoverDrawable.setBounds(
            0, childRect.top, mLeftHoverDrawable.getIntrinsicWidth(), childRect.bottom);
        mLeftHoverDrawable.draw(canvas);
      } else if (rightPage != null && rightPage.getIsDragOverlapping()) {
        mRightHoverDrawable.setBounds(
            width - mRightHoverDrawable.getIntrinsicWidth(),
            childRect.top,
            width,
            childRect.bottom);
        mRightHoverDrawable.draw(canvas);
      }
    }
  }