Пример #1
0
  @Override
  public boolean onScale(ScaleGestureDetector detector) {
    Logger.i(
        TAG,
        "onScale: "
            + detector.getFocusX()
            + "x"
            + detector.getFocusY()
            + " "
            + detector.getScaleFactor());
    float scale = detector.getScaleFactor();

    if (mVisibleGrid == GRID_SMALL && scale > 1 && scale < 1.33) {
      mSmallRecView.setScaleX(scale);
      mSmallRecView.setScaleY(scale);

      float alpha = (1.33f - scale) / 0.33f;
      mSmallRecView.setAlpha(alpha);
      mBigRecView.setAlpha(1 - alpha);
    } else if (mVisibleGrid == GRID_BIG && scale < 1 && scale > 0.75) {
      mBigRecView.setScaleX(scale);
      mBigRecView.setScaleY(scale);

      float alpha = (scale - 0.75f) / 0.25f;
      mSmallRecView.setAlpha(1 - alpha);
      mBigRecView.setAlpha(alpha);
    }
    return false;
  }
Пример #2
0
  @Override
  public void onScaleEnd(ScaleGestureDetector detector) {
    mBigRecView.setScaleX(1);
    mBigRecView.setScaleY(1);
    mSmallRecView.setScaleX(1);
    mSmallRecView.setScaleY(1);

    float scale = detector.getScaleFactor();
    if (mVisibleGrid == GRID_SMALL && scale > 1.1f) {
      //            mBigRecView.setVisibility(View.VISIBLE);
      //            mSmallRecView.setVisibility(View.GONE);
      mSmallRecView.setAlpha(0f);
      mBigRecView.setAlpha(1f);
      mVisibleGrid = GRID_BIG;
    } else if (mVisibleGrid == GRID_BIG && scale < 0.9f) {
      //            mBigRecView.setVisibility(View.GONE);
      //            mSmallRecView.setVisibility(View.VISIBLE);
      mSmallRecView.setAlpha(1f);
      mBigRecView.setAlpha(0f);
      mVisibleGrid = GRID_SMALL;
    }
  }