Example usage for android.view.animation AnimationUtils loadInterpolator

List of usage examples for android.view.animation AnimationUtils loadInterpolator

Introduction

In this page you can find the example usage for android.view.animation AnimationUtils loadInterpolator.

Prototype

public static Interpolator loadInterpolator(Context context, @AnimRes @InterpolatorRes int id)
        throws NotFoundException 

Source Link

Document

Loads an Interpolator object from a resource

Usage

From source file:Main.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static Interpolator getFastOutSlowInInterpolator(Context context) {
    if (fastOutSlowIn == null) {
        fastOutSlowIn = AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
    }/* w  w w  . j  a  v  a 2s . co  m*/
    return fastOutSlowIn;
}

From source file:Main.java

public static Interpolator getFastOutSlowInInterpolator(Context context) {
    if (fastOutSlowIn == null) {
        fastOutSlowIn = AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
    }/*from   ww w. jav a 2  s  . c  om*/
    return fastOutSlowIn;
}

From source file:Main.java

public static void initialize(Context context) {
    sDecelerateQuintInterpolator = AnimationUtils.loadInterpolator(context, interpolator.decelerate_quint);

    final Point size = new Point();
    ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(size);
    final int screenHeight = size.y;

    if (screenHeight >= ANIMATION_LONG_SCREEN_SIZE) {
        sAnimationDuration = ANIMATION_LONG_DURATION;
    } else if (screenHeight >= ANIMATION_MED_SCREEN_SIZE) {
        sAnimationDuration = ANIMATION_MED_DURATION;
    } else {/*from w  w w.j av  a  2 s. c  o  m*/
        sAnimationDuration = ANIMATION_SHORT_DURATION;
    }
}

From source file:Main.java

public static Interpolator getLinearOutSlowInInterpolator(Context context) {
    if (linearOutSlowIn == null) {
        linearOutSlowIn = AnimationUtils.loadInterpolator(context, android.R.interpolator.linear_out_slow_in);
    }//  w w w. j a  v a2s .  com
    return linearOutSlowIn;
}

From source file:Main.java

public static Interpolator getFastOutLinearInInterpolator(Context context) {
    if (fastOutLinearIn == null) {
        fastOutLinearIn = AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_linear_in);
    }/*from www  . j av a2 s  .c o m*/
    return fastOutLinearIn;
}

From source file:io.github.prefanatic.cleantap.ui.animation.InfoAndCheckinAnimation.java

public static void setupSharedElementTransitionsFab(@NonNull Activity activity, @Nullable View target,
        int dialogCornerRadius) {
    ArcMotion arcMotion = new ArcMotion();
    arcMotion.setMinimumHorizontalAngle(50f);
    arcMotion.setMinimumVerticalAngle(50f);
    int color = ContextCompat.getColor(activity, R.color.colorAccent);
    Interpolator easeInOut = AnimationUtils.loadInterpolator(activity, android.R.interpolator.fast_out_slow_in);
    MorphFabToDialog sharedEnter = new MorphFabToDialog(color, dialogCornerRadius);
    sharedEnter.setPathMotion(arcMotion);
    sharedEnter.setInterpolator(easeInOut);
    MorphDialogToFab sharedReturn = new MorphDialogToFab(color);
    sharedReturn.setPathMotion(arcMotion);
    sharedReturn.setInterpolator(easeInOut);
    if (target != null) {
        sharedEnter.addTarget(target);/*from w  w  w .  j av  a  2  s. c om*/
        sharedReturn.addTarget(target);
    }
    activity.getWindow().setSharedElementEnterTransition(sharedEnter);
    activity.getWindow().setSharedElementReturnTransition(sharedReturn);
}

From source file:com.filemanager.free.utils.AnimUtils.java

public static Interpolator getFastOutSlowInInterpolator(Context context) {
    if (fastOutSlowIn == null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            fastOutSlowIn = AnimationUtils.loadInterpolator(context, android.R.interpolator.fast_out_slow_in);
        } else {//from www. j a va2  s .  co m
            fastOutSlowIn = new FastOutSlowInInterpolator();
        }
    }
    return fastOutSlowIn;
}

From source file:android.support.graphics.drawable.AnimationUtilsCompat.java

/**
 * Loads an {@link Interpolator} object from a resource
 *
 * @param context Application context used to access resources
 * @param id      The resource id of the animation to load
 * @return The animation object reference by the specified id
 *///from  ww w.  java 2s . co  m
public static Interpolator loadInterpolator(Context context, int id) throws NotFoundException {
    // From API 21, we added path Interpolator .
    if (Build.VERSION.SDK_INT >= 21) {
        return AnimationUtils.loadInterpolator(context, id);
    }

    XmlResourceParser parser = null;
    try {
        // Special treatment for the interpolator introduced at API 21.
        if (id == AndroidResources.FAST_OUT_LINEAR_IN) {
            return new FastOutLinearInInterpolator();
        } else if (id == AndroidResources.FAST_OUT_SLOW_IN) {
            return new FastOutSlowInInterpolator();
        } else if (id == AndroidResources.LINEAR_OUT_SLOW_IN) {
            return new LinearOutSlowInInterpolator();
        }
        parser = context.getResources().getAnimation(id);
        return createInterpolatorFromXml(context, context.getResources(), context.getTheme(), parser);
    } catch (XmlPullParserException ex) {
        NotFoundException rnf = new NotFoundException(
                "Can't load animation resource ID #0x" + Integer.toHexString(id));
        rnf.initCause(ex);
        throw rnf;
    } catch (IOException ex) {
        NotFoundException rnf = new NotFoundException(
                "Can't load animation resource ID #0x" + Integer.toHexString(id));
        rnf.initCause(ex);
        throw rnf;
    } finally {
        if (parser != null)
            parser.close();
    }

}

From source file:jp.tkgktyk.xposed.forcetouchdetector.app.util.fab.FloatingActionButtonLollipop.java

FloatingActionButtonLollipop(View view, ShadowViewDelegate shadowViewDelegate) {
    super(view, shadowViewDelegate);

    if (!view.isInEditMode()) {
        mInterpolator = AnimationUtils.loadInterpolator(mView.getContext(),
                android.R.interpolator.fast_out_slow_in);
    }//from   www. j  ava2 s  . com
}

From source file:android.support.designox.widget.FloatingActionButtonLollipop.java

FloatingActionButtonLollipop(VisibilityAwareImageButton view, ShadowViewDelegate shadowViewDelegate) {
    super(view, shadowViewDelegate);

    mInterpolator = view.isInEditMode() ? null
            : AnimationUtils.loadInterpolator(mView.getContext(), android.R.interpolator.fast_out_slow_in);
}