]> iEval git - unical.git/blame - src/ro/ieval/unical/DisplayEventActivity.java
Fix the three get functions
[unical.git] / src / ro / ieval / unical / DisplayEventActivity.java
CommitLineData
222ca38d
PT
1package ro.ieval.unical;
2
3import java.util.Date;
4
5import android.app.Activity;
5cf4714f 6import android.content.Context;
46e6c000 7import android.content.Intent;
222ca38d
PT
8import android.os.Bundle;
9import android.view.Menu;
10import android.view.MenuInflater;
46e6c000 11import android.view.MenuItem;
222ca38d
PT
12import android.widget.TextView;
13
5cf4714f 14public class DisplayEventActivity extends Activity {
39f0cac1
MG
15 public static final String EXTRA_EVENT = "event";
16
5cf4714f
MG
17 public static void displayEvent(final Context context, final Event event){
18 final Intent i=new Intent(context,DisplayEventActivity.class);
19 i.putExtra(DisplayEventActivity.EXTRA_EVENT, event);
20 context.startActivity(i);
21 }
22
222ca38d 23 @Override
5cf4714f 24 protected void onCreate(final Bundle savedInstanceState) {
222ca38d 25 super.onCreate(savedInstanceState);
39f0cac1 26 final Event e=getIntent().getParcelableExtra(EXTRA_EVENT);
5cf4714f 27 setContentView(R.layout.event_view);
222ca38d
PT
28 final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
29 final TextView date=(TextView) findViewById(R.id.date);
30 final TextView description=(TextView) findViewById(R.id.description);
31 final TextView location= (TextView) findViewById(R.id.location);
32 eventTitle.setText(e.title);
5cf4714f 33 date.setText(new Date(e.dtstart).toString());
222ca38d 34 description.setText(e.description);
39f0cac1 35 location.setText(e.eventLocation);
222ca38d
PT
36 }
37
38 @Override
5cf4714f
MG
39 public boolean onCreateOptionsMenu(final Menu menu) {
40 final MenuInflater inflater = getMenuInflater();
41 inflater.inflate(R.menu.event, menu);
222ca38d
PT
42 return true;
43 }
46e6c000
PT
44
45 @Override
5cf4714f 46 public boolean onOptionsItemSelected(final MenuItem item) {
46e6c000
PT
47 // Handle item selection
48 switch (item.getItemId()) {
49 case R.id.NewEvent:
5cf4714f 50 final Intent i=new Intent(this,AddEventActivity.class);
46e6c000
PT
51 startActivity(i);
52 return true;
53 case R.id.deleteevent:
5cf4714f 54 final DeleteEventDialog d=new DeleteEventDialog();
46e6c000
PT
55 d.show(getFragmentManager(), "Delete");
56 return true;
57 default:
58 return true;
59 }
60 }
222ca38d 61}
This page took 0.02726 seconds and 4 git commands to generate.