Example usage for android.content Intent FLAG_ACTIVITY_NO_ANIMATION

List of usage examples for android.content Intent FLAG_ACTIVITY_NO_ANIMATION

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_NO_ANIMATION.

Prototype

int FLAG_ACTIVITY_NO_ANIMATION

To view the source code for android.content Intent FLAG_ACTIVITY_NO_ANIMATION.

Click Source Link

Document

If set in an Intent passed to Context#startActivity Context.startActivity() , this flag will prevent the system from applying an activity transition animation to go to the next activity state.

Usage

From source file:com.github.dfa.diaspora_android.util.Helpers.java

public static void animateToActivity(Activity from, Class to, boolean finishFromActivity) {
    Intent intent = new Intent(from, to);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    from.startActivity(intent);//from  w  w w  .  j  a  v a2  s.com
    from.overridePendingTransition(R.anim.fadein, R.anim.fadeout);
    if (finishFromActivity) {
        from.finish();
    }
}

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();//from w w  w  .j a va2 s.  c o m
    activity.overridePendingTransition(0, 0);
    activity.startActivity(intent);
    activity.overridePendingTransition(0, 0);
}

From source file:de.Maxr1998.xposed.maxlock.ui.LockActivity.java

@SuppressLint("WorldReadableFiles")
public static void directUnlock(Activity caller, Intent orig, String pkgName) {
    try {//  w ww  . ja  va 2s. co m
        //noinspection deprecation
        caller.getSharedPreferences(Common.PREFS_PACKAGES, MODE_WORLD_READABLE).edit()
                .putLong(pkgName + "_tmp", System.currentTimeMillis()).commit();
        orig.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION
                | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        caller.startActivity(orig);
    } catch (Exception e) {
        Intent intent_option = caller.getPackageManager().getLaunchIntentForPackage(pkgName);
        intent_option.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION
                | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        caller.startActivity(intent_option);
    } finally {
        caller.finish();
    }
}

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

/**
 * ??,?Splash?.//from  w w  w .  ja  v  a2s .c  o m
 * @param context
 */
public static void launchMain(Context context) {
    //        context.getPackageManager().resolveActivity(
    //                new Intent(Intent.ACTION_MAIN).setPackage(context.getPackageName())
    //                        .addCategory(Intent.CATEGORY_DEFAULT),
    //                0);
    boolean inActivityContext = context instanceof Activity;
    Intent intent = new Intent(context, MainActivity.class);
    if (!inActivityContext) {
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    }
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    if (context instanceof MainActivity) {
        ((MainActivity) context).close();
    }
    context.startActivity(intent);
    if (context instanceof Activity) {
        if (context instanceof SplashActivity)
            ((Activity) context).overridePendingTransition(android.R.anim.fade_in, 0);
        ((Activity) context).overridePendingTransition(0, 0);
    }
    if (context instanceof Activity && !(context instanceof MainActivity)) {
        ActivityCompat.finishAffinity((Activity) context);
        ((Activity) context).overridePendingTransition(0, android.R.anim.fade_out);
    }
}

From source file:com.vuze.android.remote.RemoteUtils.java

public static void openRemote(Activity activity, RemoteProfile remoteProfile, boolean isMain) {
    AppPreferences appPreferences = VuzeRemoteApp.getAppPreferences();

    if (appPreferences.getRemote(remoteProfile.getID()) == null) {
        appPreferences.addRemoteProfile(remoteProfile);
    }/*from   w ww.  ja  v  a2 s  .c o  m*/

    Intent myIntent = new Intent(activity.getIntent());
    myIntent.setAction(Intent.ACTION_VIEW);
    myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    if (isMain) {
        myIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        // Scenario:
        // User has multiple remote hosts.
        // User clicks on torrent link in browser.
        // User is displayed remote selector activity (IntenntHandler) and picks
        // Remote activity is opened, torrent is added
        // We want the back button to go back to the browser.  Going back to
        // the remote selector would be confusing (especially if they then chose
        // another remote!)
        myIntent.addFlags(Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
    }
    myIntent.setClass(activity, TorrentViewActivity.class);

    myIntent.putExtra(SessionInfoManager.BUNDLE_KEY, remoteProfile.getID());

    activity.startActivity(myIntent);

}

From source file:com.brq.wallet.lt.activity.ViewTraderInfoActivity.java

public static void callMe(Activity currentActivity, PublicTraderInfo traderInfo) {
    Intent intent = new Intent(currentActivity, ViewTraderInfoActivity.class);
    intent.putExtra("traderInfo", traderInfo);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    currentActivity.startActivity(intent);
}

From source file:com.configurer.easyscreenlock.ui.fragment.LanguageChooserDialog.java

private void restartActivity() {
    Intent intent = getActivity().getIntent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    getActivity().finish();/*from ww  w .  jav  a2 s  .  c om*/
    getActivity().overridePendingTransition(0, 0);

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

From source file:com.amazonaws.devicefarm.android.referenceapp.Activities.UpNavigationActivity.java

/**
 * Support for the back hardware button/* ww  w  . ja  v a2  s. com*/
 */
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        Intent intent = new Intent(getApplication(), MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        NavUtils.navigateUpTo(this, intent);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.vuze.android.remote.RemoteUtils.java

public static void openRemoteList(Context context) {
    Intent myIntent = new Intent();
    myIntent.setAction(Intent.ACTION_VIEW);
    myIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    myIntent.setClass(context, IntentHandler.class);
    context.startActivity(myIntent);/*from   ww  w.j  a v a  2s .c o  m*/
}

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

/**
 * ?,?Splash?/*from  ww w  .  j  a v a  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);
    }
}