@Override
  public boolean onChildClick(
      ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
    HistoryItem item =
        (HistoryItem) getExpandableListAdapter().getChild(groupPosition, childPosition);
    doNavigateToUrl(item.getUrl(), false);

    return super.onChildClick(parent, v, groupPosition, childPosition, id);
  }
  @Override
  public boolean onContextItemSelected(MenuItem menuItem) {
    ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
      int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
      int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

      HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);

      switch (menuItem.getItemId()) {
        case MENU_OPEN_IN_TAB:
          doNavigateToUrl(item.getUrl(), true);
          break;
        case MENU_COPY_URL:
          ApplicationUtils.copyTextToClipboard(
              this, item.getUrl(), getString(R.string.Commons_UrlCopyToastMessage));
          break;
        case MENU_SHARE:
          ApplicationUtils.sharePage(this, item.getTitle(), item.getUrl());
          break;
        case MENU_DELETE_FROM_HISTORY:
          BookmarksProviderWrapper.deleteHistoryRecord(getContentResolver(), item.getId());
          fillData();
          break;
        default:
          break;
      }
    }

    return super.onContextItemSelected(menuItem);
  }
  @Override
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    ExpandableListView.ExpandableListContextMenuInfo info =
        (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {

      HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
      menu.setHeaderTitle(item.getTitle());

      menu.add(0, MENU_OPEN_IN_TAB, 0, R.string.HistoryListActivity_MenuOpenInTab);
      menu.add(0, MENU_COPY_URL, 0, R.string.BookmarksHistoryActivity_MenuCopyLinkUrl);
      menu.add(0, MENU_SHARE, 0, R.string.Main_MenuShareLinkUrl);
      menu.add(0, MENU_DELETE_FROM_HISTORY, 0, R.string.HistoryListActivity_MenuDelete);
    }
  }