package ro.ieval.unical;
-import java.util.Arrays;
import java.util.Date;
import android.app.Activity;
public static final String EXTRA_EVENT = "event";
public static void displayEvent(final Context context, final Event event){
+ System.out.println("Muie");
final Intent i=new Intent(context,DisplayEventActivity.class);
i.putExtra(DisplayEventActivity.EXTRA_EVENT, event);
context.startActivity(i);
--- /dev/null
+package ro.ieval.unical;
+import android.content.Context;
+import android.widget.Button;
+
+
+public class EventButton extends Button{
+ Event e;
+ public EventButton(Context context,Event z) {
+ super(context);
+ e=z;
+ // TODO Auto-generated constructor stub
+ }
+
+}
package ro.ieval.unical;
import java.util.Arrays;
-import java.util.GregorianCalendar;
-import java.text.DateFormat;
import java.util.Date;
+import java.util.GregorianCalendar;
-import ro.ieval.unical.R;
import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Color;
import android.os.Bundle;
-import android.text.format.DateUtils;
+import android.view.View;
+import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
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);
+ EventButton[] b=new EventButton[10000];
+ for(int i=0; i<r.length; ++i) {
+ b[i]=new EventButton(getBaseContext(),r[i]);
+ b[i].setText(r[i].title);
+
+ b[i].setTextColor(Color.BLACK);
+ b[i].setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ // TODO Auto-generated method stub
+ EventButton b=(EventButton) v;
+ DisplayEventActivity.displayEvent(EventListActivity.this,b.e);
+ //Intent i=new Intent(getBaseContext(),DisplayEventActivity.class);
+ //i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ //startActivity(i);
+ }
+ });
+ ll.addView(b[i]);
}
}
+
}
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
-import android.provider.CalendarContract.Events;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
startActivity(i);
}
- DisplayEventActivity.displayEvent(this, Event.getEventsByCalendar(this,
- Calendar.getAllCalendars(this)[0]._id, Events.DTSTART)[0]);
+ //DisplayEventActivity.displayEvent(this, Event.getEventsByCalendar(this,
+ // Calendar.getAllCalendars(this)[0]._id, Events.DTSTART)[0]);
+ Intent i=new Intent(this,EventListActivity.class);
+ startActivity(i);
}
@Override