@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();
    }
  }
Пример #2
0
 @Override
 public void onPageSelected(int position) {
   currPos = position;
   activity.invalidateOptionsMenu();
   Log.d("ABN", "CURRENT POS " + currPos);
 }