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.jtechme.apphub.FDroid.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    switch (requestCode) {
    case REQUEST_PREFS:
        // The automatic update settings may have changed, so reschedule (or
        // unschedule) the service accordingly. It's cheap, so no need to
        // check if the particular setting has actually been changed.
        UpdateService.schedule(getBaseContext());

        if ((resultCode & PreferencesActivity.RESULT_RESTART) != 0) {
            ((FDroidApp) getApplication()).reloadTheme();
            final Intent intent = getIntent();
            overridePendingTransition(0, 0);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            finish();//from   w w w. j a va 2  s.  c o  m
            overridePendingTransition(0, 0);
            startActivity(intent);
        }
        break;
    case REQUEST_ENABLE_BLUETOOTH:
        fdroidApp.sendViaBluetooth(this, resultCode, "com.jtechme.apphub");
        break;
    }
}

From source file:com.frostwire.android.gui.util.UIUtils.java

public static void goToFrostWireMainActivity(Activity activity) {
    final Intent intent = new Intent(activity, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    activity.startActivity(intent);/* ww w  . ja  v a2  s  .  c om*/
    activity.finish();
    activity.overridePendingTransition(0, 0);
}

From source file:org.fdroid.fdroid.FDroid.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    switch (requestCode) {
    case REQUEST_PREFS:
        // The automatic update settings may have changed, so reschedule (or
        // unschedule) the service accordingly. It's cheap, so no need to
        // check if the particular setting has actually been changed.
        UpdateService.schedule(getBaseContext());

        if ((resultCode & PreferencesActivity.RESULT_RESTART) != 0) {
            ((FDroidApp) getApplication()).reloadTheme();
            final Intent intent = getIntent();
            overridePendingTransition(0, 0);
            intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            finish();//w ww  .  ja  v a2  s .  c  o m
            overridePendingTransition(0, 0);
            startActivity(intent);
        }
        break;
    case REQUEST_ENABLE_BLUETOOTH:
        fdroidApp.sendViaBluetooth(this, resultCode, "org.fdroid.fdroid");
        break;
    }
}

From source file:com.kncwallet.wallet.ui.WalletActivity.java

private void checkPin() {

    if (prefs.getBoolean(Constants.PREFS_KEY_APP_PIN_ENABLED, false)) {
        if (!prefs.getBoolean(Constants.PREFS_KEY_APP_PIN_AUTHORIZED, false)) {
            Intent pinIntent = new Intent(this, PinEntryActivity.class);
            pinIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(pinIntent);// w  w  w .  ja v a  2  s.c  o  m
        }
    }
}

From source file:com.klinker.android.twitter.activities.search.SearchPager.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    overridePendingTransition(0, 0);//from   ww  w. j  a  va 2 s .c om
    finish();
    Intent restart = new Intent(context, SearchPager.class);
    restart.putExtra(SearchManager.QUERY, searchQuery);
    restart.setAction(Intent.ACTION_SEARCH);
    restart.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    overridePendingTransition(0, 0);
    startActivity(restart);
}

From source file:at.jclehner.rxdroid.DrugListActivity.java

public void onDrugNameClick(View view) {
    Intent intent = new Intent(Intent.ACTION_EDIT);
    intent.setClass(this, DrugEditActivity.class);

    Drug drug = Drug.get((Integer) view.getTag(TAG_DRUG_ID));
    intent.putExtra(DrugEditActivity.EXTRA_DRUG_ID, drug.getId());
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

    //startActivityForResult(intent, 0);
    startActivity(intent);//from w  ww. j  a  v  a  2  s .com
}

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

protected void loginSuccess(boolean refresh) {
    setLoadingStatus(R.string.blank, false);

    initMenu();/*w w  w .j  a va  2s.c  om*/

    Intent intent = new Intent(OnlineActivity.this, FeedsActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

    startActivityForResult(intent, 0);
    overridePendingTransition(0, 0);

    if (hasPendingOfflineData())
        syncOfflineData();

    finish();
}

From source file:com.sir_m2x.messenger.activities.ChatWindowPager.java

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    if (item.getItemId() == R.id.mnuClose) {
        //TODO find a better solution for this than restarting the activity

        //MessengerService.getFriendsInChat().get(currentFriendId).clear();
        Utils.saveConversationHistory(this, currentFriendId);
        MessengerService.getFriendsInChat().remove(currentFriendId);
        currentItem--;//from w w  w .jav  a  2 s  .  c om
        if (currentItem < 0)
            if (MessengerService.getFriendsInChat().size() == 0) {
                finish();
                return true;
            } else
                currentItem++;

        currentFriendId = MessengerService.getFriendsInChat().keySet().toArray()[currentItem].toString();

        Intent intent = getIntent();
        overridePendingTransition(0, 0);
        intent.putExtra(Utils.qualify("friendId"), currentFriendId);
        intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        finish();
        overridePendingTransition(0, 0);
        startActivity(intent);
        /*
         * Not working properly: removing the fragment and selecting another
         * fragment will not destroy the already instantiated one and
         * therefore will cause some UI bugs.
         * 
         * this.mViewPager.setAdapter(null); this.mAdapter = new
         * ChatFragmentAdapter(getSupportFragmentManager());
         * this.mViewPager.setAdapter(this.mAdapter);
         * 
         * this.mTabPageIndicator.notifyDataSetChanged();
         * this.mAdapter.notifyDataSetChanged();
         * this.mTabPageIndicator.setCurrentItem(currentItem);
         * this.mViewPager.setCurrentItem(currentItem, true);
         */

    } else if (item.getItemId() == R.id.mnuBuzz)
        doBuzz();
    else if (item.getItemId() == R.id.mnuClear) {
        final CustomDialog dlg = new CustomDialog(this);
        dlg.setTitle("Clear history");
        dlg.setMessage(
                "Are you sure you want to clear the history for this contact (all messages will be cleared)?")
                .setPositiveButton("Yes", new View.OnClickListener() {

                    @Override
                    public void onClick(final View v) {
                        Utils.clearHistory(ChatWindowPager.this, currentFriendId);
                        Intent intent = new Intent(MessengerService.INTENT_LIST_CHANGED);
                        sendBroadcast(intent);
                        dlg.dismiss();
                    }
                }).setNegativeButton("No", new View.OnClickListener() {

                    @Override
                    public void onClick(final View v) {
                        dlg.dismiss();
                    }
                }).show();
    }

    return true;
}

From source file:com.eeshana.icstories.activities.UploadVideoActivity.java

@SuppressLint("NewApi")
@Override//from  w  w  w .j a va 2 s.c o m
public void onClick(View v) {
    if (v.getId() == uploadButton.getId()) {
        if (connectionDetector.isConnectedToInternet()) {
            title = titleEditText.getText().toString();
            description = descriptionEditText.getText().toString();
            flag = isAssignment;
            my_location = locationEditText.getText().toString();
            if (title.equalsIgnoreCase("") || description.equalsIgnoreCase("")) {
                showCustomToast.showToast(UploadVideoActivity.this, "Title and Description both are required");
            } else {

                Log.e("location2", my_location);

                //new UplodTask(getApplicationContext()).execute();
                if (title.length() <= 30 && title.length() >= 4 && description.length() >= 4
                        && description.length() <= 150 && my_location.length() <= 30) {//&& my_location.matches(pattern) && title.matches(pattern) && description.matches(pattern)){
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                        new UplodTask(getApplicationContext())
                                .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                    } else {
                        new UplodTask(getApplicationContext()).execute();
                    }

                } else {
                    //                  if(!title.matches(pattern)){
                    //                     titleEditText.setError("Title contains one or more invalid characters. Please check.");
                    //                  }
                    //                  if(!description.matches(pattern)){
                    //                     descriptionEditText.setError("Description contains one or more invalid characters. Please check");
                    //                  }
                    //                  if(!my_location.matches(pattern)){
                    //                     locationEditText.setError("Location contains one or more invalid characters. Please check");
                    //                  }
                    if (title.length() < 4) {
                        titleEditText.setError("Title must be min 4 characters.");
                    }
                    if (description.length() < 4) {
                        descriptionEditText.setError("Description must be min 4 characters.");
                    }
                    if (title.length() > 30) {
                        titleEditText.setError("Title must be max 30 characters.");
                    }
                    if (description.length() > 150) {
                        descriptionEditText.setError("Description must be max 150 characters.");
                    }
                    if (my_location.length() > 30) {
                        descriptionEditText.setError("Location must be max 30 characters.");
                    }
                }
            }
        } else {
            showCustomToast.showToast(UploadVideoActivity.this, "Please check your internet connection.");
        }
    } else if (v.getId() == isAssignmentButton.getId()) {
        if (isAssignment.equalsIgnoreCase("NO")) {
            isAssignment = "YES";
            isAssignmentButton.setText("YES");
        } else {
            isAssignment = "NO";
            isAssignmentButton.setText("NO");
        }
    } else if (v.getId() == wallRelativeLayout.getId()) {
        Intent i = new Intent(UploadVideoActivity.this, WallActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
    } else if (v.getId() == settingsRelativeLayout.getId()) {
        Intent i = new Intent(UploadVideoActivity.this, SettingsActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivity(i);
        finish();
    } else if (v.getId() == okButton.getId()) {
        //go to settings page to enable GPS
        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivityForResult(intent, REQUEST_CODE);
        locationDialog.dismiss();
    } else if (v.getId() == cancelButton.getId()) {
        locationDialog.dismiss();
    }

}

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

private void showAccount(AccountDescriptor selectedAccount) {

    AccountDescriptor currentAccount = getApp().getCurrentAccount();

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

        saveData(getCurrentLaneIndex());

        clearFragmentsCache();//from   w ww  .ja  v  a 2s.c  o m

        getApp().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);
    }
}