public void onGetResult(AsyncTaskResult<?> result, Class<?> t) {
   Exception e = result.getError();
   if (e == null) {
     // from LoadNovelsTask
     if (t == PageModel[].class) {
       PageModel[] list = (PageModel[]) result.getResult();
       if (list != null) {
         adapter.clear();
         adapter.addAll(list);
         toggleProgressBar(false);
       }
     }
     // from DownloadNovelDetailsTask
     else if (t == NovelCollectionModel[].class) {
       setMessageDialog(new CallbackEventData("Download complete."));
       NovelCollectionModel[] list = (NovelCollectionModel[]) result.getResult();
       for (NovelCollectionModel novelCol : list) {
         try {
           PageModel page = novelCol.getPageModel();
           boolean found = false;
           for (PageModel temp : adapter.data) {
             if (temp.getPage().equalsIgnoreCase(page.getPage())) {
               found = true;
               break;
             }
           }
           if (!found) {
             adapter.data.add(page);
           }
         } catch (Exception e1) {
           Log.e(TAG, e1.getClass().toString() + ": " + e1.getMessage(), e1);
         }
       }
       adapter.notifyDataSetChanged();
       toggleProgressBar(false);
     }
   } else {
     Log.e(TAG, e.getClass().toString() + ": " + e.getMessage(), e);
     Toast.makeText(this, e.getClass().toString() + ": " + e.getMessage(), Toast.LENGTH_LONG)
         .show();
   }
 }
  public void onGetResult(AsyncTaskResult<?> result, Class<?> t) {
    if (!isAdded()) return;

    Exception e = result.getError();
    if (e == null) {
      // from LoadNovelsTask
      if (t == PageModel[].class) {
        PageModel[] list = (PageModel[]) result.getResult();
        Log.d(TAG, "LoadNovelsTask result ok");
        if (list != null && list.length > 0) {
          adapter.clear();
          adapter.addAll(list);
          toggleProgressBar(false);

          // Show message if watch list is empty
          if (list.length == 0 && onlyWatched) {
            Log.d(TAG, "WatchList result set message empty");
            loadingText.setVisibility(TextView.VISIBLE);
            loadingText.setText("Watch List is empty.");
          }
        } else {
          toggleProgressBar(false);
          loadingText.setVisibility(TextView.VISIBLE);
          loadingText.setText("List is empty.");
          Log.w(TAG, "Empty ArrayList!");
        }
      }
      // from DownloadNovelDetailsTask
      else if (t == NovelCollectionModel[].class) {
        setMessageDialog(new CallbackEventData("Download complete."));
        NovelCollectionModel[] list = (NovelCollectionModel[]) result.getResult();
        for (NovelCollectionModel novelCol : list) {
          try {
            PageModel page = novelCol.getPageModel();
            boolean found = false;
            for (PageModel temp : adapter.data) {
              if (temp.getPage().equalsIgnoreCase(page.getPage())) {
                found = true;
                break;
              }
            }
            if (!found) {
              adapter.data.add(page);
            }
          } catch (Exception e1) {
            Log.e(TAG, e1.getClass().toString() + ": " + e1.getMessage(), e1);
          }
        }
        adapter.notifyDataSetChanged();
        toggleProgressBar(false);
      } else {
        Log.e(TAG, "Unknown ResultType: " + t.getName());
      }
    } else {
      Log.e(TAG, e.getClass().toString() + ": " + e.getMessage(), e);
      Toast.makeText(
              getSherlockActivity(),
              e.getClass().toString() + ": " + e.getMessage(),
              Toast.LENGTH_LONG)
          .show();
    }
  }