diff --git a/main/.classpath b/main/.classpath
index a4763d1..a662f00 100644
--- a/main/.classpath
+++ b/main/.classpath
@@ -1,8 +1,8 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/main/project.properties b/main/project.properties
index 337e8f3..acfc74e 100644
--- a/main/project.properties
+++ b/main/project.properties
@@ -8,5 +8,5 @@
# project structure.
# Project target.
-target=android-7
+target=android-16
android.library=true
diff --git a/main/src/com/polites/android/GestureImageView.java b/main/src/com/polites/android/GestureImageView.java
index d39d0e1..6dcd082 100644
--- a/main/src/com/polites/android/GestureImageView.java
+++ b/main/src/com/polites/android/GestureImageView.java
@@ -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;
@@ -263,12 +264,8 @@ protected void computeStartingScale(int imageWidth, int imageHeight, int measure
break;
case CENTER_INSIDE:
- if(isLandscape()) {
- startingScale = fitScaleHorizontal;
- }
- else {
- startingScale = fitScaleVertical;
- }
+ // FIX center inside should not crop the image
+ startingScale = Math.min(fitScaleHorizontal, fitScaleVertical);
break;
}
}
@@ -373,11 +370,15 @@ protected void initImage() {
if(colorFilter != null) {
this.drawable.setColorFilter(colorFilter);
}
+ // Keppel.Cao
+ layout = false;
+ startingScale = -1.0f;
}
if(!layout) {
requestLayout();
- redraw();
+ // redraw();
+ reset();
}
}
@@ -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;
+ }
}
diff --git a/main/src/com/polites/android/GestureImageViewTouchListener.java b/main/src/com/polites/android/GestureImageViewTouchListener.java
index 42e6cda..dc22b13 100644
--- a/main/src/com/polites/android/GestureImageViewTouchListener.java
+++ b/main/src/com/polites/android/GestureImageViewTouchListener.java
@@ -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;
@@ -136,6 +137,7 @@ public void onZoom(float scale, float x, float y) {
public void onComplete() {
inZoom = false;
handleUp();
+ isZoomed = zoomAnimation.getZoom() > 1.0;
}
});
@@ -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();
@@ -537,4 +540,8 @@ protected void calculateBoundaries() {
boundaryBottom = centerY + diff;
}
}
+
+ public boolean isZoomed() {
+ return isZoomed;
+ }
}