Program: 13835
Project: 13835
Buggy source:
private void showMessageViewIfNecessary(){
  final ViewGroup messageView=(ViewGroup)findViewById(R.id.message_container);
  if (mPost == null || mIsUpdatingPost || PostUploadService.isPostUploading(mPost) || (!mPost.isLocallyChanged() && !mPost.isLocalDraft()) && PostStatus.fromPost(mPost) != PostStatus.DRAFT) {
    messageView.setVisibility(View.GONE);
    return;
  }
  TextView messageText=(TextView)messageView.findViewById(R.id.message_text);
  if (mPost.isLocallyChanged()) {
    messageText.setText(R.string.local_changes_explainer);
  }
 else   if (mPost.isLocalDraft()) {
    messageText.setText(R.string.local_draft_explainer);
  }
 else   if (PostStatus.fromPost(mPost) == PostStatus.DRAFT) {
    messageText.setText(R.string.draft_explainer);
  }
  View btnPublish=messageView.findViewById(R.id.btn_publish);
  btnPublish.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      AniUtils.animateBottomBar(messageView,false);
      publishPost();
    }
  }
);
  View btnRevert=messageView.findViewById(R.id.btn_revert);
  btnRevert.setVisibility(mPost.isLocallyChanged() ? View.VISIBLE : View.GONE);
  if (mPost.isLocallyChanged()) {
    btnRevert.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        AniUtils.animateBottomBar(messageView,false);
        revertPost();
        AnalyticsTracker.track(Stat.EDITOR_DISCARDED_CHANGES);
      }
    }
);
  }
  if (mPost.isLocallyChanged()) {
    RelativeLayout.LayoutParams paramsMessage=(RelativeLayout.LayoutParams)messageText.getLayoutParams();
    paramsMessage.addRule(RelativeLayout.LEFT_OF,0);
    paramsMessage.addRule(RelativeLayout.CENTER_VERTICAL,0);
    ViewGroup.MarginLayoutParams marginsMessage=(ViewGroup.MarginLayoutParams)messageText.getLayoutParams();
    marginsMessage.bottomMargin=getResources().getDimensionPixelSize(R.dimen.margin_small);
    ViewGroup buttonsView=(ViewGroup)messageView.findViewById(R.id.layout_buttons);
    RelativeLayout.LayoutParams paramsButtons=(RelativeLayout.LayoutParams)buttonsView.getLayoutParams();
    paramsButtons.addRule(RelativeLayout.BELOW,R.id.message_text);
    ViewGroup.MarginLayoutParams marginsButtons=(ViewGroup.MarginLayoutParams)buttonsView.getLayoutParams();
    marginsButtons.bottomMargin=getResources().getDimensionPixelSize(R.dimen.margin_large);
  }
  messageView.setVisibility(View.INVISIBLE);
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (!isFinishing() && messageView.getVisibility() != View.VISIBLE) {
        AniUtils.animateBottomBar(messageView,true);
      }
    }
  }
,1000);
}

Fixed version (ground truth):
private void showMessageViewIfNecessary(){
  final ViewGroup messageView=(ViewGroup)findViewById(R.id.message_container);
  if (mPost == null || mIsUpdatingPost || PostUploadService.isPostUploadingOrQueued(mPost) || (!mPost.isLocallyChanged() && !mPost.isLocalDraft()) && PostStatus.fromPost(mPost) != PostStatus.DRAFT) {
    messageView.setVisibility(View.GONE);
    return;
  }
  TextView messageText=(TextView)messageView.findViewById(R.id.message_text);
  if (mPost.isLocallyChanged()) {
    messageText.setText(R.string.local_changes_explainer);
  }
 else   if (mPost.isLocalDraft()) {
    messageText.setText(R.string.local_draft_explainer);
  }
 else   if (PostStatus.fromPost(mPost) == PostStatus.DRAFT) {
    messageText.setText(R.string.draft_explainer);
  }
  View btnPublish=messageView.findViewById(R.id.btn_publish);
  btnPublish.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      AniUtils.animateBottomBar(messageView,false);
      publishPost();
    }
  }
);
  View btnRevert=messageView.findViewById(R.id.btn_revert);
  btnRevert.setVisibility(mPost.isLocallyChanged() ? View.VISIBLE : View.GONE);
  if (mPost.isLocallyChanged()) {
    btnRevert.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        AniUtils.animateBottomBar(messageView,false);
        revertPost();
        AnalyticsTracker.track(Stat.EDITOR_DISCARDED_CHANGES);
      }
    }
);
  }
  if (mPost.isLocallyChanged()) {
    RelativeLayout.LayoutParams paramsMessage=(RelativeLayout.LayoutParams)messageText.getLayoutParams();
    paramsMessage.addRule(RelativeLayout.LEFT_OF,0);
    paramsMessage.addRule(RelativeLayout.CENTER_VERTICAL,0);
    ViewGroup.MarginLayoutParams marginsMessage=(ViewGroup.MarginLayoutParams)messageText.getLayoutParams();
    marginsMessage.bottomMargin=getResources().getDimensionPixelSize(R.dimen.margin_small);
    ViewGroup buttonsView=(ViewGroup)messageView.findViewById(R.id.layout_buttons);
    RelativeLayout.LayoutParams paramsButtons=(RelativeLayout.LayoutParams)buttonsView.getLayoutParams();
    paramsButtons.addRule(RelativeLayout.BELOW,R.id.message_text);
    ViewGroup.MarginLayoutParams marginsButtons=(ViewGroup.MarginLayoutParams)buttonsView.getLayoutParams();
    marginsButtons.bottomMargin=getResources().getDimensionPixelSize(R.dimen.margin_large);
  }
  messageView.setVisibility(View.INVISIBLE);
  new Handler().postDelayed(new Runnable(){
    @Override public void run(){
      if (!isFinishing() && messageView.getVisibility() != View.VISIBLE) {
        AniUtils.animateBottomBar(messageView,true);
      }
    }
  }
,1000);
}