Permalink
Browse files

Removed .bak files

  • Loading branch information...
1 parent e8d48a1 commit c7e3bfb32418f3bbbcb30bcaeea31593b8edbb8a @mdwoolley mdwoolley committed Oct 4, 2012
View
17 NFC/NfcRaceTime7/src/nfc/sample/racetimebb7/ColouredBackground.java.bak
@@ -1,17 +0,0 @@
-package nfc.sample.racetimebb7;
-
-import net.rim.device.api.ui.container.HorizontalFieldManager;
-import net.rim.device.api.ui.decor.Background;
-import net.rim.device.api.ui.decor.BackgroundFactory;
-
-public class ColouredBackground extends HorizontalFieldManager {
-
- Background background;
-
- public ColouredBackground(int colour, long style) {
- super(style);
- background = BackgroundFactory.createSolidBackground(colour);
- setBackground(background);
- }
-
-}
View
46 NFC/NfcRaceTime7/src/nfc/sample/racetimebb7/Listener.java.bak
@@ -1,46 +0,0 @@
-package nfc.sample.racetimebb7;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Timer;
-
-import net.rim.device.api.io.nfc.ndef.NDEFMessage;
-import net.rim.device.api.io.nfc.ndef.NDEFMessageListener;
-import net.rim.device.api.io.nfc.ndef.NDEFRecord;
-
-public class Listener implements NDEFMessageListener {
-
- Timer timer;
-
- public void onNDEFMessageDetected(NDEFMessage msg) {
- Utilities.log("XXXX onNDEFMessageDetected");
- NDEFRecord[] records = msg.getRecords();
- int numRecords = records.length;
- if(numRecords > 0) {
- byte[] payloadBytes = records[0].getPayload();
- try {
- String ascii_payload = new String(payloadBytes,"US-ASCII");
- Utilities.log("XXXX payload="+ascii_payload);
- if (ascii_payload.equals("start")) {
- startTimer();
- }
- if (ascii_payload.equals("stop")) {
- stopTimer();
- }
- } catch(UnsupportedEncodingException e) {
- Utilities.log("XXXX "+e.getClass().getName()+":"+e.getMessage());
- }
- }
-
- }
-
- private void startTimer() {
- RaceTimer race_timer = new RaceTimer();
- timer = new Timer();
- timer.scheduleAtFixedRate(race_timer, 1000, 1000);
- }
-
- private void stopTimer() {
- timer.cancel();
- }
-
-}
View
28 NFC/NfcRaceTime7/src/nfc/sample/racetimebb7/MyApp.java.bak
@@ -1,28 +0,0 @@
-package nfc.sample.racetimebb7;
-
-import net.rim.device.api.ui.UiApplication;
-
-public class MyApp extends UiApplication {
-
- public static void main(String[] args) {
- MyApp app = new MyApp();
- NdefListenerManager ndef_mgr = NdefListenerManager.getInstance();
- Utilities.initLogging();
- if (args.length > 0) {
- if (args[0].equals("auto")) {
- Listener listener = new Listener();
- ndef_mgr.registerListener(listener);
- }
- } else {
- Listener listener = new Listener();
- ndef_mgr.registerListener(listener);
- app.pushScreen(TimerScreen.getTimerScreen());
- app.enterEventDispatcher();
- }
- Utilities.log("XXXX exiting");
- }
-
- public MyApp() {
- }
-
-}
View
19 NFC/NfcRaceTime7/src/nfc/sample/racetimebb7/RaceTimer.java.bak
@@ -1,19 +0,0 @@
-package nfc.sample.racetimebb7;
-
-import java.util.TimerTask;
-
-public class RaceTimer extends TimerTask {
-
- private Time time = Time.getInstance();
-
- public RaceTimer() {
- time.start();
- }
-
- public void run() {
- TimerScreen screen = TimerScreen.getTimerScreen();
- time.setNow();
- screen.updateTime(time);
- }
-
-}
View
103 NFC/NfcRaceTime7/src/nfc/sample/racetimebb7/Time.java.bak
@@ -1,103 +0,0 @@
-package nfc.sample.racetimebb7;
-
-import java.util.Calendar;
-import java.util.Date;
-
-public class Time {
-
- private static Time time;
-
-// private Calendar cal = Calendar.getInstance();
- private long started_at_ms=0;
- private long now=0;
- private long elapsed=0;
-
- private int hour1;
- private int hour2;
- private int minute1;
- private int minute2;
- private int second1;
- private int second2;
-
- private long MS_HOUR=3600000;
- private long MS_MINUTE=60000;
- private long MS_SECOND=1000;
-
- public static Time getInstance() {
- if (time == null) {
- time = new Time();
- }
- return time;
- }
-
- private Time() {
- }
-
- public void start() {
- started_at_ms = System.currentTimeMillis();
- Utilities.log("XXXX started_at_ms set to:"+started_at_ms);
- }
-
- public void setNow() {
- now = System.currentTimeMillis();
- Utilities.log("XXXX started_at_ms:"+started_at_ms);
- Utilities.log("XXXX now:"+now);
- elapsed = now - started_at_ms;
- Utilities.log("XXXX elapsed:"+elapsed);
-// cal.setTime(new Date(elapsed));
-
-// int hours = cal.get(Calendar.HOUR_OF_DAY);
-// int minutes = cal.get(Calendar.MINUTE);
-// int seconds = cal.get(Calendar.SECOND);
-
- int hours = (int) (elapsed / MS_HOUR);
- int remainder = (int) (elapsed - (hours * MS_HOUR));
- int minutes = (int) (remainder / MS_MINUTE);
- remainder = (int) (remainder - (minutes * MS_MINUTE));
- int seconds = (int) (remainder / MS_SECOND);
-
- Utilities.log("XXXX hours="+hours+",minutes="+minutes+",seconds="+seconds);
-
- hour1 = hours / 10;
- hour2 = hours % 10;
- minute1 = minutes / 10;
- minute2 = minutes % 10;
- second1 = seconds / 10;
- second2 = seconds % 10;
-
- Utilities.log("XXXX hour1="+hour1+",hour2="+hour2+",minute1="+minute1+",minute2="+minute2+",second1="+second1+",second2="+second2);
- }
-
- public long getStarted_at_ms() {
- return started_at_ms;
- }
-
- public void setStarted_at_ms(long started_at_ms) {
- this.started_at_ms = started_at_ms;
- }
-
- public int getHour1() {
- return hour1;
- }
-
- public int getHour2() {
- return hour2;
- }
-
- public int getMinute1() {
- return minute1;
- }
-
- public int getMinute2() {
- return minute2;
- }
-
- public int getSecond1() {
- return second1;
- }
-
- public int getSecond2() {
- return second2;
- }
-
-}
View
86 NFC/NfcRaceTime7/src/nfc/sample/racetimebb7/TimerScreen.java.bak
@@ -1,86 +0,0 @@
-package nfc.sample.racetimebb7;
-
-import net.rim.device.api.system.Bitmap;
-import net.rim.device.api.system.Display;
-import net.rim.device.api.ui.Color;
-import net.rim.device.api.ui.Field;
-import net.rim.device.api.ui.Screen;
-import net.rim.device.api.ui.UiApplication;
-import net.rim.device.api.ui.component.BitmapField;
-import net.rim.device.api.ui.container.AbsoluteFieldManager;
-import net.rim.device.api.ui.container.MainScreen;
-
-public final class TimerScreen extends MainScreen {
-
- public static TimerScreen screen;
-
- Bitmap[] digits = { Bitmap.getBitmapResource("60px-Seven-segment_0.png"), Bitmap.getBitmapResource("60px-Seven-segment_1.png"), Bitmap.getBitmapResource("60px-Seven-segment_2.png"),
- Bitmap.getBitmapResource("60px-Seven-segment_3.png"), Bitmap.getBitmapResource("60px-Seven-segment_4.png"), Bitmap.getBitmapResource("60px-Seven-segment_5.png"),
- Bitmap.getBitmapResource("60px-Seven-segment_6.png"), Bitmap.getBitmapResource("60px-Seven-segment_7.png"), Bitmap.getBitmapResource("60px-Seven-segment_8.png"),
- Bitmap.getBitmapResource("60px-Seven-segment_9.png") };
-
- Bitmap colon = Bitmap.getBitmapResource("60px-Seven-segment_colon.png");
-
- BitmapField hour1;
- BitmapField hour2;
- BitmapField colon1;
- BitmapField minute1;
- BitmapField minute2;
- BitmapField colon2;
- BitmapField second1;
- BitmapField second2;
-
- public synchronized static TimerScreen getTimerScreen() {
- if(screen == null) {
- screen = new TimerScreen();
- }
- return screen;
- }
-
- private TimerScreen() {
- super(Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH | Screen.NO_VERTICAL_SCROLL);
- ColouredBackground bg = new ColouredBackground(Color.WHITE, Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH | Screen.NO_VERTICAL_SCROLL);
- AbsoluteFieldManager ab_mgr = new AbsoluteFieldManager();
- hour1 = new BitmapField(digits[0]);
- hour2 = new BitmapField(digits[0]);
- minute1 = new BitmapField(digits[0]);
- minute2 = new BitmapField(digits[0]);
- second1 = new BitmapField(digits[0]);
- second2 = new BitmapField(digits[0]);
- colon1 = new BitmapField(colon);
- colon2 = new BitmapField(colon);
- bg.add(ab_mgr);
-
- int y = (Display.getHeight() - 112) / 2; // images are 112 pixels high
- int x = (Display.getWidth() - (8 * 60)) / 2; // and 60 pixels wide
-
- ab_mgr.add(hour1, x, y);
- x = x + 60;
- ab_mgr.add(hour2, x, y);
- x = x + 60;
- ab_mgr.add(colon1, x, y);
- x = x + 60;
- ab_mgr.add(minute1, x, y);
- x = x + 60;
- ab_mgr.add(minute2, x, y);
- x = x + 60;
- ab_mgr.add(colon2, x, y);
- x = x + 60;
- ab_mgr.add(second1, x, y);
- x = x + 60;
- ab_mgr.add(second2, x, y);
- add(bg);
- }
-
- public void updateTime(Time time) {
- synchronized(UiApplication.getEventLock()) {
- hour1.setBitmap(digits[time.getHour1()]);
- hour2.setBitmap(digits[time.getHour2()]);
- minute1.setBitmap(digits[time.getMinute1()]);
- minute2.setBitmap(digits[time.getMinute2()]);
- second1.setBitmap(digits[time.getSecond1()]);
- second2.setBitmap(digits[time.getSecond2()]);
- invalidate();
- }
- }
-}

0 comments on commit c7e3bfb

Please sign in to comment.