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.ruesga.rview.misc.ActivityHelper.java

public static void openSearchActivity(Activity activity) {
    Intent intent = new Intent(activity, SearchActivity.class);
    activity.startActivity(intent);//w  w w.j  av  a2  s.c o  m
    activity.overridePendingTransition(0, 0);
}

From source file:com.becapps.easydownloader.utils.Utils.java

public static void reload(Activity activity) {
    Intent intent = activity.getIntent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    activity.finish();/* ww  w .  j a  v a  2  s .  co  m*/
    activity.overridePendingTransition(0, 0);
    activity.startActivity(intent);
    activity.overridePendingTransition(0, 0);
}

From source file:at.ac.tuwien.caa.docscan.ActivityUtils.java

/**
 * Enables back navigation for activities that are launched from the NavBar. See {@code
 * AndroidManifest.xml} to find out the parent activity names for each activity.
 *
 * @param intent//from   w  w  w.  j a  v  a  2s  .  c o m
 */
public static void createBackStack(Activity activity, Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        TaskStackBuilder builder = TaskStackBuilder.create(activity);
        builder.addNextIntentWithParentStack(intent);
        builder.startActivities();
    } else {
        activity.startActivity(intent);
        activity.finish();
    }

    //        Use our own animation - instead of the default scaling animation:
    activity.overridePendingTransition(R.anim.translate_in, R.anim.translate_out);
}

From source file:com.amaze.carbonfilemanager.fragments.preference_fragments.Preffrag.java

public static void restartPC(final Activity activity) {
    if (activity == null)
        return;/* www  .  j  a  v a 2  s . 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:me.willowcheng.makerthings.util.Util.java

public static void overridePendingTransition(Activity activity, boolean reverse) {
    if (PreferenceManager.getDefaultSharedPreferences(activity)
            .getString(Constants.PREFERENCE_ANIMATION, "android").equals("android")) {
    } else if (PreferenceManager.getDefaultSharedPreferences(activity)
            .getString(Constants.PREFERENCE_ANIMATION, "android").equals("ios")) {
        if (reverse) {
            activity.overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
        } else {// w  w  w . j a  va2  s.co  m
            activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        }
    } else {
        activity.overridePendingTransition(0, 0);
    }
}

From source file:org.openhab.habdroid.util.Util.java

public static void overridePendingTransition(Activity activity, boolean reverse) {
    if (!PreferenceManager.getDefaultSharedPreferences(activity)
            .getString(Constants.PREFERENCE_ANIMATION, "android").equals("android")) {
        if (PreferenceManager.getDefaultSharedPreferences(activity)
                .getString(Constants.PREFERENCE_ANIMATION, "android").equals("ios")) {
            if (reverse) {
                activity.overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);
            } else {
                activity.overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
            }/* www .java  2 s .  c  o  m*/
        } else {
            activity.overridePendingTransition(0, 0);
        }
    }
}

From source file:org.floens.chan.ui.activity.ImageViewActivity.java

/**
 * Set the posts to show//from  w  w  w.  j a  v a  2  s  . co  m
 *
 * @param adapter  the adapter to get image data from
 * @param selected the no that the user clicked on
 */
public static void launch(Activity activity, PostAdapter adapter, int selected, ThreadManager threadManager) {
    postAdapterStatic = adapter;
    selectedIdStatic = selected;
    threadManagerStatic = threadManager;

    Intent intent = new Intent(activity, ImageViewActivity.class);
    activity.startActivity(intent);
    activity.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}

From source file:com.github.baoti.pioneer.ui.Navigator.java

/**
 * ?,?Splash?//w  ww.j  a  va 2 s.  c o  m
 * @param activity
 */
public static void upToMain(Activity activity) {
    Intent intent = new Intent(activity, MainActivity.class);
    //        NavUtils.navigateUpTo(activity, intent);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    if (activity instanceof MainActivity) {
        ((MainActivity) activity).close();
    }
    activity.startActivity(intent);
    activity.overridePendingTransition(0, 0);
    if (!(activity instanceof MainActivity)) {
        ActivityCompat.finishAffinity(activity);
        activity.overridePendingTransition(0, android.R.anim.fade_out);
    }
}

From source file:Main.java

/**
 * Helper method to recreate the Activity. This method should be called after a Locale change.
 * @param activity the Activity that will be recreated
 * @param animate a flag indicating if the recreation will be animated or not
 *///w w w  .  j av  a 2 s .  com
public static void recreate(Activity activity, boolean animate) {
    Intent restartIntent = new Intent(activity, activity.getClass());

    Bundle extras = activity.getIntent().getExtras();
    if (extras != null) {
        restartIntent.putExtras(extras);
    }

    if (animate) {
        ActivityCompat.startActivity(activity, restartIntent, ActivityOptionsCompat
                .makeCustomAnimation(activity, android.R.anim.fade_in, android.R.anim.fade_out).toBundle());
    } else {
        activity.startActivity(restartIntent);
        activity.overridePendingTransition(0, 0);
    }

    activity.finish();

}

From source file:de.pixart.messenger.ui.ScanActivity.java

public static void scan(Activity activity) {
    if (ContextCompat.checkSelfPermission(activity,
            Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) {
        Intent intent = new Intent(activity, ScanActivity.class);
        activity.startActivityForResult(intent, REQUEST_SCAN_QR_CODE);
        activity.overridePendingTransition(R.animator.fade_in, R.animator.fade_out);
    } else {//  w ww . jav  a  2s  .c  o m
        ActivityCompat.requestPermissions(activity, new String[] { Manifest.permission.CAMERA },
                REQUEST_CAMERA_PERMISSIONS_TO_SCAN);
    }

}