Added event view activity.

This commit is contained in:
Robert Kolner committed 2011-09-14 21:24:27 +02:00
1 parent 022f48de8b
commit 1b20abdb94
7 files changed
+80 -10

No files matched your search

+1
View File
@@ -15,6 +15,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.EventViewActivity"></activity>
<activity android:name=".ui.JoinUsActivity"></activity>
<activity android:name=".ui.ProgramListActivity"></activity>
+1 -1
View File
@@ -2,7 +2,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content">
<TextView android:id="@+id/event_list_row_text"
android:layout_height="wrap_content"
+26 -4
View File
@@ -1,8 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Header -->
<include layout="@layout/header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentTop="true"/>
<!-- Footer -->
<include layout="@layout/footer"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true" />
<!-- The event -->
<TextView android:id="@+id/event_view_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/header" />
<TextView android:id="@+id/event_view_decription"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/event_view_title" />
</RelativeLayout>
+4 -1
View File
@@ -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;
@@ -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);
}
@@ -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);
}
}
@@ -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;
}
};