if (at.isAlive()) {
if (!dragZoomOutAnimation) {
at.setAnimationState(AnimationThread.STATE_ZOOM_OUT);
}
} else if (!at.isNormalOver()) {
startAnimation(getScaleValue(matrix), REDUCE_FINAL_VALUE, SCALE_INCREMENT_VALUE, SLEEP_TIME); // narrow animation.
}
drawCenterImg(canvas, needScaleCenterImg);
} else {
if (at != null) {
if (at.isAlive()) {
at.setEndScale(BLOWUP_FINAL_VALUE);
at.setSleepTime(SLEEP_TIME);
at.setAnimationState(AnimationThread.STATE_ZOOM_IN);
} else {
if (at.getCurrentScale() != BLOWUP_FINAL_VALUE
&& (at.getAnimationState() == AnimationThread.STATE_ZOOM_OUT || dragZoomOutAnimation)) {
startAnimation(getScaleValue(matrix), BLOWUP_FINAL_VALUE, SCALE_INCREMENT_VALUE, SLEEP_TIME); // enlarge animation.
}
}
dragZoomOutAnimation = false;
if (at.isAlive()) {
drawCenterImg(canvas, true);
} else {
stopAnimation();
}
}
}
super.dispatchDraw(canvas);
}
@Override
public void removeView(View view) {
if (view instanceof Folder) {
havaOpenFolder = false;
}
super.removeView(view);
}
public void stopAnimation() {
if (at != null) {
at.stopAnimation();
at = null;
}
dragZoomOutAnimation = false;
matrix.setScale(BLOWUP_FINAL_VALUE, BLOWUP_FINAL_VALUE);
}
public void initAnimation() {
if (at != null) {
at.stopAnimation();
}
dragZoomOutAnimation = true;
needScaleCenterImg = true;
at = new AnimationThread(this, INIT_REDUCE_FINAL_VALUE, REDUCE_FINAL_VALUE, SCALE_INCREMENT_VALUE,
INIT_SLEEP_TIME);
at.start();
}
public void finishZoomInAnimation() {
if (at != null && !FadeAnimationView.isStarted) {
if (at.isAlive()) {
dragZoomOutAnimation = true;
at.setEndScale(BLOWUP_FINAL_VALUE);
at.setSleepTime(FINISH_ZOOM_IN_SLEEP_TIME);
at.setAnimationState(AnimationThread.STATE_ZOOM_IN);
} else {
dragZoomOutAnimation = true;
at = new AnimationThread(this, getScaleValue(matrix), BLOWUP_FINAL_VALUE, SCALE_INCREMENT_VALUE,
FINISH_ZOOM_IN_SLEEP_TIME);
needScaleCenterImg = true;
at.start();
}
}
}
if (!dragZoomOutAnimation) {
at.setAnimationState(AnimationThread.STATE_ZOOM_OUT);
}
} else if (!at.isNormalOver()) {
startAnimation(getScaleValue(matrix), REDUCE_FINAL_VALUE, SCALE_INCREMENT_VALUE, SLEEP_TIME); // narrow animation.
}
drawCenterImg(canvas, needScaleCenterImg);
} else {
if (at != null) {
if (at.isAlive()) {
at.setEndScale(BLOWUP_FINAL_VALUE);
at.setSleepTime(SLEEP_TIME);
at.setAnimationState(AnimationThread.STATE_ZOOM_IN);
} else {
if (at.getCurrentScale() != BLOWUP_FINAL_VALUE
&& (at.getAnimationState() == AnimationThread.STATE_ZOOM_OUT || dragZoomOutAnimation)) {
startAnimation(getScaleValue(matrix), BLOWUP_FINAL_VALUE, SCALE_INCREMENT_VALUE, SLEEP_TIME); // enlarge animation.
}
}
dragZoomOutAnimation = false;
if (at.isAlive()) {
drawCenterImg(canvas, true);
} else {
stopAnimation();
}
}
}
super.dispatchDraw(canvas);
}
@Override
public void removeView(View view) {
if (view instanceof Folder) {
havaOpenFolder = false;
}
super.removeView(view);
}
public void stopAnimation() {
if (at != null) {
at.stopAnimation();
at = null;
}
dragZoomOutAnimation = false;
matrix.setScale(BLOWUP_FINAL_VALUE, BLOWUP_FINAL_VALUE);
}
public void initAnimation() {
if (at != null) {
at.stopAnimation();
}
dragZoomOutAnimation = true;
needScaleCenterImg = true;
at = new AnimationThread(this, INIT_REDUCE_FINAL_VALUE, REDUCE_FINAL_VALUE, SCALE_INCREMENT_VALUE,
INIT_SLEEP_TIME);
at.start();
}
public void finishZoomInAnimation() {
if (at != null && !FadeAnimationView.isStarted) {
if (at.isAlive()) {
dragZoomOutAnimation = true;
at.setEndScale(BLOWUP_FINAL_VALUE);
at.setSleepTime(FINISH_ZOOM_IN_SLEEP_TIME);
at.setAnimationState(AnimationThread.STATE_ZOOM_IN);
} else {
dragZoomOutAnimation = true;
at = new AnimationThread(this, getScaleValue(matrix), BLOWUP_FINAL_VALUE, SCALE_INCREMENT_VALUE,
FINISH_ZOOM_IN_SLEEP_TIME);
needScaleCenterImg = true;
at.start();
}
}
}