Added opening hours for ticket office and cleaned up some code in main activity.

This commit is contained in:
Lars Jansøn Engvik committed 2012-11-14 10:12:10 +01:00
1 parent 45bf722844
commit d09c5ec326
4 files changed
+81 -35

No files matched your search

+3 -5
View File
@@ -15,7 +15,7 @@
android:layout_below="@id/header"
android:layout_alignParentBottom="true"
android:layout_marginTop="20px"
android:layout_marginBottom="50px"
android:layout_marginBottom="20px"
android:orientation="vertical"
android:gravity="center">
@@ -64,10 +64,8 @@
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_margin="5px" />
android:layout_margin="5px" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
+23
View File
@@ -82,4 +82,27 @@
android:layout_width="fill_parent"
android:layout_weight="0.5" />
</LinearLayout>
<LinearLayout android:id="@+id/main_menu_hours_to_header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginTop="10px"
android:layout_marginBottom="10px"
android:orientation="horizontal">
<TextView
style="@style/OpeningHoursText"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="0.5"
android:layout_marginLeft="20px"
android:text="Billettluka" />
<!-- This is set in Java: -->
<TextView android:id="@+id/main_menu_hours_to"
style="@style/OpeningHoursText"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_weight="0.5" />
</LinearLayout>
</LinearLayout>
+49
View File
@@ -64,5 +64,54 @@ public class Utils {
}
}
// Gets the opening hours for a specific place on this day.
public static String getOpeningHours(String get, int day) {
// Chateau Neuf
if (get.compareTo("cn")==0) {
String[] cn = {
"10.00 - 01.00",
"10.00 - 01.00",
"10.00 - 01.00",
"10.00 - 03.00",
"10.00 - 03.00",
"12.00 - 03.00",
"12.00 - 20.00"};
return cn[day];
// Glassbaren
} else if (get.compareTo("gb")==0) {
String[] gb = {
"11.00 - 01.00",
"11.00 - 01.00",
"11.00 - 01.00",
"11.00 - 03.00",
"11.00 - 03.00",
"16.00 - 03.00",
"Stengt"};
return gb[day];
// BokCaféen
} else if (get.compareTo("bc")==0) {
String[] bc = {
"19.00 - 00.00",
"19.00 - 00.00",
"19.00 - 00.00",
"19.00 - 02.00",
"19.00 - 03.00",
"21.00 - 03.00",
"Stengt"};
return bc[day];
// Billettluka
} else if (get.compareTo("to")==0) {
String[] to = {
"15.30 - 20.30",
"15.30 - 20.30",
"15.30 - 20.30",
"15.30 - 20.30",
"15.30 - 20.30",
"Stengt",
"Stengt"};
return to[day];
} else
return null; // Shouldn't happen.
}
}
@@ -15,6 +15,7 @@ import com.studentersamfundet.app.FeedFetcher;
import com.studentersamfundet.app.JSONParserNews;
import com.studentersamfundet.app.R;
import com.studentersamfundet.app.JSONParserProgram;
import com.studentersamfundet.app.Utils;
import com.studentersamfundet.app.ui.lists.EventListActivity;
import com.studentersamfundet.app.ui.lists.EventListTicketsActivity;
import com.studentersamfundet.app.ui.lists.NewsListActivity;
@@ -26,33 +27,6 @@ public class DnsActivity extends BaseDnsActivity {
private FeedFetcher eventFeedFetcher;
private FeedFetcher newsFeedFetcher;
private String[] openingHoursHouse = {
"10.00 - 01.00",
"10.00 - 01.00",
"10.00 - 01.00",
"10.00 - 03.00",
"10.00 - 03.00",
"12.00 - 03.00",
"12.00 - 20.00"};
private String[] openingHoursGB = {
"13.00 - 01.00",
"13.00 - 01.00",
"13.00 - 01.00",
"13.00 - 03.00",
"13.00 - 03.00",
"16.00 - 03.00",
"Stengt"};
private String[] openingHoursBC = {
"19.00 - 00.00",
"19.00 - 00.00",
"19.00 - 00.00",
"19.00 - 03.00",
"19.00 - 03.00",
"20.00 - 03.00",
"Stengt"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -67,11 +41,13 @@ public class DnsActivity extends BaseDnsActivity {
TextView tvNeuf = (TextView)findViewById(R.id.main_menu_hours_neuf);
TextView tvBC = (TextView)findViewById(R.id.main_menu_hours_bc);
TextView tvGB = (TextView)findViewById(R.id.main_menu_hours_gb);
TextView tvTO = (TextView)findViewById(R.id.main_menu_hours_to);
int day = (Calendar.getInstance().get(Calendar.DAY_OF_WEEK) + 5) % 7;
tvNeuf.setText(openingHoursHouse[day]);
tvBC.setText(openingHoursBC[day]);
tvGB.setText(openingHoursGB[day]);
tvNeuf.setText(Utils.getOpeningHours("cn", day));
tvBC.setText(Utils.getOpeningHours("bc", day));
tvGB.setText(Utils.getOpeningHours("gb", day));
tvTO.setText(Utils.getOpeningHours("to", day));
setupFocus();
}