Update to new room naming system
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
3
res/drawable/room_chavanne.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/room_ud2120" />
|
3
res/drawable/room_ferrer.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/room_h2215" />
|
3
res/drawable/room_guillissen.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/room_ua2220" />
|
3
res/drawable/room_lameere.xml
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:src="@drawable/room_ub2252" />
|
|
@ -146,7 +146,7 @@ public class EventDetailsFragment extends Fragment {
|
|||
((TextView) view.findViewById(R.id.time)).setText(text);
|
||||
final String roomName = event.getRoomName();
|
||||
TextView roomTextView = (TextView) view.findViewById(R.id.room);
|
||||
Spannable roomText = new SpannableString(String.format("%1$s (Building %2$s)", roomName, Building.fromRoomName(roomName)));
|
||||
Spannable roomText = new SpannableString(String.format("%1$s [Building %2$s]", roomName, Building.fromRoomName(roomName)));
|
||||
final int roomImageResId = getResources().getIdentifier(StringUtils.roomNameToResourceName(roomName), "drawable", getActivity().getPackageName());
|
||||
// If the room image exists, make the room text clickable to display it
|
||||
if (roomImageResId != 0) {
|
||||
|
|
|
@ -102,7 +102,8 @@ public class StringUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts a room name to a local drawable resource name, by stripping non-alpha chars and converting to lower case.
|
||||
* Converts a room name to a local drawable resource name, by stripping non-alpha chars and converting to lower case. Any letter following a digit will be
|
||||
* ignored, along with the rest of the string.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
@ -110,10 +111,17 @@ public class StringUtils {
|
|||
StringBuilder builder = new StringBuilder(ROOM_DRAWABLE_PREFIX.length() + roomName.length());
|
||||
builder.append(ROOM_DRAWABLE_PREFIX);
|
||||
int size = roomName.length();
|
||||
boolean lastDigit = false;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
char c = roomName.charAt(i);
|
||||
if (Character.isLetterOrDigit(c)) {
|
||||
if (Character.isLetter(c)) {
|
||||
if (lastDigit) {
|
||||
break;
|
||||
}
|
||||
builder.append(Character.toLowerCase(c));
|
||||
} else if (Character.isDigit(c)) {
|
||||
builder.append(c);
|
||||
lastDigit = true;
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
|
|