public void finishZoomOutAnimation() {
if (at != null) {
if (at.isAlive()) {
dragZoomOutAnimation = true;
at.setEndScale(INIT_REDUCE_FINAL_VALUE);
at.setSleepTime(FINISH_ZOOM_OUT_SLEEP_TIME);
at.setAnimationState(AnimationThread.STATE_ZOOM_OUT);
setAnimationListener();
} else {
dragZoomOutAnimation = true;
at = new AnimationThread(this, getScaleValue(matrix), INIT_REDUCE_FINAL_VALUE, SCALE_INCREMENT_VALUE,
FINISH_ZOOM_OUT_SLEEP_TIME);
needScaleCenterImg = true;
setAnimationListener();
at.start();
}
}
}
private void setAnimationListener() {
at.setOnListener(new AnimationThread.AnimationListener() {
public void onStart() {
}
public void onEnd() {
needScaleCenterImg = false;
if (at != null) {
at.setCurrentScale(BLOWUP_FINAL_VALUE);
}
}
public void onError() {
}
});
}
private float getScaleValue(Matrix matrix) {
float[] a = new float[9];
matrix.getValues(a);
return a[0];
}
private void drawCenterImg(Canvas canvas, boolean flag) {
LengthCalculate calculate = LengthCalculate.getInstance();
Drawable centerDrag = getResources().getDrawable(R.drawable.center_drag);
Rect rect = new Rect(0, 0, getWidth(), getHeight() - calculate.getGroupHeight());
if (flag) {
matrix.setScale(at.getCurrentScale(), at.getCurrentScale(), calculate.getCenterPointX(this),
calculate.getCenterPointY(this));
}
canvas.concat(matrix);
centerDrag.setBounds(rect);
centerDrag.draw(canvas);
}
private void startAnimation(float start, float end, float increment, long sleepTime) {
if (at != null) {
at.stopAnimation();
}
at = new AnimationThread(this, start, end, increment, sleepTime);
needScaleCenterImg = true;
at.start();
}
if (at != null) {
if (at.isAlive()) {
dragZoomOutAnimation = true;
at.setEndScale(INIT_REDUCE_FINAL_VALUE);
at.setSleepTime(FINISH_ZOOM_OUT_SLEEP_TIME);
at.setAnimationState(AnimationThread.STATE_ZOOM_OUT);
setAnimationListener();
} else {
dragZoomOutAnimation = true;
at = new AnimationThread(this, getScaleValue(matrix), INIT_REDUCE_FINAL_VALUE, SCALE_INCREMENT_VALUE,
FINISH_ZOOM_OUT_SLEEP_TIME);
needScaleCenterImg = true;
setAnimationListener();
at.start();
}
}
}
private void setAnimationListener() {
at.setOnListener(new AnimationThread.AnimationListener() {
public void onStart() {
}
public void onEnd() {
needScaleCenterImg = false;
if (at != null) {
at.setCurrentScale(BLOWUP_FINAL_VALUE);
}
}
public void onError() {
}
});
}
private float getScaleValue(Matrix matrix) {
float[] a = new float[9];
matrix.getValues(a);
return a[0];
}
private void drawCenterImg(Canvas canvas, boolean flag) {
LengthCalculate calculate = LengthCalculate.getInstance();
Drawable centerDrag = getResources().getDrawable(R.drawable.center_drag);
Rect rect = new Rect(0, 0, getWidth(), getHeight() - calculate.getGroupHeight());
if (flag) {
matrix.setScale(at.getCurrentScale(), at.getCurrentScale(), calculate.getCenterPointX(this),
calculate.getCenterPointY(this));
}
canvas.concat(matrix);
centerDrag.setBounds(rect);
centerDrag.draw(canvas);
}
private void startAnimation(float start, float end, float increment, long sleepTime) {
if (at != null) {
at.stopAnimation();
}
at = new AnimationThread(this, start, end, increment, sleepTime);
needScaleCenterImg = true;
at.start();
}