/[projects]/android/FriendRadar/src/dk/thoerup/friendradar/RadarView.java
ViewVC logotype

Diff of /android/FriendRadar/src/dk/thoerup/friendradar/RadarView.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 266 by torben, Thu Aug 13 20:08:16 2009 UTC revision 267 by torben, Sat Aug 15 10:05:48 2009 UTC
# Line 38  public class RadarView extends SurfaceVi Line 38  public class RadarView extends SurfaceVi
38          int heading;          int heading;
39          String headingText = "-";          String headingText = "-";
40                    
41    
42            int width;
43            int height;
44            int hcenter;
45            int vcenter;
46                    
47    
48          boolean mRun = true;          boolean mRun = true;
# Line 87  public class RadarView extends SurfaceVi Line 92  public class RadarView extends SurfaceVi
92          }          }
93                    
94          protected void myDraw(Canvas canvas) {          protected void myDraw(Canvas canvas) {
                 int w = this.getWidth();  
                 int h = this.getHeight();  
                 int hcenter = w / 2;  
                 int vcenter = hcenter + 20;  
                   
                   
95                    
96                  canvas.drawColor(0xff000000);                  canvas.drawColor(0xff000000);
97                  canvas.drawLine(hcenter-5, vcenter-5, hcenter+5, vcenter+5, p);                  canvas.drawLine(hcenter-5, vcenter-5, hcenter+5, vcenter+5, p);
# Line 102  public class RadarView extends SurfaceVi Line 101  public class RadarView extends SurfaceVi
101                  canvas.drawCircle(hcenter, vcenter+5, 115, p);                  canvas.drawCircle(hcenter, vcenter+5, 115, p);
102                  canvas.drawCircle(hcenter, vcenter+5, 150, p);                  canvas.drawCircle(hcenter, vcenter+5, 150, p);
103                                    
104                  canvas.drawText(distanceText1, (w-textWidth1)/2, vcenter+40+6, p3);                  canvas.drawText(distanceText1, (width-textWidth1)/2, vcenter+40+6, p3);
105                  canvas.drawText(distanceText2, (w-textWidth2)/2, vcenter+80+6, p3);                  canvas.drawText(distanceText2, (width-textWidth2)/2, vcenter+80+6, p3);
106                  canvas.drawText(distanceText3, (w-textWidth3)/2, vcenter+115+6, p3);                  canvas.drawText(distanceText3, (width-textWidth3)/2, vcenter+115+6, p3);
107                  canvas.drawText(distanceText4, (w-textWidth4)/2, vcenter+150+6, p3);                  canvas.drawText(distanceText4, (width-textWidth4)/2, vcenter+150+6, p3);
108    
109                  final float correction = 5;                  final float correction = 5;
110                  final float lineLength = 150;                  final float lineLength = 150;
# Line 151  public class RadarView extends SurfaceVi Line 150  public class RadarView extends SurfaceVi
150          @Override          @Override
151          public void surfaceCreated(SurfaceHolder holder) { //surfaceholder.CallBack          public void surfaceCreated(SurfaceHolder holder) { //surfaceholder.CallBack
152                  Log.i("surfacCreated()","-");                  Log.i("surfacCreated()","-");
153                                    
154                    width = this.getWidth();
155                    height = this.getHeight();
156                    hcenter = width / 2;
157                    vcenter = hcenter + 20;
158                    
159                  t.start();                  t.start();
160          }          }
161    
# Line 270  public class RadarView extends SurfaceVi Line 275  public class RadarView extends SurfaceVi
275          }          }
276                    
277          void drawLocation(Canvas canvas, Location location) {          void drawLocation(Canvas canvas, Location location) {
                 int w = this.getWidth();  
                 int h = this.getHeight();  
                 int hcenter = w / 2;  
                 int vcenter = hcenter + 20;  
278                                    
279                  float bearing = currentLocation.bearingTo(location);                  float bearing = currentLocation.bearingTo(location);
280                  float distance = currentLocation.distanceTo(location);                  float distance = currentLocation.distanceTo(location);

Legend:
Removed from v.266  
changed lines
  Added in v.267

  ViewVC Help
Powered by ViewVC 1.1.20