]>
Commit | Line | Data |
---|---|---|
1 | package ro.ieval.unical; | |
2 | ||
3 | import java.util.Arrays; | |
4 | import java.util.Date; | |
5 | import java.util.GregorianCalendar; | |
6 | ||
7 | import android.app.Activity; | |
8 | import android.content.Intent; | |
9 | import android.graphics.Color; | |
10 | import android.os.Bundle; | |
11 | import android.view.View; | |
12 | import android.view.View.OnClickListener; | |
13 | import android.widget.Button; | |
14 | import android.widget.LinearLayout; | |
15 | ||
16 | ||
17 | public class EventListActivity extends Activity { | |
18 | GregorianCalendar gc; | |
19 | ||
20 | @Override | |
21 | protected void onCreate(Bundle savedInstanceState) { | |
22 | // TODO Auto-generated method stub | |
23 | super.onCreate(savedInstanceState); | |
24 | setContentView(R.layout.event_list); | |
25 | ||
26 | Date d=new Date(); | |
27 | d.getTime(); | |
28 | gc=new GregorianCalendar(); | |
29 | gc.setTime(d); | |
30 | ||
31 | Event r[]=Event.getAllEvents(getBaseContext()); | |
32 | LinearLayout ll = (LinearLayout)findViewById(R.id.eventslayout); | |
33 | Arrays.sort(r,new EventComparator()); | |
34 | EventButton[] b=new EventButton[10000]; | |
35 | for(int i=0; i<r.length; ++i) { | |
36 | b[i]=new EventButton(getBaseContext(),r[i]); | |
37 | b[i].setText(r[i].title); | |
38 | ||
39 | b[i].setTextColor(Color.BLACK); | |
40 | b[i].setOnClickListener(new OnClickListener() { | |
41 | ||
42 | @Override | |
43 | public void onClick(View v) { | |
44 | // TODO Auto-generated method stub | |
45 | EventButton b=(EventButton) v; | |
46 | DisplayEventActivity.displayEvent(EventListActivity.this,b.e); | |
47 | //Intent i=new Intent(getBaseContext(),DisplayEventActivity.class); | |
48 | //i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
49 | //startActivity(i); | |
50 | } | |
51 | }); | |
52 | ll.addView(b[i]); | |
53 | } | |
54 | } | |
55 | ||
56 | } |