Ejemplo n.º 1
0
 @Override
 protected void onPostResume() {
   super.onPostResume();
   if (WordPress.currentBlog != null) {
     boolean commentsLoaded = commentList.loadComments(false, false);
     if (!commentsLoaded) commentList.refreshComments(false, false, false);
   }
 }
Ejemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    createMenuDrawer(R.layout.comments);

    ActionBar actionBar = getSupportActionBar();
    actionBar.setDisplayShowTitleEnabled(true);
    setTitle(getString(R.string.tab_comments));

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      fromNotification = extras.getBoolean("fromNotification");
      if (fromNotification) {
        try {
          WordPress.currentBlog = new Blog(extras.getInt("id"));
        } catch (Exception e) {
          Toast.makeText(this, getResources().getText(R.string.blog_not_found), Toast.LENGTH_SHORT)
              .show();
          finish();
        }
      }
    }

    FragmentManager fm = getSupportFragmentManager();
    fm.addOnBackStackChangedListener(mOnBackStackChangedListener);
    commentList = (CommentsListFragment) fm.findFragmentById(R.id.commentList);

    WordPress.currentComment = null;

    attemptToSelectComment();
    if (fromNotification) commentList.refreshComments(false, false, false);
  }
Ejemplo n.º 3
0
  private void attemptToSelectComment() {

    FragmentManager fm = getSupportFragmentManager();
    CommentFragment f = (CommentFragment) fm.findFragmentById(R.id.commentDetail);

    if (f != null && f.isInLayout()) {
      commentList.shouldSelectAfterLoad = true;
    }
  }
Ejemplo n.º 4
0
  @Override
  public boolean onOptionsItemSelected(final MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.menu_refresh) {
      popCommentDetail();
      attemptToSelectComment();
      commentList.refreshComments(false, false, false);
      return true;
    } else if (itemId == android.R.id.home) {
      FragmentManager fm = getSupportFragmentManager();
      if (fm.getBackStackEntryCount() > 0) {
        popCommentDetail();
        return true;
      }
    }

    return super.onOptionsItemSelected(item);
  }
Ejemplo n.º 5
0
 @Override
 public void onBlogChanged() {
   super.onBlogChanged();
   commentList.refreshComments(false, false, false);
 }