List of usage examples for android.app FragmentTransaction show
public abstract FragmentTransaction show(Fragment fragment);
From source file:com.poloure.simplerss.Constants.java
static void showFragments(Fragment... fragments) { FragmentTransaction transaction = s_fragmentManager.beginTransaction(); for (Fragment fragment : fragments) { transaction.show(fragment); }/*from ww w . j ava 2 s. c o m*/ transaction.commit(); }
From source file:com.poloure.simplerss.Utilities.java
private static void switchToFragment(Fragment fragment, boolean addToBackStack) { if (fragment.isHidden()) { Fragment[] fragments = { s_fragmentFavourites, s_fragmentManage, s_fragmentFeeds, s_fragmentSettings }; FragmentTransaction transaction = s_fragmentManager.beginTransaction(); for (Fragment frag : fragments) { if (frag.isVisible()) { transaction.hide(frag);//from ww w. j av a2 s. co m } } transaction.show(fragment); if (addToBackStack) { transaction.addToBackStack(null); // Set the default transition for adding to the stack. transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); } transaction.commit(); s_fragmentManager.executePendingTransactions(); fragment.getActivity().invalidateOptionsMenu(); } }
From source file:com.orange.ocara.ui.activity.EditCommentAudioActivity.java
@Override protected void handleAttachment() { if (comment.getAttachment() != null) { // override recordFilename value with those from comment audioFilename = comment.getAttachment(); }// ww w .ja va 2 s . c om Uri audioAttachment = Uri.parse(audioFilename); audioPlayerFragment.setUri(audioAttachment); android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.show(audioPlayerFragment); transaction.commit(); validateComment.setEnabled(true); }
From source file:com.example.leonid.chatzilla.MainActivity.java
@Override public void onBackPressed() { FragmentTransaction ft = getFragmentManager().beginTransaction(); if (getFragmentManager().findFragmentByTag("list") != null && getFragmentManager().findFragmentByTag("chat") != null) { getFragmentManager().findFragmentByTag("list"); ft.remove(getFragmentManager().findFragmentByTag("chat")); ft.show(getFragmentManager().findFragmentByTag("list")).commit(); } else {/*from www. jav a2 s . co m*/ System.exit(0); } }
From source file:com.vst.functionframework.ui.SupportActivity.java
/** * Fragment?//from w w w .ja v a 2s . c om * * @param resView ?? * @param targetFragment ??Fragment */ public void changeFragment(int resView, VstFragment targetFragment) { if (targetFragment.equals(currentKJFragment)) { return; } FragmentTransaction transaction = getFragmentManager().beginTransaction(); if (!targetFragment.isAdded()) { transaction.add(resView, targetFragment, targetFragment.getClass().getName()); } if (targetFragment.isHidden()) { transaction.show(targetFragment); targetFragment.onChange(); } if (currentKJFragment != null && currentKJFragment.isVisible()) { transaction.hide(currentKJFragment); } currentKJFragment = targetFragment; transaction.commit(); }
From source file:com.tassadar.multirommgr.MainActivity.java
/** Swaps fragments in the main content view */ private void selectItem(int position) { if (position < 0 || position >= m_fragments.length) { Log.e("MultiROMMgr", "Invalid fragment index " + position); return;//from w w w . j a v a2s.c o m } // Insert the fragment by replacing any existing fragment FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction t = fragmentManager.beginTransaction(); if (m_curFragment != -1) t.hide(m_fragments[m_curFragment]); t.show(m_fragments[position]); t.commit(); m_curFragment = position; // Highlight the selected item, update the title, and close the drawer m_drawerList.setItemChecked(position, true); setTitle(m_fragmentTitles[position]); m_drawerLayout.closeDrawer(m_drawerList); }
From source file:com.vst.functionframework.ui.SupportActivity.java
/** * Fragment?/*from w ww. j av a 2 s . c o m*/ * * @param resView ?? * @param targetFragment ??Fragment */ public void changeFragment(int resView, SupportFragment targetFragment) { if (targetFragment.equals(currentSupportFragment)) { return; } android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (!targetFragment.isAdded()) { transaction.add(resView, targetFragment, targetFragment.getClass().getName()); } if (targetFragment.isHidden()) { transaction.show(targetFragment); targetFragment.onChange(); } if (currentSupportFragment != null && currentSupportFragment.isVisible()) { transaction.hide(currentSupportFragment); } currentSupportFragment = targetFragment; transaction.commit(); }
From source file:de.lespace.apprtc.CallActivity.java
public void toggleCallControlFragmentVisibility() { if (!iceConnected || !callFragment.isAdded()) { return;// w w w . j a va2 s. com } // Show/hide call control fragment callControlFragmentVisible = !callControlFragmentVisible; FragmentTransaction ft = getFragmentManager().beginTransaction(); if (callControlFragmentVisible) { ft.show(callFragment); ft.show(hudFragment); } else { ft.hide(callFragment); ft.hide(hudFragment); } ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); }
From source file:org.jp.liteframe.LiteActivity.java
/** * Fragment?/*w ww . j a va 2 s .c o m*/ * * @param resView ?? * @param targetFragment ??Fragment */ public void changeFragment(int resView, LiteFragment targetFragment) { if (targetFragment.equals(mCurrentLiteFragment)) { return; } FragmentTransaction transaction = getFragmentManager().beginTransaction(); if (!targetFragment.isAdded()) { transaction.add(resView, targetFragment, targetFragment.getClass().getName()); } if (targetFragment.isHidden()) { transaction.show(targetFragment); targetFragment.onChange(); } if (mCurrentLiteFragment != null && mCurrentLiteFragment.isVisible()) { transaction.hide(mCurrentLiteFragment); } mCurrentLiteFragment = targetFragment; transaction.commit(); }
From source file:com.skubit.comics.activities.MainActivity.java
private void showFragment(Fragment targetFragment, String tag, int position) { FragmentManager fm = getFragmentManager(); FragmentTransaction transaction = fm.beginTransaction().setTransition(FragmentTransaction.TRANSIT_NONE); hidesFragments(position, transaction); Fragment f = fragments[position];// w w w .j a va 2 s. c o m if (f == null) { addFragmentToCache(targetFragment, tag, position); if (isFragmentInCache(tag)) { transaction.show(fragments[position]); } else { transaction.add(R.id.container, fragments[position], tag); } } else { transaction.show(fragments[position]); } transaction.commitAllowingStateLoss(); }