package com.view;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

public class NewMsg extends Activity {
	TextView title;
	Button bt_ok;
	Button bt_cancel;
	Button bt_browse;
	EditText et_receiver;
	EditText et_title;
	EditText et_body;
	
	boolean isMsg;
	
	final static String TITLE_MSG="New Message";
	final static String TITLE_REPLY="New Reply";
	
	String receiver;
	String s_title;
	String body;
	
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.newmsg);
		
		title=(TextView)findViewById(R.id.title_msg_or_reply);
		bt_ok=(Button)findViewById(R.id.ok_in_newmsg);
		bt_cancel=(Button)findViewById(R.id.cancel_in_newmsg);
		bt_browse=(Button)findViewById(R.id.browse_in_newmsg);
		et_receiver=(EditText)findViewById(R.id.receiver_in_newmsg);
		et_title=(EditText)findViewById(R.id.title_in_newmsg);
		et_body=(EditText)findViewById(R.id.msg_body_in_newmsg);
	}
	
	public void setKind(boolean isMsg)
	{
		if(isMsg)
		{
			title.setText(TITLE_MSG.toCharArray(), 0, TITLE_MSG.length());
			bt_ok.setText(new String("Send").toCharArray(), 0, 4);
		}
		else
		{
			title.setText(TITLE_REPLY.toCharArray(), 0, TITLE_REPLY.length());
			bt_ok.setText(new String("Publish").toCharArray(), 0, 7);
		}
	}
	
	public void setTitle(String title)
	{
		s_title=title;
		et_title.setText(title.toCharArray(), 0, title.length());
	}
	
	public void setReceiver(String rec)
	{
		receiver=rec;
		et_receiver.setText(rec.toCharArray(), 0, rec.length());
	}

	OnClickListener click_ok=new OnClickListener()
	{
		public void onClick(View view)
		{
			receiver=et_receiver.getText().toString();
			s_title=et_title.getText().toString();
			body=et_body.getText().toString();
		}
	};
}
