Ejemplo n.º 1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    // The action bar home/up action should open or close the drawer.
    // ActionBarDrawerToggle will take care of this.
    if (tkDrawer.getDrawerToggle().onOptionsItemSelected(item)) {
      return true;
    }
    // handle the top toolbar menu
    int id = item.getItemId();

    switch (id) {
      case R.id.action_shoppingcart:
        tkDrawer.selectDrawerItem(SHOPPINGCART_DRAWER_POSITION);
        break;
      case R.id.action_calendar:
        tkDrawer.selectDrawerItem(HOME_DRAWER_POSITION);
        break;
    }

    return super.onOptionsItemSelected(item);
  }
Ejemplo n.º 2
0
  private void settingUpDrawerView() {
    tkDrawer = (TKNavigationDrawer) findViewById(R.id.tkdrawer_layout);

    // setup drawer view
    tkDrawer.setupDrawerConfiguration(
        (ListView) findViewById(R.id.lvDrawer), toolbar, R.id.flContent, this);
    // adding navigation drawer items
    tkDrawer.addNavItem("Home", R.mipmap.ic_home, "Home", HomeFragment.class);
    tkDrawer.addNavItem(
        "Shopping Cart", R.mipmap.ic_shoppingcart, "Shopping Cart", ShoppingCartFragment.class);
    tkDrawer.addNavItem(
        "Order History", R.mipmap.ic_folder, "Order History", OrderHistoryFragment.class);
    // Below pages, will not showing the other navigation (calendar and add shopping cart)
    tkDrawer.addNavItem(
        "Track My Order",
        R.mipmap.ic_trackorder,
        "Track My Order",
        TrackOrderListFragment.class,
        false);
    tkDrawer.addNavItem(
        "Feedbacks History",
        R.mipmap.ic_star,
        "Feedbacks History",
        OrderFeedbackFragment.class,
        false);
    tkDrawer.addNavItem(
        getString(R.string.menu_logout),
        R.mipmap.ic_logout,
        getString(R.string.menu_logout),
        OrderFeedbackFragment.class,
        false);
    // draw the invisible fragment (from drawer perspective)
    tkDrawer.addNavItem("Menu", R.mipmap.ic_launcher, "Menu", MenuFragment.class, true, false);
    tkDrawer.addNavItem(
        "Track My Order Item",
        R.mipmap.ic_trackorder,
        "Track My Order Item",
        TrackOrderFragment.class,
        false,
        false);
  }
Ejemplo n.º 3
0
 @Override
 public void changeFragmentTo(int fragmentMenuOption, Bundle args) {
   tkDrawer.selectDrawerItem(fragmentMenuOption, args);
 }
Ejemplo n.º 4
0
 @Override
 public void changeFragmentTo(int fragmentMenuOption) {
   tkDrawer.selectDrawerItem(fragmentMenuOption);
 }
Ejemplo n.º 5
0
 @Override
 public void onConfigurationChanged(Configuration newConfig) {
   super.onConfigurationChanged(newConfig);
   tkDrawer.getDrawerToggle().onConfigurationChanged(newConfig);
 }
Ejemplo n.º 6
0
 @Override
 protected void onPostCreate(Bundle savedInstanceState) {
   super.onPostCreate(savedInstanceState);
   tkDrawer.getDrawerToggle().syncState();
 }
Ejemplo n.º 7
0
  @Override
  public boolean onPrepareOptionsMenu(Menu menu) {
    if (tkDrawer.isDrawerOpen()) {}

    return super.onPrepareOptionsMenu(menu);
  }
Ejemplo n.º 8
0
 protected void setTitle(String title) {
   tkDrawer.setTitle(title);
 }
Ejemplo n.º 9
0
 protected void setMainFragment() {
   tkDrawer.selectDrawerItem(0);
 }