Merged in new GUI.
No files matched your search
@@ -0,0 +1,5 @@
|
||||
TODO:
|
||||
- "Today@Neuf" main screen
|
||||
- Redesign GUI / make logical menu system
|
||||
- Write a mail to designers
|
||||
- Streaming?
|
||||
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 84 KiB |
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- pressed -->
|
||||
<item android:state_pressed="true" >
|
||||
<shape>
|
||||
<stroke android:width="1px" android:color="#000000" />
|
||||
<gradient android:startColor="#bd7c0b" android:endColor="#8f5e08" android:angle="270" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- focused -->
|
||||
<item android:state_focused="true" >
|
||||
<shape>
|
||||
<stroke android:width="1px" android:color="#000000" />
|
||||
<gradient android:startColor="#bd7c0b" android:endColor="#8f5e08" android:angle="270" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<!-- default -->
|
||||
<item>
|
||||
<shape>
|
||||
<stroke android:width="1px" android:color="#000000" />
|
||||
<solid android:color="#ee9c0e"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -8,19 +8,147 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
<!-- Footer -->
|
||||
<include layout="@layout/footer"
|
||||
<!-- Footer (not needed right now) -->
|
||||
<include layout="@layout/footer"
|
||||
android:visibility="gone"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
<!-- Formålsparagraf -->
|
||||
<ImageView
|
||||
android:id="@+id/paragraph"
|
||||
android:layout_height="wrap_content"
|
||||
<!-- MENU: -->
|
||||
<LinearLayout
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@drawable/partest" />
|
||||
|
||||
android:layout_below="@id/header"
|
||||
android:layout_above="@id/footer"
|
||||
android:layout_marginTop="30px"
|
||||
android:layout_marginBottom="30px"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center">
|
||||
|
||||
<RelativeLayout android:id="@+id/main_menu_program"
|
||||
style="@style/MetroTile"
|
||||
android:background="@drawable/ex1"
|
||||
android:layout_margin="5px"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:onClick="programButton">
|
||||
|
||||
<TextView
|
||||
style="@style/MetroTileText_bg"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/program_button" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/main_menu_hours"
|
||||
style="@style/MetroTile"
|
||||
android:background="@drawable/ex2"
|
||||
android:layout_margin="5px"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_width="fill_parent"
|
||||
android:onClick="doNothing"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
style="@style/MetroTileText_bg"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/main_menu_opening_hours" />
|
||||
|
||||
<!-- OPENING HOURS: -->
|
||||
<TextView android:id="@+id/main_menu_hours_neuf_header"
|
||||
style="@style/MetroTileText_bg"
|
||||
android:textSize="12sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="10px"
|
||||
android:layout_marginBottom="10px"
|
||||
android:text="Chateau Neuf" />
|
||||
|
||||
<!-- This is set in Java: -->
|
||||
<TextView android:id="@+id/main_menu_hours_neuf"
|
||||
style="@style/MetroTileText"
|
||||
android:textSize="10sp"
|
||||
android:layout_marginLeft="5px"
|
||||
android:layout_marginRight="5px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_below="@id/main_menu_hours_neuf_header" />
|
||||
|
||||
|
||||
<TextView android:id="@+id/main_menu_hours_bc_header"
|
||||
style="@style/MetroTileText_bg"
|
||||
android:textSize="12sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_marginTop="10px"
|
||||
android:layout_marginBottom="10px"
|
||||
android:layout_below="@id/main_menu_hours_neuf"
|
||||
android:text="Bokcaféen" />
|
||||
|
||||
<!-- This is set in Java: -->
|
||||
<TextView android:id="@+id/main_menu_hours_bc"
|
||||
style="@style/MetroTileText"
|
||||
android:textSize="10sp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_below="@id/main_menu_hours_bc_header" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center">
|
||||
|
||||
<RelativeLayout android:id="@+id/main_menu_tickets"
|
||||
style="@style/MetroTile"
|
||||
android:background="@drawable/ex3"
|
||||
android:layout_margin="5px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:onClick="ticketButton">
|
||||
|
||||
<TextView
|
||||
style="@style/MetroTileText_bg"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/main_menu_tickets" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/main_menu_join"
|
||||
style="@style/MetroTile"
|
||||
android:background="@drawable/ex4"
|
||||
android:layout_margin="5px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:onClick="joinButton">
|
||||
|
||||
<TextView
|
||||
style="@style/MetroTileText_bg"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:text="@string/bli_med_button" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -11,4 +11,6 @@
|
||||
<string name="menu_categories">Kategorier</string>
|
||||
<string name="choose_category">Velg kategori</string>
|
||||
<string name="error_loading">Vent til oppdateringen fullfører</string>
|
||||
<string name="main_menu_opening_hours">ÅPNINGSTIDER</string>
|
||||
<string name="main_menu_tickets">BILLETTER</string>
|
||||
</resources>
|
||||
@@ -1,5 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- MAIN MENU STYLES: -->
|
||||
<style name="MetroTile">
|
||||
<item name="android:background">@drawable/metro_background</item>
|
||||
</style>
|
||||
|
||||
<style name="MetroTileText" parent="@android:style/TextAppearance">
|
||||
<item name="android:textColor">#ffffff</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
<style name="MetroTileText_bg" parent="MetroTileText">
|
||||
<item name="android:background">#80303030</item>
|
||||
</style>
|
||||
|
||||
|
||||
<!-- EVENT VIEW STYLES: -->
|
||||
<style name="BigHeader">
|
||||
<item name="android:textSize">20sp</item>
|
||||
|
||||
@@ -7,19 +7,25 @@ import java.util.TreeSet;
|
||||
|
||||
public class DataHandler {
|
||||
private List<Event> events = new LinkedList<Event>();
|
||||
private Set<String> categories = new TreeSet<String>();
|
||||
private List<News> news = new LinkedList<News>();
|
||||
private Set<String> eventCategories = new TreeSet<String>();
|
||||
|
||||
public void insert(String id, String title, String description, String date, String location, String text, String category) {
|
||||
public void insertEvent(String id, String title, String description, String date, String location, String text, String category) {
|
||||
int intId = Integer.parseInt(id);
|
||||
if (get(intId) != null)
|
||||
if (getEvent(intId) != null)
|
||||
return;
|
||||
|
||||
Event e = new Event(intId, title, description, date, location, text, category);
|
||||
events.add(e);
|
||||
categories.add(category);
|
||||
eventCategories.add(category);
|
||||
}
|
||||
|
||||
public Event get(int id) {
|
||||
public void insertNews(String title, String description, String content, String link, String pubDate) {
|
||||
News n = new News(title, description, content, link, pubDate);
|
||||
this.news.add(n);
|
||||
}
|
||||
|
||||
public Event getEvent(int id) {
|
||||
for (Event e : events) {
|
||||
if (e.id == id)
|
||||
return e;
|
||||
@@ -27,7 +33,7 @@ public class DataHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Event[] populateList(String category) {
|
||||
public Event[] populateEventList(String category) {
|
||||
LinkedList<Event> sorted = new LinkedList<Event>();
|
||||
|
||||
if (category.equals(Event.ALL)) {
|
||||
@@ -41,12 +47,16 @@ public class DataHandler {
|
||||
return sorted.toArray(new Event[sorted.size()]);
|
||||
}
|
||||
|
||||
public String[] getCategories() {
|
||||
String[] result = new String[categories.size() + 1];
|
||||
public News[] populateNewsList() {
|
||||
return this.news.toArray(new News[this.news.size()]);
|
||||
}
|
||||
|
||||
public String[] getEventCategories() {
|
||||
String[] result = new String[eventCategories.size() + 1];
|
||||
result[0] = Event.ALL;
|
||||
|
||||
int counter = 1;
|
||||
for (String c : categories) {
|
||||
for (String c : eventCategories) {
|
||||
result[counter++] = c;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
public class Event implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
public static final String ALL = "Alle";
|
||||
@@ -44,4 +46,20 @@ public class Event implements Serializable {
|
||||
public String toString() {
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public Uri getUri() {
|
||||
if (this.id <= 0)
|
||||
return null;
|
||||
|
||||
return Uri.parse("http://studentersamfundet.no/vis.php?ID=" + this.id);
|
||||
}
|
||||
|
||||
public Uri getImageUri() {
|
||||
if (this.id <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String imageUri = "http://studentersamfundet.no/imageResize.php?pic=bilder/program/{id}.jpg&maxwidth=480";
|
||||
return Uri.parse(imageUri.replaceAll("{id}", Integer.toString(this.id)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.studentersamfundet.app;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
public class News {
|
||||
public String title;
|
||||
public String description;
|
||||
public String content;
|
||||
public Uri link;
|
||||
public Date pubDate;
|
||||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
public News(String title, String description, String content, String link, String pubDate) {
|
||||
this.title = title.trim();
|
||||
this.description = description.trim();
|
||||
this.content = content.trim();
|
||||
this.link = Uri.parse(link.trim());
|
||||
|
||||
try {
|
||||
this.pubDate = sdf.parse(pubDate.trim());
|
||||
} catch (ParseException e) {
|
||||
this.pubDate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.studentersamfundet.app;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class RSSParserNews {
|
||||
private final DataHandler dh;
|
||||
|
||||
public RSSParserNews() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public RSSParserNews(DataHandler dh) {
|
||||
if (dh == null) {
|
||||
this.dh = new DataHandler();
|
||||
} else {
|
||||
this.dh = dh;
|
||||
}
|
||||
}
|
||||
|
||||
public DataHandler parse(NodeList itemNodes) {
|
||||
String title = "";
|
||||
String description = "";
|
||||
String link = "";
|
||||
String content = "";
|
||||
String pubDate = "";
|
||||
|
||||
for (int i = 0; i < itemNodes.getLength(); i++) {
|
||||
Node itemNode = itemNodes.item(i);
|
||||
|
||||
if (itemNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
// Convert the Node into an Element.
|
||||
Element itemElement = (Element) itemNode;
|
||||
|
||||
// Get all elements under the <item> element.
|
||||
NodeList titleNodes = (itemElement).getElementsByTagName("title");
|
||||
NodeList descriptionNodes = (itemElement).getElementsByTagName("description");
|
||||
NodeList linkNodes = (itemElement).getElementsByTagName("link");
|
||||
NodeList textNodes = (itemElement).getElementsByTagName("content");
|
||||
NodeList dateNodes = (itemElement).getElementsByTagName("pubDate");
|
||||
|
||||
// Convert a Node into an Element.
|
||||
Node titleElement = titleNodes.item(0);
|
||||
Node descriptionElement = descriptionNodes.item(0);
|
||||
Node linkElement = linkNodes.item(0);
|
||||
Node textElement = textNodes.item(0);
|
||||
Node dateElement = dateNodes.item(0);
|
||||
|
||||
// Get all the child nodes.
|
||||
NodeList titleTextNodes = titleElement.getChildNodes();
|
||||
NodeList descriptionTextNodes = descriptionElement.getChildNodes();
|
||||
NodeList linkTextNodes = linkElement.getChildNodes();
|
||||
NodeList textTextNodes = textElement.getChildNodes();
|
||||
NodeList dateTextNodes = dateElement.getChildNodes();
|
||||
|
||||
// Retrieve the text.
|
||||
title = titleTextNodes.item(0).getNodeValue(); // mandatory
|
||||
if (descriptionTextNodes.getLength() > 0) description = descriptionTextNodes.item(0).getNodeValue();
|
||||
if (linkTextNodes.getLength() > 0) link = linkTextNodes.item(0).getNodeValue();
|
||||
if (textTextNodes.getLength() > 0) content = textTextNodes.item(0).getNodeValue();
|
||||
if (dateTextNodes.getLength() > 0) pubDate = dateTextNodes.item(0).getNodeValue();
|
||||
|
||||
dh.insertNews(title, description, content, link, pubDate);
|
||||
}
|
||||
}
|
||||
return dh;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.studentersamfundet.app;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class RSSParserProgram {
|
||||
private final DataHandler dh;
|
||||
|
||||
public RSSParserProgram() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public RSSParserProgram(DataHandler dh) {
|
||||
if (dh == null) {
|
||||
this.dh = new DataHandler();
|
||||
} else {
|
||||
this.dh = dh;
|
||||
}
|
||||
}
|
||||
|
||||
public DataHandler parse(NodeList itemNodes) {
|
||||
String id = "";
|
||||
String title = "";
|
||||
String description = "";
|
||||
String date = "";
|
||||
String location = "";
|
||||
String text = "";
|
||||
String category = "";
|
||||
// String pictureUrl = ""; Necessary?
|
||||
|
||||
for (int i = 0; i < itemNodes.getLength(); i++) {
|
||||
Node itemNode = itemNodes.item(i);
|
||||
|
||||
if (itemNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
// Convert the Node into an Element.
|
||||
Element itemElement = (Element) itemNode;
|
||||
|
||||
// Get all elements under the <item> element.
|
||||
NodeList idNodes = (itemElement).getElementsByTagName("id");
|
||||
NodeList titleNodes = (itemElement).getElementsByTagName("title");
|
||||
NodeList descriptionNodes = (itemElement).getElementsByTagName("description");
|
||||
NodeList dateNodes = (itemElement).getElementsByTagName("date");
|
||||
NodeList locationNodes = (itemElement).getElementsByTagName("location");
|
||||
NodeList textNodes = (itemElement).getElementsByTagName("content");
|
||||
NodeList categoryNodes = (itemElement).getElementsByTagName("category");
|
||||
|
||||
// Convert a Node into an Element.
|
||||
Node idElement = idNodes.item(0);
|
||||
Node titleElement = titleNodes.item(0);
|
||||
Node descriptionElement = descriptionNodes.item(0);
|
||||
Node dateElement = dateNodes.item(0);
|
||||
Node locationElement = locationNodes.item(0);
|
||||
Node textElement = textNodes.item(0);
|
||||
Node categoryElement = categoryNodes.item(0);
|
||||
|
||||
// Get all the child nodes.
|
||||
NodeList idTextNodes = idElement.getChildNodes();
|
||||
NodeList titleTextNodes = titleElement.getChildNodes();
|
||||
NodeList descriptionTextNodes = descriptionElement.getChildNodes();
|
||||
NodeList dateTextNodes = dateElement.getChildNodes();
|
||||
NodeList locationTextNodes = locationElement.getChildNodes();
|
||||
NodeList textTextNodes = textElement.getChildNodes();
|
||||
NodeList categoryTextNodes = categoryElement.getChildNodes();
|
||||
|
||||
// Retrieve the text.
|
||||
id = idTextNodes.item(0).getNodeValue(); // mandatory
|
||||
title = titleTextNodes.item(0).getNodeValue(); // mandatory
|
||||
if (descriptionTextNodes.getLength() > 0) description = descriptionTextNodes.item(0).getNodeValue();
|
||||
if (dateTextNodes.getLength() > 0) date = dateTextNodes.item(0).getNodeValue();
|
||||
if (locationTextNodes.getLength() > 0) location = locationTextNodes.item(0).getNodeValue();
|
||||
if (textTextNodes.getLength() > 0) text = textTextNodes.item(0).getNodeValue();
|
||||
if (categoryTextNodes.getLength() > 0) category = categoryTextNodes.item(0).getNodeValue();
|
||||
|
||||
dh.insertEvent(id, title, description, date, location, text, category);
|
||||
}
|
||||
}
|
||||
return dh;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.studentersamfundet.app;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
public class XmlParser {
|
||||
private static DataHandler dh;
|
||||
|
||||
public XmlParser() {
|
||||
dh = new DataHandler();
|
||||
}
|
||||
|
||||
public DataHandler parse(NodeList itemNodes) {
|
||||
for (int i = 0; i < itemNodes.getLength(); i++) {
|
||||
String id = "";
|
||||
String title = "";
|
||||
String description = "";
|
||||
String date = "";
|
||||
String location = "";
|
||||
String text = "";
|
||||
String category = "";
|
||||
|
||||
Node itemNode = itemNodes.item(i);
|
||||
|
||||
if (itemNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
// Convert the Node into an Element.
|
||||
Element itemElement = (Element) itemNode;
|
||||
|
||||
// Get all elements under the <item> element.
|
||||
NodeList idNodes = (itemElement).getElementsByTagName("id");
|
||||
NodeList titleNodes = (itemElement).getElementsByTagName("title");
|
||||
NodeList descriptionNodes = (itemElement).getElementsByTagName("description");
|
||||
NodeList dateNodes = (itemElement).getElementsByTagName("date");
|
||||
NodeList locationNodes = (itemElement).getElementsByTagName("location");
|
||||
NodeList textNodes = (itemElement).getElementsByTagName("content");
|
||||
NodeList categoryNodes = (itemElement).getElementsByTagName("category");
|
||||
|
||||
// Convert a Node into an Element.
|
||||
Node idElement = idNodes.item(0);
|
||||
Node titleElement = titleNodes.item(0);
|
||||
Node descriptionElement = descriptionNodes.item(0);
|
||||
Node dateElement = dateNodes.item(0);
|
||||
Node locationElement = locationNodes.item(0);
|
||||
Node textElement = textNodes.item(0);
|
||||
Node categoryElement = categoryNodes.item(0);
|
||||
|
||||
// Get all the child nodes.
|
||||
NodeList idTextNodes = idElement.getChildNodes();
|
||||
NodeList titleTextNodes = titleElement.getChildNodes();
|
||||
NodeList descriptionTextNodes = descriptionElement.getChildNodes();
|
||||
NodeList dateTextNodes = dateElement.getChildNodes();
|
||||
NodeList locationTextNodes = locationElement.getChildNodes();
|
||||
NodeList textTextNodes = textElement.getChildNodes();
|
||||
NodeList categoryTextNodes = categoryElement.getChildNodes();
|
||||
|
||||
// Retrieve the text.
|
||||
id = idTextNodes.item(0).getNodeValue(); // mandatory
|
||||
title = titleTextNodes.item(0).getNodeValue(); // mandatory
|
||||
if (descriptionTextNodes.getLength() > 0) description = descriptionTextNodes.item(0).getNodeValue();
|
||||
if (dateTextNodes.getLength() > 0) date = dateTextNodes.item(0).getNodeValue();
|
||||
if (locationTextNodes.getLength() > 0) location = locationTextNodes.item(0).getNodeValue();
|
||||
if (textTextNodes.getLength() > 0) text = textTextNodes.item(0).getNodeValue();
|
||||
if (categoryTextNodes.getLength() > 0) category = categoryTextNodes.item(0).getNodeValue();
|
||||
|
||||
dh.insert(id, title, description, date, location, text, category);
|
||||
}
|
||||
}
|
||||
return dh;
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,8 @@ public abstract class BaseDnsActivity extends Activity {
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public void doNothing(View v) {
|
||||
/* As promised. */
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,144 @@
|
||||
package com.studentersamfundet.app.ui;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnTouchListener;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
import android.view.animation.Animation;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.studentersamfundet.app.R;
|
||||
|
||||
public class DnsActivity extends BaseDnsActivity {
|
||||
String[] openingHoursHouse = {
|
||||
"13.00 - 01.00",
|
||||
"13.00 - 01.00",
|
||||
" - 01.30",
|
||||
" - 03.00",
|
||||
" - 03.00",
|
||||
"15.00 - 03.00",
|
||||
" - 19.00"};
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
}
|
||||
String[] openingHoursBC = {
|
||||
"Stengt",
|
||||
"19.00 - 00.00",
|
||||
"19.00 - 00.00",
|
||||
"19.00 - 00.00",
|
||||
"19.00 - 03.00",
|
||||
"19.00 - 03.00",
|
||||
"20.00 - 03.00"};
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.main);
|
||||
|
||||
/* Set opening hours: */
|
||||
TextView tvNeuf = (TextView)findViewById(R.id.main_menu_hours_neuf);
|
||||
TextView tvBC = (TextView)findViewById(R.id.main_menu_hours_bc);
|
||||
int day = (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) + 5) % 7;
|
||||
|
||||
tvNeuf.setText(openingHoursHouse[day]);
|
||||
tvBC.setText(openingHoursBC[day]);
|
||||
|
||||
setupFocus();
|
||||
}
|
||||
|
||||
public void setupFocus() {
|
||||
final View[] buttons = {
|
||||
findViewById(R.id.main_menu_program),
|
||||
findViewById(R.id.main_menu_hours),
|
||||
findViewById(R.id.main_menu_tickets),
|
||||
findViewById(R.id.main_menu_join),
|
||||
};
|
||||
|
||||
for (int i = 0; i < buttons.length; i++) {
|
||||
final int index = i;
|
||||
|
||||
buttons[index].setOnTouchListener(new OnTouchListener() {
|
||||
boolean pointerMoved = false;
|
||||
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
for (int j = 0; j < buttons.length; j++) {
|
||||
if (index != j) {
|
||||
Animation animation = new AlphaAnimation(1.0f, 0.6f);
|
||||
animation.setDuration(100);
|
||||
animation.setFillAfter(true);
|
||||
|
||||
buttons[j].startAnimation(animation);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
this.pointerMoved = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
/* Define the animation that makes elements opaque: */
|
||||
Animation animation = new AlphaAnimation(0.6f, 1.0f);
|
||||
animation.setDuration(50);
|
||||
animation.setFillAfter(true);
|
||||
|
||||
if (!this.pointerMoved) {
|
||||
v.performClick();
|
||||
}
|
||||
|
||||
for (int j = 0; j < buttons.length; j++) {
|
||||
buttons[j].startAnimation(animation);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
this.pointerMoved = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void programButton(View v) {
|
||||
Intent intent = new Intent();
|
||||
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
|
||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.setClass(this, ProgramListActivity.class);
|
||||
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void ticketButton(View v) {
|
||||
Intent intent = new Intent();
|
||||
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse("http://m.billettservice.no/ticket/search.do?articles=tmno&query=studentersamfundet&submit=S%C3%B8k"));
|
||||
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void newsButton(View v) {
|
||||
Toast.makeText(this, "Not implemented (yet!)", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public void joinButton(View v) {
|
||||
Intent intent = new Intent();
|
||||
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||||
intent.setClass(this, JoinUsActivity.class);
|
||||
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -60,8 +60,7 @@ public class EventViewActivity extends BaseDnsActivity {
|
||||
link.setOnClickListener(new OnClickListener() {
|
||||
|
||||
public void onClick(View v) {
|
||||
String webAdress = "http://studentersamfundet.no/vis.php?ID=" + e.id;
|
||||
Uri webDestination = Uri.parse(webAdress);
|
||||
Uri webDestination = e.getUri();
|
||||
|
||||
Intent webIntent = new Intent(Intent.ACTION_VIEW, webDestination);
|
||||
startActivity(webIntent);
|
||||
|
||||
@@ -30,14 +30,14 @@ import com.studentersamfundet.app.DataHandler;
|
||||
import com.studentersamfundet.app.Event;
|
||||
import com.studentersamfundet.app.FeedFetcher;
|
||||
import com.studentersamfundet.app.R;
|
||||
import com.studentersamfundet.app.XmlParser;
|
||||
import com.studentersamfundet.app.RSSParserProgram;
|
||||
import com.studentersamfundet.app.ui.ChooseCategoryDialog.Callback;
|
||||
|
||||
public class ProgramListActivity extends BaseDnsActivity {
|
||||
public static final String feedURL = "http://studentersamfundet.no/rss/lars_program_feed.php";
|
||||
|
||||
private FeedFetcher feed;
|
||||
private XmlParser parser;
|
||||
private RSSParserProgram parser;
|
||||
private DataHandler dataHandler;
|
||||
|
||||
private String currentCategory = Event.ALL;
|
||||
@@ -48,7 +48,7 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
setContentView(R.layout.event_list);
|
||||
|
||||
this.feed = new FeedFetcher(this, feedURL);
|
||||
this.parser = new XmlParser();
|
||||
this.parser = new RSSParserProgram();
|
||||
|
||||
ListCreator lc = new ListCreator(Event.ALL, false);
|
||||
lc.execute();
|
||||
@@ -91,7 +91,7 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
|
||||
|
||||
protected ListAdapter createAdapter(String category) {
|
||||
Event[] events = dataHandler.populateList(category);
|
||||
Event[] events = dataHandler.populateEventList(category);
|
||||
|
||||
ListAdapter adapter = new ArrayAdapter<Event>(this, R.layout.event_list_row, R.id.event_list_row_text, events) {
|
||||
@Override
|
||||
@@ -181,7 +181,7 @@ public class ProgramListActivity extends BaseDnsActivity {
|
||||
};
|
||||
|
||||
if (dataHandler != null) {
|
||||
Dialog dialog = new ChooseCategoryDialog(this, callback, dataHandler.getCategories());
|
||||
Dialog dialog = new ChooseCategoryDialog(this, callback, dataHandler.getEventCategories());
|
||||
dialog.show();
|
||||
} else {
|
||||
Toast.makeText(this, R.string.error_loading, Toast.LENGTH_SHORT);
|
||||
|
||||