]> iEval git - unical.git/blame - src/ro/ieval/unical/DisplayEventActivity.java
Default eventColour to the calendar colour
[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);
0b5b93a4 28
222ca38d
PT
29 final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
30 final TextView date=(TextView) findViewById(R.id.date);
31 final TextView description=(TextView) findViewById(R.id.description);
32 final TextView location= (TextView) findViewById(R.id.location);
0b5b93a4 33
222ca38d 34 eventTitle.setText(e.title);
5cf4714f 35 date.setText(new Date(e.dtstart).toString());
222ca38d 36 description.setText(e.description);
39f0cac1 37 location.setText(e.eventLocation);
222ca38d
PT
38 }
39
40 @Override
5cf4714f
MG
41 public boolean onCreateOptionsMenu(final Menu menu) {
42 final MenuInflater inflater = getMenuInflater();
43 inflater.inflate(R.menu.event, menu);
222ca38d
PT
44 return true;
45 }
46e6c000
PT
46
47 @Override
5cf4714f 48 public boolean onOptionsItemSelected(final MenuItem item) {
46e6c000 49 // Handle item selection
0b5b93a4 50 switch (item. getItemId()) {
46e6c000 51 case R.id.NewEvent:
5cf4714f 52 final Intent i=new Intent(this,AddEventActivity.class);
46e6c000
PT
53 startActivity(i);
54 return true;
55 case R.id.deleteevent:
5cf4714f 56 final DeleteEventDialog d=new DeleteEventDialog();
46e6c000
PT
57 d.show(getFragmentManager(), "Delete");
58 return true;
0b5b93a4
PT
59 case R.id.eventlist:
60 final Intent it=new Intent(this,EventListActivity.class);
61 startActivity(it);
62 return true;
46e6c000
PT
63 default:
64 return true;
65 }
66 }
222ca38d 67}
This page took 0.0343599999999999 seconds and 4 git commands to generate.