@Override
 public boolean onContextItemSelected(android.view.MenuItem item) {
   if (!(item.getMenuInfo() instanceof AdapterContextMenuInfo))
     return super.onContextItemSelected(item);
   Log.d(TAG, "Context menu called");
   AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
   switch (item.getItemId()) {
     case R.id.add_to_watch:
       /*
        * Implement code to toggle watch of this novel
        */
       if (info.position > -1) {
         PageModel novel = listItems.get(info.position);
         if (novel.isWatched()) {
           novel.setWatched(false);
           Toast.makeText(
                   getSherlockActivity(),
                   "Removed from watch list: " + novel.getTitle(),
                   Toast.LENGTH_SHORT)
               .show();
         } else {
           novel.setWatched(true);
           Toast.makeText(
                   getSherlockActivity(),
                   "Added to watch list: " + novel.getTitle(),
                   Toast.LENGTH_SHORT)
               .show();
         }
         NovelsDao.getInstance(getSherlockActivity()).updatePageModel(novel);
         adapter.notifyDataSetChanged();
       }
       return true;
     case R.id.download_novel:
       /*
        * Implement code to download novel synopsis
        */
       if (info.position > -1) {
         PageModel novel = listItems.get(info.position);
         ArrayList<PageModel> novels = new ArrayList<PageModel>();
         novels.add(novel);
         touchedForDownload = novel.getTitle() + "'s information";
         executeDownloadTask(novels);
       }
       return true;
     case R.id.delete_novel:
       if (info.position > -1) {
         toggleProgressBar(true);
         PageModel novel = listItems.get(info.position);
         boolean result = NovelsDao.getInstance(getSherlockActivity()).deleteNovel(novel);
         if (result) {
           listItems.remove(novel);
           adapter.notifyDataSetChanged();
         }
         toggleProgressBar(false);
       }
       return true;
     default:
       return super.onContextItemSelected(item);
   }
 }
  @Override
  public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);
    // Get the item that was clicked
    PageModel o = adapter.getItem(position);
    String novel = o.toString();

    // Create a bundle containing information about the novel that is clicked
    Bundle bundle = new Bundle();
    bundle.putString(Constants.EXTRA_NOVEL, novel);
    bundle.putString(Constants.EXTRA_PAGE, o.getPage());
    bundle.putString(Constants.EXTRA_TITLE, o.getTitle());
    bundle.putBoolean(
        Constants.EXTRA_ONLY_WATCHED,
        getSherlockActivity().getIntent().getBooleanExtra(Constants.EXTRA_ONLY_WATCHED, false));

    mFragListener.changeNextFragment(bundle);

    Log.d("DisplayLightNovelsActivity", o.getPage() + " (" + o.getTitle() + ")");

    // Need to send it through
  }
 /**
  * Set activity title to current chapter title.
  *
  * @param pageModel
  */
 private void setChapterTitle(PageModel pageModel) {
   String title = pageModel.getPage();
   try {
     if (pageModel.getParent() != null) {
       Log.d(TAG, "Parent Page: " + pageModel.getParent());
       novelDetails =
           NovelsDao.getInstance().getNovelDetails(pageModel.getParentPageModel(), null, false);
       String volume =
           pageModel
               .getParent()
               .replace(
                   pageModel.getParentPageModel().getPage() + Constants.NOVEL_BOOK_DIVIDER, "");
       title = pageModel.getTitle() + " (" + volume + ")";
     }
   } catch (Exception ex) {
     Log.e(TAG, "Error when setting title: " + ex.getMessage(), ex);
   }
   setTitle(title);
 }