</activity>
<activity android:name=".AddEventActivity"></activity>
<activity android:name=".DisplayEventActivity"></activity>
+ <activity android:name=".EventListActivity"></activity>
</application>
</manifest>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/eventlistlayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <ScrollView
+ android:id="@+id/scrollView1"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" >
+
+ <LinearLayout
+ android:id="@+id/eventslayout"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ </LinearLayout>
+ </ScrollView>
+
+</LinearLayout>
android:titleCondensed="NEW">
</item>
+ <item android:id="@+id/eventlist"
+ android:title="@string/eventlist"
+ android:visible="true"
+ android:showAsAction="never" >
+
+ </item>
</menu>
<string name="password">Password</string>
<string name="locationlabel">Location: </string>
<string name="repeatlabel">Repeating</string>
+ <string name="today">Today</string>
+ <string name="eventlist">Event List</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string name="askdeleteevent">Delete this event ?</string>
package ro.ieval.unical;
+import java.util.Arrays;
import java.util.Date;
import android.app.Activity;
super.onCreate(savedInstanceState);
final Event e=getIntent().getParcelableExtra(EXTRA_EVENT);
setContentView(R.layout.event_view);
+
final TextView eventTitle= (TextView) findViewById(R.id.eventTitle);
final TextView date=(TextView) findViewById(R.id.date);
final TextView description=(TextView) findViewById(R.id.description);
final TextView location= (TextView) findViewById(R.id.location);
+
eventTitle.setText(e.title);
date.setText(new Date(e.dtstart).toString());
description.setText(e.description);
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
// Handle item selection
- switch (item.getItemId()) {
+ switch (item. getItemId()) {
case R.id.NewEvent:
final Intent i=new Intent(this,AddEventActivity.class);
startActivity(i);
final DeleteEventDialog d=new DeleteEventDialog();
d.show(getFragmentManager(), "Delete");
return true;
+ case R.id.eventlist:
+ final Intent it=new Intent(this,EventListActivity.class);
+ startActivity(it);
+ return true;
default:
return true;
}
package ro.ieval.unical;
import java.util.ArrayList;
+import java.util.Arrays;
import android.content.ContentResolver;
import android.content.Context;
--- /dev/null
+package ro.ieval.unical;
+
+import java.util.Arrays;
+import java.util.GregorianCalendar;
+import java.text.DateFormat;
+import java.util.Date;
+
+import ro.ieval.unical.R;
+import android.app.Activity;
+import android.os.Bundle;
+import android.text.format.DateUtils;
+import android.widget.Button;
+import android.widget.LinearLayout;
+
+
+public class EventListActivity extends Activity {
+ GregorianCalendar gc;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ // TODO Auto-generated method stub
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.event_list);
+
+ Date d=new Date();
+ d.getTime();
+ gc=new GregorianCalendar();
+ gc.setTime(d);
+
+ Event r[]=Event.getAllEvents(getBaseContext());
+ LinearLayout ll = (LinearLayout)findViewById(R.id.eventslayout);
+ Button[] b=new Button[10];
+ Arrays.sort(r,new EventComparator());
+ for(int i=0; i<r.length; ++i) if(r[i].dtstart<=gc.getTimeInMillis()){
+ Button EventButton=new Button(getBaseContext());
+ EventButton.setText(r[i].title);
+ ll.addView(EventButton);
+ }
+ }
+}