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:de.qspool.clementineremote.ui.ConnectActivity.java

/**
 * We connected to clementine successfully. Now open other view
 *///from   w w w.  jav  a 2 s  . c  o m
void showPlayerDialog() {
    if (mClementineMDns != null) {
        mClementineMDns.stopServiceDiscovery();
    }

    // Start the player dialog
    Intent playerDialog = new Intent(this, MainActivity.class);
    playerDialog.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP
            | Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivityForResult(playerDialog, ID_PLAYER_DIALOG);
}

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

private void showAccount(AccountDescriptor selectedAccount) {

    App app = getApp();/*  w  ww .  j a  va  2  s  .  com*/
    AccountDescriptor currentAccount = app.getCurrentAccount();
    app.saveUpdatedAccountDescriptor(currentAccount);

    saveData(getCurrentLaneIndex());

    if (currentAccount == null || currentAccount.getId() != selectedAccount.getId()) {

        saveData(getCurrentLaneIndex());

        clearFragmentsCache();

        app.setCurrentAccount(selectedAccount.getId());

        // From http://stackoverflow.com/a/3419987/328679
        Intent intent = getIntent();
        overridePendingTransition(0, 0);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        finish();

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

From source file:org.telegram.messenger.NotificationsController.java

public void processNewMessages(final ArrayList<MessageObject> messageObjects, final boolean isLast) {
    if (messageObjects.isEmpty()) {
        return;/* www.j av  a  2s .co 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);
            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 == openned_dialog_id && ApplicationLoader.isScreenOn) {
                    playInChatSound();
                    continue;
                }
                if ((messageObject.messageOwner.flags & TLRPC.MESSAGE_FLAG_MENTION) != 0) {
                    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 (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) {
                            MessageObject messageObject = messageObjects.get(0);
                            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.ferdi2005.secondgram.NotificationsController.java

protected void forceShowPopupForReply() {
    notificationsQueue.postRunnable(new Runnable() {
        @Override/*from   w  w w.j  a  v a 2  s  .  c o m*/
        public void run() {
            final ArrayList<MessageObject> popupArray = new ArrayList<>();
            for (int a = 0; a < pushMessages.size(); a++) {
                MessageObject messageObject = pushMessages.get(a);
                long dialog_id = messageObject.getDialogId();
                if (messageObject.messageOwner.mentioned
                        && messageObject.messageOwner.action instanceof TLRPC.TL_messageActionPinMessage
                        || (int) dialog_id == 0
                        || messageObject.messageOwner.to_id.channel_id != 0 && !messageObject.isMegagroup()) {
                    continue;
                }
                popupArray.add(0, messageObject);
            }
            if (!popupArray.isEmpty() && !AndroidUtilities.needShowPasscode(false)) {
                AndroidUtilities.runOnUIThread(new Runnable() {
                    @Override
                    public void run() {
                        popupReplyMessages = popupArray;
                        Intent popupIntent = new Intent(ApplicationLoader.applicationContext,
                                PopupNotificationActivity.class);
                        popupIntent.putExtra("force", true);
                        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);
                        Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
                        ApplicationLoader.applicationContext.sendBroadcast(it);
                    }
                });
            }
        }
    });
}

From source file:com.patil.geobells.lite.MainActivity.java

public void onUpgradeClick(View v) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.patil.geobells"));
    intent.setFlags(/*from   w ww . j  a v a2s  . c  o  m*/
            Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(intent);
}

From source file:me.kaidul.uhunt.MainActivity.java

public void reloadActivity() {
    Intent intent = getIntent();//from w ww  .  ja v  a  2  s .c  o m
    overridePendingTransition(0, 0);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    finish();
    overridePendingTransition(0, 0);
    startActivity(intent);
}

From source file:com.numenta.taurus.instance.InstanceListFragment.java

@Override
public void onListItemClick(ListView list, View item, int position, long id) {

    // Check for network connection before opening detail screen
    Activity activity = getActivity();/*  w  ww  . j  a  va  2s .co  m*/
    if (activity instanceof TaurusBaseActivity && !((TaurusBaseActivity) activity).checkNetworkConnection()) {
        return;
    }

    // Get item from position
    InstanceAnomalyChartData instance = (InstanceAnomalyChartData) getListAdapter().getItem(position);

    // Make user the instance has data before opening the detail page
    if (instance == null || !instance.hasData()) {
        // Nothing to show
        return;
    }

    // Show detail page
    Intent instanceDetail = new Intent(getActivity(), InstanceDetailActivity.class);
    instanceDetail.putExtra(InstanceDetailActivity.INSTANCE_ID_ARG, instance.getId());
    instanceDetail.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    Date endDate = instance.getEndDate();
    instanceDetail.putExtra(InstanceDetailActivity.TIMESTAMP_ARG,
            endDate == null ? 0 : instance.getEndDate().getTime());
    startActivity(instanceDetail);
}

From source file:com.tweetlanes.android.core.view.HomeActivity.java

private void showAccount(AccountDescriptor selectedAccount, Constant.LaneType lane) {

    App app = getApp();/*from  w w w  .  j  ava 2 s .c o  m*/
    AccountDescriptor currentAccount = app.getCurrentAccount();
    TwitterUser cachedUser = TwitterManager.get().getFetchUserInstance().getCachedUser(currentAccount.getId());
    if (cachedUser != null) {
        currentAccount
                .setProfileImageUrl(cachedUser.getProfileImageUrl(TwitterManager.ProfileImageSize.BIGGER));
    }
    app.saveUpdatedAccountDescriptor(currentAccount);

    saveData(getCurrentLaneIndex());

    if (currentAccount == null || currentAccount.getId() != selectedAccount.getId()) {

        saveData(getCurrentLaneIndex());

        clearFragmentsCache();

        app.setCurrentAccount(selectedAccount.getId());
        if (mHomeLaneAdapter != null) {
            mHomeLaneAdapter.notifyDataSetChanged();
        }

        // From http://stackoverflow.com/a/3419987/328679
        Intent intent = getIntent();
        overridePendingTransition(0, 0);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        if (lane != null) {
            intent.putExtra("lane", lane.toString());
        }
        finish();

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

From source file:dk.ciid.android.infobooth.activities.IntroductionActivity.java

private void changeActivity(String activityName) {
    Intent openActivity = new Intent(activityName);
    openActivity.putExtra("isInDebugMode", isInDebugMode);
    openActivity.putExtra("serviceNameItems", serviceNameItems);
    openActivity.putExtra("serviceDescItems", serviceDescItems);
    openActivity.putExtra("voice1", voice1);
    openActivity.putExtra("voice2", voice2);
    openActivity.putExtra("voice3", voice3);
    openActivity.putExtra("voice4", voice4);
    openActivity.putExtra("voice5", voice5);
    openActivity.putExtra("voice6", voice6);
    openActivity.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(openActivity);//w  w  w .j a  v  a 2  s . c om
    closeAccessory();
}

From source file:de.dmarcini.bt.homelight.HomeLightMainActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    //// w  w w.  j  ava2 s .  co  m
    // Das Ergebnis der Anfrage an den Geneigten User zum Einschaklten der BT Schnittstelle
    //
    switch (requestCode) {
    case ProjectConst.REQUEST_ENABLE_BT:
        switch (resultCode) {
        case Activity.RESULT_CANCELED:
            finish();
            return;

        case Activity.RESULT_OK:
            tryReconnectToDevice();
            break;

        default:
            finish();
            return;
        }
        break;

    case ProjectConst.REQUEST_SYS_PREFS:
        Intent intent = getIntent();
        overridePendingTransition(0, 0);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        finish();
        overridePendingTransition(0, 0);
        startActivity(intent);
        break;
    }
    //
    // nix fr mich
    //
    super.onActivityResult(requestCode, resultCode, data);
}