From 685b8b2c84e47d8126e924ff3fddc22a96237680 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 28 Jul 2017 19:36:13 +0200 Subject: Solve lint issues, reduce baseline (#9627) * [android] - fix lint issues SDK --- platform/android/MapboxGLAndroidSDK/build.gradle | 2 +- .../MapboxGLAndroidSDK/lint-baseline-local.xml | 37 + .../MapboxGLAndroidSDK/lint/lint-baseline-ci.xml | 587 +---- .../src/main/java/com/mapbox/mapboxsdk/Mapbox.java | 2 + .../mapbox/mapboxsdk/annotations/IconFactory.java | 2 + .../com/mapbox/mapboxsdk/http/HTTPRequest.java | 15 +- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 5 +- .../com/mapbox/mapboxsdk/maps/NativeMapView.java | 10 +- .../java/com/mapbox/mapboxsdk/maps/Transform.java | 4 +- .../mapboxsdk/maps/widgets/MyLocationView.java | 2 + .../mapbox/mapboxsdk/net/ConnectivityReceiver.java | 4 +- .../mapbox/mapboxsdk/offline/OfflineManager.java | 10 +- .../com/mapbox/mapboxsdk/storage/FileSource.java | 6 +- .../mapbox/mapboxsdk/style/functions/Function.java | 2 +- .../src/main/res-public/values/public.xml | 4 +- .../main/res/color/mapbox_material_bg_selector.xml | 5 - .../res/drawable-nodpi/mapbox_mapview_preview.jpg | Bin 0 -> 166053 bytes .../res/drawable-xxhdpi/mapbox_mapview_preview.jpg | Bin 166053 -> 0 bytes .../mapbox_infowindow_icon_bg.9.png | Bin 928 -> 0 bytes .../res/layout/mapbox_attribution_list_item.xml | 1 + .../main/res/layout/mapbox_infowindow_content.xml | 3 +- .../main/res/layout/mapbox_view_image_marker.xml | 7 +- .../src/main/res/values/colors.xml | 1 - .../src/main/res/values/dimens.xml | 9 - .../android/MapboxGLAndroidSDKTestApp/build.gradle | 6 +- .../lint-baseline-local.xml | 166 ++ .../lint/lint-baseline-ci.xml | 2560 +------------------- .../testapp/maps/widgets/MyLocationViewTest.java | 2 + .../testapp/utils/OnMapReadyIdlingResource.java | 4 +- .../mapboxsdk/testapp/MapboxApplication.java | 4 +- .../testapp/activity/FeatureOverviewActivity.java | 2 +- .../annotation/AddRemoveMarkerActivity.java | 8 +- .../activity/annotation/BulkMarkerActivity.java | 2 +- .../activity/annotation/MarkerViewActivity.java | 7 +- .../annotation/MarkerViewsInRectangleActivity.java | 2 +- .../activity/camera/CameraPositionActivity.java | 2 + .../QueryRenderedFeaturesBoxCountActivity.java | 13 +- .../QueryRenderedFeaturesBoxHighlightActivity.java | 2 +- ...ueryRenderedFeaturesBoxSymbolCountActivity.java | 4 +- .../QueryRenderedFeaturesPropertiesActivity.java | 19 +- .../activity/imagegenerator/SnapshotActivity.java | 4 +- .../DynamicInfoWindowAdapterActivity.java | 7 +- .../activity/maplayout/DebugModeActivity.java | 2 +- .../testapp/activity/offline/OfflineActivity.java | 12 +- .../activity/style/CircleLayerActivity.java | 4 +- .../activity/style/GeoJsonClusteringActivity.java | 2 +- .../activity/style/RealTimeGeoJsonActivity.java | 2 +- .../activity/style/RuntimeStyleActivity.java | 12 +- .../testapp/activity/style/StyleFileActivity.java | 2 +- .../userlocation/MyLocationDrawableActivity.java | 2 +- .../model/other/OfflineListRegionsDialog.java | 2 +- .../mapboxsdk/testapp/utils/OfflineUtils.java | 2 +- .../mapboxsdk/testapp/utils/TimingLogger.java | 6 +- .../src/main/res/drawable/ic_check_box.xml | 9 - .../src/main/res/drawable/marker.xml | 4 - .../res/layout/activity_animated_image_source.xml | 12 - .../main/res/layout/activity_building_layer.xml | 10 +- .../res/layout/activity_camera_animation_types.xml | 5 + .../src/main/res/layout/activity_circle_layer.xml | 2 + .../src/main/res/layout/activity_debug_mode.xml | 2 + .../src/main/res/layout/activity_map_in_dialog.xml | 7 +- .../src/main/res/layout/activity_map_padding.xml | 15 +- .../src/main/res/layout/activity_marker_bulk.xml | 1 + .../src/main/res/layout/activity_marker_view.xml | 8 +- .../main/res/layout/activity_metadata_update.xml | 2 +- .../src/main/res/layout/activity_multi_map.xml | 8 +- .../layout/activity_my_location_customization.xml | 25 +- .../src/main/res/layout/activity_offline.xml | 41 +- .../res/layout/activity_offline_region_delete.xml | 2 +- .../src/main/res/layout/activity_scroll_by.xml | 14 +- .../src/main/res/layout/activity_snapshot.xml | 1 + .../src/main/res/layout/activity_viewpager.xml | 1 - .../src/main/res/layout/dialog_camera_position.xml | 30 +- .../src/main/res/layout/fragment_double_map.xml | 1 - .../src/main/res/layout/item_main_feature.xml | 2 + .../src/main/res/layout/section_main_layout.xml | 1 + .../src/main/res/layout/view_custom_marker.xml | 2 + .../src/main/res/layout/view_text_marker.xml | 1 + .../src/main/res/menu/menu_building.xml | 4 +- .../src/main/res/menu/menu_bulk_marker.xml | 2 +- .../src/main/res/menu/menu_custom_layer.xml | 12 +- .../src/main/res/menu/menu_data_driven_style.xml | 18 +- .../src/main/res/menu/menu_padding.xml | 4 +- .../src/main/res/menu/menu_press_for_marker.xml | 3 +- .../src/main/res/menu/menu_runtime_style.xml | 32 +- .../src/main/res/menu/menu_symbol_layer.xml | 6 +- .../src/main/res/menu/menu_zoom.xml | 10 +- .../src/main/res/values/dimens.xml | 1 - .../src/main/res/values/strings.xml | 56 +- 89 files changed, 599 insertions(+), 3335 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml create mode 100644 platform/android/MapboxGLAndroidSDK/src/main/res/drawable-nodpi/mapbox_mapview_preview.jpg delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_mapview_preview.jpg delete mode 100644 platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_infowindow_icon_bg.9.png create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/lint-baseline-local.xml delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_check_box.xml delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/marker.xml diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 0cb6e529f1..5e7025c4c8 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -116,7 +116,7 @@ android { } lintOptions { - baseline file("lint-baseline.xml") + baseline file("lint-baseline-local.xml") checkAllWarnings true warningsAsErrors true } diff --git a/platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml b/platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml new file mode 100644 index 0000000000..0a76f53505 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDK/lint-baseline-local.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml b/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml index 4dc8ecde70..fd65c9f627 100644 --- a/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml +++ b/platform/android/MapboxGLAndroidSDK/lint/lint-baseline-ci.xml @@ -1,5 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java index 3af7921596..70b13f05fb 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/Mapbox.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk; +import android.annotation.SuppressLint; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; @@ -26,6 +27,7 @@ import com.mapbox.services.android.telemetry.location.LocationEnginePriority; @UiThread public final class Mapbox { + @SuppressLint("StaticFieldLeak") private static Mapbox INSTANCE; private Context context; private String accessToken; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java index f9ca9bf4cc..3c9cb31211 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.annotations; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -35,6 +36,7 @@ public final class IconFactory { public static final String ICON_MARKERVIEW_ID = ICON_ID_PREFIX + "marker_view"; private Context context; + @SuppressLint("StaticFieldLeak") private static IconFactory instance; private Icon defaultMarker; private Icon defaultMarkerView; diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java index 9c8cda5544..91a235616a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java @@ -109,13 +109,11 @@ class HTTPRequest implements Callback { @Override public void onResponse(Call call, Response response) throws IOException { if (response.isSuccessful()) { - Timber.v(String.format("[HTTP] Request was successful (code = %d).", response.code())); + Timber.v("[HTTP] Request was successful (code = %s).", response.code()); } else { // We don't want to call this unsuccessful because a 304 isn't really an error String message = !TextUtils.isEmpty(response.message()) ? response.message() : "No additional information"; - Timber.d(String.format( - "[HTTP] Request with response code = %d: %s", - response.code(), message)); + Timber.d("[HTTP] Request with response code = %s: %s", response.code(), message); } byte[] body; @@ -160,15 +158,12 @@ class HTTPRequest implements Callback { String errorMessage = e.getMessage() != null ? e.getMessage() : "Error processing the request"; if (type == TEMPORARY_ERROR) { - Timber.d(String.format(MapboxConstants.MAPBOX_LOCALE, - "Request failed due to a temporary error: %s", errorMessage)); + Timber.d("Request failed due to a temporary error: %s", errorMessage); } else if (type == CONNECTION_ERROR) { - Timber.i(String.format(MapboxConstants.MAPBOX_LOCALE, - "Request failed due to a connection error: %s", errorMessage)); + Timber.i("Request failed due to a connection error: %s", errorMessage); } else { // PERMANENT_ERROR - Timber.w(String.format(MapboxConstants.MAPBOX_LOCALE, - "Request failed due to a permanent error: %s", errorMessage)); + Timber.w("Request failed due to a permanent error: %s", errorMessage); } mLock.lock(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index f47fcdfd4a..3b8bc16bb3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -272,7 +272,6 @@ public final class MapboxMap { * Check whether tile pre-fetching is enabled or not. * * @return true if enabled - * * @see MapboxMap#setPrefetchesTiles(boolean) */ @UiThread @@ -316,7 +315,7 @@ public final class MapboxMap { // noinspection unchecked return (T) nativeMapView.getLayer(layerId); } catch (ClassCastException exception) { - Timber.e(String.format("Layer: %s is a different type: %s", layerId, exception)); + Timber.e(exception, "Layer: %s is a different type: ", layerId); return null; } } @@ -437,7 +436,7 @@ public final class MapboxMap { // noinspection unchecked return (T) nativeMapView.getSource(sourceId); } catch (ClassCastException exception) { - Timber.e(String.format("Source: %s is a different type: %s", sourceId, exception)); + Timber.e(exception, "Source: %s is a different type: ", sourceId); return null; } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 52596358e2..ddeb4b326e 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -17,7 +17,6 @@ import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.Polyline; import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.geometry.ProjectedMeters; @@ -84,9 +83,10 @@ final class NativeMapView { private boolean isDestroyedOn(String callingMethod) { if (destroyed && !TextUtils.isEmpty(callingMethod)) { - Timber.e(String.format(MapboxConstants.MAPBOX_LOCALE, + Timber.e( "You're calling `%s` after the `MapView` was destroyed, were you invoking it after `onDestroy()`?", - callingMethod)); + callingMethod + ); } return destroyed; } @@ -143,14 +143,14 @@ final class NativeMapView { if (width > 65535) { // we have seen edge cases where devices return incorrect values #6111 Timber.e("Device returned an out of range width size, " - + "capping value at 65535 instead of " + width); + + "capping value at 65535 instead of %s", width); width = 65535; } if (height > 65535) { // we have seen edge cases where devices return incorrect values #6111 Timber.e("Device returned an out of range height size, " - + "capping value at 65535 instead of " + height); + + "capping value at 65535 instead of %s", height); height = 65535; } nativeResizeView(width, height); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java index d788b7772b..6f63c2eba8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java @@ -346,7 +346,7 @@ final class Transform implements MapView.OnMapChangedListener { void setMinZoom(double minZoom) { if ((minZoom < MapboxConstants.MINIMUM_ZOOM) || (minZoom > MapboxConstants.MAXIMUM_ZOOM)) { - Timber.e("Not setting minZoomPreference, value is in unsupported range: " + minZoom); + Timber.e("Not setting minZoomPreference, value is in unsupported range: %s", minZoom); return; } mapView.setMinZoom(minZoom); @@ -358,7 +358,7 @@ final class Transform implements MapView.OnMapChangedListener { void setMaxZoom(double maxZoom) { if ((maxZoom < MapboxConstants.MINIMUM_ZOOM) || (maxZoom > MapboxConstants.MAXIMUM_ZOOM)) { - Timber.e("Not setting maxZoomPreference, value is in unsupported range: " + maxZoom); + Timber.e("Not setting maxZoomPreference, value is in unsupported range: %s", maxZoom); return; } mapView.setMaxZoom(maxZoom); 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 017fdb353a..4e696fb56b 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 @@ -1,6 +1,7 @@ package com.mapbox.mapboxsdk.maps.widgets; import android.animation.ValueAnimator; +import android.annotation.SuppressLint; import android.content.Context; import android.graphics.Camera; import android.graphics.Canvas; @@ -775,6 +776,7 @@ public class MyLocationView extends View { locationSource = new WeakReference<>(locationEngine); } + @SuppressLint("MissingPermission") @Override public void onConnected() { MyLocationView locationView = userLocationView.get(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java index a1bd98b780..817dcdb438 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.net; +import android.annotation.SuppressLint; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -21,6 +22,7 @@ import timber.log.Timber; * Not public api. */ public class ConnectivityReceiver extends BroadcastReceiver { + @SuppressLint("StaticFieldLeak") private static ConnectivityReceiver INSTANCE; /** @@ -82,7 +84,7 @@ public class ConnectivityReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { boolean connected = isConnected(context); - Timber.v("Connected: " + connected); + Timber.v("Connected: %s", connected); // Loop over listeners for (ConnectivityListener listener : listeners) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index 1e6f44f094..130284e88d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.offline; +import android.annotation.SuppressLint; import android.content.Context; import android.os.Handler; import android.os.Looper; @@ -40,6 +41,7 @@ public class OfflineManager { private Handler handler; // This object is implemented as a singleton + @SuppressLint("StaticFieldLeak") private static OfflineManager instance; // The application context @@ -90,11 +92,11 @@ public class OfflineManager { */ private OfflineManager(Context context) { this.context = context.getApplicationContext(); - this.fileSource = FileSource.getInstance(context); + this.fileSource = FileSource.getInstance(this.context); initialize(fileSource); // Delete any existing previous ambient cache database - deleteAmbientDatabase(context); + deleteAmbientDatabase(this.context); } private void deleteAmbientDatabase(final Context context) { @@ -107,10 +109,10 @@ public class OfflineManager { File file = new File(path); if (file.exists()) { file.delete(); - Timber.d("Old ambient cache database deleted to save space: " + path); + Timber.d("Old ambient cache database deleted to save space: %s", path); } } catch (Exception exception) { - Timber.e("Failed to delete old ambient cache database: ", exception); + Timber.e(exception, "Failed to delete old ambient cache database: "); } } }).start(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java index eafef80e8d..a968cdf192 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java @@ -72,9 +72,9 @@ public class FileSource { MapboxConstants.KEY_META_DATA_SET_STORAGE_EXTERNAL, MapboxConstants.DEFAULT_SET_STORAGE_EXTERNAL); } catch (PackageManager.NameNotFoundException exception) { - Timber.e("Failed to read the package metadata: ", exception); + Timber.e(exception,"Failed to read the package metadata: "); } catch (Exception exception) { - Timber.e("Failed to read the storage key: ", exception); + Timber.e(exception, "Failed to read the storage key: "); } String cachePath = null; @@ -83,7 +83,7 @@ public class FileSource { // Try getting the external storage path cachePath = context.getExternalFilesDir(null).getAbsolutePath(); } catch (NullPointerException exception) { - Timber.e("Failed to obtain the external storage path: ", exception); + Timber.e(exception, "Failed to obtain the external storage path: "); } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java index e1e40821b1..e7bb52ebb3 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java @@ -279,7 +279,7 @@ public class Function { // noinspection unchecked return (S) stops; } catch (ClassCastException exception) { - Timber.e(String.format("Stops: %s is a different type: %s", stops.getClass(), exception)); + Timber.e(exception, "Stops: %s is a different type: ", stops.getClass()); return null; } } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml index 3decd6ead1..d59eef7427 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res-public/values/public.xml @@ -83,11 +83,13 @@ - + + + diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml deleted file mode 100644 index 4c733ed112..0000000000 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/color/mapbox_material_bg_selector.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-nodpi/mapbox_mapview_preview.jpg b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-nodpi/mapbox_mapview_preview.jpg new file mode 100644 index 0000000000..3a21fc08bc Binary files /dev/null and b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-nodpi/mapbox_mapview_preview.jpg differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_mapview_preview.jpg b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_mapview_preview.jpg deleted file mode 100644 index 3a21fc08bc..0000000000 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxhdpi/mapbox_mapview_preview.jpg and /dev/null differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_infowindow_icon_bg.9.png b/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_infowindow_icon_bg.9.png deleted file mode 100644 index 584b320299..0000000000 Binary files a/platform/android/MapboxGLAndroidSDK/src/main/res/drawable-xxxhdpi/mapbox_infowindow_icon_bg.9.png and /dev/null differ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_attribution_list_item.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_attribution_list_item.xml index 763bb118e0..648946e8ce 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_attribution_list_item.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_attribution_list_item.xml @@ -9,5 +9,6 @@ android:paddingLeft="24dp" android:paddingRight="24dp" android:textAllCaps="true" + android:textIsSelectable="true" android:textAppearance="?android:attr/textAppearanceButton" android:textColor="@color/mapbox_blue"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_infowindow_content.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_infowindow_content.xml index 26c974dc0d..027f3690d5 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_infowindow_content.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/layout/mapbox_infowindow_content.xml @@ -23,6 +23,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="2dp" + android:textIsSelectable="true" android:maxEms="17" android:textColor="@android:color/black" android:textSize="18sp" @@ -34,13 +35,13 @@ android:layout_height="wrap_content" android:layout_marginBottom="2dp" android:layout_marginTop="2dp" + android:textIsSelectable="true" android:lineSpacingExtra="1dp" android:maxEms="17" android:textColor="@color/mapbox_gray" android:textSize="14sp"/> + android:id="@+id/image" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:contentDescription="@null"/> diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml index 63ef42c2c3..68e70e948e 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/colors.xml @@ -3,5 +3,4 @@ #7D7F80 #EEEEEE #1E8CAB - @color/mapbox_blue diff --git a/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml b/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml index 8edbd47c29..1c6a265587 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml +++ b/platform/android/MapboxGLAndroidSDK/src/main/res/values/dimens.xml @@ -2,17 +2,8 @@ 8dp 8dp - -2dp - 1.5dp - @dimen/mapbox_two_dp - @dimen/mapbox_two_dp - @dimen/mapbox_two_dp - @dimen/mapbox_two_dp - 2dp 4dp 8dp - 10dp - 16dp 92dp 18dp diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle index b13362751a..360cb36067 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle +++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle @@ -25,12 +25,10 @@ android { } lintOptions { - baseline file("lint-baseline.xml") + baseline file("lint-baseline-local.xml") checkAllWarnings true warningsAsErrors true - disable 'MissingTranslation' - disable 'IconDensities' - disable 'InvalidPackage' + disable 'MissingTranslation', 'GoogleAppIndexingWarning', 'UnpackedNativeCode', 'IconDipSize' } buildTypes { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/lint-baseline-local.xml b/platform/android/MapboxGLAndroidSDKTestApp/lint-baseline-local.xml new file mode 100644 index 0000000000..e3c5abce4f --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/lint-baseline-local.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml b/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml index 89eab70c48..64e3d41bcc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/lint/lint-baseline-ci.xml @@ -1,2569 +1,177 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + errorLine1=" android:background="#cccc"" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~" + id="Overdraw" + message="Possible overdraw: Root element paints background `#cccc` with a theme that also paints a background (inferred theme is `@style/AppTheme`)"> + column="5" + file="src/main/res/layout/drawer_navigation_drawer.xml" + line="4"/> + errorLine1=" android:background="?android:attr/selectableItemBackground"" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + id="Overdraw" + message="Possible overdraw: Root element paints background `?android:attr/selectableItemBackground` with a theme that also paints a background (inferred theme is `@style/AppTheme`)"> + column="5" + file="src/main/res/layout/item_main_feature.xml" + line="6"/> + errorLine1=" android:background="@color/mapboxGreen">" + errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + id="Overdraw" + message="Possible overdraw: Root element paints background `@color/mapboxGreen` with a theme that also paints a background (inferred theme is `@style/AppTheme`)"> + column="5" + file="src/main/res/layout/view_text_marker.xml" + line="5"/> + errorLine1=" <string name="mapbox_attributionTelemetryMessage">Estàs ajudant a millorar els mapes d\'OpenStreetMap i de Mapbox aportant dades d\'ús anònimes.</string>" + errorLine2=" ^" + id="TypographyQuotes" + message="Replace straight quotes ('') with directional quotes (‘’, &#8216; and &#8217;) ?"> + column="55" + file="src/main/res/values-ca/strings.xml" + line="9"/> + id="IconDipSize" + message="The image `icon_burned.png` varies significantly in its density-independent (dip) size across the various density versions: drawable-hdpi/icon_burned.png: 64x64 dp (96x96 px), drawable-xxxhdpi/icon_burned.png: 48x48 dp (192x192 px), drawable-xxhdpi/icon_burned.png: 48x48 dp (144x144 px), drawable-xhdpi/icon_burned.png: 48x48 dp (96x96 px), drawable-mdpi/icon_burned.png: 48x48 dp (48x48 px)"> - - - + file="src/main/res/drawable-mdpi/icon_burned.png"/> - - - + file="src/main/res/drawable-xhdpi/icon_burned.png"/> - - - + file="src/main/res/drawable-xxhdpi/icon_burned.png"/> - - - + file="src/main/res/drawable-xxxhdpi/icon_burned.png"/> + file="src/main/res/drawable-hdpi/icon_burned.png"/> + id="IconDuplicatesConfig" + message="The `icon_burned.png` icon has identical contents in the following configuration folders: drawable-hdpi, drawable-xhdpi"> - - - + file="src/main/res/drawable-xhdpi/icon_burned.png"/> + file="src/main/res/drawable-hdpi/icon_burned.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-hdpi/ic_launcher_round.png`: expected 72x72, but was 216x216"> + file="src/main/res/drawable-hdpi/ic_launcher_round.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-mdpi/ic_launcher_round.png`: expected 48x48, but was 144x144"> + file="src/main/res/drawable-mdpi/ic_launcher_round.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-xhdpi/ic_launcher_round.png`: expected 96x96, but was 288x288"> + file="src/main/res/drawable-xhdpi/ic_launcher_round.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-xxhdpi/ic_launcher_round.png`: expected 144x144, but was 432x432"> + file="src/main/res/drawable-xxhdpi/ic_launcher_round.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-xxxhdpi/ic_launcher_round.png`: expected 192x192, but was 576x576"> + file="src/main/res/drawable-xxxhdpi/ic_launcher_round.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-hdpi/icon.png`: expected 72x72, but was 215x212"> + file="src/main/res/drawable-hdpi/icon.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-mdpi/icon.png`: expected 48x48, but was 143x141"> + file="src/main/res/drawable-mdpi/icon.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-xhdpi/icon.png`: expected 96x96, but was 286x282"> + file="src/main/res/drawable-xhdpi/icon.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-xxhdpi/icon.png`: expected 144x144, but was 429x423"> + file="src/main/res/drawable-xxhdpi/icon.png"/> + id="IconExpectedSize" + message="Incorrect icon size for `drawable-xxxhdpi/icon.png`: expected 192x192, but was 572x564"> + file="src/main/res/drawable-xxxhdpi/icon.png"/> + id="IconDensities" + message="Missing the following drawables in `drawable-hdpi`: ic_car_top.png, ic_taxi_top.png, ic_us.png, southeast_radar_0.png, southeast_radar_1.png... (2 more)"> + file="src/main/res/drawable-hdpi"/> + id="IconDensities" + message="Missing the following drawables in `drawable-mdpi`: ic_car_top.png, ic_taxi_top.png, ic_us.png"> + file="src/main/res/drawable-mdpi"/> + id="IconDensities" + message="Missing the following drawables in `drawable-xhdpi`: ic_car_top.png, ic_taxi_top.png, ic_us.png, southeast_radar_0.png, southeast_radar_1.png... (2 more)"> + file="src/main/res/drawable-xhdpi"/> + id="IconDensities" + message="Missing the following drawables in `drawable-xxhdpi`: ic_car_top.png, ic_taxi_top.png, southeast_radar_0.png, southeast_radar_1.png, southeast_radar_2.png... (1 more)"> + file="src/main/res/drawable-xxhdpi"/> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java index fa19235ad0..ec7105c321 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.testapp.maps.widgets; +import android.annotation.SuppressLint; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; @@ -97,6 +98,7 @@ public class MyLocationViewTest extends BaseActivityTest { return getClass().getSimpleName(); } + @SuppressLint("MissingPermission") @Override public void perform(UiController uiController, View view) { if (isEnabled) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java index 6e582c6a3a..3148ec6793 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java @@ -43,10 +43,10 @@ public class OnMapReadyIdlingResource implements IdlingResource { Field field = activity.getClass().getDeclaredField("mapboxMap"); field.setAccessible(true); mapboxMap = (MapboxMap) field.get(activity); - Timber.e("isMapboxReady called with value " + (mapboxMap != null)); + Timber.e("isMapboxReady called with value %s", (mapboxMap != null)); return mapboxMap != null; } catch (Exception exception) { - Timber.e("could not reflect", exception); + Timber.e(exception, "could not reflect"); return false; } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java index deee312bb3..fba33bb380 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/MapboxApplication.java @@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp; import android.app.Application; import android.os.StrictMode; import android.text.TextUtils; -import android.util.Log; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.testapp.utils.TokenUtils; @@ -21,7 +20,6 @@ import static timber.log.Timber.DebugTree; */ public class MapboxApplication extends Application { - private static final String LOG_TAG = MapboxApplication.class.getSimpleName(); private static final String DEFAULT_MAPBOX_ACCESS_TOKEN = "YOUR_MAPBOX_ACCESS_TOKEN_GOES_HERE"; private static final String ACCESS_TOKEN_NOT_SET_MESSAGE = "In order to run the Test App you need to set a valid " + "access token. During development, you can set the MAPBOX_ACCESS_TOKEN environment variable for the SDK to " @@ -55,7 +53,7 @@ public class MapboxApplication extends Application { String mapboxAccessToken = TokenUtils.getMapboxAccessToken(getApplicationContext()); if (TextUtils.isEmpty(mapboxAccessToken) || mapboxAccessToken.equals(DEFAULT_MAPBOX_ACCESS_TOKEN)) { - Log.w(LOG_TAG, ACCESS_TOKEN_NOT_SET_MESSAGE); + Timber.e(ACCESS_TOKEN_NOT_SET_MESSAGE); } Mapbox.getInstance(getApplicationContext(), mapboxAccessToken); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java index f8617366a0..3f20f19f5d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/FeatureOverviewActivity.java @@ -92,7 +92,7 @@ public class FeatureOverviewActivity extends AppCompatActivity implements Permis getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA)); } catch (PackageManager.NameNotFoundException exception) { - Timber.e("Could not resolve package info", exception); + Timber.e(exception, "Could not resolve package info"); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java index 27958c3d0c..d54063a77e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AddRemoveMarkerActivity.java @@ -115,14 +115,14 @@ public class AddRemoveMarkerActivity extends AppCompatActivity { isShowingHighThresholdMarker = false; if (activeMarker != null) { - Timber.d("Remove marker with " + activeMarker.getId()); + Timber.d("Remove marker with id %s", activeMarker.getId()); mapboxMap.removeMarker(activeMarker); } else { Timber.e("active marker is null"); } activeMarker = mapboxMap.addMarker(lowThresholdMarker); - Timber.d("showLowThresholdMarker() " + activeMarker.getId()); + Timber.d("showLowThresholdMarker() with id %s ", activeMarker.getId()); } private void showHighThresholdMarker() { @@ -134,14 +134,14 @@ public class AddRemoveMarkerActivity extends AppCompatActivity { isShowingHighThresholdMarker = true; if (activeMarker != null) { - Timber.d("Remove marker with " + activeMarker.getId()); + Timber.d("Remove marker with id %s", activeMarker.getId()); mapboxMap.removeMarker(activeMarker); } else { Timber.e("active marker is null"); } activeMarker = mapboxMap.addMarker(highThresholdMarker); - Timber.d("showHighThresholdMarker() " + activeMarker.getId()); + Timber.d("showHighThresholdMarker() with id %s", activeMarker.getId()); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java index 8b238e49a8..50adeb2d74 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/BulkMarkerActivity.java @@ -274,7 +274,7 @@ public class BulkMarkerActivity extends AppCompatActivity implements AdapterView String json = GeoParseUtil.loadStringFromAssets(activity.getApplicationContext(), "points.geojson"); return GeoParseUtil.parseGeoJsonCoordinates(json); } catch (IOException | JSONException exception) { - Timber.e("Could not add markers,", exception); + Timber.e(exception, "Could not add markers"); return null; } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java index f2f82865d1..61ece0a94f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewActivity.java @@ -36,6 +36,7 @@ import com.mapbox.mapboxsdk.testapp.model.annotations.CountryMarkerViewOptions; import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerView; import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerViewOptions; +import java.util.Locale; import java.util.Random; /** @@ -150,7 +151,11 @@ public class MarkerViewActivity extends AppCompatActivity { public void onMapChanged(@MapView.MapChange int change) { if (change == MapView.REGION_IS_CHANGING || change == MapView.REGION_DID_CHANGE) { if (!markerViewManager.getMarkerViewAdapters().isEmpty() && viewCountView != null) { - viewCountView.setText("ViewCache size " + markerViewContainer.getChildCount()); + viewCountView.setText(String.format( + Locale.getDefault(), + getString(R.string.viewcache_size), + markerViewContainer.getChildCount()) + ); } } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java index 266db3fdd1..a8a5054eaf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/MarkerViewsInRectangleActivity.java @@ -53,7 +53,7 @@ public class MarkerViewsInRectangleActivity extends AppCompatActivity implements int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i(String.format("Querying box %s", box)); + Timber.i("Querying box %s", box); List markers = mapboxMap.getMarkerViewsInRect(box); // Show count diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java index cb2f57d860..f82e9573f2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/CameraPositionActivity.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.testapp.activity.camera; +import android.annotation.SuppressLint; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; @@ -83,6 +84,7 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe fab = (FloatingActionButton) findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, R.color.primary)); fab.setOnClickListener(new View.OnClickListener() { + @SuppressLint("InflateParams") @Override public void onClick(View view) { Context context = view.getContext(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java index 9c031ad32a..20174daeaa 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java @@ -48,7 +48,7 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i(String.format("Querying box %s", box)); + Timber.i("Querying box %s", box); List features = mapboxMap.queryRenderedFeatures(box); // Show count @@ -66,22 +66,21 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity { } private void debugOutput(List features) { - Timber.i(String.format("Got %s features", features.size())); + Timber.i("Got %s features", features.size()); for (Feature feature : features) { if (feature != null) { - Timber.i(String.format("Got feature %s with %s properties and Geometry %s", + Timber.i("Got feature %s with %s properties and Geometry %s", feature.getId(), feature.getProperties() != null ? feature.getProperties().entrySet().size() : "", - feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "") + feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "" ); if (feature.getProperties() != null) { for (Map.Entry entry : feature.getProperties().entrySet()) { - Timber.i(String.format("Prop %s - %s", entry.getKey(), entry.getValue())); + Timber.i("Prop %s - %s", entry.getKey(), entry.getValue()); } } } else { - // TODO Question: Why not formatting here?? - Timber.i("Got NULL feature %s"); + Timber.i("Got 0 features"); } } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java index 1d15efef84..a909bb7151 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java @@ -53,7 +53,7 @@ public class QueryRenderedFeaturesBoxHighlightActivity extends AppCompatActivity int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i(String.format("Querying box %s for buildings", box)); + Timber.i("Querying box %s for buildings", box); List features = mapboxMap.queryRenderedFeatures(box, Filter.lt("height", 10), "building"); // Show count diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java index 8c2f3a8fb5..251a3855f0 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java @@ -59,7 +59,7 @@ public class QueryRenderedFeaturesBoxSymbolCountActivity extends AppCompatActivi try { mapboxMap.addSource(new GeoJsonSource("symbols-source", readRawResource(R.raw.test_points_utrecht))); } catch (IOException ioException) { - Timber.e("Could not load geojson: " + ioException.getMessage()); + Timber.e(ioException,"Could not load geojson"); return; } mapboxMap.addImage( @@ -76,7 +76,7 @@ public class QueryRenderedFeaturesBoxSymbolCountActivity extends AppCompatActivi int top = selectionBox.getTop() - mapView.getTop(); int left = selectionBox.getLeft() - mapView.getLeft(); RectF box = new RectF(left, top, left + selectionBox.getWidth(), top + selectionBox.getHeight()); - Timber.i(String.format("Querying box %s", box)); + Timber.i("Querying box %s", box); List features = mapboxMap.queryRenderedFeatures(box, "symbols-layer"); // Show count diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java index 8b83db3069..1bd6a34b7c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java @@ -59,9 +59,9 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { public void onMapClick(@NonNull LatLng point) { // Query final PointF pixel = mapboxMap.getProjection().toScreenLocation(point); - Timber.i(String.format( + Timber.i( "Requesting features for %sx%s (%sx%s adjusted for density)", - pixel.x, pixel.y, pixel.x / density, pixel.y / density) + pixel.x, pixel.y, pixel.x / density, pixel.y / density ); List features = mapboxMap.queryRenderedFeatures(pixel); @@ -84,22 +84,21 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { } private void debugOutput(List features) { - Timber.i(String.format("Got %s features", features.size())); + Timber.i("Got %s features", features.size()); for (Feature feature : features) { if (feature != null) { - Timber.i(String.format("Got feature %s with %s properties and Geometry %s", + Timber.i("Got feature %s with %s properties and Geometry %s", feature.getId(), feature.getProperties() != null ? feature.getProperties().entrySet().size() : "", - feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "") + feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "" ); if (feature.getProperties() != null) { for (Map.Entry entry : feature.getProperties().entrySet()) { - Timber.i(String.format("Prop %s - %s", entry.getKey(), entry.getValue())); + Timber.i("Prop %s - %s", entry.getKey(), entry.getValue()); } } } else { - // TODO Question: Why not formatting here?? - Timber.i("Got NULL feature %s"); + Timber.i("Got NULL feature"); } } } @@ -185,7 +184,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { private final List features; - public CustomMarker(BaseMarkerOptions baseMarkerOptions, List features) { + CustomMarker(BaseMarkerOptions baseMarkerOptions, List features) { super(baseMarkerOptions); this.features = features; } @@ -201,7 +200,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity { return this; } - public CustomMarkerOptions() { + CustomMarkerOptions() { } private CustomMarkerOptions(Parcel in) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java index 2be47b4e25..655012f799 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/imagegenerator/SnapshotActivity.java @@ -15,6 +15,8 @@ import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; +import java.util.Locale; + /** * Test activity showcasing the Snapshot API to create and display a bitmap of the current shown Map. */ @@ -56,7 +58,7 @@ public class SnapshotActivity extends AppCompatActivity implements OnMapReadyCal snapshotView.setImageBitmap(snapshot); Toast.makeText( SnapshotActivity.this, - String.format("Snapshot taken in %d ms", duration), + String.format(Locale.getDefault(), "Snapshot taken in %d ms", duration), Toast.LENGTH_LONG).show(); } }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java index 18db2ba8a8..e8525b6a62 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/infowindow/DynamicInfoWindowAdapterActivity.java @@ -21,6 +21,8 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.utils.IconUtils; +import java.util.Locale; + /** * Test activity showcasing how to dynamically update InfoWindow when Using an MapboxMap.InfoWindowAdapter. */ @@ -69,7 +71,7 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen // Get the view from the info window if (infoWindow != null && infoWindow.getView() != null) { // Set the new text on the text view in the info window - ((TextView) infoWindow.getView()).setText(String.format("%.2fkm", distanceKm)); + ((TextView) infoWindow.getView()).setText(String.format(Locale.getDefault(), "%.2fkm", distanceKm)); // Update the info window position (as the text length changes) infoWindow.update(); @@ -100,9 +102,8 @@ public class DynamicInfoWindowAdapterActivity extends AppCompatActivity implemen TextView textView = new TextView(DynamicInfoWindowAdapterActivity.this); textView.setText(marker.getTitle()); textView.setBackgroundColor(Color.WHITE); - textView.setText("Click the map to calculate the distance"); + textView.setText(R.string.action_calculate_distance); textView.setPadding(padding, padding, padding, padding); - return textView; } }); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java index 18d6fadcb8..dea1abea8e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/DebugModeActivity.java @@ -69,7 +69,7 @@ public class DebugModeActivity extends AppCompatActivity { @Override public void onClick(View view) { if (mapboxMap != null) { - Timber.d("Debug FAB: isDebug Active? " + mapboxMap.isDebugActive()); + Timber.d("Debug FAB: isDebug Active? %s" , mapboxMap.isDebugActive()); mapboxMap.cycleDebugOptions(); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java index 344e9e140a..5bffd4d930 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/offline/OfflineActivity.java @@ -12,7 +12,6 @@ import android.widget.Toast; import com.mapbox.mapboxsdk.Mapbox; import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.constants.MapboxConstants; import com.mapbox.mapboxsdk.constants.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.geometry.LatLngBounds; @@ -75,8 +74,7 @@ public class OfflineActivity extends AppCompatActivity // state of your app. This will override any checks performed via the ConnectivityManager. // Mapbox.getInstance().setConnected(false); Boolean connected = Mapbox.isConnected(); - Timber.d(String.format(MapboxConstants.MAPBOX_LOCALE, - "Mapbox is connected: %b", connected)); + Timber.d("Mapbox is connected: %s", connected); // Set up map mapView = (MapView) findViewById(R.id.mapView); @@ -207,7 +205,7 @@ public class OfflineActivity extends AppCompatActivity @Override public void onError(String error) { - Timber.e("Error: " + error); + Timber.e("Error: %s" , error); } }); } @@ -223,7 +221,7 @@ public class OfflineActivity extends AppCompatActivity } // Start progress bar - Timber.d("Download started: " + regionName); + Timber.d("Download started: %s", regionName); startProgress(); // Definition @@ -241,14 +239,14 @@ public class OfflineActivity extends AppCompatActivity offlineManager.createOfflineRegion(definition, metadata, new OfflineManager.CreateOfflineRegionCallback() { @Override public void onCreate(OfflineRegion offlineRegion) { - Timber.d("Offline region created: " + regionName); + Timber.d("Offline region created: %s" , regionName); OfflineActivity.this.offlineRegion = offlineRegion; launchDownload(); } @Override public void onError(String error) { - Timber.e("Error: " + error); + Timber.e("Error: %s", error); } }); } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java index 2238d1d5fe..f99a1fdb96 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CircleLayerActivity.java @@ -74,7 +74,7 @@ public class CircleLayerActivity extends AppCompatActivity implements View.OnCli source = new GeoJsonSource("bus_stop", new URL("https://raw.githubusercontent.com/cheeaun/busrouter-sg/master/data/2/bus-stops.geojson")); } catch (MalformedURLException exception) { - Timber.e("That's not an url... ", exception); + Timber.e(exception, "That's not an url... "); } mapboxMap.addSource(source); } @@ -132,7 +132,7 @@ public class CircleLayerActivity extends AppCompatActivity implements View.OnCli new URL("https://gist.githubusercontent.com/tobrun/7fbc0fe7e9ffea509f7608cda2601d5d/raw/" + "a4b8cc289020f91fa2e1553524820054395e36f5/line.geojson"))); } catch (MalformedURLException malformedUrlException) { - Timber.e("That's not an url... ", malformedUrlException); + Timber.e(malformedUrlException, "That's not an url... "); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java index 80dfe777cb..a2111bc304 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GeoJsonClusteringActivity.java @@ -128,7 +128,7 @@ public class GeoJsonClusteringActivity extends AppCompatActivity { ) ); } catch (MalformedURLException malformedUrlException) { - Timber.e("That's not an url... " + malformedUrlException.getMessage()); + Timber.e(malformedUrlException,"That's not an url... "); } // Add unclustered layer diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java index b9f7ebce35..b9f1dfe810 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RealTimeGeoJsonActivity.java @@ -55,7 +55,7 @@ public class RealTimeGeoJsonActivity extends AppCompatActivity implements OnMapR try { mapboxMap.addSource(new GeoJsonSource(ID_GEOJSON_SOURCE, new URL(URL_GEOJSON_SOURCE))); } catch (MalformedURLException malformedUrlException) { - Timber.e("Invalid URL", malformedUrlException); + Timber.e(malformedUrlException, "Invalid URL"); } // add layer diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index f6754af0f9..287108c6aa 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -317,12 +317,12 @@ public class RuntimeStyleActivity extends AppCompatActivity { layer = mapboxMap.getLayerAs("parksLayer"); // And get some properties PropertyValue fillAntialias = layer.getFillAntialias(); - Timber.d("Fill anti alias: " + fillAntialias.getValue()); + Timber.d("Fill anti alias: %s", fillAntialias.getValue()); layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP)); PropertyValue fillTranslateAnchor = layer.getFillTranslateAnchor(); - Timber.d("Fill translate anchor: " + fillTranslateAnchor.getValue()); + Timber.d("Fill translate anchor: %s", fillTranslateAnchor.getValue()); PropertyValue visibility = layer.getVisibility(); - Timber.d("Visibility: " + visibility.getValue()); + Timber.d("Visibility: %s", visibility.getValue()); // Get a good look at it all mapboxMap.animateCamera(CameraUpdateFactory.zoomTo(12)); @@ -477,11 +477,11 @@ public class RuntimeStyleActivity extends AppCompatActivity { Function function = (Function) fillColor.getFunction(); if (function != null) { ExponentialStops stops = (ExponentialStops) function.getStops(); - Timber.d("Fill color base: " + stops.getBase()); - Timber.d("Fill color #stops: " + stops.size()); + Timber.d("Fill color base: %s", stops.getBase()); + Timber.d("Fill color #stops: %s", stops.size()); if (function.getStops() != null) { for (Stop stop : stops) { - Timber.d("Fill color #stops: " + stop); + Timber.d("Fill color #stops: %s", stop); } } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java index 6906e90f6e..7dcae6a16d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/StyleFileActivity.java @@ -72,7 +72,7 @@ public class StyleFileActivity extends AppCompatActivity { try { cacheStyleFile = File.createTempFile("my-", ".style.json"); cacheStyleFile.createNewFile(); - Timber.i("Writing style file to: " + cacheStyleFile.getAbsolutePath()); + Timber.i("Writing style file to: %s", cacheStyleFile.getAbsolutePath()); writeToFile(cacheStyleFile, readRawResource(R.raw.local_style)); } catch (Exception exception) { Toast.makeText(StyleFileActivity.this, "Could not create style file in cache dir", Toast.LENGTH_SHORT).show(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java index 69e6d64325..9f6f2b2fcd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/userlocation/MyLocationDrawableActivity.java @@ -50,7 +50,7 @@ public class MyLocationDrawableActivity extends BaseLocationActivity implements mapView = new MapView(this, mapboxMapOptions); mapView.setId(R.id.mapView); - ViewGroup parent = (ViewGroup) findViewById(R.id.container); + ViewGroup parent = (ViewGroup) findViewById(android.R.id.content); parent.addView(mapView); mapView.onCreate(savedInstanceState); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java index f717daeada..76f07ba526 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/other/OfflineListRegionsDialog.java @@ -32,7 +32,7 @@ public class OfflineListRegionsDialog extends DialogFragment { .setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { - Timber.d("Selected item: " + which); + Timber.d("Selected item: %s", which); } }) .setPositiveButton("Accept", new DialogInterface.OnClickListener() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java index 8c6ab3e211..6220dc7e69 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/OfflineUtils.java @@ -29,7 +29,7 @@ public class OfflineUtils { String json = jsonObject.toString(); metadata = json.getBytes(JSON_CHARSET); } catch (Exception exception) { - Timber.e("Failed to encode metadata: " + exception.getMessage()); + Timber.e(exception, "Failed to encode metadata: "); } return metadata; } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java index 6f20d6fb0f..235fd8233b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/TimingLogger.java @@ -146,15 +146,15 @@ public class TimingLogger { if (disabled) { return; } - Timber.d(label + ": begin"); + Timber.d("%s: begin", label); final long first = splits.get(0); long now = first; for (int i = 1; i < splits.size(); i++) { now = splits.get(i); final String splitLabel = splitLabels.get(i); final long prev = splits.get(i - 1); - Timber.d(label + ": " + (now - prev) + " ms, " + splitLabel); + Timber.d("%s: %s ms, %s", label, (now - prev), splitLabel); } - Timber.d(label + ": end, " + (now - first) + " ms"); + Timber.d("%s: end, %s ms", label, (now - first)); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_check_box.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_check_box.xml deleted file mode 100644 index cf8bfa24b5..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/ic_check_box.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/marker.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/marker.xml deleted file mode 100644 index 71992ebd7f..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/drawable/marker.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml index ac1f08e821..cfc923902c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_animated_image_source.xml @@ -14,16 +14,4 @@ app:mapbox_cameraZoom="3" app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/> - - diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml index fa37c485d7..c8752df1bf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_building_layer.xml @@ -1,8 +1,6 @@ - + @@ -35,4 +33,4 @@ android:src="@drawable/ic_paint" app:backgroundTint="@color/primary"/> - + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml index b70bb6d7b2..0cb065a676 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_camera_animation_types.xml @@ -15,7 +15,9 @@ app:mapbox_cameraZoom="15"/> @@ -36,6 +37,7 @@ android:layout_marginBottom="@dimen/fab_margin" android:layout_marginRight="@dimen/fab_margin" android:src="@drawable/ic_layers" + android:layout_marginEnd="@dimen/fab_margin" app:backgroundTint="@color/primary"/> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml index 6db8b073d9..56fe909c45 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_debug_mode.xml @@ -21,6 +21,7 @@ android:layout_height="wrap_content" android:layout_gravity="bottom|start" android:layout_margin="8dp" + android:textIsSelectable="true" android:textSize="14sp"/> - +