Skip to content

Commit

Permalink
- added isZoomed feature
Browse files Browse the repository at this point in the history
  • Loading branch information
httpdispatch committed Oct 26, 2012
1 parent f47c43d commit 58445b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
# project structure.

# Project target.
target=android-7
target=android-16
android.library=true
8 changes: 8 additions & 0 deletions main/src/com/polites/android/GestureImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.InputStream;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

import android.content.Context;
import android.content.res.Configuration;
import android.database.Cursor;
Expand Down Expand Up @@ -709,4 +710,11 @@ else if(deviceOrientation == Configuration.ORIENTATION_PORTRAIT) {
public int getDeviceOrientation() {
return deviceOrientation;
}

public boolean isZoomed() {
if (gestureImageViewTouchListener != null) {
return gestureImageViewTouchListener.isZoomed();
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class GestureImageViewTouchListener implements OnTouchListener {

private boolean touched = false;
private boolean inZoom = false;
private boolean isZoomed = false;

private float initialDistance;
private float lastScale = 1.0f;
Expand Down Expand Up @@ -136,6 +137,7 @@ public void onZoom(float scale, float x, float y) {
public void onComplete() {
inZoom = false;
handleUp();
isZoomed = zoomAnimation.getZoom() > 1.0;
}
});

Expand Down Expand Up @@ -279,6 +281,7 @@ public boolean onTouch(View v, MotionEvent event) {

if(event.getAction() == MotionEvent.ACTION_UP) {
handleUp();
isZoomed = !(lastScale == startingScale);
}
else if(event.getAction() == MotionEvent.ACTION_DOWN) {
stopAnimations();
Expand Down Expand Up @@ -537,4 +540,8 @@ protected void calculateBoundaries() {
boundaryBottom = centerY + diff;
}
}

public boolean isZoomed() {
return isZoomed;
}
}

0 comments on commit 58445b8

Please sign in to comment.