Search in sources :

Example 31 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project Crouton by keyboardsurfer.

the class DefaultAnimationsBuilder method buildDefaultSlideOutUpAnimation.

/**
   * @param croutonView
   *   The croutonView which gets animated.
   *
   * @return The default Animation for a hiding {@link Crouton}.
   */
static Animation buildDefaultSlideOutUpAnimation(View croutonView) {
    if (!areLastMeasuredOutAnimationHeightAndCurrentEqual(croutonView) || (null == slideOutUpAnimation)) {
        slideOutUpAnimation = new TranslateAnimation(// X: from, to
        0, // X: from, to
        0, // Y: from, to
        0, // Y: from, to
        -croutonView.getMeasuredHeight());
        slideOutUpAnimation.setDuration(DURATION);
        setLastOutAnimationHeight(croutonView.getMeasuredHeight());
    }
    return slideOutUpAnimation;
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation)

Example 32 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project SnackBar by MrEngineer13.

the class SnackContainer method init.

private void init() {
    mInAnimationSet = new AnimationSet(false);
    TranslateAnimation mSlideInAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f);
    AlphaAnimation mFadeInAnimation = new AlphaAnimation(0.0f, 1.0f);
    mInAnimationSet.addAnimation(mSlideInAnimation);
    mInAnimationSet.addAnimation(mFadeInAnimation);
    mOutAnimationSet = new AnimationSet(false);
    TranslateAnimation mSlideOutAnimation = new TranslateAnimation(TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_PARENT, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 0.0f, TranslateAnimation.RELATIVE_TO_SELF, 1.0f);
    AlphaAnimation mFadeOutAnimation = new AlphaAnimation(1.0f, 0.0f);
    mOutAnimationSet.addAnimation(mSlideOutAnimation);
    mOutAnimationSet.addAnimation(mFadeOutAnimation);
    mOutAnimationSet.setDuration(ANIMATION_DURATION);
    mOutAnimationSet.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            removeAllViews();
            if (!mSnacks.isEmpty()) {
                sendOnHide(mSnacks.poll());
            }
            if (!isEmpty()) {
                showSnack(mSnacks.peek());
            } else {
                setVisibility(View.GONE);
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) TranslateAnimation(android.view.animation.TranslateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 33 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project actor-platform by actorapp.

the class AttachFragment method hide.

@Override
public void hide() {
    if (root != null && root.getVisibility() == View.VISIBLE) {
        onHidden();
        fastAttachAdapter.clearSelected();
        messenger().getGalleryScannerActor().send(new GalleryScannerActor.Hide());
        fastShare.scrollToPosition(0);
        hideView(root);
        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP && !isFastShareFullScreen) {
            View internal = fastShare;
            int cx = internal.getWidth() - Screen.dp(56 + 56);
            int cy = internal.getHeight() - Screen.dp(56 / 2);
            float finalRadius = (float) Math.hypot(cx, cy);
            Animator anim = ViewAnimationUtils.createCircularReveal(internal, cx, cy, finalRadius, 0);
            anim.addListener(new Animator.AnimatorListener() {

                @Override
                public void onAnimationStart(Animator animator) {
                    internal.setAlpha(1);
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    internal.setAlpha(0);
                }

                @Override
                public void onAnimationCancel(Animator animator) {
                }

                @Override
                public void onAnimationRepeat(Animator animator) {
                }
            });
            anim.setDuration(200);
            anim.start();
        } else {
            TranslateAnimation animation = new TranslateAnimation(0, 0, 0, root.getHeight());
            animation.setInterpolator(MaterialInterpolator.getInstance());
            animation.setDuration(250);
            fastShare.startAnimation(animation);
            bottomBackground.startAnimation(animation);
        }
    }
}
Also used : Animator(android.animation.Animator) TranslateAnimation(android.view.animation.TranslateAnimation) GalleryScannerActor(im.actor.core.utils.GalleryScannerActor) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView)

Example 34 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project actor-platform by actorapp.

the class InputBarFragment method hideAudio.

protected void hideAudio(boolean cancel) {
    if (!isAudioVisible) {
        return;
    }
    isAudioVisible = false;
    showView(attachButton);
    showView(messageEditText);
    showView(emojiButton);
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
    voiceRecordActor.send(new VoiceCaptureActor.Stop(cancel));
    TranslateAnimation animation = new TranslateAnimation(0, Screen.getWidth(), 0, 0);
    animation.setDuration(160);
    audioContainer.clearAnimation();
    audioContainer.setAnimation(animation);
    audioContainer.animate();
    audioContainer.setVisibility(View.GONE);
    messageEditText.requestFocus();
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) VoiceCaptureActor(im.actor.sdk.core.audio.VoiceCaptureActor)

Example 35 with TranslateAnimation

use of android.view.animation.TranslateAnimation in project actor-platform by actorapp.

the class InputBarFragment method showAudio.

protected void showAudio() {
    if (Build.VERSION.SDK_INT >= 23) {
        if (ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED || ContextCompat.checkSelfPermission(getActivity(), Manifest.permission.VIBRATE) != PackageManager.PERMISSION_GRANTED) {
            requestPermissions(new String[] { Manifest.permission.RECORD_AUDIO, Manifest.permission.VIBRATE }, PERMISSION_REQUEST_RECORD_AUDIO);
            return;
        }
    }
    if (isAudioVisible) {
        return;
    }
    isAudioVisible = true;
    hideView(attachButton);
    hideView(messageEditText);
    hideView(emojiButton);
    audioFile = ActorSDK.sharedActor().getMessenger().getInternalTempFile("voice_msg", "opus");
    getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
    voiceRecordActor.send(new VoiceCaptureActor.Start(audioFile));
    slideAudio(0);
    audioTimer.setText("00:00");
    TranslateAnimation animation = new TranslateAnimation(Screen.getWidth(), 0, 0, 0);
    animation.setDuration(160);
    audioContainer.clearAnimation();
    audioContainer.setAnimation(animation);
    audioContainer.animate();
    audioContainer.setVisibility(View.VISIBLE);
    AlphaAnimation alphaAnimation = new AlphaAnimation(1f, 0.2f);
    alphaAnimation.setDuration(800);
    alphaAnimation.setRepeatMode(AlphaAnimation.REVERSE);
    alphaAnimation.setRepeatCount(AlphaAnimation.INFINITE);
    recordPoint.clearAnimation();
    recordPoint.setAnimation(alphaAnimation);
    recordPoint.animate();
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) VoiceCaptureActor(im.actor.sdk.core.audio.VoiceCaptureActor) AlphaAnimation(android.view.animation.AlphaAnimation)

Aggregations

TranslateAnimation (android.view.animation.TranslateAnimation)157 Animation (android.view.animation.Animation)70 AlphaAnimation (android.view.animation.AlphaAnimation)65 AnimationSet (android.view.animation.AnimationSet)48 ScaleAnimation (android.view.animation.ScaleAnimation)27 View (android.view.View)17 AnimationListener (android.view.animation.Animation.AnimationListener)16 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)14 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)14 ClipRectAnimation (android.view.animation.ClipRectAnimation)12 LinearInterpolator (android.view.animation.LinearInterpolator)12 CurvedTranslateAnimation (com.android.server.wm.animation.CurvedTranslateAnimation)12 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)11 ListView (android.widget.ListView)11 TextView (android.widget.TextView)11 ImageView (android.widget.ImageView)9 WindowAnimation_activityCloseEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation)8 WindowAnimation_activityCloseExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation)8 WindowAnimation_activityOpenEnterAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation)8 WindowAnimation_activityOpenExitAnimation (com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation)8