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:com.samebits.beacon.locator.ui.activity.BaseActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: FragmentManager fm = getFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); } else {/* w w w .ja va2s . c o m*/ finish(); } return true; case R.id.action_settings: launchSettingsActivity(); return true; case R.id.action_view_on_github: launchGitHubPage(); return true; case R.id.action_help: launchHelpPage(); return true; case R.id.action_donate: launchDonatePage(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:eu.trentorise.smartcampus.jp.helper.processor.DeleteMyRecurItineraryProcessor.java
@Override public void handleResult(Void result) { Toast toast = Toast.makeText(activity, R.string.deleted_journey, Toast.LENGTH_SHORT); toast.show();//from ww w . jav a 2 s. com ((SherlockFragmentActivity) activity).getSupportFragmentManager().popBackStack(mTag, FragmentManager.POP_BACK_STACK_INCLUSIVE); //activity.getSupportFragmentManager().popBackStackImmediate(); // FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager() // .beginTransaction(); // Fragment fragment = new MyRecurItinerariesFragment(); // fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); // fragmentTransaction.replace(Config.mainlayout, fragment,Config.MY_RECUR_JOURNEYS_FRAGMENT_TAG); // fragmentTransaction.addToBackStack(fragment.getTag()); // fragmentTransaction.commit(); }
From source file:com.QuarkLabs.BTCeClient.MainActivity.java
/** * Displays selected fragment//from www . j ava2 s .c o m * * @param position Position at the list (0-based) */ private void displayItem(final int position) { Fragment fragment = null; final FragmentManager fragmentManager = getFragmentManager(); switch (position) { case 0: fragment = mHomeFragment; fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); break; case 1: fragment = new OrdersBookFragment(); break; case 2: fragment = new ActiveOrdersFragment(); break; case 3: fragment = HistoryFragment.newInstance(ListType.Trades); break; case 4: fragment = HistoryFragment.newInstance(ListType.Transactions); break; case 5: fragment = new ChartsFragment(); break; case 6: fragment = new SettingsFragment(); break; case 7: fragment = new NotifiersFragment(); break; case 8: fragment = new HelpFragment(); break; default: break; } final Fragment fr = fragment; if (fr != null) { //delay in msecs int delay = 250; //post delayed for smooth behaviour new Handler().postDelayed(new Runnable() { @Override public void run() { FragmentTransaction transaction = fragmentManager.beginTransaction() .setCustomAnimations(R.animator.fade_in, R.animator.fade_out) .replace(R.id.content_frame, fr); if (position != 0) { transaction.addToBackStack(String.valueOf(position)); //name of fragment = position } transaction.commit(); setTitle(mDrawerListItems[position]); } }, delay); mDrawerList.setItemChecked(position, true); mDrawerList.setSelection(position); if (mDrawerLayout != null) { mDrawerLayout.closeDrawer(mDrawerList); } } }
From source file:com.microsoft.office365.starter.FilesFolders.FileDetailActivity.java
@Override public void onContentsUpdated(String updatedContent) { FragmentManager fm = getFragmentManager(); fm.popBackStack(UPDATE_FRAGMENT_STACK_STATE, FragmentManager.POP_BACK_STACK_INCLUSIVE); O365APIsStart_Application application = (O365APIsStart_Application) getApplication(); application.getDisplayedFile().setContents(FileDetailActivity.this, updatedContent); mDialog = ProgressDialogHelper.showProgressDialog(FileDetailActivity.this, "Updating file contents on server...", "Please wait."); application.getFileListViewState().setEventOperationCompleteListener(FileDetailActivity.this); application.getFileListViewState().postUpdatedFileContents(application, FileDetailActivity.this, application.getFileClient(), updatedContent); }
From source file:us.cboyd.android.dicom.DcmBrowser.java
/** Called when the activity is first created. */ @Override/*from w w w . jav a2 s .c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dcm_browser); FragmentManager fragManager = getFragmentManager(); if (savedInstanceState != null) { mListFragment = (DcmListFragment) fragManager.getFragment(savedInstanceState, DcmVar.FRAGLIST); mInfoFragment = (DcmInfoFragment) fragManager.getFragment(savedInstanceState, DcmVar.FRAGINFO); // Remove existing fragments from associated views. fragManager.popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragManager.beginTransaction().remove(mListFragment).commit(); fragManager.beginTransaction().remove(mInfoFragment).commit(); fragManager.executePendingTransactions(); } // Restore the retained fragments, if this is a configuration change. if (mListFragment == null) { mListFragment = new DcmListFragment(); } if (mInfoFragment == null) { mInfoFragment = new DcmInfoFragment(); } // Specify that the Home/Up button should not be enabled, // since there is no hierarchical parent yet. ActionBar actionBar = getActionBar(); // enable ActionBar app icon to behave as action to toggle nav drawer actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setHomeButtonEnabled(false); // Check whether the activity is using the layout version with // the fragment_container FrameLayout. If so, we must add the first fragment if (findViewById(R.id.fragment_container) != null) { Log.i("cpb", "mListFrag: One-pane"); mFragmented = true; // Add the fragment to the 'fragment_container' FrameLayout fragManager.beginTransaction().add(R.id.fragment_container, mListFragment).commit(); generateDrawer(); } else { Log.i("cpb", "mListFrag: Two-pane"); mFragmented = false; // Add the fragments to the respective FrameLayouts fragManager.beginTransaction().add(R.id.fragment_left, mListFragment).commit(); fragManager.beginTransaction().add(R.id.fragment_right, mInfoFragment).commit(); } }
From source file:eu.trentorise.smartcampus.jp.custom.TabListener.java
public void onTabUnselected(Tab tab, FragmentTransaction ft) { // if (mFragment != null) { // // Detach the fragment, because another one is being attached // ft.detach(mFragment); // }// w ww. ja v a 2 s . c om mActivity.getSupportFragmentManager().popBackStack(mTag, FragmentManager.POP_BACK_STACK_INCLUSIVE); if (mFragment != null) { // Detach the fragment, because another one is being attached ft.detach(mFragment); } }
From source file:com.microsoft.office365.starter.FilesFolders.FileDetailActivity.java
@Override public void onFileUpdateCancelled() { FragmentManager fm = getFragmentManager(); fm.popBackStack(UPDATE_FRAGMENT_STACK_STATE, FragmentManager.POP_BACK_STACK_INCLUSIVE); }
From source file:jsettlers.main.android.JsettlersActivity.java
public void showFragment(JsettlersFragment fragment) { FragmentManager manager = getFragmentManager(); if (!fragment.shouldAddToBackStack()) { manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); }/*w w w. jav a 2s .co m*/ FragmentTransaction transaction = manager.beginTransaction(); if (fragment.shouldAddToBackStack()) { transaction.addToBackStack(fragment.getName()); } transaction.replace(R.id.base_menu, fragment); transaction.commit(); }
From source file:com.sharedcab.batchcar.MainActivity.java
private void selectItem(int position) { // update the main content by replacing fragments //dont add them to back stack as these are all main pages FragmentManager fragmentManager = getFragmentManager(); switch (position) { case 1:/*from w w w .j a v a 2 s. c o m*/ fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, bf).commit(); break; case 2: fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, uf).commit(); break; case 3: fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, prf).commit(); break; default: fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, mainFragment).commit(); break; } mDrawerList.setItemChecked(position, true); setTitle(mFrags[position]); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.android.mail.ui.TwoPaneController.java
@Override public void onViewModeChanged(int newMode) { if (!mSavedMiscellaneousView && mMiscellaneousViewTransactionId >= 0) { final FragmentManager fragmentManager = mActivity.getFragmentManager(); fragmentManager.popBackStackImmediate(mMiscellaneousViewTransactionId, FragmentManager.POP_BACK_STACK_INCLUSIVE); mMiscellaneousViewTransactionId = -1; }/* ww w . jav a 2s.co m*/ mSavedMiscellaneousView = false; super.onViewModeChanged(newMode); if (newMode != ViewMode.WAITING_FOR_ACCOUNT_INITIALIZATION) { // Clear the wait fragment hideWaitForInitialization(); } // In conversation mode, if the conversation list is not visible, then the user cannot // see the selected conversations. Disable the CAB mode while leaving the selected set // untouched. // When the conversation list is made visible again, try to enable the CAB // mode if any conversations are selected. if (newMode == ViewMode.CONVERSATION || newMode == ViewMode.CONVERSATION_LIST || ViewMode.isAdMode(newMode)) { enableOrDisableCab(); } }