List of usage examples for android.support.v4.app FragmentTransaction commitAllowingStateLoss
public abstract int commitAllowingStateLoss();
From source file:com.gruporaido.tasker_library.util.Helper.java
public void inflateFragment(FragmentManager fragmentManager, int resourceId, FragmentCreator creator, int inAnimation, int outAnimation, int backInAnimation, int backOutAnimation, boolean addToBackStack) { try {//from w w w . j a v a2 s . c om android.support.v4.app.FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.setCustomAnimations(inAnimation, outAnimation, backInAnimation, backOutAnimation) .replace(resourceId, creator.createFragment()); if (addToBackStack) { transaction.addToBackStack(null); } transaction.commitAllowingStateLoss(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.taobao.weex.extend.module.actionsheet.WXActionSheet.java
public void dismiss() { if (hasDismissed) { return;/*from w ww .j a v a2 s . c o m*/ } hasDismissed = true; new Handler().post(new Runnable() { @Override public void run() { getFragmentManager().popBackStack(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.remove(WXActionSheet.this); ft.commitAllowingStateLoss(); } }); }
From source file:com.mediatek.galleryfeature.stereo.segment.background.StereoBackgroundActivity.java
private void loadMainPanel() { if (findViewById(R.id.main_panel_container) == null) { return;//from ww w . j a v a 2s . c om } MainPanel panel = new MainPanel(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.main_panel_container, panel, BACKGROUNDTHUMB_FRAGMENT_TAG); transaction.commitAllowingStateLoss(); }
From source file:com.inovex.zabbixmobile.activities.BaseActivity.java
@Override public void onLoginStarted() { if (!this.isFinishing() && !mOnSaveInstanceStateCalled && !mLoginProgress.isAdded()) { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.show(mLoginProgress);/*ww w . j a va 2 s. c om*/ ft.commitAllowingStateLoss(); // mLoginProgress.show(getSupportFragmentManager(), // LoginProgressDialogFragment.TAG); } }
From source file:com.maxwen.wallpaper.board.fragments.WallpapersFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_wallpapers, menu); MenuItem search = menu.findItem(R.id.menu_search); MenuItemCompat.setOnActionExpandListener(search, new MenuItemCompat.OnActionExpandListener() { @Override//from w ww. j a va2s. co m public boolean onMenuItemActionExpand(MenuItem item) { FragmentManager fm = getActivity().getSupportFragmentManager(); if (fm == null) return false; SearchListener listener = (SearchListener) getActivity(); listener.onSearchExpanded(true); FragmentTransaction ft = fm.beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.container, new WallpaperSearchFragment(), Extras.TAG_WALLPAPER_SEARCH) .addToBackStack(null); try { ft.commit(); } catch (Exception e) { ft.commitAllowingStateLoss(); } return false; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { return true; } }); }
From source file:org.kontalk.ui.ConversationsActivity.java
private void openConversation(long threadId, boolean creatingGroup) { if (isDualPane()) { // load conversation Conversation conv = Conversation.loadFromId(this, threadId); if (conv == null) return; // get the old fragment AbstractComposeFragment f = getCurrentConversation(); // check if we are replacing the same fragment Conversation oldConv = (f != null ? f.getConversation() : null); if (oldConv == null || !oldConv.getRecipient().equals(conv.getRecipient())) { f = AbstractComposeFragment.fromConversation(this, conv, creatingGroup); // Execute a transaction, replacing any existing fragment // with this one inside the frame. FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.fragment_compose_message, f); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commitAllowingStateLoss(); }/*www. j av a 2s . c om*/ } else { startActivity(ComposeMessage.fromConversation(this, threadId, creatingGroup)); } }
From source file:org.kontalk.ui.ConversationsActivity.java
void openConversation(Uri threadUri, boolean creatingGroup) { if (isDualPane()) { // load conversation String userId = threadUri.getLastPathSegment(); Conversation conv = Conversation.loadFromUserId(this, userId); // get the old fragment AbstractComposeFragment f = getCurrentConversation(); // check if we are replacing the same fragment Conversation oldConv = (f != null ? f.getConversation() : null); if (oldConv == null || conv == null || !oldConv.getRecipient().equals(conv.getRecipient())) { if (conv == null) f = AbstractComposeFragment.fromUserId(this, userId, creatingGroup); else/*from w w w . ja v a2 s . c o m*/ f = AbstractComposeFragment.fromConversation(this, conv, creatingGroup); // Execute a transaction, replacing any existing fragment // with this one inside the frame. FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); ft.replace(R.id.fragment_compose_message, f); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commitAllowingStateLoss(); } } else { Intent i = ComposeMessage.fromUserId(this, threadUri.getLastPathSegment(), creatingGroup); if (i != null) startActivity(i); else Toast.makeText(this, R.string.contact_not_registered, Toast.LENGTH_LONG).show(); } }
From source file:org.mythdroid.fragments.RecListFragment.java
private void showDetails() { Fragment rdf = null;/*ww w . jav a 2s . c o m*/ FragmentManager fm = getFragmentManager(); if (fm == null) return; FragmentTransaction ft = fm.beginTransaction(); rdf = RecDetailFragment.newInstance(false, false); if (dualPane) { Fragment existing = fm.findFragmentById(R.id.recdetails); if (existing != null && !existing.getClass().equals(RecDetailFragment.class)) fm.popBackStackImmediate(); ft.replace(R.id.recdetails, rdf, rdf.getClass().getSimpleName()); } else { ft.replace(R.id.reclistframe, rdf, rdf.getClass().getSimpleName()); ft.addToBackStack(null); } ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commitAllowingStateLoss(); }
From source file:com.taobao.weex.extend.module.actionsheet.WXActionSheet.java
public void display(final FragmentManager manager, final String tag) { if (!hasDismissed || manager.isDestroyed()) { return;/*from w w w .j av a2s . c om*/ } hasDismissed = false; new Handler().post(new Runnable() { @Override public void run() { FragmentTransaction transaction = manager.beginTransaction(); transaction.add(WXActionSheet.this, tag); transaction.addToBackStack(null); transaction.commitAllowingStateLoss(); } }); }
From source file:com.maxwen.wallpaper.board.activities.WallpaperBoardActivity.java
private void setFragment(Fragment fragment) { if (fragment == null) return;/*www . j a v a2s . com*/ clearBackStack(); mAppBar.setExpanded(true); FragmentTransaction ft = mFragManager.beginTransaction() .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.container, fragment, mFragmentTag); try { ft.commit(); } catch (Exception e) { ft.commitAllowingStateLoss(); } }