Commit a2a0f8e7 authored by Rufus's avatar Rufus

Adds mapping table Room - Building

parent eaec48c8
......@@ -2,33 +2,84 @@ package at.linuxtage.companion.model;
import android.text.TextUtils;
import at.linuxtage.companion.R;
public enum Building {
J, K, H, U, AW, Unknown;
//TODO mapping of Building to room for GLT
public static Building fromRoomName(String roomName) {
if (!TextUtils.isEmpty(roomName)) {
switch (Character.toUpperCase(roomName.charAt(0))) {
case 'K':
return K;
case 'H':
return H;
case 'U':
return U;
}
if (roomName.regionMatches(true, 0, "AW", 0, 1)) {
return AW;
}
if ("Janson".equalsIgnoreCase(roomName)) {
return J;
}
if ("Ferrer".equalsIgnoreCase(roomName)) {
return H;
}
if ("Chavanne".equalsIgnoreCase(roomName) || "Lameere".equalsIgnoreCase(roomName) || "Guillissen".equalsIgnoreCase(roomName)) {
return U;
}
}
return Unknown;
}
I12("Inffeldgasse 12"), Unknown("Unknown"), I18EG("Inffeldgasse 16a EG"), I25fEG("Inffeldgasse 25f EG"), I10("Inffeldgasse 10"), I25d("Inffeldgasse 25d"), I251OG("Inffeldgasse 25 1. OG"), I12EG("Inffeldgasse 12"), I16bK("Inffeldgasse 16b Keller"), I18("Inffeldgasse 18");
private final String name;
Building(String name) {
this.name = name;
}
@Override
public String toString() {
if (this.equals(Unknown)) {
//return getString(R.string.unknown);
}
return this.name;
}
//TODO mapping of Building to room for GLT
public static Building fromRoomName(String roomName) {
Building building = Unknown;
if (!TextUtils.isEmpty(roomName)) {
switch (roomName) {
case "HF01092":
building = I12;
break;
case "HSTP056J":
case "i1":
case "HSEG058J":
case "IFEG042":
building = I18EG;
break;
case "MFEG210":
building = I25fEG;
break;
case "SZ01070":
case "SZ02053":
building = I10;
break;
case "i3":
case "i4":
case "i5":
case "i6":
building = I25d;
break;
case "i11":
case "ICK1002H":
case "i12":
case "ICK1130H":
case "i13":
case "ICK1120H":
building = I16bK;
break;
case "i14":
case "i15":
building = I18;
break;
case "i2":
case "HFEG038J":
building = I12EG;
break;
case "i7":
case "MD01168F":
building = I251OG;
break;
}
}
return building;
}
}
......@@ -3,6 +3,7 @@
<string name="app_name">GLT Begleiter</string>
<!-- Main screen -->
<string name="unknown">Unbekannt</string>
<string name="main_menu">Hauptmenü</string>
<string name="day_no">Tag %1$d</string>
<string name="close_menu">Menü schließen</string>
......
......@@ -13,7 +13,7 @@
<string name="update_events_db">Update events database</string>
<string name="events_download_up_to_date">Database is already up-to-date</string>
<string name="events_download_empty">No new events found</string>
<string name="unknown">Unknown</string>
<plurals name="events_download_completed">
<item quantity="one">Completed downloading %1$d event</item>
<item quantity="other">Completed downloading %1$d events</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment