List of usage examples for android.app FragmentManager POP_BACK_STACK_INCLUSIVE
int POP_BACK_STACK_INCLUSIVE
To view the source code for android.app FragmentManager POP_BACK_STACK_INCLUSIVE.
Click Source Link
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * *//*from w w w. j a v a 2 s.co m*/ @Override public void onCreate(final Bundle savedInstanceState) { //Log.i("MAIN ACTIVITY", "onCreate"); restoreInstance(savedInstanceState); super.onCreate(savedInstanceState); NetworkInfoCollector.init(this); networkInfoCollector = NetworkInfoCollector.getInstance(); preferencesUpdate(); setContentView(R.layout.main_with_navigation_drawer); if (VIEW_HIERARCHY_SERVER_ENABLED) { ViewServer.get(this).addWindow(this); } ActionBar actionBar = getActionBar(); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE); actionBar.setDisplayUseLogoEnabled(true); // initialize the navigation drawer with the main menu list adapter: String[] mainTitles = getResources().getStringArray(R.array.navigation_main_titles); int[] navIcons = new int[] { R.drawable.ic_action_home, R.drawable.ic_action_history, R.drawable.ic_action_map, R.drawable.ic_action_stat, R.drawable.ic_action_help, R.drawable.ic_action_about, R.drawable.ic_action_settings, R.drawable.ic_action_about }; MainMenuListAdapter mainMenuAdapter = new MainMenuListAdapter(this, mainTitles, navIcons); drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); drawerList = (ListView) findViewById(R.id.left_drawer); drawerLayout.setBackgroundResource(R.drawable.ic_drawer); drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.page_title_title_page, R.string.page_title_title_page) { /** Called when a drawer has settled in a completely closed state. */ public void onDrawerClosed(View view) { super.onDrawerClosed(view); //refreshActionBar(null); exitAfterDrawerClose = false; } /** Called when a drawer has settled in a completely open state. */ public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); } }; drawerLayout.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (KeyEvent.KEYCODE_BACK == event.getKeyCode() && exitAfterDrawerClose) { onBackPressed(); return true; } return false; } }); drawerLayout.setDrawerListener(drawerToggle); drawerList.setAdapter(mainMenuAdapter); drawerList.setOnItemClickListener(new OnItemClickListener() { final int[] menuIds = new int[] { R.id.action_title_page, R.id.action_history, R.id.action_map, R.id.action_stats, R.id.action_help, R.id.action_info, R.id.action_settings, R.id.action_netstat, R.id.action_log }; @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { selectMenuItem(menuIds[position]); drawerLayout.closeDrawers(); } }); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); // Do something against banding effect in gradients // Dither flag might mess up on certain devices?? final Window window = getWindow(); window.setFormat(PixelFormat.RGBA_8888); window.addFlags(WindowManager.LayoutParams.FLAG_DITHER); // Setzt Default-Werte, wenn noch keine Werte vorhanden PreferenceManager.setDefaultValues(this, R.xml.preferences, false); final String uuid = ConfigHelper.getUUID(getApplicationContext()); fm = getFragmentManager(); final Fragment fragment = fm.findFragmentById(R.id.fragment_content); if (!ConfigHelper.isTCAccepted(this)) { if (fragment != null && fm.getBackStackEntryCount() >= 1) // clear fragment back stack fm.popBackStack(fm.getBackStackEntryAt(0).getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); getActionBar().hide(); setLockNavigationDrawer(true); showTermsCheck(); } else { currentMapOptions.put("highlight", uuid); if (fragment == null) { if (false) // deactivated for si // ! ConfigHelper.isNDTDecisionMade(this)) { showTermsCheck(); showNdtCheck(); } else initApp(true); } } geoLocation = new MainGeoLocation(getApplicationContext()); mNetworkStateChangedFilter = new IntentFilter(); mNetworkStateChangedFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mNetworkStateIntentReceiver = new BroadcastReceiver() { @Override public void onReceive(final Context context, final Intent intent) { if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { final boolean connected = !intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false); final boolean isFailover = intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false); if (connected) { if (networkInfoCollector != null) { networkInfoCollector.setHasConnectionFromAndroidApi(true); } } else { if (networkInfoCollector != null) { networkInfoCollector.setHasConnectionFromAndroidApi(false); } } Log.i(DEBUG_TAG, "CONNECTED: " + connected + " FAILOVER: " + isFailover); } } }; }
From source file:ru.tinkoff.acquiring.sdk.PayFormActivity.java
void finishChooseCards() { getSupportFragmentManager().popBackStack("choose_card", FragmentManager.POP_BACK_STACK_INCLUSIVE); }
From source file:io.digibyte.tools.animation.BRAnimator.java
public static void killAllFragments(Activity app) { if (app != null && !app.isDestroyed()) app.getFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); }
From source file:com.github.cpmproto.categorystepfragment.base.GuidedStepListFragment.java
/** * Convenient method to close GuidedStepListFragments on top of other content or finish Activity if * GuidedStepListFragments were started in a separate activity. Pops all stack entries including * {@link #UI_STYLE_ENTRANCE}; if {@link #UI_STYLE_ENTRANCE} is not found, finish the activity. * Note that this method must be paired with {@link #add(FragmentManager, GuidedStepListFragment, * int)} which sets up the stack entry name for finding which fragment we need to pop back to. *///from w w w . j a v a 2 s . c o m public void finishGuidedStepListFragments() { final FragmentManager fragmentManager = getFragmentManager(); final int entryCount = fragmentManager.getBackStackEntryCount(); if (entryCount > 0) { for (int i = entryCount - 1; i >= 0; i--) { FragmentManager.BackStackEntry entry = fragmentManager.getBackStackEntryAt(i); if (isStackEntryUiStyleEntrance(entry.getName())) { GuidedStepListFragment top = getCurrentGuidedStepListFragment(fragmentManager); if (top != null) { top.setUiStyle(UI_STYLE_ENTRANCE); } fragmentManager.popBackStack(entry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); return; } } } ActivityCompat.finishAfterTransition(getActivity()); }
From source file:ua.boberproduction.bbr.BaseActivity.java
@Override public void onBackPressed() { // close navigation drawer, if it's open if (closeNavigationDrawer()) return;//from w w w.ja v a 2 s . c o m Fragment fragment = getFragmentManager().findFragmentById(R.id.main_frame); if (fragment instanceof TextContentFragment && ((TextContentFragment) fragment).isShowingPopup()) { ((TextContentFragment) fragment).hidePopupImage(); return; } else if (fragment instanceof MainMenuFragment) { this.finishAffinity(); // from NoteViewer, ensure that back press returns directly to NotebookFragment, avoiding NoteEditor even if it was saved in backstack. } else if (fragment instanceof NoteViewerFragment) { if (!getFragmentManager().popBackStackImmediate(getString(R.string.tag_fragment_notebook), FragmentManager.POP_BACK_STACK_INCLUSIVE)) { super.onBackPressed(); } } // Navigate through the fragments using the "back" button. // Check if there are fragments in the backstack, and pop them out. if (getFragmentManager().getBackStackEntryCount() > 0) { getFragmentManager().popBackStack(); return; } super.onBackPressed(); }
From source file:co.taqat.call.LinphoneActivity.java
private void changeFragment(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { FragmentManager fm = getFragmentManager(); FragmentTransaction transaction = fm.beginTransaction(); /*// w w w. ja v a 2s.c om if (!withoutAnimation && 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); } }*/ if (newFragmentType != FragmentsAvailable.DIALER && newFragmentType != FragmentsAvailable.CONTACTS_LIST && newFragmentType != FragmentsAvailable.CHAT_LIST && newFragmentType != FragmentsAvailable.HISTORY_LIST) { transaction.addToBackStack(newFragmentType.toString()); } else { while (fm.getBackStackEntryCount() > 0) { fm.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString()); transaction.commitAllowingStateLoss(); fm.executePendingTransactions(); currentFragment = newFragmentType; }
From source file:co.taqat.call.LinphoneActivity.java
private void changeFragmentForTablets(Fragment newFragment, FragmentsAvailable newFragmentType, boolean withoutAnimation) { if (getResources().getBoolean(R.bool.show_statusbar_only_on_dialer)) { if (newFragmentType == FragmentsAvailable.DIALER) { showStatusBar();/* ww w.j av a 2s . co m*/ } else { hideStatusBar(); } } emptyFragment = false; LinearLayout ll = (LinearLayout) findViewById(R.id.fragmentContainer2); FragmentTransaction transaction = getFragmentManager().beginTransaction(); if (newFragmentType == FragmentsAvailable.EMPTY) { ll.setVisibility(View.VISIBLE); emptyFragment = true; transaction.replace(R.id.fragmentContainer2, newFragment); transaction.commitAllowingStateLoss(); getFragmentManager().executePendingTransactions(); } else { if (newFragmentType.shouldAddItselfToTheRightOf(currentFragment)) { ll.setVisibility(View.VISIBLE); if (newFragmentType == FragmentsAvailable.CONTACT_EDITOR) { transaction.addToBackStack(newFragmentType.toString()); } transaction.replace(R.id.fragmentContainer2, newFragment); } else { if (newFragmentType == FragmentsAvailable.EMPTY) { ll.setVisibility(View.VISIBLE); transaction.replace(R.id.fragmentContainer2, new EmptyFragment()); emptyFragment = true; } if (newFragmentType == FragmentsAvailable.DIALER || newFragmentType == FragmentsAvailable.ABOUT || newFragmentType == FragmentsAvailable.SETTINGS || newFragmentType == FragmentsAvailable.ACCOUNT_SETTINGS) { ll.setVisibility(View.GONE); } else { ll.setVisibility(View.VISIBLE); transaction.replace(R.id.fragmentContainer2, new EmptyFragment()); } /*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); } }*/ transaction.replace(R.id.fragmentContainer, newFragment); } transaction.commitAllowingStateLoss(); getFragmentManager().executePendingTransactions(); currentFragment = newFragmentType; if (newFragmentType == FragmentsAvailable.DIALER || newFragmentType == FragmentsAvailable.SETTINGS || newFragmentType == FragmentsAvailable.CONTACTS_LIST || newFragmentType == FragmentsAvailable.CHAT_LIST || newFragmentType == FragmentsAvailable.HISTORY_LIST) { try { getFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); } catch (java.lang.IllegalStateException e) { } } fragmentsHistory.add(currentFragment); } }
From source file:org.alfresco.mobile.android.application.accounts.fragment.AccountDetailsFragment.java
private void deleteAccount() { //Remove all Sync if (acc == null) { return;//from w w w. ja v a 2 s. c o m } OperationsRequestGroup group = new OperationsRequestGroup(getActivity(), acc); group.enqueue(new CleanSyncFavoriteRequest(acc, true) .setNotificationVisibility(OperationRequest.VISIBILITY_HIDDEN)); BatchOperationManager.getInstance(getActivity()).enqueue(group); //Delete Account getActivity().getContentResolver().delete(AccountManager.getUri(acc.getId()), null, null); LocalBroadcastManager.getInstance(getActivity()) .sendBroadcast(new Intent(IntentIntegrator.ACTION_DELETE_ACCOUNT_COMPLETED)); // In case where currentAccount is the one deleted. ApplicationManager.getInstance(getActivity()).removeAccount(acc.getId()); if (SessionUtils.getAccount(getActivity()) != null && SessionUtils.getAccount(getActivity()).getId() == acc.getId()) { ((BaseActivity) getActivity()).setCurrentAccount(null); SharedPreferences settings = getActivity().getSharedPreferences(AccountsPreferences.ACCOUNT_PREFS, 0); long id = settings.getLong(AccountsPreferences.ACCOUNT_DEFAULT, -1); if (id == acc.getId()) { settings.edit().putLong(AccountsPreferences.ACCOUNT_DEFAULT, -1).commit(); } ((BaseActivity) getActivity()) .setCurrentAccount(AccountManager.getInstance(getActivity()).getDefaultAccount()); } Cursor cursor = getActivity().getContentResolver().query(AccountManager.CONTENT_URI, AccountManager.COLUMN_ALL, null, null, null); if (cursor.getCount() > 0) { // Remove Details panel if (DisplayUtils.hasCentralPane(getActivity())) { FragmentDisplayer.removeFragment(getActivity(), AccountDetailsFragment.TAG); } else { getFragmentManager().popBackStack(AccountDetailsFragment.TAG, FragmentManager.POP_BACK_STACK_INCLUSIVE); } } else { // If no account left, we remove all preferences // Remove preferences SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); Editor editor = sharedPref.edit(); editor.clear(); editor.commit(); // Redirect to HomeScreenActivity getActivity().startActivity(new Intent(getActivity(), HomeScreenActivity.class)); getActivity().finish(); } cursor.close(); }
From source file:org.naturenet.ui.MainActivity.java
private void clearBackStack() { FragmentManager manager = getFragmentManager(); if (manager.getBackStackEntryCount() > 0) { FragmentManager.BackStackEntry first = manager.getBackStackEntryAt(0); manager.popBackStack(first.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE); }// w w w .j a v a 2s. c o m }
From source file:de.sourcestream.movieDB.MainActivity.java
/** * Displays fragment view for the selected item from the slide menu. * * @param position is the position that we have selected. *///from w w w.java2 s .c o m private void displayView(int position) { if (position != 0) { // Clear history of the back stack if any FragmentManager fm = getFragmentManager(); fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); // update the main content by replacing fragments Fragment fragment = null; searchMovieDetails = 0; searchCastDetails = 0; searchTvDetails = 0; searchViewCount = false; resetMovieDetailsBundle(); resetCastDetailsBundle(); resetTvDetailsBundle(); switch (position) { // Case 0 is the header we don't want to do anything with it. case 1: reAttachMovieFragments = true; if (oldPos == position) { mDrawerLayout.closeDrawer(mDrawerList); break; } fragment = movieSlideTab; break; case 2: reAttachTVFragments = true; if (oldPos == position) { mDrawerLayout.closeDrawer(mDrawerList); break; } fragment = tvSlideTab; break; case 3: if (oldPos == position) { mDrawerLayout.closeDrawer(mDrawerList); break; } fragment = getFragmentManager().findFragmentByTag("genres"); if (fragment == null) fragment = genresList; if (genresList.getBackState() == 0) genresList.updateList(); break; case 4: if (oldPos == position) { mDrawerLayout.closeDrawer(mDrawerList); break; } fragment = about; break; default: break; } oldPos = position; if (fragment != null) { fm.beginTransaction().replace(R.id.frame_container, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); setTitle(navMenuTitles[position - 1]); mDrawerLayout.closeDrawer(mDrawerList); try { movieSlideTab.showInstantToolbar(); tvSlideTab.showInstantToolbar(); } catch (NullPointerException e) { } System.gc(); } } else { mDrawerList.setItemChecked(oldPos, true); } }