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 finishWithResultCode(Activity context, int resultCode) {
    Activity parentActivity = context.getParent();
    context.setResult(resultCode);//from  w  w  w.  ja va  2  s  . com
    context.finish();
    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:com.ps.sleek.activity.AppsActivity.java

public static void start(Activity activity) {
    activity.startActivity(new Intent(activity, AppsActivity.class));
    activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}

From source file:Main.java

public static void redirectWithClearTop(Activity activity, Class<?> cls) {
    Intent intent = new Intent(activity, cls);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.startActivity(intent);/*from w  w w. ja  v  a  2s . co m*/
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void animTo(Activity activity, Class<?> toClass, int enterAnim, int exitAnim) {
    Intent intent = new Intent();
    intent.setClass(activity, toClass);//from  w  w w.ja va  2s. c  om
    activity.startActivity(intent);
    activity.overridePendingTransition(enterAnim, exitAnim);
}

From source file:Main.java

public static void restartPC(final Activity activity) {
    if (activity == null)
        return;/*from w  ww .  j  a v  a 2s  .c o  m*/
    final int enter_anim = android.R.anim.fade_in;
    final int exit_anim = android.R.anim.fade_out;
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.finish();
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.startActivity(activity.getIntent());
}

From source file:Main.java

public static void restartApp(final Activity activity) {
    if (activity == null)
        return;// www.  j  a  v  a 2 s  . c om
    final int enter_anim = android.R.anim.fade_in;
    final int exit_anim = android.R.anim.fade_out;
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.finish();
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.startActivity(activity.getIntent());
}

From source file:com.stfalcon.socialauthhelper.twitter.TwitterAuthActivity.java

public static void authorize(Activity activity, int requestCode) {
    activity.startActivityForResult(getIntent(activity), requestCode);
    activity.overridePendingTransition(0, 0);
}

From source file:Main.java

public static void restartTW(final Activity activity) {
    if (activity == null)
        return;/*from  w w w . j  a va2s .c o  m*/
    final int enter_anim = android.R.anim.fade_in;
    final int exit_anim = android.R.anim.fade_out;
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.finish();
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.startActivity(activity.getIntent());
}

From source file:Main.java

/**
 * Restart the Activity/*w w w. ja v  a 2s  .  c  o m*/
 *
 * @param activity
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void restartActivity(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        activity.recreate();
    } else {
        Intent intent = activity.getIntent();
        activity.overridePendingTransition(0, 0);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        activity.finish();

        activity.overridePendingTransition(0, 0);
        activity.startActivity(intent);
    }
}

From source file:com.justplay1.shoppist.shared.base.activities.BaseActivity.java

private static void finishActivityAnimation(Activity activity) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        activity.overridePendingTransition(R.anim.activity_close_enter_v21, R.anim.activity_close_exit_v21);
    } else {/*  w  w w.ja v a  2 s.c om*/
        activity.overridePendingTransition(R.anim.activity_close_enter, R.anim.activity_close_exit);
    }
}