/** * Resets the widget to default state and cancels all animation. If animate is 'true', will * animate objects into place. Otherwise, objects will snap back to place. * * @param animate */ public void reset(boolean animate) { mGlowAnimations.stop(); mTargetAnimations.stop(); startBackgroundAnimation(0, 0.0f); stopAndHideWaveAnimation(); hideTargets(animate, false); hideGlow(0, 0, 0.0f, null); Tweener.reset(); }
private void switchToState(int state, float x, float y) { switch (state) { case STATE_IDLE: deactivateTargets(); hideGlow(0, 0, 0.0f, null); startBackgroundAnimation(0, 0.0f); mHandleDrawable.setState(TargetDrawable.STATE_INACTIVE); mHandleDrawable.setAlpha(1.0f); break; case STATE_START: startBackgroundAnimation(0, 0.0f); break; case STATE_FIRST_TOUCH: mHandleDrawable.setAlpha(0.0f); deactivateTargets(); showTargets(true); startBackgroundAnimation(INITIAL_SHOW_HANDLE_DURATION, 1.0f); setGrabbedState(OnTriggerListener.CENTER_HANDLE); if (AccessibilityManager.getInstance(mContext).isEnabled()) { announceTargets(); } break; case STATE_TRACKING: mHandleDrawable.setAlpha(0.0f); showGlow(REVEAL_GLOW_DURATION, REVEAL_GLOW_DELAY, 1.0f, null); break; case STATE_SNAP: // TODO: Add transition states (see list_selector_background_transition.xml) mHandleDrawable.setAlpha(0.0f); showGlow(REVEAL_GLOW_DURATION, REVEAL_GLOW_DELAY, 0.0f, null); break; case STATE_FINISH: doFinish(); break; } }