# HG changeset patch # User Medo # Date 1344806434 -7200 # Node ID d954c1a36e51eb5b2b8e995f88864ec3c78307ba # Parent 7e09947b6aa588a7070ebf74089757266ffb6664 Hedgeroid: fix wrong filenames due to windows not treating files case sensitive diff -r 7e09947b6aa5 -r d954c1a36e51 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/RoomList.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/RoomList.java Sun Aug 12 22:46:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -package org.hedgewars.hedgeroid.netplay; - -import java.util.Map; -import java.util.TreeMap; - -import org.hedgewars.hedgeroid.Datastructures.RoomlistRoom; - -import android.util.Pair; - -public class Roomlist extends ObservableTreeMap> { - private long nextId = 1; - - public void updateList(RoomlistRoom[] newRooms) { - Map> newMap = new TreeMap>(); - for(RoomlistRoom room : newRooms) { - Pair oldEntry = get(room.name); - if(oldEntry == null) { - newMap.put(room.name, Pair.create(room, nextId++)); - } else { - newMap.put(room.name, Pair.create(room, oldEntry.second)); - } - } - replaceContent(newMap); - } - - public void addRoomWithNewId(RoomlistRoom room) { - put(room.name, Pair.create(room, nextId++)); - } - - public void updateRoom(String name, RoomlistRoom room) { - Pair oldEntry = get(name); - if(oldEntry == null) { - addRoomWithNewId(room); - } else { - remove(name); - put(room.name, Pair.create(room, oldEntry.second)); - } - } -} diff -r 7e09947b6aa5 -r d954c1a36e51 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/RoomListAdapter.java --- a/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/RoomListAdapter.java Sun Aug 12 22:46:53 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -package org.hedgewars.hedgeroid.netplay; - -import java.util.Comparator; - -import org.hedgewars.hedgeroid.R; -import org.hedgewars.hedgeroid.Datastructures.RoomlistRoom; - -import android.content.Context; -import android.content.res.Resources; -import android.util.Pair; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -public class RoomlistAdapter extends ObservableTreeMapAdapter> { - private Context context; - - public RoomlistAdapter(Context context) { - this.context = context; - } - - @Override - protected Comparator> getEntryOrder() { - return RoomAgeComparator.INSTANCE; - } - - public RoomlistRoom getItem(int position) { - return getEntries().get(position).first; - } - - public long getItemId(int position) { - return getEntries().get(position).second; - } - - public boolean hasStableIds() { - return true; - } - - private static CharSequence formatExtra(Resources res, RoomlistRoom room) { - String ownermsg = res.getString(R.string.roomlist_owner, room.owner); - String mapmsg = res.getString(R.string.roomlist_map, room.formatMapName(res)); - String scheme = room.scheme.equals(room.weapons) ? room.scheme : room.scheme + " / " + room.weapons; - String schememsg = res.getString(R.string.roomlist_scheme, scheme); - return ownermsg + ". " + mapmsg + ", " + schememsg; - } - - public View getView(int position, View convertView, ViewGroup parent) { - View v = convertView; - if (v == null) { - LayoutInflater vi = LayoutInflater.from(context); - v = vi.inflate(R.layout.listview_room, null); - } - - RoomlistRoom room = getItem(position); - int iconRes = room.inProgress ? R.drawable.roomlist_ingame : R.drawable.roomlist_preparing; - - if(v.findViewById(android.R.id.text1) == null) { - // Tabular room list - TextView roomnameView = (TextView)v.findViewById(R.id.roomname); - TextView playerCountView = (TextView)v.findViewById(R.id.playercount); - TextView teamCountView = (TextView)v.findViewById(R.id.teamcount); - TextView ownerView = (TextView)v.findViewById(R.id.owner); - TextView mapView = (TextView)v.findViewById(R.id.map); - TextView schemeView = (TextView)v.findViewById(R.id.scheme); - TextView weaponView = (TextView)v.findViewById(R.id.weapons); - - roomnameView.setCompoundDrawablesWithIntrinsicBounds(iconRes, 0, 0, 0); - roomnameView.setText(room.name); - if(playerCountView != null) { - playerCountView.setText(String.valueOf(room.playerCount)); - } - if(teamCountView != null) { - teamCountView.setText(String.valueOf(room.teamCount)); - } - ownerView.setText(room.owner); - mapView.setText(room.formatMapName(context.getResources())); - schemeView.setText(room.scheme); - weaponView.setText(room.weapons); - } else { - // Small room list - TextView v1 = (TextView)v.findViewById(android.R.id.text1); - TextView v2 = (TextView)v.findViewById(android.R.id.text2); - - v1.setCompoundDrawablesWithIntrinsicBounds(iconRes, 0, 0, 0); - v1.setText(room.name); - v2.setText(formatExtra(context.getResources(), room)); - } - - return v; - } - - private static final class RoomAgeComparator implements Comparator> { - public static final RoomAgeComparator INSTANCE = new RoomAgeComparator(); - public int compare(Pair lhs, Pair rhs) { - return rhs.second.compareTo(lhs.second); - } - } -} \ No newline at end of file diff -r 7e09947b6aa5 -r d954c1a36e51 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Roomlist.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/Roomlist.java Sun Aug 12 23:20:34 2012 +0200 @@ -0,0 +1,39 @@ +package org.hedgewars.hedgeroid.netplay; + +import java.util.Map; +import java.util.TreeMap; + +import org.hedgewars.hedgeroid.Datastructures.RoomlistRoom; + +import android.util.Pair; + +public class Roomlist extends ObservableTreeMap> { + private long nextId = 1; + + public void updateList(RoomlistRoom[] newRooms) { + Map> newMap = new TreeMap>(); + for(RoomlistRoom room : newRooms) { + Pair oldEntry = get(room.name); + if(oldEntry == null) { + newMap.put(room.name, Pair.create(room, nextId++)); + } else { + newMap.put(room.name, Pair.create(room, oldEntry.second)); + } + } + replaceContent(newMap); + } + + public void addRoomWithNewId(RoomlistRoom room) { + put(room.name, Pair.create(room, nextId++)); + } + + public void updateRoom(String name, RoomlistRoom room) { + Pair oldEntry = get(name); + if(oldEntry == null) { + addRoomWithNewId(room); + } else { + remove(name); + put(room.name, Pair.create(room, oldEntry.second)); + } + } +} diff -r 7e09947b6aa5 -r d954c1a36e51 project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/RoomlistAdapter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/project_files/Android-build/SDL-android-project/src/org/hedgewars/hedgeroid/netplay/RoomlistAdapter.java Sun Aug 12 23:20:34 2012 +0200 @@ -0,0 +1,99 @@ +package org.hedgewars.hedgeroid.netplay; + +import java.util.Comparator; + +import org.hedgewars.hedgeroid.R; +import org.hedgewars.hedgeroid.Datastructures.RoomlistRoom; + +import android.content.Context; +import android.content.res.Resources; +import android.util.Pair; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; + +public class RoomlistAdapter extends ObservableTreeMapAdapter> { + private Context context; + + public RoomlistAdapter(Context context) { + this.context = context; + } + + @Override + protected Comparator> getEntryOrder() { + return RoomAgeComparator.INSTANCE; + } + + public RoomlistRoom getItem(int position) { + return getEntries().get(position).first; + } + + public long getItemId(int position) { + return getEntries().get(position).second; + } + + public boolean hasStableIds() { + return true; + } + + private static CharSequence formatExtra(Resources res, RoomlistRoom room) { + String ownermsg = res.getString(R.string.roomlist_owner, room.owner); + String mapmsg = res.getString(R.string.roomlist_map, room.formatMapName(res)); + String scheme = room.scheme.equals(room.weapons) ? room.scheme : room.scheme + " / " + room.weapons; + String schememsg = res.getString(R.string.roomlist_scheme, scheme); + return ownermsg + ". " + mapmsg + ", " + schememsg; + } + + public View getView(int position, View convertView, ViewGroup parent) { + View v = convertView; + if (v == null) { + LayoutInflater vi = LayoutInflater.from(context); + v = vi.inflate(R.layout.listview_room, null); + } + + RoomlistRoom room = getItem(position); + int iconRes = room.inProgress ? R.drawable.roomlist_ingame : R.drawable.roomlist_preparing; + + if(v.findViewById(android.R.id.text1) == null) { + // Tabular room list + TextView roomnameView = (TextView)v.findViewById(R.id.roomname); + TextView playerCountView = (TextView)v.findViewById(R.id.playercount); + TextView teamCountView = (TextView)v.findViewById(R.id.teamcount); + TextView ownerView = (TextView)v.findViewById(R.id.owner); + TextView mapView = (TextView)v.findViewById(R.id.map); + TextView schemeView = (TextView)v.findViewById(R.id.scheme); + TextView weaponView = (TextView)v.findViewById(R.id.weapons); + + roomnameView.setCompoundDrawablesWithIntrinsicBounds(iconRes, 0, 0, 0); + roomnameView.setText(room.name); + if(playerCountView != null) { + playerCountView.setText(String.valueOf(room.playerCount)); + } + if(teamCountView != null) { + teamCountView.setText(String.valueOf(room.teamCount)); + } + ownerView.setText(room.owner); + mapView.setText(room.formatMapName(context.getResources())); + schemeView.setText(room.scheme); + weaponView.setText(room.weapons); + } else { + // Small room list + TextView v1 = (TextView)v.findViewById(android.R.id.text1); + TextView v2 = (TextView)v.findViewById(android.R.id.text2); + + v1.setCompoundDrawablesWithIntrinsicBounds(iconRes, 0, 0, 0); + v1.setText(room.name); + v2.setText(formatExtra(context.getResources(), room)); + } + + return v; + } + + private static final class RoomAgeComparator implements Comparator> { + public static final RoomAgeComparator INSTANCE = new RoomAgeComparator(); + public int compare(Pair lhs, Pair rhs) { + return rhs.second.compareTo(lhs.second); + } + } +} \ No newline at end of file