Merge "Stopwatches cleanup" into ics-ub-clock-amazon
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..e8e450b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+gen/
diff --git a/src/com/android/deskclock/stopwatch/StopwatchFragment.java b/src/com/android/deskclock/stopwatch/StopwatchFragment.java
index 36f9c6a..64e87bb 100644
--- a/src/com/android/deskclock/stopwatch/StopwatchFragment.java
+++ b/src/com/android/deskclock/stopwatch/StopwatchFragment.java
@@ -61,10 +61,6 @@
// Lap information
class Lap {
- Lap () {
- mLapTime = 0;
- mTotalTime = 0;
- }
Lap (long time, long total) {
mLapTime = time;
@@ -73,15 +69,10 @@
public long mLapTime;
public long mTotalTime;
- public void updateView(Context context) {
+ public void updateView() {
View lapInfo = mLapsList.findViewWithTag(this);
if (lapInfo != null) {
- TextView lapTime = (TextView) lapInfo.findViewById(R.id.lap_time);
- TextView totalTime = (TextView) lapInfo.findViewById(R.id.lap_total);
- lapTime.setText(
- Stopwatches.getTimeText(context, mLapTime, Stopwatches.NO_LAP_NUMBER));
- totalTime.setText(
- Stopwatches.getTimeText(context, mTotalTime, Stopwatches.NO_LAP_NUMBER));
+ mLapsAdapter.setTimeText(lapInfo, this);
}
}
}
@@ -134,13 +125,17 @@
}
lapInfo.setTag(lap);
TextView count = (TextView)lapInfo.findViewById(R.id.lap_number);
+ count.setText(String.format(mLapFormat, mLaps.size() - position).toUpperCase());
+ setTimeText(lapInfo, lap);
+
+ return lapInfo;
+ }
+
+ protected void setTimeText(View lapInfo, Lap lap) {
TextView lapTime = (TextView)lapInfo.findViewById(R.id.lap_time);
TextView totalTime = (TextView)lapInfo.findViewById(R.id.lap_total);
lapTime.setText(Stopwatches.formatTimeText(lap.mLapTime, mFormats[mLapIndex]));
totalTime.setText(Stopwatches.formatTimeText(lap.mTotalTime, mFormats[mTotalIndex]));
- count.setText(String.format(mLapFormat, mLaps.size() - position).toUpperCase());
-
- return lapInfo;
}
@Override
@@ -674,7 +669,7 @@
if (mLapsAdapter.updateTimeFormats(curLap)) {
mLapsAdapter.notifyDataSetChanged();
} else {
- curLap.updateView(getActivity().getApplicationContext());
+ curLap.updateView();
}
}
}