|
|
@@ -120,15 +120,15 @@ public class CropView extends View {
|
|
|
coverWidth = (int) (getWidth()*0.815);
|
|
|
// 最小高度不能小于图片的高度
|
|
|
// coverHeight = Math.max(minHeight, (int)(getWidth()*0.3));
|
|
|
- coverHeight = SizeUtils.dp2px(50);
|
|
|
+ coverHeight = SizeUtils.dp2px(65);
|
|
|
sX = (getWidth()*1.0f-coverWidth)/2;
|
|
|
sY = getWidth()*0.177f;
|
|
|
mFrameRectF = new RectF(sX, sY, sX + coverWidth, sY + coverHeight);
|
|
|
break;
|
|
|
case SCAN_TYPE_ADDRESS:
|
|
|
case SCAN_TYPE_NAME:
|
|
|
- coverWidth = (int) (getWidth()*0.815);
|
|
|
- coverHeight = (int) (getWidth()*0.625);
|
|
|
+ coverWidth = (int) (getWidth()*0.75);
|
|
|
+ coverHeight = (int) (getWidth()*0.58);
|
|
|
sX = (getWidth()*1.0f-coverWidth)/2;
|
|
|
sY = (getHeight()*1.0f-coverHeight)/2;
|
|
|
mFrameRectF = new RectF(sX, sY, sX + coverWidth, sY + coverHeight);
|
|
|
@@ -374,6 +374,9 @@ public class CropView extends View {
|
|
|
}
|
|
|
|
|
|
private void onActionDown(MotionEvent event) {
|
|
|
+ // 按下时停止动画
|
|
|
+ AnimateManager.getInstance().stopAnimation();
|
|
|
+
|
|
|
invalidate();
|
|
|
mLastX = event.getX();
|
|
|
mLastY = event.getY();
|
|
|
@@ -540,6 +543,25 @@ public class CropView extends View {
|
|
|
}
|
|
|
|
|
|
private void onActionUp() {
|
|
|
+ float handleLineLeftX = mFrameRectF.left - mHandleWidth;
|
|
|
+ float handleLineRightX = mFrameRectF.right + mHandleWidth;
|
|
|
+ float handleLineTopY = mFrameRectF.top - mHandleWidth;
|
|
|
+ float handleLineBottomY = mFrameRectF.bottom + mHandleWidth;
|
|
|
+ coverWidth = (int) (handleLineRightX - handleLineLeftX);
|
|
|
+ coverHeight = (int) (handleLineBottomY - handleLineTopY);
|
|
|
+
|
|
|
+ new Handler().postDelayed(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ if (coverWidth > coverHeight) {
|
|
|
+ AnimateManager.getInstance().setWidth(coverWidth, coverHeight, (int)handleLineLeftX, (int)handleLineTopY, (int)handleLineRightX, (int)handleLineBottomY);
|
|
|
+ } else {
|
|
|
+ AnimateManager.getInstance().setHeight(coverWidth, coverHeight, (int)handleLineLeftX, (int)handleLineTopY, (int)handleLineRightX, (int)handleLineBottomY);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 50);
|
|
|
+
|
|
|
+
|
|
|
mTouchArea = TouchAreaEnum.OUT_OF_BOUNDS;
|
|
|
invalidate();
|
|
|
}
|