|
|
@@ -182,12 +182,7 @@ public class CropView extends View {
|
|
|
|
|
|
@SuppressWarnings("deprecation")
|
|
|
private void init() {
|
|
|
- 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);
|
|
|
+ onCropRectChanged();
|
|
|
|
|
|
WindowManager manager = (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
|
|
|
int width = manager.getDefaultDisplay().getWidth();
|
|
|
@@ -263,8 +258,7 @@ public class CropView extends View {
|
|
|
//doLayout(mViewWidth, mViewHeight);
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public boolean onTouchEvent(MotionEvent event) {
|
|
|
+ private void onCropRectChanged() {
|
|
|
float handleLineLeftX = mFrameRectF.left - mHandleWidth;
|
|
|
float handleLineRightX = mFrameRectF.right + mHandleWidth;
|
|
|
float handleLineTopY = mFrameRectF.top - mHandleWidth;
|
|
|
@@ -274,6 +268,11 @@ public class CropView extends View {
|
|
|
if (locationListener != null) {
|
|
|
locationListener.locationRect((int)handleLineLeftX, (int)handleLineTopY, (int)handleLineRightX, (int)handleLineBottomY);
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onTouchEvent(MotionEvent event) {
|
|
|
+ onCropRectChanged();
|
|
|
|
|
|
mBitmapRectBlack = makeBitmap(coverWidth, coverHeight, 0xff000000, coverWidth, coverHeight);
|
|
|
switch (event.getAction()) {
|