Exemple #1
0
  private void markStoryUnread(Story story) {

    // first, ensure the story isn't queued up to be marked as read
    this.storiesToMarkAsRead.remove(story);

    // next, call the API to un-mark it as read, just in case we missed the batch
    // operation, or it was read long before now.
    FeedUtils.markStoryUnread(story, Reading.this, this.apiManager);

    this.unreadCount++;
    this.storiesAlreadySeen.remove(story);

    this.enableOverlays();
  }
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo menuInfo =
        (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int truePosition = menuInfo.position - 1;
    Story story = adapter.getStory(truePosition);
    Activity activity = getActivity();

    switch (item.getItemId()) {
      case R.id.menu_mark_story_as_read:
        FeedUtils.markStoryAsRead(story, activity);
        return true;

      case R.id.menu_mark_story_as_unread:
        FeedUtils.markStoryUnread(story, activity);
        return true;

      case R.id.menu_mark_older_stories_as_read:
        FeedUtils.markFeedsRead(getFeedSet(), story.timestamp, null, activity);
        return true;

      case R.id.menu_mark_newer_stories_as_read:
        FeedUtils.markFeedsRead(getFeedSet(), null, story.timestamp, activity);
        return true;

      case R.id.menu_send_story:
        FeedUtils.sendStory(story, activity);
        return true;

      case R.id.menu_save_story:
        FeedUtils.setStorySaved(story, true, activity);
        return true;

      case R.id.menu_unsave_story:
        FeedUtils.setStorySaved(story, false, activity);

        return true;

      default:
        return super.onContextItemSelected(item);
    }
  }