• R/O
  • HTTP
  • SSH
  • HTTPS

JoggingTimer: Commit

A jogging timer for Android wear.


Commit MetaInfo

Revisiona2bb240d3015fa45d1c325cfd38370553c998911 (tree)
Time2018-04-15 18:44:40
AuthorMRSa <mrsa@myad...>
CommiterMRSa

Log Message

グラフ一覧でラップタイムのところに線をつなぐようにした。

Change Summary

Incremental Difference

--- a/wear/src/main/java/net/osdn/gokigen/joggingtimer/stopwatch/MainActivity.java
+++ b/wear/src/main/java/net/osdn/gokigen/joggingtimer/stopwatch/MainActivity.java
@@ -8,9 +8,7 @@ import android.support.wearable.activity.WearableActivity;
88 import android.util.Log;
99 import android.view.KeyEvent;
1010 import android.view.View;
11-import android.widget.ArrayAdapter;
1211 import android.widget.ImageButton;
13-import android.widget.ListAdapter;
1412 import android.widget.ListView;
1513 import android.widget.RelativeLayout;
1614 import android.widget.TextView;
@@ -18,7 +16,6 @@ import android.widget.TextView;
1816 import net.osdn.gokigen.joggingtimer.R;
1917 import net.osdn.gokigen.joggingtimer.recordlist.ListActivity;
2018 import net.osdn.gokigen.joggingtimer.stopwatch.graphview.LapTimeGraphView;
21-import net.osdn.gokigen.joggingtimer.stopwatch.listview.LapTimeItems;
2219 import net.osdn.gokigen.joggingtimer.utilities.TimeStringConvert;
2320
2421 import java.text.SimpleDateFormat;
@@ -563,7 +560,7 @@ public class MainActivity extends WearableActivity implements IClickCallback, My
563560 */
564561 private void updateElapsedTimesGraph()
565562 {
566- Log.v(TAG, "updateElapsedTimesGraph()");
563+ //Log.v(TAG, "updateElapsedTimesGraph()");
567564 LapTimeGraphView view = findViewById(R.id.graph_area);
568565 view.invalidate();
569566 }
--- a/wear/src/main/java/net/osdn/gokigen/joggingtimer/stopwatch/graphview/LapTimeGraphView.java
+++ b/wear/src/main/java/net/osdn/gokigen/joggingtimer/stopwatch/graphview/LapTimeGraphView.java
@@ -4,6 +4,7 @@ import android.content.Context;
44 import android.graphics.Canvas;
55 import android.graphics.Color;
66 import android.graphics.Paint;
7+import android.graphics.Path;
78 import android.graphics.Rect;
89 import android.graphics.RectF;
910 import android.util.AttributeSet;
@@ -226,8 +227,8 @@ public class LapTimeGraphView extends View
226227
227228 Paint paint = new Paint();
228229 paint.setColor(Color.WHITE);
229- paint.setStyle(Paint.Style.STROKE);
230- paint.setStyle(Paint.Style.FILL);
230+ paint.setColor(Color.GRAY);
231+ paint.setStyle(Paint.Style.FILL_AND_STROKE);
231232 paint.setStrokeWidth(0.0f);
232233 paint.setAntiAlias(true);
233234
@@ -244,17 +245,27 @@ public class LapTimeGraphView extends View
244245 return;
245246 }
246247
248+ Path linePath = new Path();
249+ linePath.moveTo(0.0f, height); // 0原点から線を引く
247250 for (Long time : curLapTimeList)
248251 {
249- canvas.drawCircle((startX + (boxWidthUnit / 2.0f)), (height - boxHeightUnit * time), circleRadius, paint);
252+ float cX = (startX + (boxWidthUnit / 2.0f));
253+ float cY = (height - boxHeightUnit * time);
254+ linePath.lineTo(cX, cY);
255+ canvas.drawCircle(cX, cY, circleRadius, paint);
250256 startX = startX + boxWidthUnit;
251257 }
252-
253258 if (isStarted)
254259 {
255260 long currentLapTime = System.currentTimeMillis() - lastSystemLaptime;
256- canvas.drawCircle((startX + (boxWidthUnit / 2.0f)), (height - boxHeightUnit * currentLapTime), circleRadius, paint);
261+ float cX = (startX + (boxWidthUnit / 2.0f));
262+ float cY = (height - boxHeightUnit * currentLapTime);
263+ linePath.lineTo(cX, cY);
264+ canvas.drawCircle(cX, cY, circleRadius, paint);
257265 }
266+ paint.setStyle(Paint.Style.STROKE);
267+ paint.setColor(Color.GRAY);
268+ canvas.drawPath(linePath, paint);
258269 }
259270
260271 /**
Show on old repository browser