Ejemplo n.º 1
0
 // Hide app instead of closing
 @Override
 public void onBackPressed() {
   if (mNavigationDrawerFragment.isDrawerOpen()) {
     mNavigationDrawerFragment.getDrawerLayout().closeDrawers();
     return;
   }
   moveTaskToBack(true);
 }
Ejemplo n.º 2
0
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    if (!mNavigationDrawerFragment.isDrawerOpen()) {
      // Drawer opened
      return true;
    }

    getMenuInflater().inflate(R.menu.chat, menu);
    // Drawer closed
    return super.onCreateOptionsMenu(menu);
  }
Ejemplo n.º 3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    if (savedInstanceState == null) {
      getFragmentManager()
          .beginTransaction()
          .add(R.id.container, new SeriesListFragment())
          .commit();
    }

    mNavigationDrawerFragment =
        (ChatFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer);

    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }