Rearrange member variables and method parameters in Zoom.java

This commit is contained in:
misaochan 2018-05-29 18:17:27 +10:00
parent 56592b3bcd
commit 50b674f221
2 changed files with 7 additions and 8 deletions

View file

@ -501,7 +501,7 @@ public class ShareActivity
/*
* function to provide pinch zoom
*/
private void zoomImageFromThumb(final View thumbView, Uri imageuri ) {
private void zoomImageFromThumb(final View thumbView, Uri imageuri) {
// If there's an animation in progress, cancel it immediately and proceed with this one.
if (CurrentAnimator != null) {
CurrentAnimator.cancel();
@ -518,13 +518,13 @@ public class ShareActivity
e.printStackTrace();
}
Zoom zoomObj = new Zoom(thumbView, startBounds, input, imageuri, this.getContentResolver());
Zoom zoomObj = new Zoom(thumbView, flContainer, input, imageuri, this.getContentResolver());
Bitmap scaledImage = zoomObj.createScaledImage();
// Load the high-resolution "zoomed-in" image.
expandedImageView.setImageBitmap(scaledImage);
float startScale = zoomObj.adjustStartEndBounds(finalBounds, globalOffset);
float startScale = zoomObj.adjustStartEndBounds(startBounds, finalBounds, globalOffset);
// Hide the thumbnail and show the zoomed-in view. When the animation
// begins, it will position the zoomed-in view in the place of the

View file

@ -18,18 +18,18 @@ import java.io.InputStream;
public class Zoom {
private View thumbView;
private Rect startBounds;
private InputStream input;
private Uri imageUri;
private ContentResolver contentResolver;
private FrameLayout flContainer;
public Zoom(View thumbView, Rect startBounds, InputStream input, Uri imageUri, ContentResolver contentResolver) {
Zoom(View thumbView, FrameLayout flContainer, InputStream input, Uri imageUri, ContentResolver contentResolver) {
this.thumbView = thumbView;
this.startBounds = startBounds;
this.input = input;
this.imageUri = imageUri;
this.contentResolver = contentResolver;
this.flContainer = flContainer;
}
Bitmap createScaledImage() {
@ -61,8 +61,7 @@ public class Zoom {
return scaled;
}
float adjustStartEndBounds(Rect finalBounds, Point globalOffset) {
float adjustStartEndBounds(Rect startBounds, Rect finalBounds, Point globalOffset) {
// Calculate the starting and ending bounds for the zoomed-in image.
// The start bounds are the global visible rectangle of the thumbnail,
// and the final bounds are the global visible rectangle of the container