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);
}
}
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();
}
}
}
}
Aggregations