@TargetApi(Build.VERSION_CODES.HONEYCOMB)
  private void onShareEpisode(ShareMethod shareMethod) {
    // Episode of this fragment is always the first item in the cursor
    final Cursor episode = (Cursor) mAdapter.getItem(0);
    final SherlockFragmentActivity activity = getSherlockActivity();
    if (episode != null && activity != null) {
      Bundle shareData = new Bundle();
      String episodestring = ShareUtils.onCreateShareString(activity, episode);
      String sharestring = getString(R.string.share_checkout);
      sharestring += " \"" + episode.getString(DetailsQuery.SHOW_TITLE);
      sharestring += " - " + episodestring + "\"";
      shareData.putString(ShareItems.EPISODESTRING, episodestring);
      shareData.putString(ShareItems.SHARESTRING, sharestring);
      shareData.putInt(ShareItems.EPISODE, episode.getInt(DetailsQuery.NUMBER));
      shareData.putInt(ShareItems.SEASON, episode.getInt(DetailsQuery.SEASON));
      shareData.putInt(ShareItems.TVDBID, episode.getInt(DetailsQuery.REF_SHOW_ID));

      // IMDb id
      String imdbId = episode.getString(DetailsQuery.IMDBID);
      if (TextUtils.isEmpty(imdbId)) {
        // fall back to show IMDb id
        imdbId = episode.getString(DetailsQuery.SHOW_IMDBID);
      }
      shareData.putString(ShareItems.IMDBID, imdbId);

      // don't close cursor!
      // episode.close();

      ShareUtils.onShareEpisode(activity, shareData, shareMethod);

      // invalidate the options menu so a potentially new
      // quick share action is displayed
      activity.invalidateOptionsMenu();
    }
  }
 private void onLoadTraktRatings(View ratingBar, boolean isUseCachedValues) {
   if (mAdapter.getCursor() != null
       && (mTraktTask == null || mTraktTask.getStatus() != AsyncTask.Status.RUNNING)) {
     mTraktTask =
         new TraktSummaryTask(getSherlockActivity(), ratingBar, isUseCachedValues)
             .episode(mShowTvdbId, mSeasonNumber, mEpisodeNumber);
     AndroidUtils.executeAsyncTask(mTraktTask);
   }
 }
  private void onAddCalendarEvent() {
    fireTrackerEvent("Add to calendar");

    // Episode of this fragment is always the first item in the cursor
    final Cursor episode = (Cursor) mAdapter.getItem(0);
    if (episode != null && episode.moveToFirst()) {
      String showTitle = episode.getString(DetailsQuery.SHOW_TITLE);
      String episodeTitleAndNumber = ShareUtils.onCreateShareString(getSherlockActivity(), episode);
      long showAirTime = episode.getLong(DetailsQuery.FIRSTAIREDMS);
      int showRunTime = episode.getInt(DetailsQuery.SHOW_RUNTIME);

      ShareUtils.onAddCalendarEvent(
          getActivity(), showTitle, episodeTitleAndNumber, showAirTime, showRunTime);
    }
  }
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   mAdapter.swapCursor(null);
 }
 @Override
 public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
   mAdapter.swapCursor(data);
 }