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:com.yutong.axxc.parents.view.common.ActivityUtils.java

/**
 * activity/*w  w  w.  j  a v  a 2 s  .c o m*/
 * @param from ?activity
 * @param to activity
 * @param extras ??
 */
public static void changeActivity(Activity from, Class<?> to, Bundle extras) {
    // Intent intent = setIntent(from, to, extras);
    Intent intent = new Intent();
    if (extras != null)
        intent.putExtras(extras);
    intent.setClass(from.getBaseContext(), to);
    intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
    from.startActivity(intent);
    //from.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
    from.overridePendingTransition(R.anim.enter_righttoleft, R.anim.exit_righttoleft);
}

From source file:com.android.settings.util.Helpers2.java

/**
 * Restart the activity smoothly/*from  www.  j  a v a2s.  c om*/
 *
 * @param activity
 */
public static void restartPC(final Activity activity) {
    if (activity == null)
        return;
    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:io.digibyte.tools.animation.BRAnimator.java

public static void startBreadActivity(Activity from, boolean auth) {
    if (from == null)
        return;//ww w.  j av  a2s. c  o  m
    Log.e(TAG, "startBreadActivity: " + from.getClass().getName());
    Class toStart = auth ? LoginActivity.class : BreadActivity.class;
    Intent intent = new Intent(from, toStart);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    from.startActivity(intent);
    from.overridePendingTransition(R.anim.fade_up, R.anim.fade_down);
    if (!from.isDestroyed()) {
        from.finish();
    }
}

From source file:io.github.hidroh.materialistic.AppUtils.java

public static void restart(Activity activity, boolean transition) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        activity.recreate();//from   w ww.  j a  va  2  s  . com
    } else {
        activity.finish();
        if (transition) {
            activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        }
        activity.startActivity(activity.getIntent());
    }
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch an Apache II License/*from  www.  j  ava  2  s .com*/
 *
 * @param activity context
 */
public static void launchAboutActivity(Activity activity) {
    Intent intent = new Intent(Intents.ACTION_VIEW_ABOUT);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link AddChannelListActivity}.
 *
 * @param activity The context used to start this intent
 *///from  www .j  av  a2s . co m
public static void launchChannelListActivity(Activity activity) {
    Intent intent = new Intent(Intents.ACTION_ADD_CHANNEL_LIST_VIEW);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:dentex.youtube.downloader.utils.Utils.java

public static void reload(Activity activity) {
    //finish//w w w  .  java2 s  . c o m
    activity.finish();
    activity.overridePendingTransition(0, 0);

    //start
    Intent intent = activity.getIntent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    activity.startActivity(intent);
    activity.overridePendingTransition(0, 0);
}

From source file:com.frostwire.android.gui.util.UIUtils.java

public static void goToFrostWireMainActivity(Activity activity) {
    final Intent intent = new Intent(activity, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    activity.startActivity(intent);/*from w w  w  .  j av a 2s.co m*/
    activity.finish();
    activity.overridePendingTransition(0, 0);
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link UserContactActivity}.
 *
 * @param activity The context used to start this intent
 * @param user     that was selected//w  w w  .j a  v a  2s. c om
 */
public static void launchUserProfileActivity(Activity activity, User user, String loggedInUserId) {
    Intent intent = getUserProfileIntent(user, loggedInUserId);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.slide_in_bottom, R.anim.fade_out);
}

From source file:com.shareyourproxy.IntentLauncher.java

/**
 * Launch the {@link com.shareyourproxy.app.IntroductionActivity}.
 *
 * @param activity The context used to start this intent
 *//*  ww w .  j av  a 2 s  .co  m*/
public static void launchIntroductionActivity(Activity activity) {
    Intent intent = new Intent(Intents.ACTION_INTRODUCTION).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}