Example usage for android.app FragmentTransaction setTransition

List of usage examples for android.app FragmentTransaction setTransition

Introduction

In this page you can find the example usage for android.app FragmentTransaction setTransition.

Prototype

public abstract FragmentTransaction setTransition(@Transit int transit);

Source Link

Document

Select a standard transition animation for this transaction.

Usage

From source file:com.aoppp.gatewaymaster.dialogs.DialogUtil.java

/**
 * ?string?./*from  w  w w  .j  a v  a 2 s. c  o  m*/
 * @param context
 * @param icon
 * @param title ?
 * @param message ???
 * @param onClickListener ?
 */
public static AlertDialogFragment showAlertDialog(Context context, int icon, String title, String message,
        AlertDialogFragment.DialogOnClickListener onClickListener) {
    FragmentActivity activity = (FragmentActivity) context;
    AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon, title, message, null,
            onClickListener);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    //    
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, mDialogTag);
    return newFragment;
}

From source file:com.aoppp.gatewaymaster.dialogs.DialogUtil.java

/**
 * ??Fragment./*  w  ww.  ja va2s  .  c  o  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);
        ft.commit();
    } catch (Exception e) {
        // ?Activity??
        e.printStackTrace();
    }
}

From source file:com.poloure.simplerss.Utilities.java

private static void switchToFragment(Fragment fragment, boolean addToBackStack) {
    if (fragment.isHidden()) {
        Fragment[] fragments = { s_fragmentFavourites, s_fragmentManage, s_fragmentFeeds, s_fragmentSettings };
        FragmentTransaction transaction = s_fragmentManager.beginTransaction();

        for (Fragment frag : fragments) {
            if (frag.isVisible()) {
                transaction.hide(frag);//  w w w .j ava2s .  c o m
            }
        }
        transaction.show(fragment);
        if (addToBackStack) {
            transaction.addToBackStack(null);

            // Set the default transition for adding to the stack.
            transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        }
        transaction.commit();
        s_fragmentManager.executePendingTransactions();
        fragment.getActivity().invalidateOptionsMenu();
    }
}

From source file:cn.org.eshow.framwork.util.AbDialogUtil.java

/**
 * ???dialog String.//from ww  w.j  a va 2  s .  co m
 * @param context
 * @param icon
 * @param title ?
 * @param message  ???
 */
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, dialogTag);
    return newFragment;
}

From source file:cn.org.eshow.framwork.util.AbDialogUtil.java

/**
 * ?View.// w ww. j  ava  2 s . co m
 * @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, dialogTag);
    return newFragment;
}

From source file:cn.org.eshow.framwork.util.AbDialogUtil.java

/**
 * ?String.//  www.j a  va  2 s .c  o  m
 * @param context
 * @param message ?
 */
public static AbAlertDialogFragment showAlertDialog(Context context, String message) {
    FragmentActivity activity = (FragmentActivity) context;
    AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, null, message, null, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    //    
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, dialogTag);
    return newFragment;
}

From source file:cn.org.eshow.framwork.util.AbDialogUtil.java

/**
 * ???dialog View./*from  w w w  .java  2s .  c om*/
 * @param icon
 * @param title ?
 * @param view  ???
 */
public static AbAlertDialogFragment showAlertDialog(int icon, String title, View view) {
    FragmentActivity activity = (FragmentActivity) view.getContext();
    AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(icon, title, null, view, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    //    
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, dialogTag);
    return newFragment;
}

From source file:cn.org.eshow.framwork.util.AbDialogUtil.java

/**
 * ???dialog View.//from  ww  w . ja  v  a  2  s. co  m
 * @param title ?
 * @param view  ???
 */
public static AbAlertDialogFragment showAlertDialog(String title, View view) {
    FragmentActivity activity = (FragmentActivity) view.getContext();
    AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, title, null, view, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    //    
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, dialogTag);
    return newFragment;
}

From source file:cn.org.eshow.framwork.util.AbDialogUtil.java

/**
 * ???dialog String./*from  ww  w  . ja va 2s .  co m*/
 * @param context
 * @param title ?
 * @param message  ???
 */
public static AbAlertDialogFragment showAlertDialog(Context context, String title, String message) {
    FragmentActivity activity = (FragmentActivity) context;
    AbAlertDialogFragment newFragment = AbAlertDialogFragment.newInstance(0, title, message, null, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    //    
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, dialogTag);
    return newFragment;
}

From source file:com.bangqu.eshow.util.ESDialogUtil.java

/**
 * ???dialog String./*from  w  w w .  j  a  v  a2s.com*/
 * @param context
 * @param icon
 * @param title ?
 * @param view  ???
 */
public static ESAlertDialogFragment showAlertDialog(Context context, int icon, String title, String message) {
    FragmentActivity activity = (FragmentActivity) context;
    ESAlertDialogFragment newFragment = ESAlertDialogFragment.newInstance(icon, title, message, null, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    //    
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, dialogTag);
    return newFragment;
}