1 package ro
.ieval
.unical
;
3 import java
.util
.Arrays
;
5 import java
.util
.GregorianCalendar
;
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
;
17 public class EventListActivity
extends Activity
{
21 protected void onCreate(Bundle savedInstanceState
) {
22 // TODO Auto-generated method stub
23 super.onCreate(savedInstanceState
);
24 setContentView(R
.layout
.event_list
);
28 gc
=new GregorianCalendar();
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
);
39 b
[i
].setTextColor(Color
.BLACK
);
40 b
[i
].setOnClickListener(new OnClickListener() {
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);