diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 12ae1f0..e0331b3 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -15,6 +15,7 @@ + diff --git a/res/layout/event_list_row.xml b/res/layout/event_list_row.xml index 6e1e7a6..1059ee4 100644 --- a/res/layout/event_list_row.xml +++ b/res/layout/event_list_row.xml @@ -2,7 +2,7 @@ + android:layout_height="wrap_content"> + xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + + + + + + + + + + diff --git a/src/com/studentersamfundet/app/Event.java b/src/com/studentersamfundet/app/Event.java index 8ad55c9..b97f1c7 100644 --- a/src/com/studentersamfundet/app/Event.java +++ b/src/com/studentersamfundet/app/Event.java @@ -1,6 +1,9 @@ package com.studentersamfundet.app; -public class Event { +import java.io.Serializable; + +public class Event implements Serializable { + private static final long serialVersionUID = 1L; public int id; public String title; public String description; diff --git a/src/com/studentersamfundet/app/ui/BaseDnsActivity.java b/src/com/studentersamfundet/app/ui/BaseDnsActivity.java index 670863e..5dae281 100644 --- a/src/com/studentersamfundet/app/ui/BaseDnsActivity.java +++ b/src/com/studentersamfundet/app/ui/BaseDnsActivity.java @@ -9,15 +9,18 @@ import android.view.View; public abstract class BaseDnsActivity extends Activity { public void clickHandler(View v) { Intent intent = new Intent(); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION - | Intent.FLAG_ACTIVITY_NO_HISTORY - | Intent.FLAG_ACTIVITY_SINGLE_TOP); if (v.getId() == R.id.program_button) { + intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT + | Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.setClass(this, ProgramListActivity.class); startActivity(intent); } else if (v.getId() == R.id.bli_med_button) { + intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY + | Intent.FLAG_ACTIVITY_SINGLE_TOP); + intent.setClass(this, JoinUsActivity.class); startActivity(intent); } diff --git a/src/com/studentersamfundet/app/ui/EventViewActivity.java b/src/com/studentersamfundet/app/ui/EventViewActivity.java new file mode 100644 index 0000000..93a49b3 --- /dev/null +++ b/src/com/studentersamfundet/app/ui/EventViewActivity.java @@ -0,0 +1,29 @@ +package com.studentersamfundet.app.ui; + +import android.content.Intent; +import android.os.Bundle; +import android.widget.TextView; + +import com.studentersamfundet.app.Event; +import com.studentersamfundet.app.R; + +public class EventViewActivity extends BaseDnsActivity { + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.event_view); + + Intent intent = getIntent(); + Event e = (Event)intent.getSerializableExtra("event"); + + if (e == null) { + throw new Error("This should NEVER happen"); + } + + TextView title = (TextView) findViewById(R.id.event_view_title); + TextView desc = (TextView) findViewById(R.id.event_view_decription); + + title.setText(e.title); + desc.setText(e.description); + } +} diff --git a/src/com/studentersamfundet/app/ui/ProgramListActivity.java b/src/com/studentersamfundet/app/ui/ProgramListActivity.java index f78416a..9b22d67 100644 --- a/src/com/studentersamfundet/app/ui/ProgramListActivity.java +++ b/src/com/studentersamfundet/app/ui/ProgramListActivity.java @@ -2,10 +2,12 @@ package com.studentersamfundet.app.ui; import org.w3c.dom.NodeList; +import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.ListView; @@ -66,7 +68,7 @@ public class ProgramListActivity extends BaseDnsActivity { row = convertView; } - Event e = getItem(position); + final Event e = getItem(position); TextView titleView = (TextView) row.findViewById(R.id.event_list_row_text); titleView.setText(e.title); @@ -74,6 +76,16 @@ public class ProgramListActivity extends BaseDnsActivity { TextView dateView = (TextView) row.findViewById(R.id.event_list_row_date); dateView.setText(e.getDateString()); + row.setOnClickListener(new OnClickListener() { + + public void onClick(View v) { + Intent intent = new Intent(ProgramListActivity.this, EventViewActivity.class); + intent.putExtra("event", e); + + startActivity(intent); + } + }); + return row; } };