/** 旋转完成后自定义动画旋转 */ private void handleFinishTouch() { if_animate = true; changeDegree = (float) getActionDegrees(centerX, centerY, saveX, saveY, curTouchX, curTouchY); tempDegree = (float) curDegree + changeDegree; if (tempDegree >= 0f && tempDegree < 45f) { flag = 0; ((FourModuleChooseActivity) currentContext).getFragment(0); } else if (tempDegree >= 45f && tempDegree < 90f) { flag = 1; ((FourModuleChooseActivity) currentContext).getFragment(1); } else if (tempDegree >= 90f && tempDegree < 135f) { ((FourModuleChooseActivity) currentContext).getFragment(1); flag = 2; } else if (tempDegree >= 135f && tempDegree < 180f) { ((FourModuleChooseActivity) currentContext).getFragment(2); flag = 3; } else if (tempDegree >= 180f && tempDegree < 225f) { ((FourModuleChooseActivity) currentContext).getFragment(2); flag = 4; } else if (tempDegree >= 225f && tempDegree < 270f) { ((FourModuleChooseActivity) currentContext).getFragment(3); flag = 5; } else if (tempDegree >= 270f && tempDegree < 315f) { ((FourModuleChooseActivity) currentContext).getFragment(3); flag = 6; } else { ((FourModuleChooseActivity) currentContext).getFragment(0); flag = 7; } new Thread(new FLingRunnable()).start(); saveTouchPoint(); }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // centerX = (float) this.getWidth() / 2; // centerY = (float) this.getHeight() / 2; centerX = (float) this.getHeight() / 2; centerY = (float) this.getHeight() / 2; if (Count == 0) { ((FourModuleChooseActivity) currentContext).setMargin(this.getWidth(), this.getHeight()); Count++; } }