diff options
author | Brad Leege <bleege@gmail.com> | 2016-04-29 11:53:00 -0500 |
---|---|---|
committer | Brad Leege <bleege@gmail.com> | 2016-04-29 13:42:04 -0500 |
commit | 25442a77be75001665771097d8978b1191e403d9 (patch) | |
tree | f2addea74c7a94b81f4c6406197c9f23ac5fa754 /platform | |
parent | c1ad3214858f6e8a852b2346ad69947b26e43172 (diff) | |
download | qtlocation-mapboxgl-25442a77be75001665771097d8978b1191e403d9.tar.gz |
[android] #4902 - Standarizing Locale and Language
Diffstat (limited to 'platform')
8 files changed, 29 insertions, 38 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java index 78e2b80e42..19d2144615 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java @@ -23,7 +23,6 @@ import android.support.annotation.NonNull; import android.support.v4.view.animation.FastOutLinearInInterpolator; import android.util.AttributeSet; import android.view.View; - import com.mapbox.mapboxsdk.R; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; @@ -35,7 +34,6 @@ import com.mapbox.mapboxsdk.location.LocationServices; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.Projection; import com.mapbox.mapboxsdk.maps.UiSettings; - import java.lang.ref.WeakReference; /** @@ -43,7 +41,7 @@ import java.lang.ref.WeakReference; */ public class MyLocationView extends View { - private MyLocationBehaviour myLocationBehaviour; + private MyLocationBehavior myLocationBehavior; private MapboxMap mapboxMap; private Projection projection; private int maxSize; @@ -106,7 +104,7 @@ public class MyLocationView extends View { private void init(Context context) { setEnabled(false); - myLocationBehaviour = new MyLocationBehaviourFactory().getBehaviouralModel(MyLocationTracking.TRACKING_NONE); + myLocationBehavior = new MyLocationBehaviorFactory().getBehavioralModel(MyLocationTracking.TRACKING_NONE); compassListener = new CompassListener(context); maxSize = (int) context.getResources().getDimension(R.dimen.my_locationview_size); } @@ -286,7 +284,7 @@ public class MyLocationView extends View { public void update() { if (isEnabled()) { - myLocationBehaviour.invalidate(); + myLocationBehavior.invalidate(); } else { setVisibility(View.INVISIBLE); } @@ -344,7 +342,7 @@ public class MyLocationView extends View { } this.location = location; - myLocationBehaviour.updateLatLng(location); + myLocationBehavior.updateLatLng(location); } public void setMyBearingTrackingMode(@MyBearingTracking.Mode int myBearingTrackingMode) { @@ -365,12 +363,12 @@ public class MyLocationView extends View { public void setMyLocationTrackingMode(@MyLocationTracking.Mode int myLocationTrackingMode) { this.myLocationTrackingMode = myLocationTrackingMode; - MyLocationBehaviourFactory factory = new MyLocationBehaviourFactory(); - myLocationBehaviour = factory.getBehaviouralModel(myLocationTrackingMode); + MyLocationBehaviorFactory factory = new MyLocationBehaviorFactory(); + myLocationBehavior = factory.getBehavioralModel(myLocationTrackingMode); if (myLocationTrackingMode != MyLocationTracking.TRACKING_NONE && location != null) { // center map directly if we have a location fix - myLocationBehaviour.updateLatLng(location); + myLocationBehavior.updateLatLng(location); mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(location))); } invalidate(); @@ -519,14 +517,14 @@ public class MyLocationView extends View { private class MarkerCoordinateAnimatorListener implements ValueAnimator.AnimatorUpdateListener { - private MyLocationBehaviour behaviour; + private MyLocationBehavior behavior; private double fromLat; private double fromLng; private double toLat; private double toLng; - private MarkerCoordinateAnimatorListener(MyLocationBehaviour myLocationBehaviour, LatLng from, LatLng to) { - behaviour = myLocationBehaviour; + private MarkerCoordinateAnimatorListener(MyLocationBehavior myLocationBehavior, LatLng from, LatLng to) { + behavior = myLocationBehavior; fromLat = from.getLatitude(); fromLng = from.getLongitude(); toLat = to.getLatitude(); @@ -538,23 +536,23 @@ public class MyLocationView extends View { float frac = animation.getAnimatedFraction(); double latitude = fromLat + (toLat - fromLat) * frac; double longitude = fromLng + (toLng - fromLng) * frac; - behaviour.updateLatLng(latitude, longitude); + behavior.updateLatLng(latitude, longitude); updateOnNextFrame(); } } - private class MyLocationBehaviourFactory { + private class MyLocationBehaviorFactory { - public MyLocationBehaviour getBehaviouralModel(@MyLocationTracking.Mode int mode) { + public MyLocationBehavior getBehavioralModel(@MyLocationTracking.Mode int mode) { if (mode == MyLocationTracking.TRACKING_NONE) { - return new MyLocationShowBehaviour(); + return new MyLocationShowBehavior(); } else { - return new MyLocationTrackingBehaviour(); + return new MyLocationTrackingBehavior(); } } } - private abstract class MyLocationBehaviour { + private abstract class MyLocationBehavior { abstract void updateLatLng(@NonNull Location location); @@ -581,7 +579,7 @@ public class MyLocationView extends View { abstract void invalidate(); } - private class MyLocationTrackingBehaviour extends MyLocationBehaviour { + private class MyLocationTrackingBehavior extends MyLocationBehavior { @Override void updateLatLng(@NonNull Location location) { @@ -641,7 +639,7 @@ public class MyLocationView extends View { } } - private class MyLocationShowBehaviour extends MyLocationBehaviour { + private class MyLocationShowBehavior extends MyLocationBehavior { @Override void updateLatLng(@NonNull final Location location) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java index b5d932ac71..600f72ae93 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/telemetry/MapboxEventManager.java @@ -36,7 +36,6 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.Hashtable; import java.util.List; -import java.util.Locale; import java.util.Timer; import java.util.TimerTask; import java.util.UUID; @@ -63,7 +62,7 @@ public class MapboxEventManager { private final Vector<Hashtable<String, Object>> events = new Vector<>(); private static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); - private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.US); + private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", MapboxConstants.MAPBOX_LOCALE); private Context context = null; private String accessToken = null; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/README.md b/platform/android/MapboxGLAndroidSDKTestApp/README.md index 646f29c4b4..0acb509b3e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/README.md +++ b/platform/android/MapboxGLAndroidSDKTestApp/README.md @@ -42,7 +42,7 @@ Then: On Step 2, you can also separate by commas different classes: `com.mapbox.mapboxgl.testapp.MainActivityTest,com.mapbox.mapboxgl.testapp.MainActivityScreenTest` -If you have no tests for your app, or want to test some random user behaviour, +If you have no tests for your app, or want to test some random user behavior, you can just choose "Built-in: Fuzz" in step 2. ### Running pure JUnit tests diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index e5bf9397b9..1aa6cfeb0b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -138,7 +138,7 @@ android:value="@string/category_userlocation" /> </activity> <activity - android:name=".activity.userlocation.MyLocationCustomisationActivity" + android:name=".activity.userlocation.MyLocationCustomizationActivity" android:description="@string/description_user_location_customization" android:label="@string/activity_user_tracking_customization"> <meta-data diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationCustomisationActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationCustomizationActivity.java index 6de2056faf..449ed51de9 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationCustomisationActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationCustomizationActivity.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.activity.userlocation; -import android.content.res.Resources; import android.graphics.Color; import android.location.Location; import android.os.Bundle; @@ -12,7 +11,6 @@ import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.constants.Style; @@ -25,7 +23,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; -public class MyLocationCustomisationActivity extends AppCompatActivity implements LocationListener { +public class MyLocationCustomizationActivity extends AppCompatActivity implements LocationListener { private MapView mapView; private MapboxMap mapboxMap; @@ -35,7 +33,7 @@ public class MyLocationCustomisationActivity extends AppCompatActivity implement @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_my_location_customisation); + setContentView(R.layout.activity_my_location_customization); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); @@ -134,4 +132,4 @@ public class MyLocationCustomisationActivity extends AppCompatActivity implement } } -}
\ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java index 6d4d4de299..fcd61e70b4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationTrackingModeActivity.java @@ -4,7 +4,6 @@ import android.location.Location; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; -import android.support.annotation.StringDef; import android.support.design.widget.Snackbar; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; @@ -16,8 +15,8 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; +import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.constants.MyBearingTracking; import com.mapbox.mapboxsdk.constants.MyLocationTracking; import com.mapbox.mapboxsdk.geometry.LatLng; @@ -26,11 +25,8 @@ import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.TrackingSettings; -import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings; import com.mapbox.mapboxsdk.testapp.R; -import java.util.Locale; - public class MyLocationTrackingModeActivity extends AppCompatActivity implements MapboxMap.OnMyLocationChangeListener, AdapterView.OnItemSelectedListener { private MapView mMapView; @@ -132,15 +128,15 @@ public class MyLocationTrackingModeActivity extends AppCompatActivity implements String desc = "Loc Chg: "; boolean noInfo = true; if (mLocation.hasSpeed()) { - desc += String.format(Locale.getDefault(), "Spd = %.1f km/h ", mLocation.getSpeed() * 3.6f); + desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Spd = %.1f km/h ", mLocation.getSpeed() * 3.6f); noInfo = false; } if (mLocation.hasAltitude()) { - desc += String.format(Locale.getDefault(), "Alt = %.0f m ", mLocation.getAltitude()); + desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Alt = %.0f m ", mLocation.getAltitude()); noInfo = false; } if (mLocation.hasAccuracy()) { - desc += String.format(Locale.getDefault(), "Acc = %.0f m", mLocation.getAccuracy()); + desc += String.format(MapboxConstants.MAPBOX_LOCALE, "Acc = %.0f m", mLocation.getAccuracy()); } if (noInfo) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_customisation.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_customization.xml index 75218423fb..75218423fb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_customisation.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_my_location_customization.xml diff --git a/platform/android/tests/docs/UI_TESTS.md b/platform/android/tests/docs/UI_TESTS.md index f2d74f07fb..a921804c76 100644 --- a/platform/android/tests/docs/UI_TESTS.md +++ b/platform/android/tests/docs/UI_TESTS.md @@ -39,7 +39,7 @@ Then: On Step 2, you can also separate by commas different classes: `com.mapbox.mapboxgl.testapp.MainActivityTest,com.mapbox.mapboxgl.testapp.MainActivityScreenTest` -If you have no tests for your app, or want to test some random user behaviour, +If you have no tests for your app, or want to test some random user behavior, you can just choose "Built-in: Fuzz" in step 2. ### Code coverage |