Search in sources :

Example 31 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project weiciyuan by qii.

the class LeftMenuFragment method showProfilePageImp.

private void showProfilePageImp() {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.hide(rightFragments.get(HOME_INDEX));
    ft.hide(rightFragments.get(MENTIONS_INDEX));
    ft.hide(rightFragments.get(COMMENTS_INDEX));
    ft.hide(rightFragments.get(SEARCH_INDEX));
    ft.hide(rightFragments.get(DM_INDEX));
    ft.hide(rightFragments.get(FAV_INDEX));
    UserInfoFragment fragment = (UserInfoFragment) rightFragments.get(PROFILE_INDEX);
    ft.show(fragment);
    ft.commit();
    ((UserInfoFragment) fragment).buildActionBarAndViewPagerTitles();
    AnimationUtility.translateFragmentY(fragment, -400, 0, fragment);
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) UserInfoFragment(org.qii.weiciyuan.ui.userinfo.UserInfoFragment)

Example 32 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project weiciyuan by qii.

the class LeftMenuFragment method showHomePageImp.

private void showHomePageImp() {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.hide(rightFragments.get(MENTIONS_INDEX));
    ft.hide(rightFragments.get(COMMENTS_INDEX));
    ft.hide(rightFragments.get(SEARCH_INDEX));
    ft.hide(rightFragments.get(DM_INDEX));
    ft.hide(rightFragments.get(FAV_INDEX));
    ft.hide(rightFragments.get(PROFILE_INDEX));
    FriendsTimeLineFragment fragment = (FriendsTimeLineFragment) rightFragments.get(HOME_INDEX);
    ft.show(fragment);
    ft.commit();
    setTitle("");
    fragment.buildActionBarNav();
}
Also used : FriendsTimeLineFragment(org.qii.weiciyuan.ui.maintimeline.FriendsTimeLineFragment) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 33 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project weiciyuan by qii.

the class LeftMenuFragment method showMentionPageImp.

private void showMentionPageImp() {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.hide(rightFragments.get(HOME_INDEX));
    ft.hide(rightFragments.get(COMMENTS_INDEX));
    ft.hide(rightFragments.get(SEARCH_INDEX));
    ft.hide(rightFragments.get(DM_INDEX));
    ft.hide(rightFragments.get(FAV_INDEX));
    ft.hide(rightFragments.get(PROFILE_INDEX));
    Fragment m = rightFragments.get(MENTIONS_INDEX);
    if (firstStart) {
        int navPosition = GlobalContext.getInstance().getAccountBean().getNavigationPosition() / 10;
        if (navPosition == MENTIONS_INDEX) {
            mentionsTabIndex = GlobalContext.getInstance().getAccountBean().getNavigationPosition() % 10;
        }
    }
    m.getArguments().putInt("mentionsTabIndex", mentionsTabIndex);
    ft.show(m);
    ft.commit();
    ((MentionsTimeLine) m).buildActionBarAndViewPagerTitles(mentionsTabIndex);
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) MyFavListFragment(org.qii.weiciyuan.ui.userinfo.MyFavListFragment) SearchMainParentFragment(org.qii.weiciyuan.ui.search.SearchMainParentFragment) UserInfoFragment(org.qii.weiciyuan.ui.userinfo.UserInfoFragment) Fragment(android.support.v4.app.Fragment) AbstractAppFragment(org.qii.weiciyuan.ui.interfaces.AbstractAppFragment) FriendsTimeLineFragment(org.qii.weiciyuan.ui.maintimeline.FriendsTimeLineFragment) DMUserListFragment(org.qii.weiciyuan.ui.dm.DMUserListFragment)

Example 34 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction in project robolectric by robolectric.

the class ShadowDialogFragmentTest method removeUsingTransaction_shouldDismissTheDialog.

@Test
public void removeUsingTransaction_shouldDismissTheDialog() throws Exception {
    dialogFragment.show(fragmentManager, null);
    FragmentTransaction t = fragmentManager.beginTransaction();
    t.remove(dialogFragment);
    t.commit();
    Dialog dialog = ShadowDialog.getLatestDialog();
    assertFalse(dialog.isShowing());
    assertTrue(shadowOf(dialog).hasBeenDismissed());
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) Dialog(android.app.Dialog) ShadowDialog(org.robolectric.shadows.ShadowDialog) Test(org.junit.Test)

Example 35 with FragmentTransaction

use of android.support.v4.app.FragmentTransaction 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

FragmentTransaction (android.support.v4.app.FragmentTransaction)392 Fragment (android.support.v4.app.Fragment)135 FragmentManager (android.support.v4.app.FragmentManager)79 View (android.view.View)29 DialogFragment (android.support.v4.app.DialogFragment)27 FragmentActivity (android.support.v4.app.FragmentActivity)25 Bundle (android.os.Bundle)21 TextView (android.widget.TextView)19 FragmentTransaction (android.app.FragmentTransaction)18 Intent (android.content.Intent)18 Button (android.widget.Button)17 OnClickListener (android.view.View.OnClickListener)16 SherlockFragment (com.actionbarsherlock.app.SherlockFragment)12 ActionBar (android.support.v7.app.ActionBar)8 TargetApi (android.annotation.TargetApi)6 AppCompatActivity (android.support.v7.app.AppCompatActivity)6 Toolbar (android.support.v7.widget.Toolbar)6 FriendsTimeLineFragment (org.qii.weiciyuan.ui.maintimeline.FriendsTimeLineFragment)6 UserInfoFragment (org.qii.weiciyuan.ui.userinfo.UserInfoFragment)6 Transition (android.transition.Transition)5