Search in sources :

Example 1 with FragmentManager

use of android.support.v4.app.FragmentManager in project nmid-headline by miao1007.

the class HomeActivity method onNavigationDrawerItemSelected.

@Override
public void onNavigationDrawerItemSelected(int position) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    Fragment fragment = null;
    switch(position) {
        case 0:
            fragment = new SlidingTabFragment();
            break;
        case 1:
            fragment = new ImagesFeedFragment();
            break;
        case 2:
            fragment = new FavFeedFragment();
            break;
    }
    if (fragment != null) {
        fragmentManager.beginTransaction().replace(R.id.base_fragment_container, fragment).commit();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) ImagesFeedFragment(cn.edu.cqupt.nmid.headline.ui.fragment.ImagesFeedFragment) FavFeedFragment(cn.edu.cqupt.nmid.headline.ui.fragment.base.FavFeedFragment) SlidingTabFragment(cn.edu.cqupt.nmid.headline.ui.fragment.SlidingTabFragment) NavigationDrawerFragment(cn.edu.cqupt.nmid.headline.ui.fragment.NavigationDrawerFragment) ImagesFeedFragment(cn.edu.cqupt.nmid.headline.ui.fragment.ImagesFeedFragment) Fragment(android.support.v4.app.Fragment) FavFeedFragment(cn.edu.cqupt.nmid.headline.ui.fragment.base.FavFeedFragment) SlidingTabFragment(cn.edu.cqupt.nmid.headline.ui.fragment.SlidingTabFragment)

Example 2 with FragmentManager

use of android.support.v4.app.FragmentManager in project Signal-Android by WhisperSystems.

the class MmsPreferencesActivity method onCreate.

@Override
protected void onCreate(Bundle icicle, @NonNull MasterSecret masterSecret) {
    this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    Fragment fragment = new MmsPreferencesFragment();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    fragmentTransaction.replace(android.R.id.content, fragment);
    fragmentTransaction.commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction) Fragment(android.support.v4.app.Fragment)

Example 3 with FragmentManager

use of android.support.v4.app.FragmentManager in project Android-ObservableScrollView by ksoichiro.

the class FragmentActionBarControlListViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fragmentactionbarcontrol);
    FragmentManager fm = getSupportFragmentManager();
    if (fm.findFragmentByTag(FragmentTransitionDefaultFragment.FRAGMENT_TAG) == null) {
        FragmentTransaction ft = fm.beginTransaction();
        ft.add(R.id.container, new FragmentActionBarControlListViewFragment(), FragmentActionBarControlListViewFragment.FRAGMENT_TAG);
        ft.commit();
        fm.executePendingTransactions();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 4 with FragmentManager

use of android.support.v4.app.FragmentManager in project SeriesGuide by UweTrottmann.

the class AddListDialogFragment method showAddListDialog.

/**
     * Display a dialog which allows to edit the title of this list or remove it.
     */
public static void showAddListDialog(FragmentManager fm) {
    // DialogFragment.show() will take care of adding the fragment
    // in a transaction. We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("addlistdialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    // Create and show the dialog.
    DialogFragment newFragment = AddListDialogFragment.newInstance();
    newFragment.show(ft, "addlistdialog");
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) AppCompatDialogFragment(android.support.v7.app.AppCompatDialogFragment) DialogFragment(android.support.v4.app.DialogFragment) AppCompatDialogFragment(android.support.v7.app.AppCompatDialogFragment) DialogFragment(android.support.v4.app.DialogFragment) Fragment(android.support.v4.app.Fragment)

Example 5 with FragmentManager

use of android.support.v4.app.FragmentManager in project Signal-Android by WhisperSystems.

the class ApplicationPreferencesActivity method onSupportNavigateUp.

@Override
public boolean onSupportNavigateUp() {
    FragmentManager fragmentManager = getSupportFragmentManager();
    if (fragmentManager.getBackStackEntryCount() > 0) {
        fragmentManager.popBackStack();
    } else {
        Intent intent = new Intent(this, ConversationListActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        finish();
    }
    return true;
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Intent(android.content.Intent)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)585 FragmentTransaction (android.support.v4.app.FragmentTransaction)260 Fragment (android.support.v4.app.Fragment)220 View (android.view.View)84 Bundle (android.os.Bundle)69 TextView (android.widget.TextView)54 Intent (android.content.Intent)45 DialogFragment (android.support.v4.app.DialogFragment)36 ImageView (android.widget.ImageView)31 OnClickListener (android.view.View.OnClickListener)26 ArrayList (java.util.ArrayList)20 Button (android.widget.Button)18 FragmentActivity (android.support.v4.app.FragmentActivity)15 ScrollView (android.widget.ScrollView)15 RecyclerView (android.support.v7.widget.RecyclerView)14 ListFragment (android.support.v4.app.ListFragment)12 NavigationView (android.support.design.widget.NavigationView)10 Toolbar (android.support.v7.widget.Toolbar)9 AgendaFragment (com.orgzly.android.ui.fragments.AgendaFragment)9 BookFragment (com.orgzly.android.ui.fragments.BookFragment)9