/** Listener tests for AnimatorSet. */ public class AnimatorSetEventsTest extends EventsTest { Button button; ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "translationX", 0, 100); ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "translationY", 0, 100); @Override public void setUp() throws Exception { button = (Button) getActivity().findViewById(R.id.animatingButton); mAnimator = new AnimatorSet(); ((AnimatorSet) mAnimator).playSequentially(xAnim, yAnim); super.setUp(); } @Override protected long getTimeout() { return (xAnim.getDuration() + yAnim.getDuration()) + (xAnim.getStartDelay() + yAnim.getStartDelay()) + ANIM_DELAY + FUTURE_RELEASE_DELAY; } /** Tests that an AnimatorSet can be correctly canceled during the delay of one of its children */ @MediumTest public void testPlayingCancelDuringChildDelay() throws Exception { yAnim.setStartDelay(500); final AnimatorSet animSet = new AnimatorSet(); animSet.playSequentially(xAnim, yAnim); mFutureListener = new FutureReleaseListener(mFuture); getActivity() .runOnUiThread( new Runnable() { @Override public void run() { try { Handler handler = new Handler(); animSet.addListener(mFutureListener); mRunning = true; animSet.start(); handler.postDelayed(new Canceler(animSet, mFuture), ANIM_DURATION + 250); } catch (junit.framework.AssertionFailedError e) { mFuture.setException(new RuntimeException(e)); } } }); mFuture.get(getTimeout(), TimeUnit.MILLISECONDS); } public void setTranslationX(float value) { button.setTranslationX(value); } public void setTranslationY(float value) { button.setTranslationY(value); } }
@Override public void ßløødy_Image() { if (Active_Image == -1) { Active_Image = 1; animate((View) Arpan_ßløødy_CoverImages[Active_Image]); return; } int n = Active_Image; Active_Image = (1 + Active_Image) % Arpan_ßløødy_CoverImages.length; ImageView imageView = Arpan_ßløødy_CoverImages[Active_Image]; imageView.setAlpha(0.0f); ImageView imageView2 = Arpan_ßløødy_CoverImages[n]; animate((View) imageView); AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration((long) Fade_In_Out_Animation_Duration); Animator[] animator = new Animator[] { ObjectAnimator.ofFloat((Object) imageView2, "alpha", new float[] {1.0f, 0.0f}), ObjectAnimator.ofFloat((Object) imageView, "alpha", new float[] {0.0f, 1.0f}) }; animatorSet.playTogether(animator); animatorSet.start(); }
private void v() { Object localObject1 = a.mMediaMailingMetadata; if ((r()) && (!((MediaMailingMetadata)localObject1).d().isEmpty())) { ((SendToBottomPanelView)M.a()).setBackgroundColor(getResources().getColor(2131230723)); ((SendToBottomPanelView)M.a()).setSendButtonOnClickListener(new View.OnClickListener() { public final void onClick(View paramAnonymousView) { if (!n()) { return; } SnapPreviewFragment.v(SnapPreviewFragment.this).a("SNAP_SENT_DELAY", imClientId, "preview_screen"); paramAnonymousView = imMediaMailingMetadata; if (!paramAnonymousView.d().isEmpty()) { SnapPreviewFragment.a(SnapPreviewFragment.this, akp.a(getActivity())); SnapPreviewFragment.w(SnapPreviewFragment.this).e(); } aji localaji; if (imSnapType == Mediabryo.SnapType.SNAP) { paramAnonymousView = (akg)paramAnonymousView; if (!mPostToStories.isEmpty()) { localaji = SnapPreviewFragment.i(SnapPreviewFragment.this); if (paramAnonymousView.d().isEmpty()) { break label222; } } } label222: for (boolean bool = true;; bool = false) { AnalyticsEvents.a(localaji, true, bool, "SEND_TO_SCREEN"); SnapPreviewFragment.x(SnapPreviewFragment.this).a(new bbq(CameraDisplayState.SHOW)); SnapPreviewFragment.x(SnapPreviewFragment.this).a(new bcb()); SnapPreviewFragment.x(SnapPreviewFragment.this).a(new ben(SnapPreviewFragment.i(SnapPreviewFragment.this))); ((SendToBottomPanelView)SnapPreviewFragment.y(SnapPreviewFragment.this).a()).setSendButtonOnClickListener(null); return; } } }); if (a.mIsChatMedia) { ((SendToBottomPanelView)M.a()).setClickable(false); ((SendToBottomPanelView)M.a()).setOnClickListener(null); } for (;;) { localObject4 = ""; localObject3 = ""; localObject5 = a.mMediaMailingMetadata; localObject1 = localObject3; localObject2 = localObject4; if (a.mSnapType != Mediabryo.SnapType.SNAP) { break; } localIterator = mPostToStories.iterator(); for (;;) { localObject1 = localObject3; localObject2 = localObject4; if (!localIterator.hasNext()) { break; } localObject1 = (ajy)localIterator.next(); localObject4 = (String)localObject4 + (String)localObject3 + mDisplayName; localObject3 = ", "; } ((SendToBottomPanelView)M.a()).setClickable(true); ((SendToBottomPanelView)M.a()).setOnClickListener(new View.OnClickListener() { public final void onClick(View paramAnonymousView) { if (!n()) { return; } SnapPreviewFragment.x(SnapPreviewFragment.this).a(new ben(SnapPreviewFragment.i(SnapPreviewFragment.this), true)); new EasyMetric("TAP_RECIPIENTS_IN_PREVIEW").e(); ((SendToBottomPanelView)SnapPreviewFragment.y(SnapPreviewFragment.this).a()).setOnClickListener(null); } }); } localObject3 = ((MediaMailingMetadata)localObject5).d().iterator(); while (((Iterator)localObject3).hasNext()) { localObject4 = (Friend)((Iterator)localObject3).next(); localObject2 = (String)localObject2 + (String)localObject1 + ((Friend)localObject4).e(); localObject1 = ", "; } ((SendToBottomPanelView)M.a()).setText((String)localObject2); B(); A.setVisibility(8); if (!a.mIsChatMedia) { localObject1 = (SendToBottomPanelView)M.a(); if ((c == null) || (!c.isStarted())) { f1 = awf.a(b) / 2.0F; localObject2 = ObjectAnimator.ofFloat(a, "translationY", new float[] { -1.0F * f1 }); ((ObjectAnimator)localObject2).setDuration(200L); ((ObjectAnimator)localObject2).addListener(new SendToBottomPanelView.1((SendToBottomPanelView)localObject1)); localObject3 = ObjectAnimator.ofFloat(b, "alpha", new float[] { 0.0F }); ((ObjectAnimator)localObject3).setDuration(200L); ((ObjectAnimator)localObject3).setStartDelay(3000L); localObject4 = ObjectAnimator.ofFloat(a, "translationY", new float[] { f1 }); localObject5 = new AnimatorSet(); ((AnimatorSet)localObject5).play((Animator)localObject3).with((Animator)localObject4).after((Animator)localObject2); ((AnimatorSet)localObject5).addListener(new SendToBottomPanelView.2((SendToBottomPanelView)localObject1)); c = ((Animator)localObject5); ((AnimatorSet)localObject5).start(); } } } while (a.mSnapType != Mediabryo.SnapType.DISCOVER) { Object localObject4; Object localObject3; Object localObject5; Object localObject2; Iterator localIterator; float f1; return; } z(); C(); if (avr.a(a)) { y.setVisibility(4); } for (;;) { h.setVisibility(8); A.setVisibility(8); t.setVisibility(8); return; y.setVisibility(8); } }
@Override public boolean onTouchEvent(MotionEvent event) { if (event.getAction() != MotionEvent.ACTION_DOWN && event.getAction() != MotionEvent.ACTION_MOVE) { return false; } ShapeHolder newBall = addBall(event.getX(), event.getY()); // Bouncing animation with squash and stretch float startY = newBall.getY(); float endY = getHeight() - 50f; float h = (float) getHeight(); float eventY = event.getY(); int duration = (int) (500 * ((h - eventY) / h)); ValueAnimator bounceAnim = ObjectAnimator.ofFloat(newBall, "y", startY, endY); bounceAnim.setDuration(duration); bounceAnim.setInterpolator(new AccelerateInterpolator()); ValueAnimator squashAnim1 = ObjectAnimator.ofFloat(newBall, "x", newBall.getX(), newBall.getX() - 25f); squashAnim1.setDuration(duration / 4); squashAnim1.setRepeatCount(1); squashAnim1.setRepeatMode(ValueAnimator.REVERSE); squashAnim1.setInterpolator(new DecelerateInterpolator()); ValueAnimator squashAnim2 = ObjectAnimator.ofFloat(newBall, "width", newBall.getWidth(), newBall.getWidth() + 50); squashAnim2.setDuration(duration / 4); squashAnim2.setRepeatCount(1); squashAnim2.setRepeatMode(ValueAnimator.REVERSE); squashAnim2.setInterpolator(new DecelerateInterpolator()); ValueAnimator stretchAnim1 = ObjectAnimator.ofFloat(newBall, "y", endY, endY + 25f); stretchAnim1.setDuration(duration / 4); stretchAnim1.setRepeatCount(1); stretchAnim1.setInterpolator(new DecelerateInterpolator()); stretchAnim1.setRepeatMode(ValueAnimator.REVERSE); ValueAnimator stretchAnim2 = ObjectAnimator.ofFloat(newBall, "height", newBall.getHeight(), newBall.getHeight() - 25); stretchAnim2.setDuration(duration / 4); stretchAnim2.setRepeatCount(1); stretchAnim2.setInterpolator(new DecelerateInterpolator()); stretchAnim2.setRepeatMode(ValueAnimator.REVERSE); ValueAnimator bounceBackAnim = ObjectAnimator.ofFloat(newBall, "y", endY, startY); bounceBackAnim.setDuration(duration); bounceBackAnim.setInterpolator(new DecelerateInterpolator()); // Sequence the down/squash&stretch/up animations AnimatorSet bouncer = new AnimatorSet(); bouncer.play(bounceAnim).before(squashAnim1); bouncer.play(squashAnim1).with(squashAnim2); bouncer.play(squashAnim1).with(stretchAnim1); bouncer.play(squashAnim1).with(stretchAnim2); bouncer.play(bounceBackAnim).after(stretchAnim2); // Fading animation - remove the ball when the animation is done ValueAnimator fadeAnim = ObjectAnimator.ofFloat(newBall, "alpha", 1f, 0f); fadeAnim.setDuration(250); fadeAnim.addListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { balls.remove(((ObjectAnimator) animation).getTarget()); } }); // Sequence the two animations to play one after the other AnimatorSet animatorSet = new AnimatorSet(); animatorSet.play(bouncer).before(fadeAnim); // Start the animation animatorSet.start(); return true; }