fix lint errors

This commit is contained in:
Jimmy Shih
2012-09-11 15:52:55 -07:00
parent 0ef7713433
commit c9d4a07756
4 changed files with 28 additions and 139 deletions
-3
View File
@@ -50,9 +50,6 @@ limitations under the License.
<!-- track widget line --> <!-- track widget line -->
<color name="track_widget_line">#99999999</color> <color name="track_widget_line">#99999999</color>
<!-- track widget red -->
<color name="track_widget_red">#FFCA1F25</color>
<!-- dynamic track slow path, green --> <!-- dynamic track slow path, green -->
<color name="slow_path">#F774DF00</color> <color name="slow_path">#F774DF00</color>
+25 -25
View File
@@ -569,11 +569,11 @@ limitations under the License.
translation_description="The body in the 'Terms of Service. See http://m.google.com/toscountry. translation_description="The body in the 'Terms of Service. See http://m.google.com/toscountry.
%1$s: host name, 'm.google.com'"> %1$s: host name, 'm.google.com'">
By using Google\'s mobile products and services ("Services"), you agree to be bound by a) the By using Google\'s mobile products and services (&#8220;Services&#8221;), you agree to be bound
YouTube Terms of Use (%1$s/tos_youtube) for YouTube-related Services, b) the Google Maps Terms by a) the YouTube Terms of Use (%1$s/tos_youtube) for YouTube-related Services, b) the Google
and Conditions (%1$s/tos_maps) for mapping, local and location-based Services, c) the Google Maps Terms and Conditions (%1$s/tos_maps) for mapping, local and location-based Services, c) the
Books Terms of Service (%1$s/tos_books) for Books-related Services, and e) the Google Terms of Google Books Terms of Service (%1$s/tos_books) for Books-related Services, and e) the Google
Service (%1$s/utos) for all other Services, as updated from time to time. Terms of Service (%1$s/utos) for all other Services, as updated from time to time.
</string> </string>
<string name="eula_copyright_year" <string name="eula_copyright_year"
translation_description="The copyright year in the 'Terms of Service'. See translation_description="The copyright year in the 'Terms of Service'. See
@@ -654,11 +654,11 @@ limitations under the License.
</string> </string>
<string name="generic_progress_title" <string name="generic_progress_title"
translation_description="The title on a progress dialog asking the user to wait."> translation_description="The title on a progress dialog asking the user to wait.">
Please wait... Please wait&#8230;
</string> </string>
<string name="generic_recording" <string name="generic_recording"
translation_description="Text indicating a track is recording."> translation_description="Text indicating a track is recording.">
Recording... Recording&#8230;
</string> </string>
<string name="generic_save" <string name="generic_save"
translation_description="The text on a button to say save."> translation_description="The text on a button to say save.">
@@ -673,12 +673,12 @@ limitations under the License.
<string name="gps_google_location_settings" <string name="gps_google_location_settings"
translation_description="In Android, the Google location settings to modify location settings translation_description="In Android, the Google location settings to modify location settings
for all Google applications. See Settings -> Google -> Location settings."> for all Google applications. See Settings -> Google -> Location settings.">
\'Google location settings\' &#8216;Google location settings&#8217;
</string> </string>
<string name="gps_location_access" <string name="gps_location_access"
translation_description="In Android, the location access settings to modify location settings translation_description="In Android, the location access settings to modify location settings
for all applications. See Settings -> Location access."> for all applications. See Settings -> Location access.">
\'Location access\' &#8216;Location access&#8217;
</string> </string>
<string name="gps_disabled" <string name="gps_disabled"
translation_description="In the main view, the message on the top asking the user to enable translation_description="In the main view, the message on the top asking the user to enable
@@ -733,11 +733,11 @@ limitations under the License.
</string> </string>
<string name="help_delete_tracks_answer" <string name="help_delete_tracks_answer"
translation_description="In the 'Help' page, the answer on delete tracks."> translation_description="In the 'Help' page, the answer on delete tracks.">
From the track list, select \"Delete all\" when not recording. This permanently deletes the From the track list, select &#8220;Delete all&#8221; when not recording. This permanently
recorded tracks from memory. If you have saved tracks or backups on the SD card, you must delete deletes the recorded tracks from memory. If you have saved tracks or backups on the SD card, you
them separately. You can access the SD card using any file manager app from the Play Store or must delete them separately. You can access the SD card using any file manager app from the Play
using a USB cable to connect your phone to your computer. Tracks uploaded to Google Maps, Store or using a USB cable to connect your phone to your computer. Tracks uploaded to Google
Google Fusion Tables, and Google Docs must also be deleted separately. Maps, Google Fusion Tables, and Google Docs must also be deleted separately.
</string> </string>
<string name="help_delete_tracks_question" <string name="help_delete_tracks_question"
translation_description="In the 'Help' page, the question on delete tracks."> translation_description="In the 'Help' page, the question on delete tracks.">
@@ -772,7 +772,7 @@ limitations under the License.
</string> </string>
<string name="help_gps_signal_question" <string name="help_gps_signal_question"
translation_description="In the 'Help' page, the question on the GPS signal message."> translation_description="In the 'Help' page, the question on the GPS signal message.">
Why does the application sometimes display \"Waiting for a better GPS signal.\"? Why does the application sometimes display &#8220;Waiting for a better GPS signal.&#8221;?
</string> </string>
<string name="help_location_precision_answer" <string name="help_location_precision_answer"
translation_description="In the 'Help' page, the answer on location precision."> translation_description="In the 'Help' page, the answer on location precision.">
@@ -829,8 +829,8 @@ limitations under the License.
%2$s url. E.g., 'google.com/fusiontables'. %2$s url. E.g., 'google.com/fusiontables'.
%3$s url. E.g., 'docs.google.com'."> %3$s url. E.g., 'docs.google.com'.">
You can send a track to Google Maps, Google Fusion Tables, and Google Docs. Tracks sent to You can send a track to Google Maps, Google Fusion Tables, and Google Docs. Tracks sent to
Google Maps are at %1$s, \"My Places\". Tracks sent to Google Fusion Tables are at %2$s. Tracks Google Maps are at %1$s, &#8220;My Places&#8221;. Tracks sent to Google Fusion Tables are at
sent to Google Docs are at %3$s. %2$s. Tracks sent to Google Docs are at %3$s.
</string> </string>
<string name="help_send_track_question" <string name="help_send_track_question"
translation_description="In the 'Help' page, the question on sending a track."> translation_description="In the 'Help' page, the question on sending a track.">
@@ -954,7 +954,7 @@ limitations under the License.
<string name="maps_list_progress_message" <string name="maps_list_progress_message"
translation_description="When sending a track to an existing Google Map, the progress message translation_description="When sending a track to an existing Google Map, the progress message
informing the user that his maps are being loaded."> informing the user that his maps are being loaded.">
Loading your Google Maps... Loading your Google Maps&#8230;
</string> </string>
<string name="maps_list_public_label" <string name="maps_list_public_label"
translation_description="When sending a track to an existing Google Map, in the 'Maps' list translation_description="When sending a track to an existing Google Map, in the 'Maps' list
@@ -1264,7 +1264,7 @@ limitations under the License.
</string> </string>
<string name="sd_card_import_progress_message" <string name="sd_card_import_progress_message"
translation_description="When importing from the SD card, the progress message."> translation_description="When importing from the SD card, the progress message.">
Importing from SD card... Importing from SD card&#8230;
</string> </string>
<string name="sd_card_import_success" <string name="sd_card_import_success"
translation_description="When importing from the SD card, the success message."> translation_description="When importing from the SD card, the success message.">
@@ -1296,7 +1296,7 @@ limitations under the License.
</string> </string>
<string name="sd_card_save_progress_message" <string name="sd_card_save_progress_message"
translation_description="When saving to the SD card, the progress message."> translation_description="When saving to the SD card, the progress message.">
Saving to SD card... Saving to SD card&#8230;
</string> </string>
<string name="sd_card_save_success" <string name="sd_card_save_success"
translation_description="When saving to the SD card, the success message"> translation_description="When saving to the SD card, the success message">
@@ -1403,7 +1403,7 @@ limitations under the License.
translation_description="When sending a track to a Google service, the progress message. translation_description="When sending a track to a Google service, the progress message.
%1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Docs'."> %1$s: service name. 'Google Maps', 'Google Fusion Tables', or 'Google Docs'.">
Sending to %1$s... Sending to %1$s&#8230;
</string> </string>
<string name="send_google_send_now" <string name="send_google_send_now"
translation_description="When sending a track to Google, under the 'Send to...' dialog, the translation_description="When sending a track to Google, under the 'Send to...' dialog, the
@@ -1419,7 +1419,7 @@ limitations under the License.
translation_description="When sending a track to Google, the dialog title to choose the Google translation_description="When sending a track to Google, the dialog title to choose the Google
services to send the track to. The user can choose Google Maps, Google Fusion Tables, and services to send the track to. The user can choose Google Maps, Google Fusion Tables, and
Google Docs."> Google Docs.">
Send to... Send to&#8230;
</string> </string>
<string name="send_google_track_part_label" <string name="send_google_track_part_label"
translation_description="When sending a track to Google, the label to name segments of a large translation_description="When sending a track to Google, the label to name segments of a large
@@ -1522,7 +1522,7 @@ limitations under the License.
<string name="settings_backup_now_progress_message" <string name="settings_backup_now_progress_message"
translation_description="In the 'Backup' settings, after pressing the 'Backup now' option, the translation_description="In the 'Backup' settings, after pressing the 'Backup now' option, the
progress message telling the user that it is writing all tracks and settings to the SD card."> progress message telling the user that it is writing all tracks and settings to the SD card.">
Writing all tracks and settings... Writing all tracks and settings&#8230;
</string> </string>
<string name="settings_backup_now_summary" <string name="settings_backup_now_summary"
translation_description="In the 'Backup' settings, under the 'SD card' section, the summary for translation_description="In the 'Backup' settings, under the 'SD card' section, the summary for
@@ -1552,7 +1552,7 @@ limitations under the License.
translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the
progress message informing that My Tracks is reading all tracks and settings from the backup progress message informing that My Tracks is reading all tracks and settings from the backup
on the SD card."> on the SD card.">
Reading all tracks and settings... Reading all tracks and settings&#8230;
</string> </string>
<string name="settings_backup_restore_select_title" <string name="settings_backup_restore_select_title"
translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the translation_description="In the 'Backup' settings, after pressing the 'Restore now' option, the
@@ -2275,7 +2275,7 @@ limitations under the License.
<string name="track_record_notification" <string name="track_record_notification"
translation_description="When recording a track, the message on the My Tracks notification translation_description="When recording a track, the message on the My Tracks notification
informing the user that My Tracks is actively recording his track."> informing the user that My Tracks is actively recording his track.">
Recording your track... Recording your track&#8230;
</string> </string>
<!-- Unit --> <!-- Unit -->
@@ -16,12 +16,10 @@
package com.google.android.apps.mytracks.maps; package com.google.android.apps.mytracks.maps;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.util.PreferencesUtils; import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R; import com.google.android.maps.mytracks.R;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
/** /**
@@ -32,13 +30,11 @@ import android.test.AndroidTestCase;
public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase { public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase {
private Context context; private Context context;
private SharedPreferences sharedPreferences;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
context = getContext(); context = getContext();
sharedPreferences = context.getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
} }
/** /**
@@ -57,39 +53,6 @@ public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase {
} }
} }
/**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
* String)} when the key is trackColorModeDynamicVariation.
*/
public void testOnSharedPreferenceChanged_trackColorModeDynamicVariationKey() {
DynamicSpeedTrackPathDescriptor dynamicSpeedTrackPathDescriptor = new DynamicSpeedTrackPathDescriptor(
context);
int speedMargin = dynamicSpeedTrackPathDescriptor.getSpeedMargin();
// Change value in shared preferences.
PreferencesUtils.setInt(context, R.string.track_color_mode_percentage_key, speedMargin + 2);
dynamicSpeedTrackPathDescriptor.onSharedPreferenceChanged(sharedPreferences,
PreferencesUtils.getKey(context, R.string.track_color_mode_percentage_key));
assertEquals(speedMargin + 2, dynamicSpeedTrackPathDescriptor.getSpeedMargin());
}
/**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
* String)} when the values of speedMargin is the default value.
*/
public void testOnSharedPreferenceChanged_defaultValue() {
DynamicSpeedTrackPathDescriptor dynamicSpeedTrackPathDescriptor = new DynamicSpeedTrackPathDescriptor(
context);
// Change value in shared preferences
PreferencesUtils.setInt(context, R.string.track_color_mode_percentage_key,
PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT);
dynamicSpeedTrackPathDescriptor.onSharedPreferenceChanged(sharedPreferences,
PreferencesUtils.getKey(context, R.string.track_color_mode_percentage_key));
// The default value of speedMargin is 25.
assertEquals(PreferencesUtils.TRACK_COLOR_MODE_PERCENTAGE_DEFAULT,
dynamicSpeedTrackPathDescriptor.getSpeedMargin());
}
/** /**
* Tests {@link DynamicSpeedTrackPathDescriptor#updateState()} by wrong track * Tests {@link DynamicSpeedTrackPathDescriptor#updateState()} by wrong track
* id. * id.
@@ -15,12 +15,10 @@
*/ */
package com.google.android.apps.mytracks.maps; package com.google.android.apps.mytracks.maps;
import com.google.android.apps.mytracks.Constants;
import com.google.android.apps.mytracks.util.PreferencesUtils; import com.google.android.apps.mytracks.util.PreferencesUtils;
import com.google.android.maps.mytracks.R; import com.google.android.maps.mytracks.R;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.test.AndroidTestCase; import android.test.AndroidTestCase;
/** /**
@@ -31,13 +29,11 @@ import android.test.AndroidTestCase;
public class FixedSpeedTrackPathDescriptorTest extends AndroidTestCase { public class FixedSpeedTrackPathDescriptorTest extends AndroidTestCase {
private Context context; private Context context;
private SharedPreferences sharedPreferences;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
context = getContext(); context = getContext();
sharedPreferences = context.getSharedPreferences(Constants.SETTINGS_NAME, Context.MODE_PRIVATE);
} }
/** /**
@@ -60,10 +56,10 @@ public class FixedSpeedTrackPathDescriptorTest extends AndroidTestCase {
} }
/** /**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences, * Tests {@link FixedSpeedTrackPathDescriptor#getSlowSpeed()} and
* String)} when the key is null. * {@link FixedSpeedTrackPathDescriptor#getNormalSpeed()}.
*/ */
public void testOnSharedPreferenceChanged_null_key() { public void testGetSpeed() {
FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor( FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor(
context); context);
int slowSpeed = fixedSpeedTrackPathDescriptor.getSlowSpeed(); int slowSpeed = fixedSpeedTrackPathDescriptor.getSlowSpeed();
@@ -71,74 +67,7 @@ public class FixedSpeedTrackPathDescriptorTest extends AndroidTestCase {
// Change value in shared preferences // Change value in shared preferences
PreferencesUtils.setInt(context, R.string.track_color_mode_slow_key, slowSpeed + 2); PreferencesUtils.setInt(context, R.string.track_color_mode_slow_key, slowSpeed + 2);
PreferencesUtils.setInt(context, R.string.track_color_mode_medium_key, normalSpeed + 2); PreferencesUtils.setInt(context, R.string.track_color_mode_medium_key, normalSpeed + 2);
fixedSpeedTrackPathDescriptor.onSharedPreferenceChanged(sharedPreferences, null);
assertEquals(slowSpeed, fixedSpeedTrackPathDescriptor.getSlowSpeed()); assertEquals(slowSpeed, fixedSpeedTrackPathDescriptor.getSlowSpeed());
assertEquals(normalSpeed, fixedSpeedTrackPathDescriptor.getNormalSpeed()); assertEquals(normalSpeed, fixedSpeedTrackPathDescriptor.getNormalSpeed());
} }
/**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
* String)} when the key is not null, and not slowSpeed and not normalSpeed.
*/
public void testOnSharedPreferenceChanged_other_key() {
FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor(
context);
int slowSpeed = fixedSpeedTrackPathDescriptor.getSlowSpeed();
int normalSpeed = fixedSpeedTrackPathDescriptor.getNormalSpeed();
// Change value in shared preferences
PreferencesUtils.setInt(context, R.string.track_color_mode_slow_key, slowSpeed + 2);
PreferencesUtils.setInt(context, R.string.track_color_mode_medium_key, normalSpeed + 2);
fixedSpeedTrackPathDescriptor.onSharedPreferenceChanged(sharedPreferences, "anyKey");
assertEquals(slowSpeed, fixedSpeedTrackPathDescriptor.getSlowSpeed());
assertEquals(normalSpeed, fixedSpeedTrackPathDescriptor.getNormalSpeed());
}
/**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
* String)} when the key is slowSpeed.
*/
public void testOnSharedPreferenceChanged_slowSpeedKey() {
FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor(
context);
int slowSpeed = fixedSpeedTrackPathDescriptor.getSlowSpeed();
// Change value in shared preferences
PreferencesUtils.setInt(context, R.string.track_color_mode_slow_key, slowSpeed + 2);
fixedSpeedTrackPathDescriptor.onSharedPreferenceChanged(
sharedPreferences, context.getString(R.string.track_color_mode_slow_key));
assertEquals(slowSpeed + 2, fixedSpeedTrackPathDescriptor.getSlowSpeed());
}
/**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
* String)} when the key is normalSpeed.
*/
public void testOnSharedPreferenceChanged_normalSpeedKey() {
FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor(
context);
int normalSpeed = fixedSpeedTrackPathDescriptor.getNormalSpeed();
PreferencesUtils.setInt(context, R.string.track_color_mode_medium_key, normalSpeed + 4);
fixedSpeedTrackPathDescriptor.onSharedPreferenceChanged(
sharedPreferences, context.getString(R.string.track_color_mode_medium_key));
assertEquals(normalSpeed + 4, fixedSpeedTrackPathDescriptor.getNormalSpeed());
}
/**
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
* String)} when the values of slowSpeed and normalSpeed in SharedPreference
* are the default values.
*/
public void testOnSharedPreferenceChanged_defaultValue() {
FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor(
context);
PreferencesUtils.setInt(context, R.string.track_color_mode_slow_key,
PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
PreferencesUtils.setInt(context, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
fixedSpeedTrackPathDescriptor.onSharedPreferenceChanged(
sharedPreferences, context.getString(R.string.track_color_mode_medium_key));
assertEquals(PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT,
fixedSpeedTrackPathDescriptor.getSlowSpeed());
assertEquals(PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT,
fixedSpeedTrackPathDescriptor.getNormalSpeed());
}
} }