use of de.madcyph3r.materialnavigationdrawer.listener.MaterialHeadItemChangeListener in project AdvancedMaterialDrawer by madcyph3r.
the class HeadItemThreeChangeListenerActivity method init.
@Override
public void init(Bundle savedInstanceState) {
drawer = this;
// add head Item (menu will be loaded automatically)
this.addHeadItem(getHeadItem1());
this.addHeadItem(getHeadItem2());
this.addHeadItem(getHeadItem3());
// set the listener
this.setHeadItemOnChangeListener(new MaterialHeadItemChangeListener() {
@Override
public void onBeforeChangeHeadItem(MaterialHeadItem newHeadItem) {
Toast.makeText(drawer, "before change head item", Toast.LENGTH_SHORT).show();
}
@Override
public void onAfterChangeHeadItem(MaterialHeadItem newHeadItem) {
Toast.makeText(drawer, "after change head item", Toast.LENGTH_SHORT).show();
}
});
// load menu
this.loadMenu(getCurrentHeadItem().getMenu());
// load the MaterialItemSectionFragment, from the given startIndex
this.loadStartFragmentFromMenu(getCurrentHeadItem().getMenu());
}
Aggregations