List of usage examples for android.app FragmentTransaction setTransition
public abstract FragmentTransaction setTransition(@Transit int transit);
From source file:ab.util.AbDialogUtil.java
/** * ??./*from ww w . j a v a 2 s. co m*/ * * @param context * @param indeterminateDrawable * @param message * @param * @return */ public static AbRefreshDialogFragment showRefreshDialog(Context context, int indeterminateDrawable, String message, AbDialogOnLoadListener abDialogOnLoadListener) { FragmentActivity activity = (FragmentActivity) context; AbRefreshDialogFragment newFragment = AbRefreshDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo_Light_Dialog); newFragment.setIndeterminateDrawable(indeterminateDrawable); newFragment.setMessage(message); newFragment.setAbDialogOnLoadListener(abDialogOnLoadListener); FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); newFragment.show(ft, mDialogTag); return newFragment; }
From source file:ab.util.AbDialogUtil.java
/** * ??./*from w w w .j av a2 s. c o m*/ * * @param context * the context * @param indeterminateDrawable * @param message * the message */ public static AbRefreshDialogFragment showRefreshPanel(Context context, int indeterminateDrawable, String message) { FragmentActivity activity = (FragmentActivity) context; AbRefreshDialogFragment newFragment = AbRefreshDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Light_Panel); newFragment.setIndeterminateDrawable(indeterminateDrawable); newFragment.setMessage(message); newFragment.setAbDialogOnLoadListener(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
/** * ??./*from w w w .j av a2 s . com*/ * * @param context * @param indeterminateDrawable * @param message * @param * @return */ public static AbRefreshDialogFragment showRefreshPanel(Context context, int indeterminateDrawable, String message, AbDialogOnLoadListener abDialogOnLoadListener) { FragmentActivity activity = (FragmentActivity) context; AbRefreshDialogFragment newFragment = AbRefreshDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Light_Panel); newFragment.setIndeterminateDrawable(indeterminateDrawable); newFragment.setMessage(message); newFragment.setAbDialogOnLoadListener(abDialogOnLoadListener); 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// w w w.j a v a 2 s. c o m * * @param view * @return */ public static AbSampleDialogFragment showTipsDialog(View view) { FragmentActivity activity = (FragmentActivity) view.getContext(); // Create and show the dialog. AbSampleDialogFragment newFragment = AbSampleDialogFragment.newInstance(DialogFragment.STYLE_NO_TITLE, android.R.style.Theme_Holo_Light); newFragment.setContentView(view); FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); // ?,content?fragment,Activity ft.add(android.R.id.content, newFragment, mDialogTag).addToBackStack(null).commit(); return newFragment; }
From source file:com.ternup.caddisfly.fragment.ResultFragment.java
private void goBack() { FragmentManager fm = getFragmentManager(); try {/* w ww . j av a 2 s . c o 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:ab.util.AbDialogUtil.java
/** * ??Fragment./*from w w w .j a v a 2s .co m*/ * * @param context * the context */ public static void removeDialog(Context context) { try { FragmentActivity activity = (FragmentActivity) context; FragmentTransaction ft = activity.getFragmentManager().beginTransaction(); // ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE); Fragment prev = activity.getFragmentManager().findFragmentByTag(mDialogTag); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); if (context != null) { ft.commit(); } } catch (Exception e) { // ?Activity?? e.printStackTrace(); } }
From source file:com.ternup.caddisfly.fragment.DetailsFragment.java
private void goBack() { FragmentManager fm = getFragmentManager(); try {//from www . ja v a 2 s.c o m if (fm.getBackStackEntryCount() > 0) { fm.popBackStack(); fm.executePendingTransactions(); } else { Fragment fragment = new HomeFragment(); FragmentManager fragmentManager = getFragmentManager(); 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:com.android.mail.ui.OnePaneController.java
/** * Replace the content_pane with the fragment specified here. The tag is specified so that * the {@link ActivityController} can look up the fragments through the * {@link android.app.FragmentManager}.//from w ww. j a v a 2 s. c o m * @param fragment the new fragment to put * @param transition the transition to show * @param tag a tag for the fragment manager. * @param anchor ID of view to replace fragment in * @return transaction ID returned when the transition is committed. */ private int replaceFragment(Fragment fragment, int transition, String tag, int anchor) { final FragmentManager fm = mActivity.getFragmentManager(); FragmentTransaction fragmentTransaction = fm.beginTransaction(); fragmentTransaction.setTransition(transition); fragmentTransaction.replace(anchor, fragment, tag); final int id = fragmentTransaction.commitAllowingStateLoss(); fm.executePendingTransactions(); return id; }
From source file:com.cdhxqh.inventorymovement.ui.MainActivity.java
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { mSelectPos = position;//from w w w . j a v a 2 s . c om FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); switch (position) { case 0:// titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newItemFragment == null) { newItemFragment = new ItemFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newItemFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newItemFragment).commit(); drawer.closeDrawer(mDrawerList); break; case 1://? titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newPoFragemnt == null) { newPoFragemnt = new PoFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newPoFragemnt.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newPoFragemnt).commit(); drawer.closeDrawer(mDrawerList); break; case 2://? titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newWorkorderFragment == null) { newWorkorderFragment = new WorkorderFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newWorkorderFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newWorkorderFragment).commit(); drawer.closeDrawer(mDrawerList); break; case 3:// titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newCheckFragment == null) { newCheckFragment = new CheckFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newCheckFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newCheckFragment).commit(); drawer.closeDrawer(mDrawerList); break; case 4:// titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newPoFragemnt == null) { newLocationFragment = new LocationFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newLocationFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newLocationFragment).commit(); drawer.closeDrawer(mDrawerList); break; // case 5://??? // titleTextView.setText(adapter.getTitle(position)); // searchButton.setVisibility(View.GONE); // if (newTypoFragment == null) { // newTypoFragment = new TypoFragment(); // Bundle bundle = new Bundle(); // bundle.putString("text", adapter.getTitle(position)); // newTypoFragment.setArguments(bundle); // } // fragmentTransaction.replace(R.id.content_frame, newTypoFragment).commit(); // drawer.closeDrawer(mDrawerList); // break; case 5:// titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newInVFragment == null) { newInVFragment = new InVFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newInVFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newInVFragment).commit(); drawer.closeDrawer(mDrawerList); break; case 6://? titleTextView.setText(adapter.getTitle(position)); searchButton.setVisibility(View.VISIBLE); if (newItemreqFragment == null) { newItemreqFragment = new ItemreqFragment(); Bundle bundle = new Bundle(); bundle.putString("text", adapter.getTitle(position)); newItemreqFragment.setArguments(bundle); } fragmentTransaction.replace(R.id.content_frame, newItemreqFragment).commit(); drawer.closeDrawer(mDrawerList); break; case 7: // showAlertDialog(); searchButton.setVisibility(View.GONE); drawer.closeDrawer(mDrawerList); break; default: titleTextView.setText(adapter.getTitle(position)); Fragment contentFragment = new ContentFragment(); Bundle args = new Bundle(); args.putString("text", adapter.getTitle(position)); contentFragment.setArguments(args); fragmentTransaction.replace(R.id.content_frame, contentFragment).commit(); drawer.closeDrawer(mDrawerList); break; } }
From source file:com.android.mail.ui.TwoPaneController.java
@Override public void showWaitForInitialization() { super.showWaitForInitialization(); FragmentTransaction fragmentTransaction = mActivity.getFragmentManager().beginTransaction(); fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); fragmentTransaction.replace(R.id.conversation_list_pane, getWaitFragment(), TAG_WAIT); fragmentTransaction.commitAllowingStateLoss(); }