Commit | Line | Data |
---|---|---|
0b5b93a4 PT |
1 | package ro.ieval.unical; |
2 | ||
3 | import java.util.Arrays; | |
0b5b93a4 | 4 | import java.util.Date; |
0c5f3a9b | 5 | import java.util.GregorianCalendar; |
0b5b93a4 | 6 | |
0b5b93a4 | 7 | import android.app.Activity; |
0c5f3a9b PT |
8 | import android.content.Intent; |
9 | import android.graphics.Color; | |
0b5b93a4 | 10 | import android.os.Bundle; |
0c5f3a9b PT |
11 | import android.view.View; |
12 | import android.view.View.OnClickListener; | |
0b5b93a4 PT |
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); | |
0b5b93a4 | 33 | Arrays.sort(r,new EventComparator()); |
0c5f3a9b PT |
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]); | |
0b5b93a4 PT |
53 | } |
54 | } | |
0c5f3a9b | 55 | |
0b5b93a4 | 56 | } |