List of usage examples for android.app FragmentTransaction setTransition
public abstract FragmentTransaction setTransition(@Transit int transit);
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * //from w w w. j a v a2s. c om * @param uid */ public void showResultDetail(final String testUUid) { FragmentTransaction ft; final Fragment fragment = new RMBTTestResultDetailFragment(); final Bundle args = new Bundle(); args.putString(RMBTTestResultDetailFragment.ARG_UID, testUUid); fragment.setArguments(args); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_RESULT_DETAIL); ft.addToBackStack(AppConstants.PAGE_TITLE_RESULT_DETAIL); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_RESULT_DETAIL); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * /*www . ja va2 s . c o m*/ * @param uid */ public void showExpandedResultDetail(QoSServerResultCollection testResultArray, DetailType detailType, int position) { FragmentTransaction ft; //final RMBTResultDetailPagerFragment fragment = new RMBTResultDetailPagerFragment(); final QoSCategoryPagerFragment fragment = new QoSCategoryPagerFragment(); fragment.setQoSResult(testResultArray); fragment.setDetailType(detailType); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_RESULT_QOS); ft.addToBackStack("result_detail_expanded"); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); fragment.setCurrentPosition(position); refreshActionBar(AppConstants.PAGE_TITLE_RESULT_QOS); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
public void showMap(boolean popBackStack) { if (popBackStack) { popBackStackFull();/*from w ww .ja va2 s . c o m*/ } FragmentTransaction ft; ft = fm.beginTransaction(); Fragment f = new RMBTMapFragment(); Bundle bundle = new Bundle(); bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_ALL_GESTURES, true); bundle.putBoolean(RMBTMapFragment.OPTION_SHOW_INFO_TOAST, true); bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_CONTROL_BUTTONS, true); f.setArguments(bundle); ft.replace(R.id.fragment_content, f, AppConstants.PAGE_TITLE_MAP); ft.addToBackStack(AppConstants.PAGE_TITLE_MAP); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_MAP); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * // www . j a v a2s.c o m * @param uid */ public void showQoSTestDetails(List<QoSServerResult> resultList, List<QoSServerResultDesc> descList, int index) { FragmentTransaction ft; //final RMBTResultDetailPagerFragment fragment = new RMBTResultDetailPagerFragment(); final QoSTestDetailPagerFragment fragment = new QoSTestDetailPagerFragment(); fragment.setQoSResultList(resultList); fragment.setQoSDescList(descList); fragment.setInitPosition(index); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_TEST_DETAIL_QOS); ft.addToBackStack(AppConstants.PAGE_TITLE_TEST_DETAIL_QOS); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_TEST_DETAIL_QOS); }
From source file:de.mrapp.android.preference.activity.PreferenceActivity.java
/** * Replaces the fragment, which is currently contained by a specific parent view, by an other * fragment.// w ww. ja va 2s. c om * * @param fragment * The fragment, which should replace the current fragment, as an instance of the class * {@link Fragment}. The fragment may not be null * @param parentViewId * The id of the parent view, which contains the fragment, that should be replaced, as * an {@link Integer} value * @param transition * The transition, which should be shown when replacing the fragment, as an {@link * Integer} value or 0, if no transition should be shown */ private void replaceFragment(@NonNull final Fragment fragment, final int parentViewId, final int transition) { FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.setTransition(transition); transaction.replace(parentViewId, fragment); transaction.commit(); }
From source file:com.android.dialer.DialtactsFragment.java
/** * Shows the search fragment/* ww w.j a va 2 s . com*/ */ private void enterSearchUi(boolean smartDialSearch, String query, boolean animate) { if (mStateSaved || getChildFragmentManager().isDestroyed()) { // Weird race condition where fragment is doing work after the activity is destroyed // due to talkback being on (b/10209937). Just return since we can't do any // constructive here. return; } mDialpadFragment.showSearchView(); if (DEBUG) { Log.d(TAG, "Entering search UI - smart dial " + smartDialSearch); } final FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); if (mInDialpadSearch && mSmartDialSearchFragment != null) { transaction.remove(mSmartDialSearchFragment); } else if (mInRegularSearch && mRegularSearchFragment != null) { transaction.remove(mRegularSearchFragment); } final String tag; if (smartDialSearch) { tag = TAG_SMARTDIAL_SEARCH_FRAGMENT; } else { tag = TAG_REGULAR_SEARCH_FRAGMENT; } mInDialpadSearch = smartDialSearch; mInRegularSearch = !smartDialSearch; mFloatingActionButtonController.scaleOut(); SearchFragment fragment = (SearchFragment) getChildFragmentManager().findFragmentByTag(tag); if (animate) { transaction.setCustomAnimations(android.R.animator.fade_in, 0); } else { transaction.setTransition(FragmentTransaction.TRANSIT_NONE); } if (fragment == null) { Log.e(TAG, " --- enterSearchUi --- null"); if (smartDialSearch) { fragment = new SmartDialSearchFragment(); transaction.add(R.id.dialtacts_frame, fragment, tag); } else { fragment = new RegularSearchFragment(); fragment.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // Show the FAB when the user touches the lists fragment and the soft // keyboard is hidden. showFabInSearchUi(); return false; } }); } } else { transaction.show(fragment); } // DialtactsFragment will provide the options menu fragment.setHasOptionsMenu(false); fragment.setShowEmptyListForNullQuery(true); fragment.setQueryString(query, false /* delaySelection */); transaction.commitAllowingStateLoss(); // transaction.commit(); // if (animate) { // mListsFragment.getView().animate().alpha(0).withLayer(); // } // mListsFragment.setUserVisibleHint(false); }
From source file:org.appspot.apprtc.CallActivity.java
private void toggleCallControlFragmentVisibility() { updateVideoView();/*from ww w . jav a2 s. c o m*/ if (!iceConnected || !callFragment.isAdded()) { return; } // 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:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * @param testPoint /*w w w . j av a2s . c om*/ * @param mapType * */ public RMBTMapFragment showMap(String mapType, LatLng initialCenter, boolean clearFilter, int viewId, boolean popBackStack) { if (popBackStack) { popBackStackFull(); } FragmentTransaction ft; setCurrentMapType(mapType); if (clearFilter) { final List<MapListSection> mapFilterListSelectionList = getMapFilterListSelectionList(); if (mapFilterListSelectionList != null) { for (final MapListSection section : mapFilterListSelectionList) { for (final MapListEntry entry : section.getMapListEntryList()) entry.setChecked(entry.isDefault()); } updateMapFilter(); } } final RMBTMapFragment fragment = new RMBTMapFragment(); final Bundle bundle = new Bundle(); bundle.putParcelable("initialCenter", initialCenter); if (viewId >= 0) { bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_ALL_GESTURES, false); bundle.putBoolean(RMBTMapFragment.OPTION_SHOW_INFO_TOAST, false); bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_CONTROL_BUTTONS, false); bundle.putBoolean(RMBTMapFragment.OPTION_ENABLE_OVERLAY, false); fragment.setArguments(bundle); ft = fm.beginTransaction(); //replace the given viewgroup, but do not add to backstack ft.replace(viewId, fragment, AppConstants.PAGE_TITLE_MINI_MAP); //ft.addToBackStack(AppConstants.PAGE_TITLE_MINI_MAP); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); } else { System.out.println("SHOW MAP"); fragment.setArguments(bundle); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_MAP); ft.addToBackStack(AppConstants.PAGE_TITLE_MAP); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_MAP); } return fragment; }
From source file:com.android.mail.compose.ComposeActivity.java
private int replaceFragment(Fragment fragment, int transition, String tag) { FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.setTransition(transition); fragmentTransaction.replace(R.id.wait, fragment, tag); final int transactionId = fragmentTransaction.commitAllowingStateLoss(); return transactionId; }
From source file:com.android.calendar.AllInOneActivity.java
private void setMainPane(FragmentTransaction ft, int viewId, int viewType, long timeMillis, boolean force) { if (mOnSaveInstanceStateCalled) { return;/*from w w w . j av a2 s . c o m*/ } if (!force && mCurrentView == viewType) { return; } // Remove this when transition to and from month view looks fine. boolean doTransition = viewType != ViewType.MONTH && mCurrentView != ViewType.MONTH; FragmentManager fragmentManager = getFragmentManager(); // Check if our previous view was an Agenda view // TODO remove this if framework ever supports nested fragments if (mCurrentView == ViewType.AGENDA) { // If it was, we need to do some cleanup on it to prevent the // edit/delete buttons from coming back on a rotation. Fragment oldFrag = fragmentManager.findFragmentById(viewId); if (oldFrag instanceof AgendaFragment) { ((AgendaFragment) oldFrag).removeFragments(fragmentManager); } } if (viewType != mCurrentView) { // The rules for this previous view are different than the // controller's and are used for intercepting the back button. if (mCurrentView != ViewType.EDIT && mCurrentView > 0) { mPreviousView = mCurrentView; } mCurrentView = viewType; } // Create new fragment Fragment frag = null; Fragment secFrag = null; switch (viewType) { case ViewType.AGENDA: mNavigationView.getMenu().findItem(R.id.agenda_menu_item).setChecked(true); frag = new AgendaFragment(timeMillis, false); if (mIsTabletConfig) { mToolbar.setTitle(R.string.agenda_view); } break; case ViewType.DAY: mNavigationView.getMenu().findItem(R.id.day_menu_item).setChecked(true); frag = new DayFragment(timeMillis, 1); if (mIsTabletConfig) { mToolbar.setTitle(R.string.day_view); } break; case ViewType.MONTH: mNavigationView.getMenu().findItem(R.id.month_menu_item).setChecked(true); frag = new MonthByWeekFragment(timeMillis, false); if (mShowAgendaWithMonth) { secFrag = new AgendaFragment(timeMillis, false); } if (mIsTabletConfig) { mToolbar.setTitle(R.string.month_view); } break; case ViewType.WEEK: default: mNavigationView.getMenu().findItem(R.id.week_menu_item).setChecked(true); frag = new DayFragment(timeMillis, Utils.getDaysPerWeek(this)); if (mIsTabletConfig) { mToolbar.setTitle(R.string.week_view); } break; } // Update the current view so that the menu can update its look according to the // current view. if (mCalendarToolbarHandler != null) { mCalendarToolbarHandler.setCurrentMainView(viewType); } if (!mIsTabletConfig) { refreshActionbarTitle(timeMillis); } // Show date only on tablet configurations in views different than Agenda if (!mIsTabletConfig) { mDateRange.setVisibility(View.GONE); } else if (viewType != ViewType.AGENDA) { mDateRange.setVisibility(View.VISIBLE); } else { mDateRange.setVisibility(View.GONE); } // Clear unnecessary buttons from the option menu when switching from the agenda view if (viewType != ViewType.AGENDA) { clearOptionsMenu(); } boolean doCommit = false; if (ft == null) { doCommit = true; ft = fragmentManager.beginTransaction(); } if (doTransition) { ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); } ft.replace(viewId, frag); if (mShowAgendaWithMonth) { // Show/hide secondary fragment if (secFrag != null) { ft.replace(R.id.secondary_pane, secFrag); mSecondaryPane.setVisibility(View.VISIBLE); } else { mSecondaryPane.setVisibility(View.GONE); Fragment f = fragmentManager.findFragmentById(R.id.secondary_pane); if (f != null) { ft.remove(f); } mController.deregisterEventHandler(R.id.secondary_pane); } } if (DEBUG) { Log.d(TAG, "Adding handler with viewId " + viewId + " and type " + viewType); } // If the key is already registered this will replace it mController.registerEventHandler(viewId, (EventHandler) frag); if (secFrag != null) { mController.registerEventHandler(viewId, (EventHandler) secFrag); } if (doCommit) { if (DEBUG) { Log.d(TAG, "setMainPane AllInOne=" + this + " finishing:" + this.isFinishing()); } ft.commit(); } }