Search in sources :

Example 6 with FragmentManager

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

the class PhoneDelegate method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    if (findViewById(R.id.content_frame) == null)
        setContentView(R.layout.phone_layout);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(true);
    drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    drawerToggle = new ActionBarDrawerToggle(getActivity(), drawer, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {

        public void onDrawerClosed(View view) {
            supportInvalidateOptionsMenu();
        // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            supportInvalidateOptionsMenu();
        // creates call to onPrepareOptionsMenu()
        }
    };
    drawer.setDrawerListener(drawerToggle);
    FragmentManager fm = getSupportFragmentManager();
    fm.addOnBackStackChangedListener(this);
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) ActionBarDrawerToggle(android.support.v4.app.ActionBarDrawerToggle) View(android.view.View)

Example 7 with FragmentManager

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

Example 8 with FragmentManager

use of android.support.v4.app.FragmentManager in project barcodescanner by dm77.

the class FullScannerActivity method closeDialog.

public void closeDialog(String dialogName) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    DialogFragment fragment = (DialogFragment) fragmentManager.findFragmentByTag(dialogName);
    if (fragment != null) {
        fragment.dismiss();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) DialogFragment(android.support.v4.app.DialogFragment)

Example 9 with FragmentManager

use of android.support.v4.app.FragmentManager in project barcodescanner by dm77.

the class FullScannerActivity method closeDialog.

public void closeDialog(String dialogName) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    DialogFragment fragment = (DialogFragment) fragmentManager.findFragmentByTag(dialogName);
    if (fragment != null) {
        fragment.dismiss();
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) DialogFragment(android.support.v4.app.DialogFragment)

Example 10 with FragmentManager

use of android.support.v4.app.FragmentManager in project FlexibleAdapter by davideas.

the class MainActivity method initializeFragment.

private void initializeFragment(Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        mFragment = (AbstractFragment) getSupportFragmentManager().getFragment(savedInstanceState, STATE_ACTIVE_FRAGMENT);
    }
    if (mFragment == null) {
        mFragment = FragmentOverall.newInstance(2);
    }
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.recycler_view_container, mFragment).commit();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager)

Aggregations

FragmentManager (android.support.v4.app.FragmentManager)265 FragmentTransaction (android.support.v4.app.FragmentTransaction)98 Fragment (android.support.v4.app.Fragment)76 View (android.view.View)46 TextView (android.widget.TextView)34 OnClickListener (android.view.View.OnClickListener)24 Bundle (android.os.Bundle)23 Intent (android.content.Intent)20 ImageView (android.widget.ImageView)15 ScrollView (android.widget.ScrollView)14 DialogFragment (android.support.v4.app.DialogFragment)13 ListFragment (android.support.v4.app.ListFragment)12 Button (android.widget.Button)11 FragmentActivity (android.support.v4.app.FragmentActivity)6 ArrayList (java.util.ArrayList)6 ViewPager (android.support.v4.view.ViewPager)5 UiThreadTest (android.test.UiThreadTest)5 BackStackEntry (android.support.v4.app.FragmentManager.BackStackEntry)4 AppCompatActivity (android.support.v7.app.AppCompatActivity)4 Time (android.text.format.Time)4