Archived
Added event view activity.
This commit is contained in:
1 parent
022f48de8b
commit
1b20abdb94
7 files changed
+80
-10
No files matched your search
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user