Search in sources :

Example 11 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project superCleanMaster by joyoyao.

the class DialogUtil method showAlertDialog.

/**
	 * 描述:对话框dialog (图标,标题,View内容).
	 * @param icon
	 * @param title 对话框标题内容
	 * @param view  对话框提示内容
	 */
public static AlertDialogFragment showAlertDialog(int icon, String title, View view) {
    FragmentActivity activity = (FragmentActivity) view.getContext();
    AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon, title, null, view, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    // 指定一个系统转场动画   
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, mDialogTag);
    return newFragment;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.app.FragmentTransaction)

Example 12 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project superCleanMaster by joyoyao.

the class DialogUtil method showAlertDialog.

/**
	 * 描述:对话框dialog (图标,标题,String内容).
	 * @param context
	 * @param icon
	 * @param title 对话框标题内容
	 *
	 */
public static AlertDialogFragment showAlertDialog(Context context, int icon, String title, String message) {
    FragmentActivity activity = (FragmentActivity) context;
    AlertDialogFragment newFragment = AlertDialogFragment.newInstance(icon, title, message, null, null);
    FragmentTransaction ft = activity.getFragmentManager().beginTransaction();
    // 指定一个系统转场动画   
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    newFragment.show(ft, mDialogTag);
    return newFragment;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.app.FragmentTransaction)

Example 13 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project superCleanMaster by joyoyao.

the class DialogUtil method removeDialog.

/**
	 * 描述:移除Fragment.
	 * 
	 * @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();
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.app.FragmentTransaction) Fragment(android.app.Fragment)

Example 14 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project scdl by passy.

the class ChangelogDialog method showDialogForActivity.

public static void showDialogForActivity(FragmentActivity activity) {
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    new ChangelogDialog().show(ft, FRAGMENT_TAG);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment) DialogFragment(android.support.v4.app.DialogFragment)

Example 15 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project roboguice by roboguice.

the class FragmentInjectionTest method startFragment.

// http://stackoverflow.com/questions/11333354/how-can-i-test-fragments-with-robolectric
protected static void startFragment(FragmentActivity activity, Fragment fragment) {
    final FragmentManager fragmentManager = activity.getSupportFragmentManager();
    final FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.add(fragment, null);
    fragmentTransaction.commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)91 FragmentTransaction (android.app.FragmentTransaction)16 FragmentManager (android.support.v4.app.FragmentManager)16 FragmentTransaction (android.support.v4.app.FragmentTransaction)16 Fragment (android.support.v4.app.Fragment)11 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)11 Intent (android.content.Intent)7 Bundle (android.os.Bundle)5 View (android.view.View)5 TextView (android.widget.TextView)4 DialogFragment (android.support.v4.app.DialogFragment)3 SearchView (android.widget.SearchView)3 Fragment (android.app.Fragment)2 ActionBar (android.support.v7.app.ActionBar)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)2 MediaRouteDialogFactory (android.support.v7.app.MediaRouteDialogFactory)2 RecyclerView (android.support.v7.widget.RecyclerView)2 ImageView (android.widget.ImageView)2 InjectView (butterknife.InjectView)2 RequestManager (com.bumptech.glide.RequestManager)2