Closed vxhviet closed 8 years ago
I would like to add, I solve this by addOnGlobalLayoutListener()
to the mOverlayView
object in initiateRootViews()
. Something like this:
//init position
mOverlayView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
mRectF = getOverlayViewRectF();
//do your thing
}
});
Hope this help someone,
Yes, I read #81 and this issues, and I'll try to provide more methods and callbacks in the next update so you won't need to use reflection etc.
Awesome, thanks you for your time.
Please try version 1.5.0.
I've added getter for mCropViewRect
in OverlayView
, and also revised logic (because now uCrop supports freestyle crop) so OverlayViewChangeListener#onCropRectUpdated(RectF cropRect)
will always update you with the current crop rectangle.
How can I get current RectF of the cropView?or current instace of OverlayView?
Dear @shliama,
I' currently trying to attach my own rotating wheel below the Crop Bounds. I've managed to do it in the
onClick
event of thecropAspectRatioView
like this:the
mRectF
is the privatemCropViewRect
retrieved fromOverlayView
using reflection. My wheel view update nicely when the ratio get changed.However the problem is when I try to position my wheel view below the crop bound when the activity first start up, the wheel is place at wrong position. If I understand your code correctly, you only call
mViewOverlay.postInvalidate();
:when there's a ratio change. And as such when the activity first start, when I try to get
mCropViewRect
, it still retain the old value. Is there anyway to get the updatedmCropViewRect
value when everything are fully initialized?Thank you so much for your time.