Ejemplo n.º 1
0
 @Override
 public Loader<CommonResponse> onCreateLoader(int i, Bundle bundle) {
   String identity = MobilePushApp.getInstance().getUserIdentity();
   String url = Constants.getFeedBackUrl();
   LoadContext<CommonResponse> loadContext = new LoadContext<CommonResponse>();
   loadContext.setFlag(LoadContext.FLAG_POST_DATA);
   loadContext.setPostContent(
       "identity="
           + identity
           + "&messageid="
           + String.valueOf(message.getId())
           + "&message="
           + responseString);
   loadContext.setClazz(CommonResponse.class);
   loadContext.setParam(url);
   return new JsonLoaderJeallyBean<CommonResponse>(
       MessageDetailActivity.this,
       loadContext,
       new Configuration.CREATOR()
           .setExpiration(Constants.EXPIRATION_TIME)
           .setCacheDir(getCacheDir().toString())
           .create());
 }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.message_detail);
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setMessage(getString(R.string.dialog_doing));
    mProgressDialog.setCancelable(false);
    mProgressDialog.setCanceledOnTouchOutside(false);
    TextView title = (TextView) findViewById(R.id.detail_title);
    TextView messageDate = (TextView) findViewById(R.id.detail_message_date);
    mReplyTextView = (TextView) findViewById(R.id.detail_message_content);
    Intent intent = getIntent();
    fromPush = intent.getBooleanExtra(Constants.EXTRA_FROM_PUSH, false);
    message = (SingleMessage) intent.getSerializableExtra("message");

    if (message != null && !TextUtils.isEmpty(message.getOptions()))
      options = message.getOptions().split("#");
    title.setText(message.getTitle());
    messageDate.setText(message.getTimes());
    ((TextView) findViewById(R.id.detail_content)).setText("    " + (message.getMessage()));

    mEditText = (EditText) findViewById(R.id.detail_reply);
    mSendButton = (Button) findViewById(R.id.detail_send);
    mOptionReplyButton = (Button) findViewById(R.id.option_reply);
    mSendButton.setOnClickListener(this);
    mOptionReplyButton.setOnClickListener(this);
    if (message.getIsReply().equals(SingleMessage.NOT_RESPONSE)) {
      mEditText.setVisibility(View.GONE);
      findViewById(R.id.not_response_text).setVisibility(View.VISIBLE);
      mOptionReplyButton.setVisibility(View.GONE);
    } else if (message.getIsReply().equals(SingleMessage.REQUIRE_RESPONSE)) {
      mEditText.setVisibility(View.VISIBLE);
      findViewById(R.id.not_response_text).setVisibility(View.GONE);
      mOptionReplyButton.setVisibility(View.GONE);
    } else {
      if (options != null && options.length > 0) {
        mEditText.setVisibility(View.GONE);
        findViewById(R.id.not_response_text).setVisibility(View.GONE);
        mOptionReplyButton.setVisibility(View.VISIBLE);
      } else {
        mEditText.setVisibility(View.GONE);
        findViewById(R.id.not_response_text).setVisibility(View.VISIBLE);
        mOptionReplyButton.setVisibility(View.GONE);
      }
    }
    mEditText.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

          @Override
          public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

          @Override
          public void afterTextChanged(Editable editable) {
            if (TextUtils.isEmpty(editable.toString())) {
              mSendButton.setVisibility(View.GONE);
            } else {
              mSendButton.setVisibility(View.VISIBLE);
            }
          }
        });
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  }