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.farmerbb.taskbar.service.StartMenuService.java

@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.N)/*from   www . j  a v  a2  s .  c o m*/
private void showStartMenu(boolean shouldReset) {
    if (layout.getVisibility() == View.GONE) {
        if (shouldReset)
            startMenu.setSelection(0);

        layout.setOnClickListener(ocl);
        layout.setVisibility(View.VISIBLE);

        StartMenuHelper.getInstance().setStartMenuOpen(true);

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

        boolean onHomeScreen = LauncherHelper.getInstance().isOnHomeScreen();
        boolean inFreeformMode = FreeformHackHelper.getInstance().isInFreeformWorkspace();

        if (!onHomeScreen || inFreeformMode) {
            Class clazz = inFreeformMode && !shouldShowSearchBox && !U.isOPreview() ? InvisibleActivityAlt.class
                    : InvisibleActivity.class;
            Intent intent = new Intent(this, clazz);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

            if (inFreeformMode) {
                if (clazz.equals(InvisibleActivity.class))
                    U.launchAppLowerRight(this, intent);
                else if (clazz.equals(InvisibleActivityAlt.class))
                    U.launchAppMaximized(this, intent);
            } else
                startActivity(intent);
        }

        if (searchView.getVisibility() == View.VISIBLE)
            searchView.requestFocus();

        refreshApps(false);
    }
}

From source file:org.durka.hallmonitor.CoreStateManager.java

public void requestAdmin() {
    if (!adminApp && preference_all.getBoolean("pref_lockmode", false) && configurationActivity != null) {
        ComponentName me = new ComponentName(mAppContext, AdminReceiver.class);
        Log.d(LOG_TAG, "launching dpm overlay");
        mAppContext.startActivity(new Intent(getContext(), Configuration.class)
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION
                        | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS));
        Log.d(LOG_TAG, "Started configuration activity.");
        Intent coup = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
        coup.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, me);
        coup.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, mAppContext.getString(R.string.admin_excuse));
        getConfigurationActivity().startActivityForResult(coup, CoreApp.DEVICE_ADMIN_WAITING);
    }/*from w  w w  .j a v a2s.  co  m*/
}

From source file:kr.wdream.storyshop.NotificationsController.java

public void processNewMessages(final ArrayList<MessageObject> messageObjects, final boolean isLast) {
    if (messageObjects.isEmpty()) {
        return;//from  w w w . j  ava2s.c om
    }
    final ArrayList<MessageObject> popupArray = new ArrayList<>(popupMessages);
    notificationsQueue.postRunnable(new Runnable() {
        @Override
        public void run() {
            boolean added = false;

            int oldCount = popupArray.size();
            HashMap<Long, Boolean> settingsCache = new HashMap<>();
            SharedPreferences preferences = ApplicationLoader.applicationContext
                    .getSharedPreferences("Notifications", Context.MODE_PRIVATE);
            boolean allowPinned = preferences.getBoolean("PinnedMessages", true);
            int popup = 0;

            for (int a = 0; a < messageObjects.size(); a++) {
                MessageObject messageObject = messageObjects.get(a);
                long mid = messageObject.messageOwner.id;
                if (messageObject.messageOwner.to_id.channel_id != 0) {
                    mid |= ((long) messageObject.messageOwner.to_id.channel_id) << 32;
                }
                if (pushMessagesDict.containsKey(mid)) {
                    continue;
                }
                long dialog_id = messageObject.getDialogId();
                long original_dialog_id = dialog_id;
                if (dialog_id == opened_dialog_id && ApplicationLoader.isScreenOn) {
                    playInChatSound();
                    continue;
                }
                if (messageObject.messageOwner.mentioned) {
                    if (!allowPinned
                            && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
                        continue;
                    }
                    dialog_id = messageObject.messageOwner.from_id;
                }
                if (isPersonalMessage(messageObject)) {
                    personal_count++;
                }
                added = true;

                Boolean value = settingsCache.get(dialog_id);
                boolean isChat = (int) dialog_id < 0;
                popup = (int) dialog_id == 0 ? 0 : preferences.getInt(isChat ? "popupGroup" : "popupAll", 0);
                if (value == null) {
                    int notifyOverride = getNotifyOverride(preferences, dialog_id);
                    value = !(notifyOverride == 2 || (!preferences.getBoolean("EnableAll", true)
                            || isChat && !preferences.getBoolean("EnableGroup", true)) && notifyOverride == 0);
                    settingsCache.put(dialog_id, value);
                }
                if (popup != 0 && messageObject.messageOwner.to_id.channel_id != 0
                        && !messageObject.isMegagroup()) {
                    popup = 0;
                }
                if (value) {
                    if (popup != 0) {
                        popupArray.add(0, messageObject);
                    }
                    delayedPushMessages.add(messageObject);
                    pushMessages.add(0, messageObject);
                    pushMessagesDict.put(mid, messageObject);
                    if (original_dialog_id != dialog_id) {
                        pushDialogsOverrideMention.put(original_dialog_id, 1);
                    }
                }
            }

            if (added) {
                notifyCheck = isLast;
            }

            if (!popupArray.isEmpty() && oldCount != popupArray.size()
                    && !AndroidUtilities.needShowPasscode(false)) {
                final int popupFinal = popup;
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        popupMessages = popupArray;
                        if (ApplicationLoader.mainInterfacePaused
                                || !ApplicationLoader.isScreenOn && !UserConfig.isWaitingForPasscodeEnter) {
                            if (popupFinal == 3 || popupFinal == 1 && ApplicationLoader.isScreenOn
                                    || popupFinal == 2 && !ApplicationLoader.isScreenOn) {
                                Intent popupIntent = new Intent(ApplicationLoader.applicationContext,
                                        PopupNotificationActivity.class);
                                popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                        | Intent.FLAG_ACTIVITY_NO_ANIMATION
                                        | Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_FROM_BACKGROUND);
                                ApplicationLoader.applicationContext.startActivity(popupIntent);
                            }
                        }
                    }
                });
            }
        }
    });
}

From source file:com.shafiq.mytwittle.view.BaseLaneActivity.java

void restartApp() {
    Intent intent = getBaseContext().getPackageManager()
            .getLaunchIntentForPackage(getBaseContext().getPackageName());
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION);
    overridePendingTransition(0, 0);/*w w w  . j  av  a  2  s  .  c  o m*/
    startActivity(intent);
}

From source file:com.shafiq.mytwittle.view.BaseLaneActivity.java

void restartActivity() {
    finish();
    getIntent().addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    overridePendingTransition(0, 0);
    startActivity(getIntent());
}

From source file:com.moonpi.swiftnotes.MainActivity.java

@Override
public void onClick(View v) {
    // If new note button pressed, start edit note activity with new note request code
    if (v.getId() == R.id.newNote) {
        Intent intent = new Intent(this, EditActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

        intent.putExtra("requestCode", NEW_NOTE_REQUEST);

        startActivityForResult(intent, NEW_NOTE_REQUEST);
    }//ww w . j  a v  a  2 s .  c o  m
}

From source file:com.vuze.android.remote.activity.TorrentViewActivity.java

@Override
public void onTorrentSelectedListener(TorrentListFragment torrentListFragment, long[] ids,
        boolean inMultiMode) {
    // The user selected the headline of an article from the HeadlinesFragment
    // Do something here to display that article

    TorrentDetailsFragment detailFrag = (TorrentDetailsFragment) getSupportFragmentManager()
            .findFragmentById(R.id.frag_torrent_details);
    View fragmentView = findViewById(R.id.frag_details_container);

    if (DEBUG) {/*from   w  w  w  . j  av a  2s  .c  o m*/
        Log.d(TAG, "onTorrentSelectedListener: " + Arrays.toString(ids) + ";multi?" + inMultiMode + ";"
                + detailFrag + " via " + AndroidUtils.getCompressedStackTrace());
    }
    if (detailFrag != null && fragmentView != null) {
        // If article frag is available, we're in two-pane layout...

        // Call a method in the TorrentDetailsFragment to update its content
        if (ids == null || ids.length != 1) {
            fragmentView.setVisibility(View.GONE);
        } else {
            fragmentView.setVisibility(View.VISIBLE);
        }
        detailFrag.setTorrentIDs(sessionInfo.getRemoteProfile().getID(), ids);
    } else if (ids != null && ids.length == 1 && !inMultiMode) {
        torrentListFragment.clearSelection();

        Intent intent = new Intent(Intent.ACTION_VIEW, null, this, TorrentDetailsActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        intent.putExtra("TorrentID", ids[0]);
        intent.putExtra("RemoteProfileID", remoteProfile.getID());
        startActivity(intent);
    }
}

From source file:com.moonpi.swiftnotes.MainActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Intent intent = new Intent(this, EditActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

    try {//ww w  . j  a va 2s. co  m
        // Package current note content and send to edit note activity
        intent.putExtra("title", notes.getJSONObject(position).getString("title"));
        intent.putExtra("body", notes.getJSONObject(position).getString("body"));
        intent.putExtra("colour", notes.getJSONObject(position).getString("colour"));
        intent.putExtra("fontSize", notes.getJSONObject(position).getInt("fontSize"));
        intent.putExtra("requestCode", position);

        startActivityForResult(intent, position);

    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:com.ferdi2005.secondgram.NotificationsController.java

public void processNewMessages(final ArrayList<MessageObject> messageObjects, final boolean isLast) {
    if (messageObjects.isEmpty()) {
        return;/*from   w w  w.  ja v  a2 s  .  c o  m*/
    }
    final ArrayList<MessageObject> popupArray = new ArrayList<>(popupMessages);
    notificationsQueue.postRunnable(new Runnable() {
        @Override
        public void run() {
            boolean added = false;

            int oldCount = popupArray.size();
            HashMap<Long, Boolean> settingsCache = new HashMap<>();
            SharedPreferences preferences = ApplicationLoader.applicationContext
                    .getSharedPreferences("Notifications", Context.MODE_PRIVATE);
            boolean allowPinned = preferences.getBoolean("PinnedMessages", true);
            int popup = 0;

            for (int a = 0; a < messageObjects.size(); a++) {
                MessageObject messageObject = messageObjects.get(a);
                long mid = messageObject.messageOwner.id;
                if (messageObject.messageOwner.to_id.channel_id != 0) {
                    mid |= ((long) messageObject.messageOwner.to_id.channel_id) << 32;
                }
                if (pushMessagesDict.containsKey(mid)) {
                    continue;
                }
                long dialog_id = messageObject.getDialogId();
                long original_dialog_id = dialog_id;
                if (dialog_id == opened_dialog_id && ApplicationLoader.isScreenOn) {
                    playInChatSound();
                    continue;
                }
                if (messageObject.messageOwner.mentioned) {
                    if (!allowPinned
                            && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage) {
                        continue;
                    }
                    dialog_id = messageObject.messageOwner.from_id;
                }
                if (isPersonalMessage(messageObject)) {
                    personal_count++;
                }
                added = true;

                Boolean value = settingsCache.get(dialog_id);
                int lower_id = (int) dialog_id;
                boolean isChat = lower_id < 0;
                if (lower_id != 0) {
                    if (preferences.getBoolean("custom_" + dialog_id, false)) {
                        popup = preferences.getInt("popup_" + dialog_id, 0);
                    } else {
                        popup = 0;
                    }
                    if (popup == 0) {
                        popup = preferences.getInt((int) dialog_id < 0 ? "popupGroup" : "popupAll", 0);
                    } else if (popup == 1) {
                        popup = 3;
                    } else if (popup == 2) {
                        popup = 0;
                    }
                }
                if (value == null) {
                    int notifyOverride = getNotifyOverride(preferences, dialog_id);
                    value = !(notifyOverride == 2 || (!preferences.getBoolean("EnableAll", true)
                            || isChat && !preferences.getBoolean("EnableGroup", true)) && notifyOverride == 0);
                    settingsCache.put(dialog_id, value);
                }
                if (popup != 0 && messageObject.messageOwner.to_id.channel_id != 0
                        && !messageObject.isMegagroup()) {
                    popup = 0;
                }
                if (value) {
                    if (popup != 0) {
                        popupArray.add(0, messageObject);
                    }
                    delayedPushMessages.add(messageObject);
                    pushMessages.add(0, messageObject);
                    pushMessagesDict.put(mid, messageObject);
                    if (original_dialog_id != dialog_id) {
                        pushDialogsOverrideMention.put(original_dialog_id, 1);
                    }
                }
            }

            if (added) {
                notifyCheck = isLast;
            }

            if (!popupArray.isEmpty() && oldCount != popupArray.size()
                    && !AndroidUtilities.needShowPasscode(false)) {
                final int popupFinal = popup;
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        popupMessages = popupArray;
                        if (ApplicationLoader.mainInterfacePaused
                                || !ApplicationLoader.isScreenOn && !UserConfig.isWaitingForPasscodeEnter) {
                            if (popupFinal == 3 || popupFinal == 1 && ApplicationLoader.isScreenOn
                                    || popupFinal == 2 && !ApplicationLoader.isScreenOn) {
                                Intent popupIntent = new Intent(ApplicationLoader.applicationContext,
                                        PopupNotificationActivity.class);
                                popupIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                                        | Intent.FLAG_ACTIVITY_NO_ANIMATION
                                        | Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_FROM_BACKGROUND);
                                ApplicationLoader.applicationContext.startActivity(popupIntent);
                            }
                        }
                    }
                });
            }
        }
    });
}

From source file:com.ichi2.anki.DeckOptions.java

private void restartActivity() {
    if (Build.VERSION.SDK_INT >= 11) {
        recreate();/* ww  w  . ja va  2  s  . c o  m*/
    } else {
        Intent intent = getIntent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        finish();
        overridePendingTransition(0, 0);
        startActivity(intent);
        overridePendingTransition(0, 0);
    }
}