From 0c5f3a9bca6621c3341ee2076ec8dad9ab556b72 Mon Sep 17 00:00:00 2001 From: Petru Trimbitas Date: Sun, 9 Jun 2013 14:14:02 +0300 Subject: [PATCH] Display event if the button is clicked --- src/ro/ieval/unical/DisplayEventActivity.java | 2 +- src/ro/ieval/unical/Event.java | 1 - src/ro/ieval/unical/EventButton.java | 14 ++++++++ src/ro/ieval/unical/EventListActivity.java | 34 ++++++++++++++----- src/ro/ieval/unical/MainActivity.java | 7 ++-- 5 files changed, 44 insertions(+), 14 deletions(-) create mode 100644 src/ro/ieval/unical/EventButton.java diff --git a/src/ro/ieval/unical/DisplayEventActivity.java b/src/ro/ieval/unical/DisplayEventActivity.java index af68224..8b8a767 100644 --- a/src/ro/ieval/unical/DisplayEventActivity.java +++ b/src/ro/ieval/unical/DisplayEventActivity.java @@ -1,6 +1,5 @@ package ro.ieval.unical; -import java.util.Arrays; import java.util.Date; import android.app.Activity; @@ -16,6 +15,7 @@ public class DisplayEventActivity extends 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); diff --git a/src/ro/ieval/unical/Event.java b/src/ro/ieval/unical/Event.java index cdeafaf..23ccd74 100644 --- a/src/ro/ieval/unical/Event.java +++ b/src/ro/ieval/unical/Event.java @@ -1,7 +1,6 @@ package ro.ieval.unical; import java.util.ArrayList; -import java.util.Arrays; import android.content.ContentResolver; import android.content.Context; diff --git a/src/ro/ieval/unical/EventButton.java b/src/ro/ieval/unical/EventButton.java new file mode 100644 index 0000000..3061d7d --- /dev/null +++ b/src/ro/ieval/unical/EventButton.java @@ -0,0 +1,14 @@ +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 + } + +} diff --git a/src/ro/ieval/unical/EventListActivity.java b/src/ro/ieval/unical/EventListActivity.java index 793573b..2473260 100644 --- a/src/ro/ieval/unical/EventListActivity.java +++ b/src/ro/ieval/unical/EventListActivity.java @@ -1,14 +1,15 @@ 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; @@ -29,12 +30,27 @@ public class EventListActivity extends Activity { 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