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.nextzy.oneassetmanagement.view.dashboard.DashboardActivity.java

@Override
public void onNavigationClick() {
    Intent intent = new Intent(this, MenuActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(intent);// w w w  .  java2  s . co  m
}

From source file:id.zelory.codepolitan.ui.ReadActivity.java

@Override
public void onBackPressed() {
    removeReadArticle();//from  w  ww . j ava2s  .c  o  m

    if (type == TYPE_FROM_NOTIF) {
        Intent intent = new Intent(this, MainActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(intent);
        finish();
    } else {
        super.onBackPressed();
    }
}

From source file:com.klinker.android.twitter.activities.MainActivity.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    try {//from   w w w. j a v a 2 s . c  om
        mDrawerToggle.onConfigurationChanged(newConfig);
    } catch (Exception e) {
    }

    context.sendBroadcast(new Intent("com.klinker.android.twitter.MARK_POSITION"));
    sharedPrefs.edit().putBoolean("refresh_me", true).commit();

    sharedPrefs.edit().putBoolean("open_a_page", true).commit();
    sharedPrefs.edit().putInt("open_what_page", mViewPager.getCurrentItem()).commit();

    overridePendingTransition(0, 0);
    finish();
    Intent restart = new Intent(context, MainActivity.class);
    restart.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    restart.putExtra("open_a_page", true);
    restart.putExtra("open_what_page", mViewPager.getCurrentItem());
    overridePendingTransition(0, 0);
    sharedPrefs.edit().putBoolean("should_refresh", false).commit();
    startActivity(restart);
    overridePendingTransition(0, 0);
}

From source file:org.nypl.simplified.app.MainSettingsAccountActivity.java

@Override
public boolean onOptionsItemSelected(final @Nullable MenuItem item_mn) {
    final MenuItem item = NullCheck.notNull(item_mn);

    if (item.getItemId() == R.id.show_eula) {
        final Intent eula_intent = new Intent(this, MainEULAActivity.class);
        if (this.account.getEula() != null) {
            final Bundle b = new Bundle();
            MainEULAActivity.setActivityArguments(b, this.account.getEula());
            eula_intent.putExtras(b);/*from   ww w.java 2  s.c  om*/
        }
        eula_intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(eula_intent);

        return true;
    }

    switch (item.getItemId()) {
    case android.R.id.home: {
        onBackPressed();
        return true;
    }

    default: {
        return super.onOptionsItemSelected(item);
    }
    }
}

From source file:com.farmerbb.taskbar.service.DashboardService.java

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.N)/*from   w w w.j  ava  2  s  . com*/
private void showDashboard() {
    if (layout.getVisibility() == View.GONE) {
        layout.setOnClickListener(ocl);
        fadeIn();

        LocalBroadcastManager.getInstance(this)
                .sendBroadcast(new Intent("com.farmerbb.taskbar.DASHBOARD_APPEARING"));
        LocalBroadcastManager.getInstance(this)
                .sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU"));

        boolean inFreeformMode = FreeformHackHelper.getInstance().isInFreeformWorkspace();

        final SharedPreferences pref = U.getSharedPreferences(this);
        Intent intent = null;

        switch (pref.getString("theme", "light")) {
        case "light":
            intent = new Intent(this, DashboardActivity.class);
            break;
        case "dark":
            intent = new Intent(this, DashboardActivityDark.class);
            break;
        }

        if (intent != null) {
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        }

        if (inFreeformMode) {
            if (intent != null && U.isOPreview())
                intent.putExtra("context_menu_fix", true);

            U.launchAppMaximized(this, intent);
        } else
            startActivity(intent);

        for (int i = 0; i < maxSize; i++) {
            final DashboardCell cellLayout = cells.get(i);
            final AppWidgetHostView hostView = widgets.get(i);

            if (hostView != null) {
                try {
                    getPackageManager()
                            .getApplicationInfo(hostView.getAppWidgetInfo().provider.getPackageName(), 0);
                    hostView.post(() -> {
                        ViewGroup.LayoutParams params = hostView.getLayoutParams();
                        params.width = cellLayout.getWidth();
                        params.height = cellLayout.getHeight();
                        hostView.setLayoutParams(params);
                        hostView.updateAppWidgetSize(null, cellLayout.getWidth(), cellLayout.getHeight(),
                                cellLayout.getWidth(), cellLayout.getHeight());
                    });
                } catch (PackageManager.NameNotFoundException e) {
                    removeWidget(i, false);
                } catch (NullPointerException e) {
                    removeWidget(i, true);
                }
            }
        }

        if (!pref.getBoolean("dashboard_tutorial_shown", false)) {
            U.showToastLong(this, R.string.dashboard_tutorial);
            pref.edit().putBoolean("dashboard_tutorial_shown", true).apply();
        }
    }
}

From source file:cw.kop.autobackground.settings.AppSettingsFragment.java

private void restartActivity() {
    Intent intent = new Intent(appContext, MainActivity.class);
    intent.putExtra("fragment", 7);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    appContext.startActivity(intent);//from   w w w.  ja v a2s .  c  o  m
    getActivity().finish();
    getActivity().overridePendingTransition(0, 0);
}

From source file:org.fox.ttrss.OnlineActivity.java

private void switchOfflineSuccess() {
    logout();//w  w w  .  ja v  a 2  s . c o  m
    // setLoadingStatus(R.string.blank, false);

    SharedPreferences.Editor editor = m_prefs.edit();
    editor.putBoolean("offline_mode_active", true);
    editor.commit();

    Intent offline = new Intent(OnlineActivity.this, OfflineActivity.class);
    offline.putExtra("initial", true);
    offline.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

    startActivityForResult(offline, 0);

    finish();

}

From source file:fossasia.valentina.bodyapp.main.SettingsActivity.java

public void reload() {

    Intent intent = getIntent();// ww  w. j  a  va  2 s  .  com
    overridePendingTransition(0, 0);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    finish();

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

From source file:net.gsantner.opoc.preference.GsPreferenceFragmentCompat.java

protected void restartActivity() {
    Activity activity;//w w  w  .  j a v a 2 s .c o m
    if (isAdded() && (activity = getActivity()) != null) {
        Intent intent = getActivity().getIntent();
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_NO_ANIMATION);
        activity.overridePendingTransition(0, 0);
        activity.finish();
        activity.overridePendingTransition(0, 0);
        startActivity(intent);
    }
}

From source file:azad.hallaji.farzad.com.masirezendegi.PageVirayesh.java

@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.END)) {
        drawer.closeDrawer(GravityCompat.END);
    }// w w  w . j a  va  2 s.  c o m
    Intent intent = new Intent(this, Pagemenu.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(intent);

}