Search in sources :

Example 16 with AnimationCompleteListener

use of org.thoughtcrime.securesms.animation.AnimationCompleteListener in project Signal-Android by signalapp.

the class RegistrationActivity method displayRestoreView.

private void displayRestoreView(@NonNull BackupUtil.BackupInfo backup) {
    title.animate().translationX(title.getWidth()).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            title.setText(R.string.RegistrationActivity_restore_from_backup);
            title.clearAnimation();
            title.setTranslationX(-1 * title.getWidth());
            title.animate().translationX(0).setListener(null).setInterpolator(new OvershootInterpolator()).setDuration(SCENE_TRANSITION_DURATION).start();
        }
    }).start();
    subtitle.animate().translationX(subtitle.getWidth()).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            subtitle.setText(R.string.RegistrationActivity_restore_your_messages_and_media_from_a_local_backup);
            subtitle.clearAnimation();
            subtitle.setTranslationX(-1 * subtitle.getWidth());
            subtitle.animate().translationX(0).setListener(null).setInterpolator(new OvershootInterpolator()).setDuration(SCENE_TRANSITION_DURATION).start();
        }
    }).start();
    registrationContainer.animate().translationX(registrationContainer.getWidth()).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            registrationContainer.clearAnimation();
            registrationContainer.setVisibility(View.INVISIBLE);
            registrationContainer.setTranslationX(0);
            restoreContainer.setTranslationX(-1 * registrationContainer.getWidth());
            restoreContainer.setVisibility(View.VISIBLE);
            restoreButton.setProgress(0);
            restoreButton.setIndeterminateProgressMode(false);
            restoreButton.setOnClickListener(v -> handleRestore(backup));
            restoreBackupSize.setText(getString(R.string.RegistrationActivity_backup_size_s, Util.getPrettyFileSize(backup.getSize())));
            restoreBackupTime.setText(getString(R.string.RegistrationActivity_backup_timestamp_s, DateUtils.getExtendedRelativeTimeSpanString(RegistrationActivity.this, Locale.US, backup.getTimestamp())));
            restoreBackupProgress.setText("");
            restoreContainer.animate().translationX(0).setDuration(SCENE_TRANSITION_DURATION).setListener(null).setInterpolator(new OvershootInterpolator()).start();
        }
    }).start();
    fab.animate().rotationBy(375f).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            fab.clearAnimation();
            fab.setImageResource(R.drawable.ic_restore_white_24dp);
            fab.animate().rotationBy(360f).setDuration(SCENE_TRANSITION_DURATION).setListener(null).start();
        }
    }).start();
}
Also used : Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 17 with AnimationCompleteListener

use of org.thoughtcrime.securesms.animation.AnimationCompleteListener in project Signal-Android by signalapp.

the class RegistrationActivity method displayPinView.

private void displayPinView(String code, long lockedUntil) {
    title.animate().translationX(-1 * title.getWidth()).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            title.setText(R.string.RegistrationActivity_registration_lock_pin);
            title.clearAnimation();
            title.setTranslationX(title.getWidth());
            title.animate().translationX(0).setListener(null).setInterpolator(new OvershootInterpolator()).setDuration(SCENE_TRANSITION_DURATION).start();
        }
    }).start();
    subtitle.animate().translationX(-1 * subtitle.getWidth()).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            subtitle.setText(R.string.RegistrationActivity_this_phone_number_has_registration_lock_enabled_please_enter_the_registration_lock_pin);
            subtitle.clearAnimation();
            subtitle.setTranslationX(subtitle.getWidth());
            subtitle.animate().translationX(0).setListener(null).setInterpolator(new OvershootInterpolator()).setDuration(SCENE_TRANSITION_DURATION).start();
        }
    }).start();
    verificationContainer.animate().translationX(-1 * verificationContainer.getWidth()).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            verificationContainer.clearAnimation();
            verificationContainer.setVisibility(View.INVISIBLE);
            verificationContainer.setTranslationX(0);
            pinContainer.setTranslationX(pinContainer.getWidth());
            pinContainer.setVisibility(View.VISIBLE);
            pinContainer.animate().translationX(0).setListener(null).setInterpolator(new OvershootInterpolator()).setDuration(SCENE_TRANSITION_DURATION).start();
        }
    }).start();
    fab.animate().rotationBy(-360f).setDuration(SCENE_TRANSITION_DURATION).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            fab.clearAnimation();
            fab.setImageResource(R.drawable.ic_lock_white_24dp);
            fab.animate().rotationBy(-360f).setDuration(SCENE_TRANSITION_DURATION).setListener(null).start();
        }
    }).start();
    pinButton.setOnClickListener(v -> handleVerifyWithPinClicked(code, pin.getText().toString()));
    pinForgotButton.setOnClickListener(v -> handleForgottenPin(lockedUntil));
    pin.addTextChangedListener(new TextWatcher() {

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            if (s != null && code.equals(s.toString()))
                pinClarificationContainer.setVisibility(View.VISIBLE);
            else if (pinClarificationContainer.getVisibility() == View.VISIBLE)
                pinClarificationContainer.setVisibility(View.GONE);
        }
    });
}
Also used : Animator(android.animation.Animator) OvershootInterpolator(android.view.animation.OvershootInterpolator) TextWatcher(android.text.TextWatcher) Editable(android.text.Editable) TextPaint(android.text.TextPaint) SuppressLint(android.annotation.SuppressLint) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 18 with AnimationCompleteListener

use of org.thoughtcrime.securesms.animation.AnimationCompleteListener in project Signal-Android by WhisperSystems.

the class ConversationReactionOverlay method newHideAnimatorSet.

@NonNull
private AnimatorSet newHideAnimatorSet() {
    AnimatorSet set = new AnimatorSet();
    set.addListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            setVisibility(View.GONE);
        }
    });
    set.setInterpolator(INTERPOLATOR);
    set.playTogether(newHideAnimators());
    return set;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorSet(android.animation.AnimatorSet) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener) NonNull(androidx.annotation.NonNull)

Example 19 with AnimationCompleteListener

use of org.thoughtcrime.securesms.animation.AnimationCompleteListener in project Signal-Android by WhisperSystems.

the class ConversationReactionOverlay method hideInternal.

private void hideInternal(@Nullable OnHideListener onHideListener) {
    overlayState = OverlayState.HIDDEN;
    AnimatorSet animatorSet = newHideAnimatorSet();
    hideAnimatorSet = animatorSet;
    revealAnimatorSet.end();
    animatorSet.start();
    if (onHideListener != null) {
        onHideListener.startHide();
    }
    if (selectedConversationModel.getFocusedView() != null) {
        ViewUtil.focusAndShowKeyboard(selectedConversationModel.getFocusedView());
    }
    animatorSet.addListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            animatorSet.removeListener(this);
            toolbarShade.setVisibility(INVISIBLE);
            inputShade.setVisibility(INVISIBLE);
            if (onHideListener != null) {
                onHideListener.onHide();
            }
        }
    });
    if (contextMenu != null) {
        contextMenu.dismiss();
    }
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ValueAnimator(android.animation.ValueAnimator) AnimatorSet(android.animation.AnimatorSet) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 20 with AnimationCompleteListener

use of org.thoughtcrime.securesms.animation.AnimationCompleteListener in project Signal-Android by WhisperSystems.

the class PictureInPictureGestureHelper method fling.

private void fling() {
    Point projection = new Point((int) projectionX, (int) projectionY);
    Point nearestCornerPosition = findNearestCornerPosition(projection);
    isAnimating = true;
    isDragging = false;
    child.animate().translationX(getTranslationXForPoint(nearestCornerPosition)).translationY(getTranslationYForPoint(nearestCornerPosition)).setDuration(250).setInterpolator(interpolator).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            isAnimating = false;
            Iterator<Runnable> afterFlingRunnables = runAfterFling.iterator();
            while (afterFlingRunnables.hasNext()) {
                Runnable runnable = afterFlingRunnables.next();
                runnable.run();
                afterFlingRunnables.remove();
            }
        }
    }).start();
}
Also used : Animator(android.animation.Animator) Point(android.graphics.Point) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Aggregations

Animator (android.animation.Animator)28 AnimationCompleteListener (org.thoughtcrime.securesms.animation.AnimationCompleteListener)28 AnimatorSet (android.animation.AnimatorSet)4 ObjectAnimator (android.animation.ObjectAnimator)4 ValueAnimator (android.animation.ValueAnimator)4 View (android.view.View)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 NonNull (androidx.annotation.NonNull)4 ConstraintSet (androidx.constraintlayout.widget.ConstraintSet)4 LottieAnimationView (com.airbnb.lottie.LottieAnimationView)4 TextPaint (android.text.TextPaint)3 SuppressLint (android.annotation.SuppressLint)2 Activity (android.app.Activity)2 Point (android.graphics.Point)2 TextView (android.widget.TextView)2 MainThread (androidx.annotation.MainThread)2 RawRes (androidx.annotation.RawRes)2 AlertDialog (androidx.appcompat.app.AlertDialog)2 HintConstants (androidx.autofill.HintConstants)2 ContextCompat (androidx.core.content.ContextCompat)2