List of usage examples for android.app FragmentTransaction TRANSIT_FRAGMENT_FADE
int TRANSIT_FRAGMENT_FADE
To view the source code for android.app FragmentTransaction TRANSIT_FRAGMENT_FADE.
Click Source Link
From source file:de.lespace.apprtc.CallActivity.java
public void toggleCallControlFragmentVisibility() { if (!iceConnected || !callFragment.isAdded()) { return;//w w w .j a v a 2 s. c o m } // 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:com.waz.zclient.pages.main.profile.ZetaPreferencesActivity.java
@Override public void onOpenCamera(CameraContext cameraContext) { if (getSupportFragmentManager().findFragmentByTag(CameraFragment.TAG) != null) { return;/*from ww w . j a v a 2 s. c o m*/ } getSupportFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .add(R.id.fl__root__camera, CameraFragment.newInstance(cameraContext), CameraFragment.TAG) .addToBackStack(CameraFragment.TAG).commit(); }
From source file:org.eyeseetea.malariacare.DashboardActivity.java
/** * Init the fragments/*from w w w. ja v a2 s . c o m*/ */ private void setFragmentTransaction(int layout, ListFragment fragment) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(layout, fragment); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); }
From source file:com.ternup.caddisfly.fragment.ResultFragment.java
private void goBack() { FragmentManager fm = getFragmentManager(); try {//w w w. j ava2 s.co m if (fm.getBackStackEntryCount() > 0) { fm.popBackStack(); fm.executePendingTransactions(); } else { Fragment fragment = new HomeFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.executePendingTransactions(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.replace(R.id.container, fragment, "0"); ft.addToBackStack(null); ft.commit(); fm.executePendingTransactions(); ListView drawerList = (ListView) getActivity().findViewById(R.id.navigation_drawer); drawerList.setItemChecked(0, true); drawerList.setSelection(0); } } catch (Exception e) { e.printStackTrace(); } }
From source file:cx.ring.client.HomeActivity.java
@Override public boolean onNavigationItemSelected(MenuItem pos) { pos.setChecked(true);// ww w . ja v a2 s . c o m mNavigationDrawer.closeDrawers(); switch (pos.getItemId()) { case R.id.menuitem_home: if (fContent instanceof CallListFragment) break; if (getFragmentManager().getBackStackEntryCount() == 1) break; popCustomBackStack(); break; case R.id.menuitem_accounts: if (fContent instanceof AccountsManagementFragment) break; fContent = new AccountsManagementFragment(); getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.main_frame, fContent, "Accounts").addToBackStack("Accounts").commit(); break; case R.id.menuitem_about: if (fContent instanceof AboutFragment) break; fContent = new AboutFragment(); getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.main_frame, fContent, "About").addToBackStack("About").commit(); break; case R.id.menuitem_prefs: if (fContent instanceof SettingsFragment) break; fContent = new SettingsFragment(); getFragmentManager().beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE) .replace(R.id.main_frame, fContent, "Prefs").addToBackStack("Prefs").commit(); break; default: return false; } return true; }
From source file:de.mrapp.android.preference.activity.PreferenceActivity.java
/** * Shows the fragment, which corresponds to a specific class name. * * @param preferenceHeader//from ww w .jav a 2 s . co m * The preference header, the fragment, which should be shown, corresponds to, as an * instance of the class {@link PreferenceHeader}. The preference header may not be * null * @param params * The parameters, which should be passed to the fragment, as an instance of the class * {@link Bundle} or null, if the preference header's extras should be used instead * @param forceTransition * True, if instantiating a new fragment should be enforced, even if a fragment instance * of the same class is already shown, false otherwise. Must be true for transitions, * which have been initiated manually by the user in order to support using the same * fragment class for multiple preference headers */ private void showPreferenceScreenFragment(@NonNull final PreferenceHeader preferenceHeader, @Nullable final Bundle params, final boolean forceTransition) { String fragmentName = preferenceHeader.getFragment(); if (forceTransition || preferenceScreenFragment == null || !preferenceScreenFragment.getClass().getName().equals(fragmentName)) { preferenceScreenFragment = Fragment.instantiate(this, fragmentName, params); } if (isSplitScreen()) { replaceFragment(preferenceScreenFragment, R.id.preference_screen_parent, 0); } else { updateSavedInstanceState(); replaceFragment(preferenceScreenFragment, R.id.preference_header_parent, FragmentTransaction.TRANSIT_FRAGMENT_FADE); showToolbarNavigationIcon(); } notifyOnPreferenceFragmentShown(); }
From source file:org.proninyaroslav.libretorrent.fragments.MainFragment.java
private void showDetailTorrent(String id) { if (Utils.isTwoPane(activity.getApplicationContext())) { FragmentManager fm = getFragmentManager(); DetailTorrentFragment detail = DetailTorrentFragment.newInstance(id); Fragment fragment = fm.findFragmentById(R.id.detail_torrent_fragmentContainer); if (fragment != null && fragment instanceof DetailTorrentFragment) { String oldId = ((DetailTorrentFragment) fragment).getTorrentId(); if (oldId != null && id.equals(oldId)) { return; }/*from ww w . j av a2 s . c o m*/ } fm.beginTransaction().replace(R.id.detail_torrent_fragmentContainer, detail) .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit(); } else { Intent i = new Intent(activity, DetailTorrentActivity.class); i.putExtra(DetailTorrentActivity.TAG_TORRENT_ID, id); startActivity(i); } }
From source file:com.nuvolect.securesuite.main.ContactListActivity.java
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private ContactListFragment startContactListFragment() { boolean isDestroyed = false; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && m_act.isDestroyed()) isDestroyed = true;/*www.j a v a2s . c o m*/ if (m_act == null || isDestroyed || m_act.isFinishing()) return null; ContactListFragment clf = new ContactListFragment(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.contact_list_container, clf, CConst.CONTACT_LIST_FRAGMENT_TAG); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.addToBackStack(null); ft.commit(); return clf; }
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 ww w .j a v a 2s.co 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(); } }
From source file:org.appspot.apprtc.CallActivity.java
private void toggleCallControlFragmentVisibility() { updateVideoView();/*from w w w . j a va 2 s.com*/ 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(); }