Search in sources :

Example 16 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Signal-Android by WhisperSystems.

the class InviteActivity method loadAnimation.

private Animation loadAnimation(@AnimRes int animResId) {
    final Animation animation = AnimationUtils.loadAnimation(this, animResId);
    animation.setInterpolator(new FastOutSlowInInterpolator());
    return animation;
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) Animation(android.view.animation.Animation)

Example 17 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Signal-Android by WhisperSystems.

the class VerifyDisplayFragment method animateVerified.

private void animateVerified() {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0, 1, 0, 1, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setInterpolator(new FastOutSlowInInterpolator());
    scaleAnimation.setDuration(800);
    scaleAnimation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            qrVerified.postDelayed(() -> {
                ScaleAnimation scaleAnimation1 = new ScaleAnimation(1, 0, 1, 0, ScaleAnimation.RELATIVE_TO_SELF, 0.5f, ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
                scaleAnimation1.setInterpolator(new AnticipateInterpolator());
                scaleAnimation1.setDuration(500);
                ViewUtil.animateOut(qrVerified, scaleAnimation1, View.GONE);
                ViewUtil.fadeIn(qrCode, 800);
                qrCodeContainer.setEnabled(true);
                tapLabel.setText(getString(R.string.verify_display_fragment__tap_to_scan));
            }, 2000);
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
        }
    });
    ViewUtil.fadeOut(qrCode, 200, View.INVISIBLE);
    ViewUtil.animateIn(qrVerified, scaleAnimation);
    qrCodeContainer.setEnabled(false);
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) ScaleAnimation(android.view.animation.ScaleAnimation) Animation(android.view.animation.Animation) ScaleAnimation(android.view.animation.ScaleAnimation) AnticipateInterpolator(android.view.animation.AnticipateInterpolator)

Example 18 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.

the class CrossfadeSubtitleToolbar method init.

private void init() {
    mSubtitleAnimator = ObjectAnimator.ofFloat(null, ALPHA, 1, 0, 1).setDuration(2 * ViewUtils.getShortAnimTime(this));
    mSubtitleAnimator.setInterpolator(new FastOutSlowInInterpolator());
    AnimatorListener listener = new AnimatorListener();
    mSubtitleAnimator.addUpdateListener(listener);
    mSubtitleAnimator.addListener(listener);
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator)

Example 19 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.

the class GalleryFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    AppCompatActivity activity = (AppCompatActivity) getActivity();
    activity.setSupportActionBar(mToolbar);
    mSystemUiHelper = new SystemUiHelper(activity, SystemUiHelper.LEVEL_IMMERSIVE, SystemUiHelper.FLAG_IMMERSIVE_STICKY, visible -> {
        if (visible) {
            mToolbar.animate().alpha(1).translationY(0).setDuration(mToolbarHideDuration).setInterpolator(new FastOutSlowInInterpolator()).start();
        } else {
            mToolbar.animate().alpha(0).translationY(-mToolbar.getBottom()).setDuration(mToolbarHideDuration).setInterpolator(new FastOutSlowInInterpolator()).start();
        }
    });
    // This will set up window flags.
    mSystemUiHelper.show();
    mAdapter = new GalleryAdapter(mImageList, new GalleryAdapter.Listener() {

        @Override
        public void onTap() {
            mSystemUiHelper.toggle();
        }

        @Override
        public void onFileDownloaded(int position) {
            if (position == mViewPager.getCurrentItem()) {
                updateOptionsMenu();
            }
        }
    });
    mViewPager.setAdapter(mAdapter);
    mViewPager.setCurrentItem(mInitialPosition);
    mViewPager.setPageTransformer(true, ViewPagerTransformers.DEPTH);
    mViewPager.addOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            updateTitle();
            updateOptionsMenu();
        }
    });
    updateTitle();
}
Also used : EffortlessPermissions(me.zhanghai.android.effortlesspermissions.EffortlessPermissions) ToastUtils(me.zhanghai.android.douya.util.ToastUtils) Bundle(android.os.Bundle) ButterKnife(butterknife.ButterKnife) NonNull(androidx.annotation.NonNull) Uri(android.net.Uri) ViewPager(androidx.viewpager.widget.ViewPager) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) SaveImageService(me.zhanghai.android.douya.gallery.app.SaveImageService) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) MenuItem(android.view.MenuItem) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) FragmentUtils(me.zhanghai.android.douya.util.FragmentUtils) Manifest(android.Manifest) MenuInflater(android.view.MenuInflater) Fragment(androidx.fragment.app.Fragment) Menu(android.view.Menu) View(android.view.View) IntentUtils(me.zhanghai.android.douya.util.IntentUtils) AppUtils(me.zhanghai.android.douya.util.AppUtils) AfterPermissionDenied(me.zhanghai.android.effortlesspermissions.AfterPermissionDenied) LayoutInflater(android.view.LayoutInflater) BindInt(butterknife.BindInt) ViewGroup(android.view.ViewGroup) File(java.io.File) R(me.zhanghai.android.douya.R) FileUtils(me.zhanghai.android.douya.util.FileUtils) AfterPermissionGranted(pub.devrel.easypermissions.AfterPermissionGranted) OpenAppDetailsDialogFragment(me.zhanghai.android.effortlesspermissions.OpenAppDetailsDialogFragment) Nullable(androidx.annotation.Nullable) SystemUiHelper(me.zhanghai.android.systemuihelper.SystemUiHelper) Toolbar(androidx.appcompat.widget.Toolbar) Activity(android.app.Activity) ViewPagerTransformers(me.zhanghai.android.douya.ui.ViewPagerTransformers) SystemUiHelper(me.zhanghai.android.systemuihelper.SystemUiHelper) FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator) AppCompatActivity(androidx.appcompat.app.AppCompatActivity) ViewPager(androidx.viewpager.widget.ViewPager)

Example 20 with FastOutSlowInInterpolator

use of androidx.interpolator.view.animation.FastOutSlowInInterpolator in project Douya by DreaminginCodeZH.

the class ViewUtils method fadeIn.

public static void fadeIn(@NonNull View view, int duration) {
    if (view.getVisibility() == View.VISIBLE && view.getAlpha() == 1) {
        // Cancel any starting animation.
        view.animate().alpha(1).setDuration(0).start();
        return;
    }
    view.setAlpha(isVisible(view) ? view.getAlpha() : 0);
    view.setVisibility(View.VISIBLE);
    view.animate().alpha(1).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).setListener(null).start();
}
Also used : FastOutSlowInInterpolator(androidx.interpolator.view.animation.FastOutSlowInInterpolator)

Aggregations

FastOutSlowInInterpolator (androidx.interpolator.view.animation.FastOutSlowInInterpolator)34 ValueAnimator (android.animation.ValueAnimator)8 Animator (android.animation.Animator)6 Animation (android.view.animation.Animation)6 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)4 PropertyValuesHolder (android.animation.PropertyValuesHolder)4 View (android.view.View)4 ObjectAnimator (android.animation.ObjectAnimator)3 ViewGroup (android.view.ViewGroup)3 IEndListener (su.levenetc.android.textsurface.interfaces.IEndListener)3 ISurfaceAnimation (su.levenetc.android.textsurface.interfaces.ISurfaceAnimation)3 AnimatorSet (android.animation.AnimatorSet)2 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)2 AccelerateInterpolator (android.view.animation.AccelerateInterpolator)2 AlphaAnimation (android.view.animation.AlphaAnimation)2 AnticipateInterpolator (android.view.animation.AnticipateInterpolator)2 ScaleAnimation (android.view.animation.ScaleAnimation)2 Nullable (androidx.annotation.Nullable)2 Manifest (android.Manifest)1 TimeInterpolator (android.animation.TimeInterpolator)1