List of usage examples for android.support.v4.app FragmentTransaction setTransition
public abstract FragmentTransaction setTransition(int transit);
From source file:eu.trentorise.smartcampus.eb.fragments.CollectionsListFragment.java
@Override public void onListItemClick(ListView listView, View containerView, int position, long duration) { FragmentTransaction ft = getSherlockActivity().getSupportFragmentManager().beginTransaction(); Fragment f = new ExperiencesListFragment(); Bundle b = new Bundle(); ExperienceFilter filter = new ExperienceFilter(); filter.setCollectionId(collections.get(position).getId()); b.putSerializable(ExperiencesListFragment.ARG_FILTER, filter); f.setArguments(b);/*from w w w . j a v a 2s.c om*/ ft.replace(android.R.id.content, f); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.addToBackStack(null); ft.commit(); }
From source file:com.permutassep.presentation.navigation.Navigator.java
/** * Navigates to the login screen fragment * * @param activity An activity needed to load the destination fragment. *//*from www . ja v a 2s. c o m*/ public void navigateToLogin(BaseActivity activity) { if (activity != null) { FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction(); fragmentTransaction.hide(activity.getSupportFragmentManager().findFragmentById(R.id.fragmentContainer)); fragmentTransaction.add(R.id.fragmentContainer, FragmentLogin.newInstance()); fragmentTransaction.addToBackStack(null); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); fragmentTransaction.commit(); } }
From source file:com.permutassep.presentation.navigation.Navigator.java
/** * Navigates to the sign up screen fragment * * @param activity An activity needed to load the destination fragment. *//* www .j a va 2 s . c o m*/ public void navigateToSignUp(BaseActivity activity) { if (activity != null) { FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction(); fragmentTransaction.hide(activity.getSupportFragmentManager().findFragmentById(R.id.fragmentContainer)); fragmentTransaction.add(R.id.fragmentContainer, FragmentSignUp.newInstance()); fragmentTransaction.addToBackStack(null); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); fragmentTransaction.commit(); } }
From source file:com.renard.documentview.DocumentActivity.java
public void setDocumentFragmentType(final boolean text) { // Check what fragment is shown, replace if needed. DocumentContainerFragment fragment = (DocumentContainerFragment) getSupportFragmentManager() .findFragmentById(R.id.document_fragment_container); DocumentContainerFragment newFragment = null; if (text) {//w ww . j a v a2s.com if ((fragment != null && fragment instanceof DocumentCurlFragment) || fragment == null) { newFragment = new DocumentPagerFragment(); } } else if (!text) { if ((fragment != null && fragment instanceof DocumentPagerFragment) || fragment == null) { newFragment = new DocumentCurlFragment(); } } if (newFragment != null) { if (mCursor != null) { newFragment.setCursor(mCursor); } FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); if (fragment != null) { ft.remove((Fragment) fragment); } ft.add(R.id.document_fragment_container, (Fragment) newFragment); // ft.replace(R.id.document_fragment_container, (Fragment) // newFragment); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } }
From source file:eu.trentorise.smartcampus.eb.custom.MainAdapter.java
private void open(final int position) { currentlyOpened = position;//from w w w. j a va 2 s . co m if (MAIN_ACTIONS[position].fragmentClass != null) { // Starting transaction FragmentTransaction ft = fragmentManager.beginTransaction(); Fragment fragment = (Fragment) Fragment.instantiate(context, MAIN_ACTIONS[position].fragmentClass.getName()); if (fragment instanceof DialogFragment) { ((DialogFragment) fragment).show(ft, "dialog"); } else { // Replacing old fragment with new one ft.replace(android.R.id.content, fragment); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.addToBackStack(null); ft.commit(); } } else { Toast toast = Toast.makeText(context, "TODO", Toast.LENGTH_SHORT); toast.show(); } }
From source file:com.noshufou.android.su.AppDetailsFragment.java
public void closeDetails() { if (mDualPane) { Fragment logFragment = LogFragment.newInstance(); FragmentTransaction transaction = ((FragmentActivity) getActivity()).getSupportFragmentManager() .beginTransaction();//w ww .j av a 2 s .co m transaction.replace(R.id.fragment_container, logFragment); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.commit(); } else { Util.goHome(getActivity()); } }
From source file:com.permutassep.presentation.navigation.Navigator.java
/** * Navigates to the sign up screen fragment * * @param activity An activity needed to load the destination fragment. *///from w w w. j a v a2 s . c o m public void navigateToCompleteFbData(BaseActivity activity, Bundle bundle) { if (activity != null && bundle != null) { FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction(); fragmentTransaction.hide(activity.getSupportFragmentManager().findFragmentById(R.id.fragmentContainer)); fragmentTransaction.add(R.id.fragmentContainer, FragmentCompleteFbData.newInstance(bundle)); fragmentTransaction.addToBackStack(null); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); fragmentTransaction.commit(); } }
From source file:org.comixwall.pffw.MainActivity.java
/** * Select the fragment to display./* w ww. ja va 2 s .c o m*/ * We modify the backstack ourselves so that no fragment is pushed to the backstack twice. * So if a fragment which is already in the backstack is selected, we roll back the backstack * to its position. * <p> * We never push the Dashboard fragment to the backstack because it is always * the first fragment displayed (if we push it to the backstack too, pressing the back button * while Dashboard fragment is displayed causes a blank activity screen). * * @param item The menu item selected. * @return See {@link NavigationView.OnNavigationItemSelectedListener} */ @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); // Ignore requests for the same fragment already displayed if (!mMenuItems2Fragments.get(id).isInstance(fragment)) { FragmentManager fm = getSupportFragmentManager(); boolean add = true; if (id == R.id.menuDashboard) { // Dashboard is the main fragment, should never be removed, // so remove all backstack entries first to reach the first Dashboard. popAllBackStack(); // Never add Dashboard to the backstack add = false; fragment = new Dashboard(); // ATTENTION: menuDashboard does not check initially, so we need to manage it ourselves item.setChecked(true); } else { // TODO: Check why android:checkableBehavior="single" does not uncheck menuDashboard MenuItem itemDashboard = navigationView.getMenu().findItem(R.id.menuDashboard); if (itemDashboard.isChecked()) { itemDashboard.setChecked(false); } try { fragment = (Fragment) mMenuItems2Fragments.get(id).getConstructor().newInstance(); } catch (Exception e) { e.printStackTrace(); logger.severe("EXCEPTION: " + e.toString()); return false; } } String fragmentName = fragment.getClass().getSimpleName(); // Rolls back the backstack if the fragment is already in if (!fm.popBackStackImmediate(fragmentName, 0)) { android.support.v4.app.FragmentTransaction transaction = fm.beginTransaction(); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); if (add) { transaction.addToBackStack(fragmentName); } // TODO: Check if we need to pass any args //fragment.setArguments(getIntent().getExtras()); transaction.replace(R.id.fragmentContainer, fragment); transaction.commit(); } } else { logger.finest("onNavigationItemSelected will not show the same fragment"); } drawer.closeDrawer(GravityCompat.START); createOptionsMenu(); return true; }
From source file:com.glabs.homegenie.StartActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/*from w w w .ja va2 s . co m*/ protected void onCreate(Bundle savedInstanceState) { //Remove title bar //this.requestWindowFeature(Window.FEATURE_NO_TITLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB && getActionBar() != null) { getActionBar().setDisplayShowHomeEnabled(false); } super.onCreate(savedInstanceState); setContentView(R.layout.activity_start); mLoadingCircle = (LinearLayout) findViewById(R.id.loadingCircle); mLoaderText = (TextView) findViewById(R.id.tapoptions); mDonateText = (TextView) findViewById(R.id.donatetext); mEventText = (TextView) findViewById(R.id.eventStatus); mEventTime = (TextView) findViewById(R.id.eventTime); mEventIcon = (ImageView) findViewById(R.id.eventIcon); mGroupsViewFragment = new GroupsViewFragment(); FragmentManager fm = getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.add(R.id.fragmentMain, mGroupsViewFragment, "Groups"); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); fragmentTransaction.commit(); }
From source file:com.secupwn.aimsicd.ui.activities.MainActivity.java
private void openFragment(Fragment fragment) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.replace(R.id.content_frame, fragment); transaction.addToBackStack(null);/*from www . j a v a2 s. c o m*/ transaction.commit(); }