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.bluros.music.utils.NavigationUtils.java

public static Intent getNavigateToStyleSelectorIntent(Activity context, String what) {
    final Intent intent = new Intent(context, SettingsActivity.class);
    if (!PreferencesUtility.getInstance(context).getSystemAnimations()) {
        intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    }//from w w  w  . j  av a2  s .co  m
    intent.setAction(Constants.SETTINGS_STYLE_SELECTOR);
    intent.putExtra(Constants.SETTINGS_STYLE_SELECTOR_WHAT, what);
    return intent;
}

From source file:com.appteam.nimbus.activity.homeActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_logout) {
        personalData.SaveData(false);/*from w  w w.j  a va 2  s .  c  o  m*/

        Intent launch_logout = new Intent(homeActivity.this, Login.class);
        launch_logout.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        launch_logout.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
        launch_logout.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);

        startActivity(launch_logout);
        finish();

        return true;
    } else if (id == R.id.action_leaderboard) {
        startActivity(new Intent(homeActivity.this, Leaderboard.class));
        return true;
    } else if (id == R.id.action_important_contact) {
        CharSequence name[] = { "Ankush Sharma\n(Discipline Secretary)",
                "Rishabh Kumar\n(Discipline Joint Secretary)", "Kumud Jindal\n(Discipline Joint Secretary)", };
        final CharSequence number[] = { "9736688292", "8627090570", "9882263949" };
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setIcon(android.R.drawable.ic_menu_call);
        builder.setTitle("Emergency Contact");
        builder.setItems(name, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:+91" + number[i]));
                startActivity(intent);
            }
        });
        AlertDialog alertDialog = builder.create();
        alertDialog.show();
    }

    return super.onOptionsItemSelected(item);
}

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

public void onReload() {
    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);/*from  ww w.j  a  v  a 2s  . c om*/
    finish();
}

From source file:com.example.administrator.myapplication2._3_HB._3_MainActivity.java

@Override
public void onBackPressed() {

    ExampleFragment frg = (ExampleFragment) mSectionsPagerAdapter.getItem(FragmentAdapter.FRAGMENT_POS_EXAMPLE);
    frg.stopThread();//from  ww  w .  j a  va 2  s . c  om
    //Set Class to Top of App and no history
    Intent launchNextActivity;
    launchNextActivity = new Intent(this, Main.class);
    launchNextActivity.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    launchNextActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    launchNextActivity.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    startActivity(launchNextActivity);
}

From source file:com.hmsoft.weargoproremote.services.WearMessageHandlerService.java

void updateNotification(String contentText) {
    if (mNotificationBuilder == null) {
        Context context = getApplicationContext();
        Intent activityIntent = new Intent(context, MobileMainActivity.class);
        activityIntent.setAction(Intent.ACTION_MAIN);
        activityIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        activityIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_NEW_TASK);

        Intent stopIntent = new Intent(context, WearMessageHandlerService.class);
        stopIntent.setAction(ACTION_STOP);

        mNotificationBuilder = (new Builder(this)).setSmallIcon(R.drawable.icon_notification)
                .setContentTitle(getString(R.string.notification_tittle))
                .setContentIntent(PendingIntent.getActivity(context, 0, activityIntent, 0)).setLocalOnly(true)
                .addAction(R.drawable.icon_power, getString(R.string.action_stop),
                        PendingIntent.getService(context, 0, stopIntent, 0));
    }/*from   www . java2  s.  c  o  m*/

    mNotificationBuilder.setContentText(contentText);
    startForeground(1, mNotificationBuilder.build());
}

From source file:com.orange.oidc.secproxy_service.Service.java

void resetCookies() {
    // init intent
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setClass(Service.this, WebViewActivity.class);

    intent.putExtra("resetcookies", "true");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP
            | Intent.FLAG_ACTIVITY_NO_ANIMATION);

    // launch webview
    startActivity(intent);/* ww  w  . j  av a 2  s  .c o m*/
}

From source file:com.onesignal.GenerateNotification.java

private static Intent getNewBaseDeleteIntent(int notificationId) {
    Intent intent = new Intent(currentContext, notificationOpenedClass)
            .putExtra("notificationId", notificationId).putExtra("dismissed", true);

    if (openerIsBroadcast)
        return intent;
    return intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK
            | Intent.FLAG_ACTIVITY_NO_ANIMATION);
}

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

@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.chat_window_pager);

    this.rootLayout = (RelativeLayout) findViewById(R.id.chatPagerParent);
    this.buzzAnimation = AnimationUtils.loadAnimation(this, R.anim.shake);

    this.mViewPager = (ViewPager) findViewById(R.id.chatPager);
    this.mAdapter = new ChatFragmentAdapter(getSupportFragmentManager());
    this.mViewPager.setAdapter(this.mAdapter);

    this.drawer = (SlidingDrawer) findViewById(R.id.drawer);
    this.btnClose = (Button) findViewById(R.id.btnClose);
    this.btnSmiley = (Button) findViewById(R.id.btnSmiley);
    GridView gv = (GridView) this.drawer.findViewById(R.id.content);
    gv.setAdapter(new SmileyAdapter());
    gv.setOnItemClickListener(new OnItemClickListener() {

        @Override/* w w w.  ja v  a 2 s.  c  o m*/
        public void onItemClick(final AdapterView<?> arg0, final View arg1, final int arg2, final long arg3) {
            String smiley = arg1.getTag().toString();
            Intent intent = new Intent();
            intent.setAction(MessengerService.INTENT_INSERT_SMILEY)
                    .putExtra(Utils.qualify("from"), ChatWindowPager.currentFriendId)
                    .putExtra(Utils.qualify("symbol"), smiley);

            sendBroadcast(intent);
            ChatWindowPager.this.drawer.animateClose();
        }
    });

    if (getIntent().hasExtra(Utils.qualify("friendId"))) {
        currentFriendId = getIntent().getExtras().getString(Utils.qualify("friendId"));
        if (!MessengerService.getFriendsInChat().keySet().contains(currentFriendId))
            MessengerService.getFriendIMs(this, currentFriendId);
    } else if (currentFriendId == "" || !MessengerService.getFriendsInChat().keySet().contains(currentFriendId))
        currentFriendId = MessengerService.getFriendsInChat().keySet().toArray()[0].toString();

    for (int i = 0; i < MessengerService.getFriendsInChat().size(); i++)
        if (MessengerService.getFriendsInChat().keySet().toArray()[i].toString().equals(currentFriendId)) {
            currentItem = i;
            break;
        }

    this.mTabPageIndicator = (TabPageIndicator) findViewById(R.id.chatIndicator);
    this.mTabPageIndicator.setViewPager(this.mViewPager, currentItem);
    this.mTabPageIndicator.setOnPageChangeListener(new OnPageChangeListener() {

        @Override
        public void onPageScrollStateChanged(final int arg0) {
        }

        @Override
        public void onPageScrolled(final int arg0, final float arg1, final int arg2) {
        }

        @Override
        public void onPageSelected(final int arg0) {
            buzzWaitElapsed.set(true);
            ChatWindowPager.this.buzzAllower.cancel();
            ChatWindowPager.currentFriendId = ChatWindowPager.this.mAdapter.getId(arg0);
            currentItem = arg0;

            synchronized (MessengerService.getUnreadIMs()) {
                MessengerService.getUnreadIMs().remove(ChatWindowPager.this.mAdapter.getId(arg0));
                ChatWindowPager.this.mTabPageIndicator.notifyDataSetChanged();
            }
        }
    });

    this.btnClose.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(final View v) {
            Utils.saveConversationHistory(ChatWindowPager.this, currentFriendId);
            MessengerService.getFriendsInChat().remove(currentFriendId);
            currentItem--;
            if (currentItem < 0)
                if (MessengerService.getFriendsInChat().size() == 0) {
                    finish();
                    return;
                } 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);
        }
    });
    this.btnSmiley.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(final View v) {
            ChatWindowPager.this.drawer.animateOpen();
        }
    });

    MessengerService.getUnreadIMs().remove(currentFriendId);
    this.mViewPager.setCurrentItem(currentItem);
    this.mTabPageIndicator.notifyDataSetChanged();

    // reshow the default notification
    MessengerService.getNotificationHelper().showDefaultNotification(false, false);
}

From source file:com.cocosw.framework.core.Base.java

/**
 * Restart current activity/*  w  ww. j av  a 2 s.com*/
 */
protected void restart() {
    Intent intent = getIntent();
    overridePendingTransition(0, 0);
    intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    finish();

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

From source file:com.owncloud.android.ui.activity.FingerprintActivity.java

private void fingerprintResult(boolean fingerok) {
    if (fingerok) {
        Intent resultIntent = new Intent();
        resultIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        resultIntent.putExtra(KEY_CHECK_RESULT, true);
        setResult(RESULT_OK, resultIntent);
        finish();//from   w ww.ja va2s.c o m
    } else {
        showErrorAndRestart(R.string.fingerprint_unknown);
    }
}