List of usage examples for android.support.v4.app FragmentManager POP_BACK_STACK_INCLUSIVE
int POP_BACK_STACK_INCLUSIVE
To view the source code for android.support.v4.app FragmentManager POP_BACK_STACK_INCLUSIVE.
Click Source Link
From source file:net.reichholf.dreamdroid.fragment.NavigationFragment.java
private void clearBackStack() { // Pop the backstack completely everytime the user navigates "away" // Avoid's "stacking" fragments due to back-button behaviour that feels // really mysterious FragmentManager fm = getActionBarActivity().getSupportFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); }//w w w . j av a2 s. co m }
From source file:com.popdeem.sdk.uikit.fragment.PDUIConnectSocialAccountFragment.java
public void removeThisFragment() { if (!isAdded()) { return;/*from ww w . j a va 2 s . c om*/ } getActivity().getSupportFragmentManager().popBackStack(getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE); }
From source file:org.sufficientlysecure.keychain.ui.BackupCodeFragment.java
private void popBackStackNoAction() { FragmentManager fragMan = getFragmentManager(); fragMan.removeOnBackStackChangedListener(this); fragMan.popBackStackImmediate(BACK_STACK_INPUT, FragmentManager.POP_BACK_STACK_INCLUSIVE); mBackStackLevel = null;// w ww . j a va 2 s . co m }
From source file:org.alfresco.mobile.android.application.fragments.preferences.AccountSettingsFragment.java
private void deleteAccount() { // List all accounts. List<AlfrescoAccount> accounts = AlfrescoAccountManager.retrieveAccounts(getActivity()); // Remove all Sync if (account == null) { return;// ww w . j a va 2s.co m } Operator.with(getActivity()).load(new CleanSyncFavoriteRequest.Builder(account, true)); // Delete Account from AccountManager AccountManager.get(getActivity()).removeAccount( AlfrescoAccountManager.getInstance(getActivity()).getAndroidAccount(account.getId()), null, null); // Analytics AnalyticsHelper.reportOperationEvent(getActivity(), AnalyticsManager.CATEGORY_ACCOUNT, AnalyticsManager.ACTION_DELETE, account.getTypeId() == AlfrescoAccount.TYPE_ALFRESCO_CLOUD ? AnalyticsManager.SERVER_TYPE_CLOUD : AnalyticsManager.SERVER_TYPE_ONPREMISE, 1, false); // In case where currentAccount is the one deleted. SessionManager.getInstance(getActivity()).removeAccount(account.getId()); // Send the event EventBusManager.getInstance().post(new DeleteAccountEvent(account)); AlfrescoAccount newAccount = AlfrescoAccountManager.getInstance(getActivity()).getDefaultAccount(); if (newAccount != null && newAccount.getId() == account.getId()) { SharedPreferences settings = getActivity().getSharedPreferences(AccountsPreferences.ACCOUNT_PREFS, 0); long id = settings.getLong(AccountsPreferences.ACCOUNT_DEFAULT, -1); if (id == account.getId()) { settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, -1).apply(); } } // UI Management if (accounts.size() - 1 > 0) { for (AlfrescoAccount acc : accounts) { if (acc.getId() == account.getId()) { accounts.remove(acc); break; } } newAccount = accounts.get(0); SessionManager.getInstance(getActivity()).saveAccount(newAccount); SharedPreferences settings = getActivity().getSharedPreferences(AccountsPreferences.ACCOUNT_PREFS, 0); settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, newAccount.getId()).apply(); setCurrentAccount(newAccount); if (SessionManager.getInstance(getActivity()).hasSession(newAccount.getId())) { SessionManager.getInstance(getActivity()).getCurrentSession(); } else { SessionManager.getInstance(getActivity()).loadSession(newAccount); } // There's still other account. // Remove Details panel if (DisplayUtils.hasCentralPane(getActivity())) { FragmentDisplayer.with(getActivity()).remove(AccountSettingsFragment.TAG); } else { getFragmentManager().popBackStack(AccountSettingsFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } else { // If no AlfrescoAccount left, we remove all preferences // Remove preferences SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); sharedPref.edit().clear().apply(); // Redirect to HomeScreenActivity getActivity().startActivity(new Intent(getActivity(), WelcomeActivity.class)); getActivity().finish(); } // Clear Analytics Info for deleted account AnalyticHelper.cleanOpt(getActivity(), account); }
From source file:com.pdmanager.views.patient.MainActivity.java
@Override public void onMessageReceived(final CNMessage cnMessage) { if (application.getUniqueId().equals(cnMessage.getUniqueId())) { return;//ww w . j a v a2s . co m } if (cnMessage.getMessageType() == CNMessage.CNMessageType.Calling) { if (application.isInConference()) { application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.Busy, null); return; } callDialog = new AlertDialog.Builder(this).create(); LayoutInflater inflater = getLayoutInflater(); View incomingCallDialog = inflater.inflate(R.layout.incoming_call_dialog, null); incomingCallDialog.setAlpha(0.5f); callDialog.setView(incomingCallDialog); TextView caller = (TextView) incomingCallDialog.findViewById(R.id.caller); caller.setText(cnMessage.getDisplayName()); Button answerButton = (Button) incomingCallDialog.findViewById(R.id.answer_button); answerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { application.setConferenceId(cnMessage.getConferenceId()); application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerAccept, null); callDialog.hide(); currentRingtone.stop(); Intent intent = new Intent(application.getContext(), MainActivity.class); intent.setAction(Intent.ACTION_MAIN); intent.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(intent); application.join(application.getConferenceId(), true); } }); Button declineButton = (Button) incomingCallDialog.findViewById(R.id.decline_button); declineButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { application.sendCNMessage(cnMessage.getFrom(), CNMessage.CNMessageType.AnswerDecline, null); currentRingtone.stop(); callDialog.hide(); } }); callDialog.setCancelable(false); callDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT); //play current Ringtone currentRingtone.play(); callDialog.show(); } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.Cancel) { currentRingtone.stop(); callDialog.hide(); } else if (cnMessage.getMessageType() == CNMessage.CNMessageType.EndCall) { if (application.leave()) { int count = getFragmentManager().getBackStackEntryCount(); String name = getFragmentManager().getBackStackEntryAt(count - 2).getName(); getFragmentManager().popBackStack(name, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } }
From source file:org.alfresco.mobile.android.application.fragments.menu.MainMenuFragment.java
private void hideSlidingMenu(boolean goHome) { if (SLIDING_TAG.equals(getTag())) { if (goHome) { getFragmentManager().popBackStack(TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE); }/*from w w w. jav a 2 s .c o m*/ if (getActivity() instanceof MainActivity) { ((MainActivity) getActivity()).hideSlideMenu(); FragmentDisplayer.clearCentralPane(getActivity()); } } }
From source file:com.sim2dial.dialer.LinphoneActivity.java
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) { if (newFragmentType == FragmentsAvailable.DIALER) { showStatusBar();// ww w. jav a 2s. com // hideStatusBar(); } else { hideStatusBar(); } } // if (statusFragment != null) // { // statusFragment.closeStatusBar(); // } FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (!withoutAnimation && !isAnimationDisabled && currentFragment.shouldAnimate()) { if (newFragmentType.isRightOf(currentFragment)) { transaction.setCustomAnimations(R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left, R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right); } else { transaction.setCustomAnimations(R.anim.slide_in_left_to_right, R.anim.slide_out_left_to_right, R.anim.slide_in_right_to_left, R.anim.slide_out_right_to_left); } } try { getSupportFragmentManager().popBackStackImmediate(newFragmentType.toString(), FragmentManager.POP_BACK_STACK_INCLUSIVE); } catch (java.lang.IllegalStateException e) { } transaction.addToBackStack(newFragmentType.toString()); transaction.replace(R.id.fragmentContainer, newFragment); transaction.commitAllowingStateLoss(); getSupportFragmentManager().executePendingTransactions(); currentFragment = newFragmentType; }
From source file:com.chatwing.whitelabel.activities.LegacyLoginActivity.java
/** * After Reset Password Task// w w w . ja v a2 s . c om * * @param event * @param task */ private void onTaskFinished(TaskFinishedEvent event, @SuppressWarnings("UnusedParameters") ResetPasswordTask task) { if (event.getStatus() == TaskFinishedEvent.Status.SUCCEED) { //FIXME: this is not localizable mConfirmMessageView.show(getString(R.string.message_forgot_password_success)); getSupportFragmentManager().popBackStack(BACK_STACK_FORGOT_PASSWORD, FragmentManager.POP_BACK_STACK_INCLUSIVE); } else { if ((event.getException() instanceof ApiManager.ValidationException || event.getException() instanceof EmailValidator.InvalidEmailException)) { showEmailForgotError(getString(R.string.error_invalid_email)); return; } //Other errors (Unknown or general errors) we let other to handle it mErrorMessageView.show(event.getException()); } }
From source file:com.chatwing.whitelabel.activities.CommunicationActivity.java
@Override public void onBackPressed() { if (mCurrentCommunicationMode.isSecondaryDrawerOpening()) { ((ChatboxModeManager) mCurrentCommunicationMode).closeSecondaryDrawer(); } else if (!mCurrentCommunicationMode.isCommunicationBoxDrawerOpening()) { // Both online users and chat boxes/conversation lists are closed. // Open chat boxes/conversation list now. mCurrentCommunicationMode.openCommunicationBoxDrawer(); } else {//from w w w .j a v a 2 s. co m // Online users list is closed, chat boxes list is opened. // User probably is trying to quit the app. FragmentManager fragmentManager = getSupportFragmentManager(); int stackSize = fragmentManager.getBackStackEntryCount(); if (stackSize == 0) { finish(); } else { String fragmentTag = fragmentManager.getBackStackEntryAt(stackSize - 1).getName(); fragmentManager.popBackStack(fragmentTag, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } }
From source file:com.sbgapps.scoreit.ScoreItActivity.java
private void showScoreScene() { if (mIsEdited) { mEditedLap.set(mLap);/*from w w w . ja va2s .c om*/ mEditedLap = null; mIsEdited = false; } else { mLap.computeScores(); mGameManager.addLap(mLap); } CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) mActionButton.getLayoutParams(); p.setBehavior(FAB_BEHAVIOUR); mLap = null; animateActionButton(); updateFragments(); getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); }