@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;

    setContentView(R.layout.crowd_invitation_activity);
    mTitleName = (TextView) findViewById(R.id.crowd_invitation_title_text);
    mNameTV = (TextView) findViewById(R.id.crowd_invitation_name);
    mNoTV = (TextView) findViewById(R.id.crowd_invitation_crowd_no);
    mCreatorTV = (TextView) findViewById(R.id.crowd_invitation_creator_tv);
    mBriefTV = (TextView) findViewById(R.id.crowd_invitation_brief);
    mAnnounceTV = (TextView) findViewById(R.id.crowd_invitation_announcement);

    mAcceptButton = findViewById(R.id.crowd_invitation_accept_button);
    mAcceptButton.setOnClickListener(mAcceptButtonListener);
    mDeclineButton = findViewById(R.id.crowd_invitation_decline_button);
    mDeclineButton.setOnClickListener(mDeclineButtonListener);
    mReturnButton = findViewById(R.id.crowd_invitation_return_button);
    mReturnButton.setOnClickListener(mReturnButtonListener);
    mSendMsgButton = (TextView) findViewById(R.id.crowd_invitation_send_msg_button);
    mSendMsgButton.setOnClickListener(mSendMsgButtonListener);

    mButtonLayout = findViewById(R.id.crowd_invitation_button_ly);
    mNotesLayout = findViewById(R.id.crowd_invitation_notes_ly);
    mNotesTV = (TextView) findViewById(R.id.crowd_invitation_notes);
    mAcceptedLy = findViewById(R.id.crowd_invitation_accepted_ly);

    mRejectResasonLayout = findViewById(R.id.crowd_content_reject_reason_ly);
    mBoxLy = findViewById(R.id.crowd_invitation_box_ly);
    mReasonET = (EditText) findViewById(R.id.crowd_content_reject_reason_et);

    crowd = (Crowd) getIntent().getExtras().get("crowd");
    mNoTV.setText(String.valueOf(crowd.getId()).substring(1));
    mNameTV.setText(crowd.getName());
    mBriefTV.setText(crowd.getBrief());
    mCreatorTV.setText(crowd.getCreator().getName());
    mAnnounceTV.setText(crowd.getAnnounce());

    CrowdGroup g = new CrowdGroup(crowd.getId(), crowd.getName(), crowd.getCreator(), null);
    g.setAuthType(AuthType.fromInt(crowd.getAuth()));
    vq =
        MessageBuilder.queryQualMessageByCrowdId(
            mContext, GlobalHolder.getInstance().getCurrentUser(), g);
    updateView(false);

    mRejectResasonLayout.setVisibility(View.GONE);
  }
 private void handleDeclineDone() {
   CrowdGroup g = new CrowdGroup(crowd.getId(), crowd.getName(), crowd.getCreator(), null);
   vq.setReadState(VMessageQualification.ReadState.READ);
   vq.setQualState(VMessageQualification.QualificationState.REJECT);
   // Update message state to database;
   MessageBuilder.updateQualicationMessage(mContext, vq);
   updateView(false);
 }
  private void handleAcceptDone() {
    CrowdGroup g = new CrowdGroup(crowd.getId(), crowd.getName(), crowd.getCreator(), null);
    g.setBrief(crowd.getBrief());
    g.setAnnouncement(crowd.getAnnounce());
    GlobalHolder.getInstance().addGroupToList(GroupType.CHATING.intValue(), g);

    Intent i = new Intent();
    i.setAction(PublicIntent.BROADCAST_NEW_CROWD_NOTIFICATION);
    i.addCategory(JNIService.JNI_BROADCAST_CATEGROY);
    i.putExtra("crowd", crowd.getId());
    sendBroadcast(i);

    vq.setReadState(VMessageQualification.ReadState.READ);
    vq.setQualState(VMessageQualification.QualificationState.ACCEPTED);
    MessageBuilder.updateQualicationMessage(mContext, vq);

    updateView(false);
  }
 @Override
 public void onClick(View view) {
   if (isInRejectReasonMode) {
     synchronized (mState) {
       if (mState == State.UPDATING) {
         return;
       }
       mState = State.UPDATING;
       service.refuseInvitation(
           crowd,
           mReasonET.getEditableText().toString(),
           new Registrant(mLocalHandler, REFUSE_INVITATION_DONE, null));
     }
     return;
   } else {
     Group group = GlobalHolder.getInstance().getGroupById(crowd.getId());
     Intent i = new Intent(PublicIntent.START_CONVERSACTION_ACTIVITY);
     i.addCategory(PublicIntent.DEFAULT_CATEGORY);
     i.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
     i.putExtra("obj", new ConversationNotificationObject(new CrowdConversation(group)));
     startActivity(i);
   }
 }