Changeset 189


Ignore:
Timestamp:
04/29/08 21:32:53 (5 years ago)
Author:
saua
Message:

#79: View number of satellites

Display the number of satellites in the DetailTile?. This will be at or below the bottom of the screen on most screens/resolutions/font sizes, so this will have to wait for some better configuration to be clearly visible.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • bbtracker/trunk/src/org/bbtracker/mobile/gui/DetailsTile.java

    r165 r189  
    5151        private static final String NAME_LABEL = "Name: "; 
    5252 
     53        private static final String SATELLITES_LABEL = "Satellites: "; 
     54 
    5355        private static final int MARGIN = 2; 
    5456 
     
    6769                font = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, fontSize); 
    6870                labelWidth = 0; 
    69                 updateLabeWidth(ELEVATION_LABEL); 
    70                 updateLabeWidth(LAT_LABEL); 
    71                 updateLabeWidth(LON_LABEL); 
    72                 updateLabeWidth(TIME_LABEL); 
    73                 updateLabeWidth(DISTANCE_LABEL); 
    74                 updateLabeWidth(SPEED_LABEL); 
    75                 updateLabeWidth(POINT_LABEL); 
    76                 updateLabeWidth(NAME_LABEL); 
     71                updateLabelWidth(ELEVATION_LABEL); 
     72                updateLabelWidth(LAT_LABEL); 
     73                updateLabelWidth(LON_LABEL); 
     74                updateLabelWidth(TIME_LABEL); 
     75                updateLabelWidth(DISTANCE_LABEL); 
     76                updateLabelWidth(SPEED_LABEL); 
     77                updateLabelWidth(POINT_LABEL); 
     78                updateLabelWidth(NAME_LABEL); 
     79                updateLabelWidth(SATELLITES_LABEL); 
    7780        } 
    7881 
    79         private void updateLabeWidth(final String label) { 
     82        private void updateLabelWidth(final String label) { 
    8083                final int w = font.stringWidth(label); 
    8184                if (w > labelWidth) { 
     
    101104                double lengthValue = Double.NaN; 
    102105                String pointTime = null; 
     106                byte satellitesValue = -1; 
    103107                String time = "-"; 
    104108                if (p != null) { 
     
    109113                        elevationValue = p.getElevation(); 
    110114                        pointTime = new Date(p.getTimestamp()).toString().substring(11, 19); 
     115                        satellitesValue = p.getSatellites(); 
    111116                } 
    112117                if (track != null) { 
     
    145150                final String elevation = unit.elevationToString(elevationValue); 
    146151                final String length = unit.distanceToString(lengthValue); 
     152                final String satellites = satellitesValue > 0 ? String.valueOf(satellitesValue) : "-"; 
    147153 
    148154                final int fontHeight = font.getHeight(); 
     
    176182                g.drawString(COURSE_LABEL, MARGIN, y, Graphics.TOP | Graphics.LEFT); 
    177183                g.drawString(course, x, y, Graphics.TOP | Graphics.LEFT); 
     184                y += fontHeight; 
     185                g.drawString(SATELLITES_LABEL, MARGIN, y, Graphics.TOP | Graphics.LEFT); 
     186                g.drawString(satellites, x, y, Graphics.TOP | Graphics.LEFT); 
    178187        } 
    179188 
Note: See TracChangeset for help on using the changeset viewer.