--- android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java 2010/06/07 12:13:10 804 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/RequestPlotter.java 2010/06/07 18:26:09 805 @@ -126,10 +126,11 @@ */ + final String STYLE_GREEN = "green"; + final String STYLE_YELLOW = "yellow"; + final String STYLE_RED = "red"; - - - + String oldstyle = null; Date now = new Date(); for(RequestPosition current : list) { @@ -137,21 +138,30 @@ long timediff = now.getTime() - current.time.getTime(); if ( timediff < (3*60*60*1000) ) { - style = "#red"; + style = STYLE_RED; } else if ( timediff < (24*60*60*1000)) { - style = "#yellow"; + style = STYLE_YELLOW; } else { - style = "#green"; + style = STYLE_GREEN; + } + + if ( !style.equals(oldstyle) ) { + if (oldstyle != null) + sb.append( "\n"); + sb.append( "\n"); + sb.append( " " ).append(style).append("\n"); + + oldstyle = style; } sb.append( " \n" ); - sb.append( " " + style + "\n" ); + sb.append( " #" + style + "\n" ); sb.append( " IP=" + current.ip + " Time=" + current.time + "\n" ); sb.append( " " + current.lng + "," + current.lat + ",0\n" ); sb.append( " \n" ); } - - sb.append( "\n" ); + sb.append( "\n" ); + sb.append( "\n" ); sb.append( "\n" ); return sb.toString();