Exemplo n.º 1
0
  public NavDrawer(BaseActivity activity) {
    this.activity = activity;
    items = new ArrayList<>();
    drawerLayout = (DrawerLayout) activity.findViewById(R.id.drawer_layout);
    navDrawerView = (ViewGroup) activity.findViewById(R.id.nav_drawer);
    if (drawerLayout == null && navDrawerView == null) {
      throw new RuntimeException(
          "To use this class, you must have views with the ids of drawer_layout and nav_drawer");
    }
    Toolbar toolbar = activity.getToolbar();
    toolbar.setNavigationIcon(R.drawable.ic_action_navigation_menu);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            setOpen(!isOpen());
          }
        });
    activity.getYoraApplication().getBus().register(this);
  }
Exemplo n.º 2
0
 public void destroy() {
   activity.getYoraApplication().getBus().unregister(this);
 }