Code review comments

This commit is contained in:
Matthew Simmons
2010-11-01 15:21:33 -04:00
parent a2f46821f5
commit b2907226bf
4 changed files with 15 additions and 12 deletions
+2 -2
View File
@@ -211,8 +211,8 @@ limitations under the License.
<string name="settings_auto_resume_track_timeout_summary">Maximum time in minutes after which a previously recording track will not be resumed on phone reboot</string>
<string name="settings_timestamp_track_name">Timestamp as track name</string>
<string name="settings_timestamp_track_name_on">The default track name will be the date and time at the start of the track</string>
<string name="settings_timestamp_track_name_off">Track names will have numbers which increment for each new track.</string>
<string name="settings_timestamp_track_name_summary_on">The default track name will be the date and time at the start of the track</string>
<string name="settings_timestamp_track_name_summary_off">Track names will have numbers which increment for each new track.</string>
<string name="pace_label">Pace</string>
+2 -2
View File
@@ -103,8 +103,8 @@ limitations under the License.
<CheckBoxPreference
android:key="@string/timestamp_track_name_key"
android:title="@string/settings_timestamp_track_name"
android:summaryOn="@string/settings_timestamp_track_name_on"
android:summaryOff="@string/settings_timestamp_track_name_off"
android:summaryOn="@string/settings_timestamp_track_name_summary_on"
android:summaryOff="@string/settings_timestamp_track_name_summary_off"
android:defaultValue="true" />
</PreferenceScreen>
@@ -60,13 +60,7 @@ class DefaultTrackNameFactory {
protected boolean useTimestampTrackName() {
SharedPreferences prefs =
context.getSharedPreferences(MyTracksSettings.SETTINGS_NAME, 0);
boolean useTimestamp = false;
if (prefs != null) {
useTimestamp = prefs.getBoolean(
context.getString(R.string.timestamp_track_name_key), true);
}
return useTimestamp;
return prefs.getBoolean(
context.getString(R.string.timestamp_track_name_key), true);
}
}
@@ -21,7 +21,16 @@ import android.test.AndroidTestCase;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Tests {@link DefaultTrackNameFactory}
*
* @author Matthew Simmons
*/
public class DefaultTrackNameFactoryTest extends AndroidTestCase {
/**
* A version of the factory which allows us to supply our own answer as to
* whether a timestamp-based track name should be used.
*/
private static class MockDefaultTrackNameFactory
extends DefaultTrackNameFactory {
private final boolean useTimestamp;