Example usage for android.app Activity overridePendingTransition

List of usage examples for android.app Activity overridePendingTransition

Introduction

In this page you can find the example usage for android.app Activity overridePendingTransition.

Prototype

public void overridePendingTransition(int enterAnim, int exitAnim) 

Source Link

Document

Call immediately after one of the flavors of #startActivity(Intent) or #finish to specify an explicit transition animation to perform next.

Usage

From source file:Main.java

public static void startActAnim(Activity activity, int inAnim, int outAnim) {

    if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT) {
        new Object() {
            public void overridePendingTransition(Activity act, int i, int j) {
                act.overridePendingTransition(i, j);
            }// w  ww  .j a  v  a 2  s.c  om
        }.overridePendingTransition(activity, inAnim, outAnim);
    }
}

From source file:Main.java

/**
 * Calls {@link Activity#overridePendingTransition(int, int)}. This is used
 * to set a different animation type for screen transition animations.
 *
 * @param activity - The activity handling the animation
 * @param enterAnim - The enter animation type
 * @param exitAnim - The exit animation type
 */// w  w w . j  a v a 2  s.  c o  m
public static void overridePendingTransitions(Activity activity, int enterAnim, int exitAnim) {
    activity.overridePendingTransition(enterAnim, exitAnim);
}

From source file:Main.java

public static void finishActivityAnim(Activity activity, int exitAnim) {
    activity.finish();//ww  w .j  ava2 s  .  com
    activity.overridePendingTransition(0, exitAnim);
}

From source file:Main.java

public static void switchToWithFadeEffect(Activity activity, Intent intent) {
    activity.startActivity(intent);/*  w w  w  .j  av a2s . c o m*/
    activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}

From source file:Main.java

public static void startByFade(Activity context, Class<?> clazz) {
    context.startActivity(new Intent(context, clazz));
    context.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}

From source file:Main.java

public static void finishWithoutResult(Activity context) {
    Activity parentActivity = context.getParent();
    context.finish();//from  ww w .j  a  v a  2 s .  com
    if (parentActivity != null) {
        parentActivity.overridePendingTransition(0, android.R.anim.slide_out_right);
    } else {
        context.overridePendingTransition(0, android.R.anim.slide_out_right);
    }
}

From source file:Main.java

public static void redirect(Activity activity, Class<?> cls) {
    Intent intent = new Intent(activity, cls);
    activity.startActivity(intent);/* w ww .j  a  va  2s .c o m*/
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void animFinish(Activity activity, int enterAnim, int exitAnim) {
    if (activity == null) {
        return;//from   ww w  .j a v a  2 s  . c om
    }
    activity.finish();
    activity.overridePendingTransition(enterAnim, exitAnim);
}

From source file:Main.java

public static void launchActivity(Activity activity, Class activityClass, int enterAnim, int exitAnim) {
    activity.startActivity(new Intent(activity, activityClass));
    activity.overridePendingTransition(enterAnim, exitAnim);
}

From source file:Main.java

public static void changeToTheme(Activity activity, int theme) {
    sTheme = theme;//from   www .  ja v  a2  s  .  com
    activity.finish();
    activity.startActivity(new Intent(activity, activity.getClass()));
    activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}