Changeset 62


Ignore:
Timestamp:
08/08/07 03:20:42 (6 years ago)
Author:
saua
Message:

make status text size configurable

Location:
bbtracker/trunk/src/org/bbtracker/mobile
Files:
4 edited

Legend:

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

    r61 r62  
    2424import java.io.IOException; 
    2525 
     26import javax.microedition.lcdui.Font; 
    2627import javax.microedition.rms.InvalidRecordIDException; 
    2728import javax.microedition.rms.RecordEnumeration; 
     
    8586 
    8687        private int units = UNITS_METRIC; 
     88 
     89        private int statusFontSize = Font.SIZE_MEDIUM; 
    8790 
    8891        private String exportDirectory; 
     
    164167        } 
    165168 
     169        public int getStatusFontSize() { 
     170                return statusFontSize; 
     171        } 
     172 
     173        public void setStatusFontSize(final int statusFontSize) { 
     174                this.statusFontSize = statusFontSize; 
     175        } 
     176 
    166177        public int getNextTrackNumber() { 
    167178                return trackNumber++; 
     
    199210                        exportFormats = in.readInt(); 
    200211                        units = in.readInt(); 
     212                        statusFontSize = in.readInt(); 
    201213 
    202214                        in.close(); 
     
    237249                        out.writeInt(exportFormats); 
    238250                        out.writeInt(units); 
     251                        out.writeInt(statusFontSize); 
    239252 
    240253                        out.close(); 
  • bbtracker/trunk/src/org/bbtracker/mobile/gui/MainCanvas.java

    r61 r62  
    215215                super.showNotify(); 
    216216                manager.addPointListener(this); 
     217                updateTileSize(); 
    217218                for (int i = 0; i < visibleTiles.length && visibleTiles[i] != null; i++) { 
    218219                        visibleTiles[i].showNotify(); 
  • bbtracker/trunk/src/org/bbtracker/mobile/gui/OptionsForm.java

    r61 r62  
    2424import javax.microedition.lcdui.Display; 
    2525import javax.microedition.lcdui.Displayable; 
     26import javax.microedition.lcdui.Font; 
    2627import javax.microedition.lcdui.Form; 
    2728import javax.microedition.lcdui.Item; 
     
    5354        private final ChoiceGroup unitsGroup; 
    5455 
     56        private final ChoiceGroup statusFontSizeGroup; 
     57 
    5558        public OptionsForm(final TrackManager trackManager) { 
    5659                super("Options"); 
     
    6568                unitsGroup = new ChoiceGroup("Units: ", Choice.POPUP, Preferences.UNITS, null); 
    6669                unitsGroup.setSelectedIndex(pref.getUnits(), true); 
     70 
     71                statusFontSizeGroup = new ChoiceGroup("Status text size: ", Choice.POPUP, new String[] { "Small", "Medium", 
     72                                "Large" }, null); 
     73                int selectedFontSizeItem; 
     74                switch (pref.getStatusFontSize()) { 
     75                case Font.SIZE_SMALL: 
     76                        selectedFontSizeItem = 0; 
     77                        break; 
     78                case Font.SIZE_MEDIUM: 
     79                        selectedFontSizeItem = 1; 
     80                        break; 
     81                case Font.SIZE_LARGE: 
     82                        selectedFontSizeItem = 2; 
     83                        break; 
     84                default: 
     85                        selectedFontSizeItem = 1; 
     86                } 
     87                statusFontSizeGroup.setSelectedIndex(selectedFontSizeItem, true); 
    6788 
    6889                startTypeGroup = new ChoiceGroup("Startup action: ", Choice.POPUP, Preferences.START_ACTIONS, null); 
     
    81102                append(sampleField); 
    82103                append(unitsGroup); 
     104                append(statusFontSizeGroup); 
    83105                append(startTypeGroup); 
    84106                append(directoryField); 
     
    108130 
    109131                                pref.setUnits(unitsGroup.getSelectedIndex()); 
     132 
     133                                final int newFontSize; 
     134                                switch (statusFontSizeGroup.getSelectedIndex()) { 
     135                                case 0: 
     136                                        newFontSize = Font.SIZE_SMALL; 
     137                                        break; 
     138                                case 1: 
     139                                        newFontSize = Font.SIZE_MEDIUM; 
     140                                        break; 
     141                                case 2: 
     142                                        newFontSize = Font.SIZE_LARGE; 
     143                                        break; 
     144                                default: 
     145                                        throw new IllegalStateException(); 
     146                                } 
     147                                pref.setStatusFontSize(newFontSize); 
    110148 
    111149                                pref.store(); 
  • bbtracker/trunk/src/org/bbtracker/mobile/gui/StatusTile.java

    r61 r62  
    192192 
    193193        public int getPreferredHeight(final int width) { 
     194                setFontSize(Preferences.getInstance().getStatusFontSize()); 
    194195                final int lineCount; 
    195196                if (fitsTwoLineLayout(width)) { 
Note: See TracChangeset for help on using the changeset viewer.