Search in sources :

Example 16 with Fragment

use of android.support.v4.app.Fragment in project UltimateAndroid by cymcsg.

the class BasicUtils method addFragmentToActivity.

/**
     * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
     * performed by the {@code fragmentManager}.
     */
public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager, @NonNull Fragment fragment, int frameId) {
    Preconditions.checkNotNull(fragmentManager);
    Preconditions.checkNotNull(fragment);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.add(frameId, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 17 with Fragment

use of android.support.v4.app.Fragment in project android-betterpickers by code-troopers.

the class SampleNumberUsingFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.frame_layout);
    Fragment fragment = new SampleNumberFragment();
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.frame, fragment);
    transaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) SampleNumberFragment(com.codetroopers.betterpickers.sample.fragment.SampleNumberFragment) SampleNumberFragment(com.codetroopers.betterpickers.sample.fragment.SampleNumberFragment) Fragment(android.support.v4.app.Fragment)

Example 18 with Fragment

use of android.support.v4.app.Fragment in project Android-PanesLibrary by cricklet.

the class PhoneDelegate method setMenuFragment.

@Override
public void setMenuFragment(Fragment f) {
    FragmentManager fm = getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.menu_frame, f);
    ft.commit();
    wMenuFragment = new WeakReference<Fragment>(f);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment)

Example 19 with Fragment

use of android.support.v4.app.Fragment in project Android-PanesLibrary by cricklet.

the class PhoneDelegate method getMenuFragment.

@Override
public Fragment getMenuFragment() {
    Fragment f = wMenuFragment.get();
    if (f == null) {
        f = getSupportFragmentManager().findFragmentById(R.id.menu_frame);
        wMenuFragment = new WeakReference<Fragment>(f);
    }
    return f;
}
Also used : Fragment(android.support.v4.app.Fragment)

Example 20 with Fragment

use of android.support.v4.app.Fragment in project Android-PanesLibrary by cricklet.

the class TabletDelegate method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    if (findViewById(R.id.content_frame) == null) {
        setContentView(R.layout.panes_layout);
    } else {
        View.inflate(getActivity(), R.layout.panes_layout, (ViewGroup) findViewById(R.id.content_frame));
    }
    panesLayout = (PanesLayout) findViewById(R.id.panes);
    panesLayout.setOnIndexChangedListener(this);
    if (savedInstanceState != null) {
        int[] panesType = savedInstanceState.getIntArray("PanesLayout_panesType");
        boolean[] panesFocused = savedInstanceState.getBooleanArray("PanesLayout_panesFocused");
        int currentIndex = savedInstanceState.getInt("PanesLayout_currentIndex");
        for (int i = 0; i < panesType.length; i++) {
            panesLayout.addPane(panesType[i], panesFocused[i]);
        }
        panesLayout.setIndex(currentIndex);
    }
    if (savedInstanceState != null) {
        FragmentManager fm = getSupportFragmentManager();
        for (int index = 0; index < panesLayout.getNumPanes(); index++) {
            int id = panesLayout.getPane(index).getInnerId();
            Fragment f = fm.findFragmentById(id);
            fragmentStack.add(f);
        }
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Fragment(android.support.v4.app.Fragment)

Aggregations

Fragment (android.support.v4.app.Fragment)617 FragmentTransaction (android.support.v4.app.FragmentTransaction)220 Bundle (android.os.Bundle)140 View (android.view.View)129 FragmentManager (android.support.v4.app.FragmentManager)115 DialogFragment (android.support.v4.app.DialogFragment)77 TextView (android.widget.TextView)55 FragmentInstruction (de.madcyph3r.example.example.FragmentInstruction)48 MaterialMenu (de.madcyph3r.materialnavigationdrawer.menu.MaterialMenu)48 MaterialItemSectionFragment (de.madcyph3r.materialnavigationdrawer.menu.item.section.MaterialItemSectionFragment)48 FragmentDummy (de.madcyph3r.example.example.FragmentDummy)43 Intent (android.content.Intent)39 ViewPager (android.support.v4.view.ViewPager)35 FragmentActivity (android.support.v4.app.FragmentActivity)34 BaseFragment (com.waz.zclient.pages.BaseFragment)29 ImageView (android.widget.ImageView)27 FragmentPagerAdapter (android.support.v4.app.FragmentPagerAdapter)25 Button (android.widget.Button)24 ArrayList (java.util.ArrayList)24 FragmentStatePagerAdapter (android.support.v4.app.FragmentStatePagerAdapter)21