List of usage examples for android.app FragmentTransaction setTransition
public abstract FragmentTransaction setTransition(@Transit int transit);
From source file:com.microsoft.office365.starter.FilesFolders.FileDetailActivity.java
private void updateActionHandler() { // Display the update fragment FileUpdateFragment updateFragment = new FileUpdateFragment(); FragmentManager fragmentManager = getFragmentManager(); android.app.FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.file_detail_container, updateFragment, UPDATE_FRAGMENT_STACK_STATE); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.addToBackStack(UPDATE_FRAGMENT_STACK_STATE); ft.commit();/* www . jav a 2s . co m*/ }
From source file:com.example.android.cloudnotes.ui.HomeActivity.java
/** * Callback from child fragment/* w w w. j av a 2 s .co m*/ */ public void onNoteDeleted() { // remove the NoteEditFragment after a deletion FragmentManager fm = getFragmentManager(); NoteEditFragment edit = (NoteEditFragment) fm.findFragmentByTag(NOTE_EDIT_TAG); if (edit != null) { FragmentTransaction ft = fm.beginTransaction(); ft.remove(edit); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.commit(); } }
From source file:net.hockeyapp.android.internal.CheckUpdateTask.java
private void showUpdateFragment(final JSONArray updateInfo) { FragmentTransaction fragmentTransaction = activity.getFragmentManager().beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); Fragment existingFragment = activity.getFragmentManager().findFragmentByTag("hockey_update_dialog"); if (existingFragment != null) { fragmentTransaction.remove(existingFragment); }/* www . j av a2 s .c om*/ fragmentTransaction.addToBackStack(null); // Create and show the dialog Class<? extends UpdateFragment> fragmentClass = UpdateFragment.class; if (listener != null) { fragmentClass = listener.getUpdateFragmentClass(); } try { Method method = fragmentClass.getMethod("newInstance", JSONArray.class, String.class); DialogFragment updateFragment = (DialogFragment) method.invoke(null, updateInfo, getURLString("apk")); updateFragment.show(fragmentTransaction, "hockey_update_dialog"); } catch (Exception e) { Log.d(Constants.TAG, "An exception happened while showing the update fragment:"); e.printStackTrace(); Log.d(Constants.TAG, "Showing update activity instead."); startUpdateIntent(updateInfo, false); } }
From source file:com.ternup.caddisfly.activity.MainActivity.java
/** * Display view fragment for selected nav drawer menu option *//*from w w w .ja v a 2s.co m*/ public void displayView(int position, boolean addToBackStack) { int index = getCurrentFragmentIndex(); if (index == position) { // requested fragment is already showing return; } Fragment fragment; showCheckUpdateOption = false; switch (position) { case Globals.HOME_SCREEN_INDEX: if (homeFragment == null) { homeFragment = new HomeFragment(); } fragment = homeFragment; break; case Globals.LOCATION_LIST_SCREEN_INDEX: if (mLocationListFragment == null) { mLocationListFragment = new LocationListFragment(); } fragment = mLocationListFragment; break; case Globals.CALIBRATE_SCREEN_INDEX: if (calibrateFragment == null) { calibrateFragment = new CalibrateFragment(); } fragment = calibrateFragment; break; case Globals.SETTINGS_SCREEN_INDEX: showCheckUpdateOption = true; if (settingsFragment == null) { settingsFragment = new SettingsFragment(); } fragment = settingsFragment; break; case Globals.HELP_SCREEN_INDEX: showCheckUpdateOption = true; if (helpFragment == null) { helpFragment = new HelpFragment(); } fragment = helpFragment; break; case Globals.ABOUT_SCREEN_INDEX: showCheckUpdateOption = true; if (aboutFragment == null) { aboutFragment = new AboutItFragment(); } fragment = aboutFragment; break; default: toggleTheme(); return; } invalidateOptionsMenu(); if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.container, fragment, String.valueOf(position)); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); if (addToBackStack) { ft.addToBackStack(null); } ft.commit(); } mNavigationDrawerFragment.checkItem(position); }
From source file:com.cdhxqh.inventorymovement.ui.MainActivity.java
/** * *//from w ww .j a va 2s . c o m */ private void defaultShowItem() { FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); if (newItemFragment == null) { newItemFragment = new ItemFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(0)); newItemFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newItemFragment).commit(); drawer.closeDrawer(mDrawerList); }
From source file:com.example.android.cloudnotes.ui.HomeActivity.java
/** * This method controls both fragments, instructing them to display a * certain note./*w w w.j a v a2s . c o m*/ * * @param noteUri The {@link Uri} of the note to show. To create a new note, * pass {@code null}. */ private void showNote(final Uri noteUri) { if (mTwoPaneView) { // check if the NoteEditFragment has been added FragmentManager fm = getFragmentManager(); NoteEditFragment edit = (NoteEditFragment) fm.findFragmentByTag(NOTE_EDIT_TAG); final boolean editNoteAdded = (edit != null); if (editNoteAdded) { if (edit.mCurrentNote != null && edit.mCurrentNote.equals(noteUri)) { // clicked on the currently selected note return; } NoteEditFragment editFrag = (NoteEditFragment) fm.findFragmentByTag(NOTE_EDIT_TAG); if (noteUri != null) { // load an existing note editFrag.loadNote(noteUri); NoteListFragment list = (NoteListFragment) fm.findFragmentById(R.id.list); list.setActivatedNote(Long.valueOf(noteUri.getLastPathSegment())); } else { // creating a new note - clear the form & list // activation if (editNoteAdded) { editFrag.clear(); } NoteListFragment list = (NoteListFragment) fm.findFragmentById(R.id.list); list.clearActivation(); } } else { // add the NoteEditFragment to the container FragmentTransaction ft = fm.beginTransaction(); edit = new NoteEditFragment(); ft.add(R.id.note_detail_container, edit, NOTE_EDIT_TAG); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); edit.loadNote(noteUri); } } else { startActivity(new Intent(NoteEditFragment.ACTION_VIEW_NOTE, noteUri)); } }
From source file:cz.zcu.kiv.eeg.mobile.base.ui.NavigationActivity.java
public boolean openSection(int itemPosition) { Intent intent;//from w ww .ja v a 2 s . c o m if (itemPosition != previousFragment) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); switch (itemPosition) { // dashboard case 0: DashboardFragment dashboardFrag; dashboardFrag = new DashboardFragment(); fragmentTransaction.replace(R.id.content, dashboardFrag, DashboardFragment.TAG); fragmentTransaction.commit(); previousFragment = itemPosition; break; // scenarios case 1: intent = new Intent(); intent.setClass(this, ScenarioActivity.class); startActivity(intent); break; // experiments case 2: intent = new Intent(); intent.setClass(this, ExperimentActivity.class); startActivity(intent); break; // datafile upload case 3: DataFileUploadFragment dataFileFrag; dataFileFrag = new DataFileUploadFragment(); fragmentTransaction.replace(R.id.content, dataFileFrag, DataFileUploadFragment.TAG); fragmentTransaction.commit(); previousFragment = itemPosition; break; // reservations case 4: ReservationFragment agendaFrag; agendaFrag = new ReservationFragment(); fragmentTransaction.replace(R.id.content, agendaFrag, ReservationFragment.TAG); fragmentTransaction.commit(); previousFragment = itemPosition; break; // application settings case 5: intent = new Intent(); intent.setClass(this, SettingsActivity.class); startActivity(intent); break; default: return false; } } drawerLayout.closeDrawer(drawerList); return true; }
From source file:com.optimusinfo.elasticpath.cortex.common.EPFragmentActivity.java
/** * This method adds a fragment to the current activity * //from www . j a va 2s.c o m * @param title * @param isNew * @param tag * @param fargmentContainerId * @param objFragment */ public void addFragmentToBreadCrumb(String title, int fargmentContainerId, EPFragment objFragment) { String breadTitle = title; if (title.length() > 16) { breadTitle = title.substring(0, 14).concat(getString(R.string.ellipsis)); } mStackLevel++; // Add the fragment to the activity, pushing this transaction // on to the back stack. FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setBreadCrumbTitle(breadTitle); ft.replace(fargmentContainerId, objFragment); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.addToBackStack(null); ft.commit(); }
From source file:ab.util.AbDialogUtil.java
/** * ???dialog String.//from w w w .ja v a 2s . c om * * @param context * @param icon * @param title * ? * @param * */ public static AbAlertDialogFragment showAlertDialog(Context context, int icon, String title, String message) { FragmentActivity activity = (FragmentActivity) context; AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(icon, title, message, null, null); FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); newFragment.show(ft, mDialogTag); return newFragment; }
From source file:ab.util.AbDialogUtil.java
/** * ?View.//from w ww. j a v a2 s . com * * @param view * ? */ public static AbAlertDialogFragment showAlertDialog(View view) { FragmentActivity activity = (FragmentActivity) view.getContext(); AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, null, null, view, null); FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); newFragment.show(ft, mDialogTag); return newFragment; }