Java Code Examples for android.support.v7.app.ActionBarActivity#getSupportFragmentManager()

The following examples show how to use android.support.v7.app.ActionBarActivity#getSupportFragmentManager() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIHelper.java    From iSCAU-Android with GNU General Public License v3.0 5 votes vote down vote up
private static void deAttachAllFragments(ActionBarActivity act){
    FragmentManager fragmentManager = act.getSupportFragmentManager();
    FragmentTransaction ft = fragmentManager.beginTransaction();
    List<Fragment> fragments = fragmentManager.getFragments();
    if (fragments == null) return;
    for(Fragment fragment : fragments){
        if (fragment.isVisible())
            ft.hide(fragment);
    }
    ft.commitAllowingStateLoss();
}
 
Example 2
Source File: FragmentTestCase.java    From Beautiful-Photos with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Adds the fragment to a new blank activity, thereby fully
 * initializing its view.
 */
public void startFragment(T fragment) {
	this.fragment = fragment;
	controller = Robolectric.buildActivity(ActionBarActivity.class);
	activity = (ActionBarActivity) controller.create().start().visible().get();
	FragmentManager manager = activity.getSupportFragmentManager();
	manager.beginTransaction().add(fragment, FRAGMENT_TAG).commit();
}
 
Example 3
Source File: DialogHelper.java    From HeadsUp with GNU General Public License v2.0 5 votes vote down vote up
private static void showDialog(@NonNull ActionBarActivity activity,
                               @NonNull DialogFragment fragment,
                               @NonNull String tag) {
    Check.getInstance().isInMainThread();

    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(tag);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    fragment.show(ft, tag);
}
 
Example 4
Source File: AbstractTabsAdapter.java    From tup.dota2recipe with Apache License 2.0 5 votes vote down vote up
public AbstractTabsAdapter(ActionBarActivity activity, ViewPager pager) {
    super(activity.getSupportFragmentManager());
    mContext = activity;
    mActionBar = activity.getSupportActionBar();
    mViewPager = pager;
    mViewPager.setAdapter(this);
    mViewPager.setOnPageChangeListener(this);
}
 
Example 5
Source File: PagerAdapter.java    From android with Apache License 2.0 4 votes vote down vote up
public PagerAdapter(ActionBarActivity activity, String title) {
    super(activity.getSupportFragmentManager());
    mTitles = new String[]{title};
}
 
Example 6
Source File: PagerAdapter.java    From android with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor for <code>PagerAdapter</code>
 *
 * @param activity The {@link android.support.v7.app.ActionBarActivity} to use
 */
public PagerAdapter(ActionBarActivity activity, int titles) {
    super(activity.getSupportFragmentManager());
    mTitles = activity.getResources().getStringArray(titles);
}