public void updateTextCount(CharSequence s) {
   int remainingCount = 140 - TwitterUtils.getFixedTextLength(s.toString());
   if (!TextUtils.isEmpty(PostState.getState().getMediaFilePath())) {
     remainingCount -= new Validator().getShortUrlLength();
   }
   textViewCount.setText(String.valueOf(remainingCount));
   if (remainingCount == 140) {
     textViewCount.setTextColor(getResources().getColor(R.color.red));
     buttonTweet.setEnabled(false);
   } else if (remainingCount < 0) {
     textViewCount.setTextColor(getResources().getColor(R.color.red));
     buttonTweet.setEnabled(false);
   } else {
     textViewCount.setTextAppearance(
         getActivity(), android.R.style.TextAppearance_Widget_TextView);
     buttonTweet.setEnabled(true);
   }
   setStateFromView();
 }
  @Override
  public void onPostStateChange(final PostState postState) {
    Logger.debug("PostFragment PostStateChange");
    final MainActivity activity = (MainActivity) getActivity();
    if (editText != null) {
      final int start = postState.getSelectionStart();
      final int end = postState.getSelectionEnd();
      editText.removeTextChangedListener(this);
      editText.setTextKeepState(postState.getText());
      editText.addTextChangedListener(this);
      updateTextCount(editText.getText());
      new UIHandler() {
        @Override
        public void run() {
          editText.setSelection(start, end);
        }
      }.postAtFrontOfQueue();
    }
    if (viewGroupReply != null) {
      if (postState.getInReplyToStatusID() >= 0) {
        viewGroupReply.setVisibility(View.VISIBLE);
        final Account account = activity.getAccount();
        final Consumer consumer = activity.getConsumer();
        Twitter twitter = TwitterApi.getTwitter(consumer, account);
        TwitterUtils.tryGetStatus(
            twitter,
            account,
            postState.getInReplyToStatusID(),
            new TwitterUtils.StatusCallback() {
              @Override
              public void success(Status status) {
                View header = viewGroupReply.findViewById(R.id.layout_post_reply_status);
                header =
                    new StatusViewModel(status, account)
                        .getView(activity, activity.getLayoutInflater(), header);
                header.setBackgroundColor(getResources().getColor(R.color.transparent));
                header.setClickable(false);
              }

              @Override
              public void error() {
                viewGroupReply.setVisibility(View.GONE);
              }
            });
        ImageButton imageButtonDeleteReply =
            (ImageButton) viewGroupReply.findViewById(R.id.button_post_reply_delete);
        imageButtonDeleteReply.setOnClickListener(this);
      } else {
        viewGroupReply.setVisibility(View.GONE);
      }
    }
    if (viewGroupMedia != null) {
      ImageView imageViewMedia = (ImageView) viewGroupMedia.findViewById(R.id.image_post_media);
      if (TextUtils.isEmpty(postState.getMediaFilePath())) {
        viewGroupMedia.setVisibility(View.GONE);
      } else {
        viewGroupMedia.setVisibility(View.VISIBLE);
      }
      new BitmapThumbnailTask(activity, postState.getMediaFilePath(), imageViewMedia).execute();
    }
  }