From c9d4a0775620e16d663c222d0da88136c4239cbc Mon Sep 17 00:00:00 2001 From: Jimmy Shih Date: Tue, 11 Sep 2012 15:52:55 -0700 Subject: [PATCH] fix lint errors --- MyTracks/res/values/colors.xml | 3 - MyTracks/res/values/strings.xml | 50 ++++++------ .../DynamicSpeedTrackPathDescriptorTest.java | 37 --------- .../FixedSpeedTrackPathDescriptorTest.java | 77 +------------------ 4 files changed, 28 insertions(+), 139 deletions(-) diff --git a/MyTracks/res/values/colors.xml b/MyTracks/res/values/colors.xml index 3616e56f2..c413fccf7 100644 --- a/MyTracks/res/values/colors.xml +++ b/MyTracks/res/values/colors.xml @@ -50,9 +50,6 @@ limitations under the License. #99999999 - - #FFCA1F25 - #F774DF00 diff --git a/MyTracks/res/values/strings.xml b/MyTracks/res/values/strings.xml index 3daeb4992..fb36eed71 100644 --- a/MyTracks/res/values/strings.xml +++ b/MyTracks/res/values/strings.xml @@ -569,11 +569,11 @@ limitations under the License. translation_description="The body in the 'Terms of Service. See http://m.google.com/toscountry. %1$s: host name, 'm.google.com'"> - By using Google\'s mobile products and services ("Services"), you agree to be bound by a) the - YouTube Terms of Use (%1$s/tos_youtube) for YouTube-related Services, b) the Google Maps Terms - and Conditions (%1$s/tos_maps) for mapping, local and location-based Services, c) the Google - Books Terms of Service (%1$s/tos_books) for Books-related Services, and e) the Google Terms of - Service (%1$s/utos) for all other Services, as updated from time to time. + By using Google\'s mobile products and services (“Services”), you agree to be bound + by a) the YouTube Terms of Use (%1$s/tos_youtube) for YouTube-related Services, b) the Google + Maps Terms and Conditions (%1$s/tos_maps) for mapping, local and location-based Services, c) the + Google Books Terms of Service (%1$s/tos_books) for Books-related Services, and e) the Google + Terms of Service (%1$s/utos) for all other Services, as updated from time to time. - Please wait... + Please wait… - Recording... + Recording… @@ -673,12 +673,12 @@ limitations under the License. - \'Google location settings\' + ‘Google location settings’ - \'Location access\' + ‘Location access’ - From the track list, select \"Delete all\" when not recording. This permanently deletes the - recorded tracks from memory. If you have saved tracks or backups on the SD card, you must delete - them separately. You can access the SD card using any file manager app from the Play Store or - using a USB cable to connect your phone to your computer. Tracks uploaded to Google Maps, - Google Fusion Tables, and Google Docs must also be deleted separately. + From the track list, select “Delete all” when not recording. This permanently + deletes the recorded tracks from memory. If you have saved tracks or backups on the SD card, you + must delete them separately. You can access the SD card using any file manager app from the Play + Store or using a USB cable to connect your phone to your computer. Tracks uploaded to Google + Maps, Google Fusion Tables, and Google Docs must also be deleted separately. @@ -772,7 +772,7 @@ limitations under the License. - Why does the application sometimes display \"Waiting for a better GPS signal.\"? + Why does the application sometimes display “Waiting for a better GPS signal.”? @@ -829,8 +829,8 @@ limitations under the License. %2$s url. E.g., 'google.com/fusiontables'. %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 - Google Maps are at %1$s, \"My Places\". Tracks sent to Google Fusion Tables are at %2$s. Tracks - sent to Google Docs are at %3$s. + Google Maps are at %1$s, “My Places”. Tracks sent to Google Fusion Tables are at + %2$s. Tracks sent to Google Docs are at %3$s. @@ -954,7 +954,7 @@ limitations under the License. - Loading your Google Maps... + Loading your Google Maps… - Importing from SD card... + Importing from SD card… @@ -1296,7 +1296,7 @@ limitations under the License. - Saving to SD card... + Saving to SD card… @@ -1403,7 +1403,7 @@ limitations under the License. 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'."> - Sending to %1$s... + Sending to %1$s… - Send to... + Send to… - Writing all tracks and settings... + Writing all tracks and settings… - Reading all tracks and settings... + Reading all tracks and settings… - Recording your track... + Recording your track… diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/maps/DynamicSpeedTrackPathDescriptorTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/maps/DynamicSpeedTrackPathDescriptorTest.java index c788497f1..482b8c91c 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/maps/DynamicSpeedTrackPathDescriptorTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/maps/DynamicSpeedTrackPathDescriptorTest.java @@ -16,12 +16,10 @@ 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.maps.mytracks.R; import android.content.Context; -import android.content.SharedPreferences; import android.test.AndroidTestCase; /** @@ -32,13 +30,11 @@ import android.test.AndroidTestCase; public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase { private Context context; - private SharedPreferences sharedPreferences; @Override protected void setUp() throws Exception { super.setUp(); 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 * id. diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/maps/FixedSpeedTrackPathDescriptorTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/maps/FixedSpeedTrackPathDescriptorTest.java index 1533214e0..44305520b 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/maps/FixedSpeedTrackPathDescriptorTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/maps/FixedSpeedTrackPathDescriptorTest.java @@ -15,12 +15,10 @@ */ 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.maps.mytracks.R; import android.content.Context; -import android.content.SharedPreferences; import android.test.AndroidTestCase; /** @@ -31,13 +29,11 @@ import android.test.AndroidTestCase; public class FixedSpeedTrackPathDescriptorTest extends AndroidTestCase { private Context context; - private SharedPreferences sharedPreferences; @Override protected void setUp() throws Exception { super.setUp(); 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, - * String)} when the key is null. + * Tests {@link FixedSpeedTrackPathDescriptor#getSlowSpeed()} and + * {@link FixedSpeedTrackPathDescriptor#getNormalSpeed()}. */ - public void testOnSharedPreferenceChanged_null_key() { + public void testGetSpeed() { FixedSpeedTrackPathDescriptor fixedSpeedTrackPathDescriptor = new FixedSpeedTrackPathDescriptor( context); int slowSpeed = fixedSpeedTrackPathDescriptor.getSlowSpeed(); @@ -71,74 +67,7 @@ public class FixedSpeedTrackPathDescriptorTest extends AndroidTestCase { // 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, null); assertEquals(slowSpeed, fixedSpeedTrackPathDescriptor.getSlowSpeed()); 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()); - } } \ No newline at end of file