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.amazonaws.devicefarm.android.referenceapp.Activities.UpNavigationContent.java

@Override
/**/*from  w  w  w.j a v a 2  s.co m*/
 * Support for the back button
 */
public boolean onOptionsItemSelected(final MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        Intent intent = new Intent(getApplication(), UpNavigationActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        NavUtils.navigateUpTo(this, intent);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

From source file:android.fj.com.rxactivity.PermissionInterceptorActivity.java

static Observable<Pair<String[], int[]>> subscribe(final Activity activity, final String[] permissions) {
    return Observable.create(new ObservableOnSubscribe<Pair<String[], int[]>>() {
        @Override/*from  w w w .j  av  a2s.  c  o  m*/
        public void subscribe(final ObservableEmitter<Pair<String[], int[]>> e) throws Exception {
            PermissionInterceptorActivity.param = permissions;
            PermissionInterceptorActivity.resultEmitter = e;

            activity.startActivity(new Intent(activity, PermissionInterceptorActivity.class)
                    .addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION));
        }
    });
}

From source file:android.fj.com.rxactivity.ResultInterceptorActivity.java

static Observable<Pair<Integer, Intent>> subscribe(final Context context, final Intent param) {
    return Observable.create(new ObservableOnSubscribe<Pair<Integer, Intent>>() {
        @Override//from   ww w  .  j  av  a2 s . c om
        public void subscribe(final ObservableEmitter<Pair<Integer, Intent>> e) throws Exception {
            ResultInterceptorActivity.param = param;
            ResultInterceptorActivity.resultEmitter = e;

            context.startActivity(new Intent(context, ResultInterceptorActivity.class)
                    .addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION));
        }
    });
}

From source file:com.liferay.mobile.sample.task.callback.ContactCallback.java

@Override
public void onSuccess(Contact contact) {
    _user.setContact(contact);//from w  ww.j  av a2  s. c  o  m

    Intent intent = new Intent(_context, DetailsActivity.class);

    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.putExtra(DetailsActivity.EXTRA_USER, _user);

    _context.startActivity(intent);
}

From source file:com.github.wakhub.monodict.activity.bean.ActivityHelper.java

/**
 * http://stackoverflow.com/questions/6547969/android-refresh-current-activity
 *///from   ww  w. j  a va2 s  .co  m
public void restartActivity() {
    Intent intent = new Intent(activity, activity.getClass());
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    activity.finish();
    activity.startActivity(intent);
}

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

/**
 * Creates a new activity with a incremented number
 */// w  w  w  .  j  a  va  2 s. co  m
@OnClick(R.id.back_navigation_next_button)
public void nextButtonOnClick() {
    Intent target = new Intent(this, BackNavigationActivity.class);
    target.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    target.putExtra(getString(R.string.PEER_COUNT), PeerCount);
    startActivity(target);
}

From source file:net.gsantner.opoc.util.ActivityUtils.java

/**
 * Animate to Activity specified in intent
 * Requires animation resources/*from   ww  w . j a  va2s  .  c  o m*/
 *
 * @param intent             Intent to open start an activity
 * @param finishFromActivity true: Finish the current activity
 * @param requestCode        Request code for stating the activity, not waiting for result if null
 */
public void animateToActivity(Intent intent, Boolean finishFromActivity, Integer requestCode) {
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    if (requestCode != null) {
        _activity.startActivityForResult(intent, requestCode);
    } else {
        _activity.startActivity(intent);

    }
    _activity.overridePendingTransition(getResId(ResType.DIMEN, "fadein"), getResId(ResType.DIMEN, "fadeout"));
    if (finishFromActivity != null && finishFromActivity) {
        _activity.finish();
    }
}

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

public static void reload(Activity activity) {
    //finish/*from   w  w  w .  j  av a  2s .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:org.birthdayadapter.ui.BaseActivity.java

/**
 * Called when the activity is first created.
 *///from  w w w . j  a  v  a  2 s.  com
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mActivity = this;

    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // Load Activity for Android < 4.0
        Intent oldActivity = new Intent(mActivity, BaseActivityV8.class);
        oldActivity.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(oldActivity);
        finish();
    } else {
        // Load new design with tabs
        mViewPager = new ViewPager(this);
        mViewPager.setId(R.id.pager);

        setContentView(mViewPager);

        ActionBar actionBar = getActionBar();
        actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
        actionBar.setDisplayShowTitleEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(false);

        mTabsAdapter = new TabsAdapter(this, mViewPager);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_main)), BaseFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_preferences)),
                PreferencesFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_accounts)),
                AccountListFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_help)), HelpFragment.class, null);

        mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.tab_about)), AboutFragment.class,
                null);

        // default is disabled:
        mActivity.setProgressBarIndeterminateVisibility(Boolean.FALSE);

        mySharedPreferenceChangeListener = new MySharedPreferenceChangeListener(mActivity,
                mBackgroundStatusHandler);

        /*
         * Show workaround dialog for Android bug http://code.google.com/p/android/issues/detail?id=34880
         * Bug exists on Android 4.1 (SDK 16) and on some phones like Galaxy S4
         */
        if (BuildConfig.GOOGLE_PLAY_VERSION && PreferencesHelper.getShowWorkaroundDialog(mActivity)
                && !isPackageInstalled("org.birthdayadapter.jb.workaround")) {
            if ((Build.VERSION.SDK_INT == 16) || Build.DEVICE.toUpperCase().startsWith("GT-I9000")
                    || Build.DEVICE.toUpperCase().startsWith("GT-I9500")) {
                InstallWorkaroundDialogFragment dialog = InstallWorkaroundDialogFragment.newInstance();
                dialog.show(getFragmentManager(), "workaroundDialog");
            }
        }
    }
}

From source file:de.baumann.browser.about.About_content.java

static MaterialAboutList createMaterialAboutList(final Context c) {
    MaterialAboutCard.Builder appCardBuilder = new MaterialAboutCard.Builder();

    // Add items to card

    appCardBuilder.addItem(//from www.j av a2 s. c  o m
            new MaterialAboutTitleItem.Builder().text(R.string.app_name).icon(R.mipmap.ic_launcher).build());

    try {

        appCardBuilder.addItem(ConvenienceBuilder.createVersionActionItem(c,
                ContextCompat.getDrawable(c, R.drawable.earth2), "Version", false));

    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_changelog)
            .subText(R.string.about_changelog_summary).icon(R.drawable.format_list_bulleted2)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                    c.getString(R.string.about_changelog),
                    "https://github.com/scoute-dich/browser/blob/master/CHANGELOG.md", true, false))
            .build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_license)
            .subText(R.string.about_license_summary).icon(R.drawable.copyright)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_title)
                            .setMessage(helper_main.textSpannable(c.getString(R.string.about_text)))
                            .setPositiveButton(c.getString(R.string.toast_yes),
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            dialog.cancel();
                                        }
                                    })
                            .show();
                    d.show();
                    ((TextView) d.findViewById(android.R.id.message))
                            .setMovementMethod(LinkMovementMethod.getInstance());
                }
            }).build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_intro)
            .subText(R.string.about_intro_summary).icon(R.drawable.information_outline)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    Intent intent = new Intent(c, Activity_intro.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                    c.startActivity(intent);
                }
            }).build());

    appCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_help)
            .subText(R.string.about_help_summary).icon(R.drawable.help_circle_outline)
            .setOnClickListener(new MaterialAboutActionItem.OnClickListener() {
                @Override
                public void onClick() {
                    final AlertDialog d = new AlertDialog.Builder(c).setTitle(R.string.about_help)
                            .setMessage(helper_main.textSpannable(c.getString(R.string.help_text)))
                            .setPositiveButton(c.getString(R.string.toast_yes),
                                    new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            dialog.cancel();
                                        }
                                    })
                            .show();
                    d.show();
                    ((TextView) d.findViewById(android.R.id.message))
                            .setMovementMethod(LinkMovementMethod.getInstance());
                }
            }).build());

    MaterialAboutCard.Builder authorCardBuilder = new MaterialAboutCard.Builder();
    authorCardBuilder.title(R.string.about_title_dev);

    authorCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text(R.string.about_dev)
                    .subText(R.string.about_dev_summary).icon(R.drawable.gaukler_faun)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            c.getString(R.string.about_dev), "https://github.com/scoute-dich/", true, false))
                    .build());

    authorCardBuilder.addItem(new MaterialAboutActionItem.Builder().text(R.string.about_donate)
            .subText(R.string.about_donate_summary).icon(R.drawable.coin)
            .setOnClickListener(ConvenienceBuilder.createWebsiteOnClickAction(c, Uri.parse(
                    "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=NP6TGYDYP9SHY")))
            .build());

    MaterialAboutCard.Builder convenienceCardBuilder = new MaterialAboutCard.Builder();
    convenienceCardBuilder.title(R.string.about_title_libs);

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Observable ScrollView")
                    .subText(R.string.about_license_2).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Observable ScrollView",
                            "https://github.com/ksoichiro/Android-ObservableScrollView", true, false))
                    .build());

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("Android Onboarder")
                    .subText(R.string.about_license_3).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "Android Onboarder", "https://github.com/chyrta/AndroidOnboarder", true, false))
                    .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Glide")
            .subText(R.string.about_license_9).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Glide",
                    "https://github.com/bumptech/glide", true, false))
            .build());

    convenienceCardBuilder
            .addItem(new MaterialAboutActionItem.Builder().text("MAH Encryptor Lib")
                    .subText(R.string.about_license_6).icon(R.drawable.github_circle)
                    .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c,
                            "MAH Encryptor Lib", "https://github.com/hummatli/MAHEncryptorLib", true, false))
                    .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material About Library")
            .subText(R.string.about_license_7).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material About Library",
                    "https://github.com/daniel-stoneuk/material-about-library", true, false))
            .build());

    convenienceCardBuilder.addItem(new MaterialAboutActionItem.Builder().text("Material Design Icons")
            .subText(R.string.about_license_8).icon(R.drawable.github_circle)
            .setOnClickListener(ConvenienceBuilder.createWebViewDialogOnClickAction(c, "Material Design Icons",
                    "https://github.com/Templarian/MaterialDesign", true, false))
            .build());

    return new MaterialAboutList(appCardBuilder.build(), authorCardBuilder.build(),
            convenienceCardBuilder.build());
}