Example #1
1
  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    Log.d("LB", "onNewIntent");
    if ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
        != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) {
      contentView.closeDrawers();
    }

    if (intent.getAction() == Intent.ACTION_WEB_SEARCH
        || intent.getAction() == Intent.ACTION_VIEW) {
      if (intent.getDataString() != null) {
        int tabNumber =
            intent.getIntExtra("tabNumber", -1); // used if intent is coming from Lucid Browser

        if (tabNumber != -1 && tabNumber < webWindows.size()) {
          webWindows.get(tabNumber).loadUrl(intent.getDataString());
        } else tabNumber = -1;

        if (tabNumber == -1) {
          openURLInNewTab(intent.getDataString());
        }
      }
    }
  }
 @Override
 public void onFilterChanged(Filter filter) {
   list.setFilter(filter);
   setFilterInTitle();
   drawer.closeDrawers();
   prefs.articleTypeIndex().put(filter.getType().ordinal());
 }
  private void itemRedirect(int position, String label) {

    switch (position) {
      case 0:
        mDrawerLayout.closeDrawers();
        break;
      case 1:
        Toast.makeText(this, "Favorites", Toast.LENGTH_SHORT).show();
        break;
      case 2:
        Toast.makeText(this, "Explore", Toast.LENGTH_SHORT).show();
        break;

      case 3:
        startActivity(new Intent(this, InterestActivity.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        break;
      case 4:
        break;
      case 5:
        startActivity(new Intent(this, SettingsActivity.class));
        overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
        break;
      default:
        break;
    }
  }
 @Override
 public void onClick(View view) {
   mDrawerLayout.closeDrawers();
   UserSupportUtil support = new UserSupportUtil(MainActivity.this);
   switch (view.getId()) {
     case R.id.review:
       support.sendReview();
       AnalyticsUtil.sendEventAnalytics(
           MainActivity.this,
           R.string.analytics_category_navigation,
           R.string.analytics_action_navigation,
           R.string.analytics_label_review);
       break;
     case R.id.mail:
       support.sendMail();
       AnalyticsUtil.sendEventAnalytics(
           MainActivity.this,
           R.string.analytics_category_navigation,
           R.string.analytics_action_navigation,
           R.string.analytics_label_mail);
       break;
     default:
       break;
   }
 }
  @Override
  public void onBackPressed() {
    drawerLayout.closeDrawers();
    int count = getSupportFragmentManager().getBackStackEntryCount();
    if (count > 0) {
      FragmentManager.BackStackEntry entry =
          getSupportFragmentManager().getBackStackEntryAt(count - 1);
      if (entry.getName().equalsIgnoreCase(HOME_FRAGMENT_TAG)) {

        which = HOME_FRAGMENT;
        invalidateOptionsMenu();
      } else if (entry.getName().equalsIgnoreCase(DIET_FRAGMENT_TAG)) {
        which = HOME_FRAGMENT;
        invalidateOptionsMenu();
      } else if (entry.getName().equalsIgnoreCase(GENERAL_FRAGMENT_TAG)) {
        which = HOME_FRAGMENT;
        invalidateOptionsMenu();
      } else if (entry.getName().equalsIgnoreCase(CREATE_DIET_FRAGMENT_TAG)) {
        which = DIET_FRAGMENT;
        invalidateOptionsMenu();
      }
    }
    mode = EDIT_MODE;
    super.onBackPressed();
    overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
  }
Example #6
0
  public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    switch (itemId) {
        // 如果ActionBar设置setDisplayHomeAsUpEnabled为true,则可以监听到前面的箭头图标
      case android.R.id.home:
        if (drawerLayout.isDrawerOpen(Gravity.LEFT)) {
          drawerLayout.closeDrawers();
        } else {
          drawerLayout.openDrawer(Gravity.LEFT);
        }
        break;
      case R.id.action_settings:
        startActivity(new Intent(this, SettingActivity.class));
        break;
      case R.id.action_about:
        startActivity(new Intent(this, AboutActivity.class));
        break;
      case R.id.action_share:
        startActivity(
            ShareActivity.makeIntent(
                this, "干货集中营", "每日分享妹子图 和 技术干货,还有供大家中午休息的休闲视频。", "http://gank.io"));
        break;
      default:
        break;
    }

    return super.onOptionsItemSelected(item);
  }
 @Override
 public void onBackPressed() {
   if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
     drawerLayout.closeDrawers();
     return;
   } else {
     if (((BaseFragment) mStacks.get(mCurrentTab).lastElement()).onBackPressed() == false) {
       /*
        * top fragment in current tab doesn't handles back press, we can do our thing, which is
        *
        * if current tab has only one fragment in stack, ie first fragment is showing for this tab.
        *        finish the activity
        * else
        *        pop to previous fragment in stack for the same tab
        *
        */
       if (mStacks.get(mCurrentTab).size() == 1) {
         super.onBackPressed(); // or call finish..
       } else {
         popFragments();
       }
     } else {
       // do nothing.. fragment already handled back button press.
     }
   }
 }
Example #8
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (mDrawerToggle != null && mDrawerToggle.onOptionsItemSelected(item)) return true;

    if (android.R.id.home == item.getItemId()) {
      if (mDrawerLayout.isDrawerVisible(GravityCompat.START)) mDrawerLayout.closeDrawers();
      else mDrawerLayout.openDrawer(GravityCompat.START);

      return true;
    }

    // 关于
    if (item.getItemId() == R.id.about) AboutWebFragment.launchAbout(this);
    // 意见反馈
    else if (item.getItemId() == R.id.feedback) PublishActivity.publishFeedback(this);
    // 好友分组
    else if (item.getItemId() == R.id.friendGroups) GroupSortFragment.lanuch(this);
    // 搜索用户或者微博
    //        else if (item.getItemId() == R.id.search)
    //            SearchActivity.launch(this);
    // 退出
    else if (item.getItemId() == R.id.exitapp) finish();
    // 新微博
    else if (item.getItemId() == R.id.publish) PublishActivity.publishStatus(this, null);
    // 搜人
    else if (item.getItemId() == R.id.search_user) SearchUserFragment.launch(this);
    // 搜微博
    else if (item.getItemId() == R.id.search_status) SearchTopicsFragment.launch(this);
    // 开始离线
    else if (item.getItemId() == R.id.toggle_offline) OfflineUtils.toggleOffline(this);

    return super.onOptionsItemSelected(item);
  }
  @Override
  public boolean onKeyDown(int keyCode, KeyEvent event) {
    Boolean isDrawerOpen = mDrawerLayout.isDrawerOpen(Gravity.RIGHT);
    Boolean isMenuListFocused = false;
    if (mList != null) {
      isMenuListFocused = mList.hasFocus();
    }
    View view = this.getCurrentFocus();

    if (isDrawerOpen) {
      if (!view.getClass()
          .getName()
          .equalsIgnoreCase("com.android.internal.view.menu.ActionMenuItemView")) {
        mDrawerLayout.closeDrawers();
        mDrawerLayout.getChildAt(0).requestFocus();
      }
    } else {
      if (KeyEvent.KEYCODE_DPAD_UP == keyCode) {
        // action bar
        mDrawerLayout.getChildAt(1).requestFocus();
      } else if (KeyEvent.KEYCODE_DPAD_DOWN == keyCode) {
        // grid view
        mDrawerLayout.getChildAt(0).requestFocus();
      } else if (KeyEvent.KEYCODE_DPAD_LEFT == keyCode) {
      } else if (KeyEvent.KEYCODE_MENU == keyCode) {
        if (!mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) {
          mDrawerLayout.openDrawer(Gravity.RIGHT);
        } else {
          mDrawerLayout.closeDrawer(Gravity.RIGHT);
        }
      }
    }

    return super.onKeyDown(keyCode, event);
  }
Example #10
0
 @Override
 public boolean onNavigationItemSelected(MenuItem item) {
   mainPresenter.switchNavigation(item.getItemId());
   item.setChecked(true);
   mDrawerLayout.closeDrawers();
   return true;
 }
  // This method will trigger on item Click of navigation menu
  @Override
  public boolean onNavigationItemSelected(MenuItem menuItem) {

    // Checking if the item is in checked state or not, if not make it in checked state
    if (menuItem.isChecked()) menuItem.setChecked(false);
    else menuItem.setChecked(true);

    // Closing drawer on item click
    drawerLayout.closeDrawers();

    // Check to see which item was being clicked and perform appropriate action
    switch (menuItem.getItemId()) {
      case R.id.option_1:
        Toast.makeText(getApplicationContext(), "Option 1 Selected", Toast.LENGTH_SHORT).show();
        launchHomeFragment();
        return true;

      case R.id.option_2:
        Toast.makeText(getApplicationContext(), "Option 2 Selected", Toast.LENGTH_SHORT).show();
        return true;
      case R.id.option_3:
        Toast.makeText(getApplicationContext(), "Option 3 Selected", Toast.LENGTH_SHORT).show();
        return true;
      default:
        Toast.makeText(getApplicationContext(), "Somethings Wrong", Toast.LENGTH_SHORT).show();
        return true;
    }
  }
 public void openSettings(MenuItem view) {
   mDrawerLayout.closeDrawers();
   Intent intent = new Intent(this, DisplaySettingsActivity.class);
   startActivity(intent);
   overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
   // FOR TESTING
   // resetFirstRun();
 }
Example #13
0
 @Override
 public void onBackPressed() {
   if (drawerLayout.isDrawerOpen(Gravity.START)) {
     drawerLayout.closeDrawers();
     return;
   }
   super.onBackPressed();
 }
Example #14
0
 @Override
 public void onBackPressed() {
   if (mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
     mDrawerLayout.closeDrawers();
   } else {
     super.onBackPressed();
   }
 }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    switch (position) {
      case 0:
        showGeneralFragment(getIntent().getStringExtra("profileId"));
        drawerLayout.closeDrawers();
        break;
      case 1:
        showDietFragment(getIntent().getStringExtra("profileId"));
        drawerLayout.closeDrawers();
        break;
      case 2:
        showVaccinFragment(getIntent().getStringExtra("profileId"));
        drawerLayout.closeDrawers();
        break;
      case 3:
        showDoctorFragment();
        drawerLayout.closeDrawers();
        break;
      case 4:
        showGrowthFragment();
        drawerLayout.closeDrawers();
        break;
      case 5:
        showHistoryFragment();
        drawerLayout.closeDrawers();
        break;

      case 6:
        removeProfile();
        drawerLayout.closeDrawers();
        break;
    }
  }
Example #16
0
 @OnClick(R.id.drawer_all)
 public void clickDrawerAll(View v) {
   drawerLayout.closeDrawers();
   getSupportFragmentManager()
       .beginTransaction()
       .replace(R.id.main_container, new AllFragment())
       .commit();
   getActionBar().setSubtitle(RequestModel.DATATYPE.all);
 }
Example #17
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    if (drawerToggle != null && drawerToggle.onOptionsItemSelected(item)) return true;

    if (android.R.id.home == item.getItemId()) {
      if (mDrawerLayout.isDrawerVisible(GravityCompat.START)) mDrawerLayout.closeDrawers();
      else mDrawerLayout.openDrawer(GravityCompat.START);

      return true;
    }

    // 关于
    //        if (item.getItemId() == R.id.about)
    //            AboutWebFragment.launchAbout(this);
    // 意见反馈
    //        else if (item.getItemId() == R.id.feedback)
    //            PublishActivity.publishFeedback(this);
    // 退出
    if (item.getItemId() == R.id.exitapp) {
      finish();

      MobclickAgent.onEvent(this, "exitapp");
    }
    // 新微博
    else if (item.getItemId() == R.id.publish) PublishActivity.publishStatus(this, null);
    // 开始离线
    else if (item.getItemId() == R.id.toggle_offline) {
      OfflineUtils.toggleOffline(this);

      MobclickAgent.onEvent(this, "toggle_offline");
    }
    // 停止离线
    else if (item.getItemId() == R.id.stop_offline) {
      OfflineService.stopOffline();

      MobclickAgent.onEvent(this, "stop_offline");
    }
    // 通知设置
    else if (item.getItemId() == R.id.notification_settings)
      NotificationSettingsFragment.launch(this);
    // 搜索
    else if (item.getItemId() == R.id.search) {
      new IAction(
          MainActivity.this,
          new WebLoginAction(MainActivity.this, BizFragment.createBizFragment(this))) {

        @Override
        public void doAction() {
          SearchFragment.launch(MainActivity.this, "");

          MobclickAgent.onEvent(MainActivity.this, "toggle_search");
        }
      }.run();
    }

    return super.onOptionsItemSelected(item);
  }
Example #18
0
  public boolean onBackPressed() {
    if (mDrawerLayout != null && drawerContainer != null) {
      if (mDrawerLayout.isDrawerOpen(drawerContainer)) {
        mDrawerLayout.closeDrawers();
        return true;
      } else return false;

    } else {
      return false;
    }
  }
Example #19
0
 public boolean onBackPressedSupport() {
   if (drawerOpen) {
     drawer.closeDrawers();
     return false;
   } else if (backStack.size() > 0) {
     removeCurrent();
     return false;
   } else {
     return true;
   }
 }
  // Change the page
  // Update Webview, Toolbar, Refresh button...
  void changePage(Pages newPage) {
    actual = newPage;

    // Handle tabs
    tabs.removeAllTabs();
    if (newPage.tabs != null && newPage.tabs.contains("||")) {
      showTabs();
      for (String s : newPage.tabs.split("\\|\\|")) {
        tabs.addTab(tabs.newTab().setText(s));
      }
      if (newPage.url != null) {
        newPage.actualURL = newPage.url.split("\\|\\|")[0];
      }
      if (newPage.localPage != null) {
        newPage.actualAlternativeURL = newPage.localPage.split("\\|\\|")[0];
      }

      // There are no tabs...
    } else {
      hideTabs();
      newPage.actualURL = newPage.url;
      newPage.actualAlternativeURL = newPage.localPage;
    }

    // Enable JS for the webview
    webView.getSettings().setJavaScriptEnabled(true);

    // Load URL to the webview...
    if (newPage.url != null) {
      webView.loadUrl(newPage.actualURL);
    } else {
      if (newPage.localPage != null) // ...Or use local page
      webView.loadUrl("file:///android_asset/" + newPage.actualAlternativeURL);
    }

    // Update Toolbar and Statusbar
    toolbar.setBackgroundColor(newPage.actionBarColor.value);
    drawerLayout.setBackgroundColor(newPage.actionBarColor.value);
    drawerLayout.closeDrawers();
    toolbar.setTitle(newPage.title);

    // Show refresh button
    if (refreshButton != null) {
      if (newPage.refreshButton) {
        refreshButton.setVisible(true);
      } else {
        refreshButton.setVisible(false);
      }
    }

    actual = newPage;
  }
Example #21
0
  @Override
  public boolean onNavigationItemSelected(MenuItem menuItem) {
    mDrawerLayout.closeDrawers();
    switch (menuItem.getItemId()) {
      case R.id.settings:
        startActivity(new Intent(this, SettingsActivity.class));
        return true;
      case R.id.team:
        startActivity(new Intent(this, TeamActivity.class));
        return true;
      case R.id.backup:
        startOperation(OperationType.BACKUP);
        return true;
      case R.id.restore:
        startOperation(OperationType.RESTORE);
        return true;
      case R.id.donate:
        final List<String> titles = new ArrayList<>();
        titles.add("Cup Of Coffee");
        titles.add("I'm Generous");
        ArrayAdapter arrayAdapter =
            new ArrayAdapter(this, android.R.layout.simple_list_item_1, titles);
        new AlertDialog.Builder(Home.this)
            .setAdapter(
                arrayAdapter,
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    try {
                      mHelper.launchPurchaseFlow(
                          Home.this,
                          productsList.get(which),
                          2001,
                          onIabPurchaseFinishedListener,
                          titles.get(which));
                    } catch (Exception e) {
                      e.printStackTrace();
                      Snackbar.make(mainContent, "Oops, Something went wrong", Snackbar.LENGTH_LONG)
                          .show();
                    }
                  }
                })
            .setNegativeButton("Cancel", null)
            .show();

        return true;
    }
    return true;
  }
Example #22
0
 // on user selecting something from the action bar....
 @Override
 public boolean onOptionsItemSelected(MenuItem item) {
   // if we're already on the home screen & user hit home, just toggle the drawer state
   int itemid = item.getItemId();
   String lcn = mContext.getLocalClassName();
   if (itemid == android.R.id.home) {
     if (lcn.equals(GRTApplication.LocalClassNameHome)) {
       if (mDrawerLayout.isDrawerOpen(Gravity.LEFT)) mDrawerLayout.closeDrawers();
       else mDrawerLayout.openDrawer(Gravity.LEFT);
       return true;
     }
   }
   // Otherwise deal with the options.
   return NavOptions.onNavOptionSelected(mContext, itemid) || super.onOptionsItemSelected(item);
 }
  @Override
  public boolean onNavigationItemSelected(MenuItem menuItem) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();

    switch (menuItem.getItemId()) {
      case R.id.menPerfil:
        Fragment perfilFragment = PerfilFragment.newInstance();

        ft.replace(R.id.flaContenido, perfilFragment);
        ft.commit();
        dlaContenedor.closeDrawers();
        return true;
      case R.id.menMascota:
        Fragment mascotaFragment = MascotaFragment.newInstance();

        ft.replace(R.id.flaContenido, mascotaFragment);
        ft.commit();
        dlaContenedor.closeDrawers();
        return true;
      case R.id.menActividades:
        Fragment actividadesFragment = ActividadesFragment.newInstance();

        ft.replace(R.id.flaContenido, actividadesFragment);
        ft.commit();
        dlaContenedor.closeDrawers();
        return true;
      case R.id.menServicios:
        Fragment listadoServiciosFragment = ListadoServiciosFragment.newInstance();
        ft.replace(R.id.flaContenido, listadoServiciosFragment);
        ft.commit();
        dlaContenedor.closeDrawers();
        return true;
    }

    return false;
  }
 private void selectItem(int position) {
   if (position < 0) position = 1;
   mCurrentSelectedPosition = position;
   if (mRecyclerView != null) {
     mAdapter.setCheckedPos(position);
   }
   if (mDrawerLayout != null) {
     mDrawerLayout.closeDrawer(mFragmentContainerView);
   }
   DrawerActivity act = (DrawerActivity) getActivity();
   Pins.Item item = mAdapter.getItem(position);
   act.switchDirectory(item);
   mTitle = item.getDisplay(getActivity());
   mDrawerLayout.closeDrawers();
 }
 @Override
 public void onBackPressed() {
   // If the drawer is open, back will close it
   if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) {
     mDrawerLayout.closeDrawers();
     return;
   }
   // Otherwise, it may return to the previous fragment stack
   FragmentManager fragmentManager = getFragmentManager();
   if (fragmentManager.getBackStackEntryCount() > 0) {
     fragmentManager.popBackStack();
   } else {
     // Lastly, it will rely on the system behavior for back
     super.onBackPressed();
   }
 }
Example #26
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == android.R.id.home) {
      if (drawerLayout.isDrawerOpen(GravityCompat.START)) {
        drawerLayout.closeDrawers();
      } else {
        drawerLayout.openDrawer(GravityCompat.START);
      }
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
Example #27
0
  private void setupDrawerContent(final NavigationView navigationView) {
    navigationView
        .getHeaderView(0)
        .findViewById(R.id.nav_weibo)
        .setOnClickListener(
            v -> {
              ClipboardHelper.copy(MainActivity.this, getResources().getString(R.string.weibo));
              ToastUtil.showShortToast("微博地址[http://weibo.com/123466678]已经复制到剪贴板╮(╯_╰)╭");
            });
    navigationView.setNavigationItemSelectedListener(
        menuItem -> {
          switch (menuItem.getItemId()) {
            case R.id.nav_avatar:
            case R.id.nav_weibo:
              break;
            case R.id.nav_all:
              viewPager.setCurrentItem(0);
              drawerLayout.closeDrawers();
              break;
            case R.id.nav_mm:
              viewPager.setCurrentItem(1);
              drawerLayout.closeDrawers();
              break;
            case R.id.nav_android:
              viewPager.setCurrentItem(2);
              drawerLayout.closeDrawers();
              break;
            case R.id.nav_ios:
              viewPager.setCurrentItem(3);
              drawerLayout.closeDrawers();
              break;
            case R.id.nav_github:
              drawerLayout.closeDrawers();
              jump2Url("https://github.com/login");
              break;
            case R.id.nav_trending:
              drawerLayout.closeDrawers();
              jump2Url("https://github.com/trending?l=java");
              break;
            case R.id.nav_about:
              drawerLayout.closeDrawers();
              startActivity(new Intent(this, AboutActivity.class));
              break;

            default:
              return true;
          }
          return true;
        });
  }
Example #28
0
  public void selectDrawerItem(MenuItem menuItem) {

    switch (menuItem.getItemId()) {
      case R.id.nav_first_fragment:
        Intent intent = new Intent(this, MapsActivity.class);
        this.startActivity(intent);
        break;
      case R.id.nav_second_fragment:
        Intent intent1 = new Intent(this, GPS_Location.class);
        this.startActivity(intent1);
        break;
      case R.id.nav_third_fragment:
        Intent intent2 = new Intent(this, PlaceOfInterest.class);
        this.startActivity(intent2);
        break;
      case R.id.nav_fourth_fragment:
        Intent intent3 = new Intent(this, Bus.class);
        this.startActivity(intent3);
        break;
      case R.id.nav_fifth_fragment:
        Intent intent4 = new Intent(this, Trains.class);
        this.startActivity(intent4);
        break;
      case R.id.directions:
        Intent intent5 = new Intent(this, Directions.class);
        this.startActivity(intent5);
        break;
      case R.id.nav_sixth_fragment:
        Intent intent6 = new Intent(this, Status.class);
        this.startActivity(intent6);
        break;
      case R.id.nav_seventh_fragment:
        Intent intent7 = new Intent(this, Navigator.class);
        this.startActivity(intent7);
        break;
      case R.id.favourites_nav:
        Intent intent8 = new Intent(this, Favourites.class);
        this.startActivity(intent8);
        break;
    }

    // Highlight the selected item, update the title, and close the drawer
    menuItem.setChecked(true);
    setTitle(menuItem.getTitle());
    mDrawer.closeDrawers();
  }
  private void selectDrawerItem(MenuItem menuItem) {

    Fragment fragment = null;
    Class MyFragmentClass;

    switch (menuItem.getItemId()) {
      case R.id.home:
        MyFragmentClass = HomeFragment.class;
        break;
      case R.id.about:
        MyFragmentClass = AboutFragment.class;
        break;
      case R.id.library:
        MyFragmentClass = LibraryFragment.class;
        break;
      case R.id.adminssion:
        MyFragmentClass = AdmissionFragment.class;
        break;
      case R.id.timetable:
        MyFragmentClass = TimeTableFragment.class;
        break;
      case R.id.map:
        MyFragmentClass = MapFragment.class;
        break;
      case R.id.news:
        MyFragmentClass = NewsEvenFragment.class;
        break;
      case R.id.contact:
        MyFragmentClass = ContactFragment.class;
        break;
      default:
        MyFragmentClass = HomeFragment.class;
    }
    try {
      fragment = (Fragment) MyFragmentClass.newInstance();
    } catch (Exception e) {
      e.printStackTrace();
    }

    FragmentManager manager = getSupportFragmentManager();
    manager.beginTransaction().replace(R.id.flContent, fragment).commit();

    menuItem.setChecked(true);
    setTitle(menuItem.getTitle());
    dlDrawer.closeDrawers();
  }
 public void openBookmarks(MenuItem view) {
   mDrawerLayout.closeDrawers();
   View f = findViewById(R.id.mainFrame);
   if (f != null) {
     FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
     transaction
         .replace(getLeftFrame(), new BookmarkFragment())
         .setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left)
         .addToBackStack(BookmarkFragment.class.toString())
         .commit();
   } else {
     Intent i = new Intent(this, MainActivity.class);
     i.putExtra(Constants.EXTRA_INITIAL_FRAGMENT, BookmarkFragment.class.toString());
     startActivity(i);
     overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
   }
 }