Search in sources :

Example 1 with NavigationFragment

use of org.edx.mobile.view.NavigationFragment in project edx-app-android by edx.

the class BaseFragmentActivity method addDrawer.

/**
 * It will add the slide drawer in the activity's layout.
 * <p>
 * For addition, {@link DrawerLayout} with id {@link R.id#drawer_layout R.id.drawer_layout} will
 * be searched in activity's layout, if it exists, the {@link NavigationFragment Navigation Drawer}
 * will be replaced by the container having id {@link R.id#slider_menu R.id.slider_menu}.
 * </p>
 *
 * @deprecated As of release v2.13, see new toolbar design used in
 * {@link org.edx.mobile.view.MainDashboardActivity} and menu options used in
 * {@link org.edx.mobile.view.MainTabsDashboardFragment} as an alternate.
 */
@Deprecated
protected void addDrawer() {
    DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (mDrawerLayout != null) {
        getSupportFragmentManager().beginTransaction().replace(R.id.slider_menu, new NavigationFragment(), "NavigationFragment").commit();
        mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.label_open_navigation_menu, R.string.label_close_navigation_menu) {

            public void onDrawerClosed(View view) {
                super.onDrawerClosed(view);
                invalidateOptionsMenu();
            }

            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);
                Fragment frag = getSupportFragmentManager().findFragmentByTag("NavigationFragment");
                if (frag == null) {
                    getSupportFragmentManager().beginTransaction().replace(R.id.slider_menu, new NavigationFragment(), "NavigationFragment").commit();
                }
                invalidateOptionsMenu();
            }

            @Override
            public void onDrawerSlide(View drawerView, float slideOffset) {
                // this disables the animation
                super.onDrawerSlide(drawerView, 0);
            }
        };
        mDrawerLayout.setDrawerListener(mDrawerToggle);
    }
}
Also used : NavigationFragment(org.edx.mobile.view.NavigationFragment) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) View(android.view.View) TextView(android.widget.TextView) AlertDialogFragment(org.edx.mobile.view.dialog.AlertDialogFragment) NavigationFragment(org.edx.mobile.view.NavigationFragment) Fragment(android.support.v4.app.Fragment)

Example 2 with NavigationFragment

use of org.edx.mobile.view.NavigationFragment in project edx-app-android by edx.

the class BaseFragmentActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    EventBus.getDefault().registerSticky(this);
    final DrawerLayout drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawerLayout != null) {
        if (environment.getConfig().isTabsLayoutEnabled()) {
            blockDrawerFromOpening();
        } else {
            final Fragment frag = getSupportFragmentManager().findFragmentByTag("NavigationFragment");
            if (frag == null) {
                getSupportFragmentManager().beginTransaction().replace(R.id.slider_menu, new NavigationFragment(), "NavigationFragment").commit();
            }
        }
    }
}
Also used : NavigationFragment(org.edx.mobile.view.NavigationFragment) DrawerLayout(android.support.v4.widget.DrawerLayout) AlertDialogFragment(org.edx.mobile.view.dialog.AlertDialogFragment) NavigationFragment(org.edx.mobile.view.NavigationFragment) Fragment(android.support.v4.app.Fragment)

Aggregations

Fragment (android.support.v4.app.Fragment)2 DrawerLayout (android.support.v4.widget.DrawerLayout)2 NavigationFragment (org.edx.mobile.view.NavigationFragment)2 AlertDialogFragment (org.edx.mobile.view.dialog.AlertDialogFragment)2 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 View (android.view.View)1 TextView (android.widget.TextView)1