Android Open Source - ribbit New Message Activity






From Project

Back to project page ribbit.

License

The source code is released under:

MIT License

If you think the Android project ribbit listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.lleshiart.ribbit;
//w  ww  .  jav  a  2  s . c  o  m
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;

public class NewMessageActivity extends Activity {

  protected EditText mMessageText;
  protected Button mSendMessageButton;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_new_message);
    
    mMessageText = (EditText) findViewById(R.id.sendMessageField);
    mSendMessageButton = (Button) findViewById(R.id.sendMessageButton);
    
    mSendMessageButton.setOnClickListener(new OnClickListener() {
      
      @Override
      public void onClick(View v) {
        setProgressBarIndeterminateVisibility(true);
        String message = mMessageText.getText().toString();
        message = message.trim();
        
        if (message.isEmpty()) {
          // Display error
          AlertDialog.Builder builder = new AlertDialog.Builder(NewMessageActivity.this);
          builder.setTitle(R.string.send_message_error_title)
            .setMessage(R.string.send_message_error_message)
            .setPositiveButton(android.R.string.ok, null);
          AlertDialog dialog = builder.create();
          dialog.show();
        }
        else {
          Intent intent = new Intent(NewMessageActivity.this, RecipientsActivity.class);
          intent.putExtra(ParseConstants.KEY_FILE_TYPE, ParseConstants.TYPE_TEXT);
          intent.putExtra(ParseConstants.KEY_MESSAGE, message);
          startActivity(intent);
          finish();
        }
        setProgressBarIndeterminateVisibility(false);
      }
    });
    
  }
}




Java Source Code List

com.lleshiart.ribbit.EditFriendsActivity.java
com.lleshiart.ribbit.FileHelper.java
com.lleshiart.ribbit.ForgotPasswordActivity.java
com.lleshiart.ribbit.FriendsFragment.java
com.lleshiart.ribbit.ImageResizer.java
com.lleshiart.ribbit.InboxFragment.java
com.lleshiart.ribbit.LoginActivity.java
com.lleshiart.ribbit.MainActivity.java
com.lleshiart.ribbit.MessageAdapter.java
com.lleshiart.ribbit.NewMessageActivity.java
com.lleshiart.ribbit.ParseConstants.java
com.lleshiart.ribbit.RecipientsActivity.java
com.lleshiart.ribbit.SectionsPagerAdapter.java
com.lleshiart.ribbit.SignUpActivity.java
com.lleshiart.ribbit.ViewImageActivity.java