Example #1
0
  protected void layoutSweep(ChartSweepView sweep) {
    final Rect parentRect = new Rect(mContent);
    final Rect childRect = new Rect();

    layoutSweep(sweep, parentRect, childRect);
    sweep.layout(childRect.left, childRect.top, childRect.right, childRect.bottom);
  }
Example #2
0
  protected void layoutSweep(ChartSweepView sweep, Rect parentRect, Rect childRect) {
    final Rect sweepMargins = sweep.getMargins();

    // sweep is always placed along specific dimension
    if (sweep.getFollowAxis() == ChartSweepView.VERTICAL) {
      parentRect.top += sweepMargins.top + (int) sweep.getPoint();
      parentRect.bottom = parentRect.top;
      parentRect.left += sweepMargins.left;
      parentRect.right += sweepMargins.right;
      Gravity.apply(
          SWEEP_GRAVITY, parentRect.width(), sweep.getMeasuredHeight(), parentRect, childRect);

    } else {
      parentRect.left += sweepMargins.left + (int) sweep.getPoint();
      parentRect.right = parentRect.left;
      parentRect.top += sweepMargins.top;
      parentRect.bottom += sweepMargins.bottom;
      Gravity.apply(
          SWEEP_GRAVITY, sweep.getMeasuredWidth(), parentRect.height(), parentRect, childRect);
    }
  }