Solve lint issues, reduce baseline (#9627)

* [android] - fix lint issues SDK
This commit is contained in:
Tobrun
2017-07-28 19:36:13 +02:00
committed by GitHub
parent ba7574ec51
commit 685b8b2c84
88 changed files with 557 additions and 3293 deletions

View File

@@ -116,7 +116,7 @@ android {
}
lintOptions {
baseline file("lint-baseline.xml")
baseline file("lint-baseline-local.xml")
checkAllWarnings true
warningsAsErrors true
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<issues format="4" by="lint 2.3.1">
<issue
id="MissingTranslation"
message="&quot;`mapbox_attributionErrorNoBrowser`&quot; is not translated in &quot;ca&quot; (Catalan), &quot;es&quot; (Spanish), &quot;lt&quot; (Lithuanian), &quot;nl&quot; (Dutch), &quot;sv&quot; (Swedish), &quot;vi&quot; (Vietnamese)"
errorLine1=" &lt;string name=&quot;mapbox_attributionErrorNoBrowser&quot;>No web browser installed on device, can\&apos;t open web page.&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="13"
column="13"/>
</issue>
<issue
id="MissingTranslation"
message="&quot;`mapbox_telemetrySettings`&quot; is not translated in &quot;ca&quot; (Catalan), &quot;es&quot; (Spanish), &quot;lt&quot; (Lithuanian), &quot;nl&quot; (Dutch), &quot;sv&quot; (Swedish), &quot;vi&quot; (Vietnamese)"
errorLine1=" &lt;string name=&quot;mapbox_telemetrySettings&quot;>Telemetry Settings&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="15"
column="13"/>
</issue>
<issue
id="TypographyQuotes"
message="Replace straight quotes (&apos;&apos;) with directional quotes (‘’, &amp;#8216; and &amp;#8217;) ?"
errorLine1=" &lt;string name=&quot;mapbox_attributionTelemetryMessage&quot;>Estàs ajudant a millorar els mapes d\&apos;OpenStreetMap i de Mapbox aportant dades d\&apos;ús anònimes.&lt;/string>"
errorLine2=" ^">
<location
file="src/main/res/values-ca/strings.xml"
line="9"
column="55"/>
</issue>
</issues>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- REMEMBER! First you run Lint locally you'll need to move the lint-baseline.xml file
<!-- REMEMBER! First you run Lint locally you'll need to move lint-baseline-local.xml.xml file
generated into the lint folder and called it lint-baseline-local.xml
If you remove any error when running Lint locally, you'll get a warning from the command
line advising you to remove it from the baseline. If you remove it (remember to remove it
@@ -8,94 +8,6 @@
Eventually, it'll be removed (when we remove all current lint errors included). -->
<issues format="4" by="lint 2.3.1">
<issue
id="MissingPermission"
message="Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`"
errorLine1=" Location lastKnownLocation = locationEngine.getLastLocation();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java"
line="783"
column="38"/>
</issue>
<issue
id="MissingPermission"
message="Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with `checkPermission`) or explicitly handle a potential `SecurityException`"
errorLine1=" locationEngine.requestLocationUpdates();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/widgets/MyLocationView.java"
line="787"
column="9"/>
</issue>
<issue
id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" Timber.v(String.format(&quot;[HTTP] Request was successful (code = %d).&quot;, response.code()));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="112"
column="16"/>
</issue>
<issue
id="DefaultLocale"
message="Implicitly using the default locale is a common source of bugs: Use `String.format(Locale, ...)` instead"
errorLine1=" Timber.d(String.format("
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="116"
column="16"/>
</issue>
<issue
id="TimberArgCount"
message="Wrong argument count, format string `Failed to read the package metadata: ` requires `0` but format call supplies `1`"
errorLine1=" Timber.e(&quot;Failed to read the package metadata: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java"
line="75"
column="7"/>
</issue>
<issue
id="TimberArgCount"
message="Wrong argument count, format string `Failed to read the storage key: ` requires `0` but format call supplies `1`"
errorLine1=" Timber.e(&quot;Failed to read the storage key: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java"
line="77"
column="7"/>
</issue>
<issue
id="TimberArgCount"
message="Wrong argument count, format string `Failed to obtain the external storage path: ` requires `0` but format call supplies `1`"
errorLine1=" Timber.e(&quot;Failed to obtain the external storage path: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java"
line="86"
column="9"/>
</issue>
<issue
id="TimberArgCount"
message="Wrong argument count, format string `Failed to delete old ambient cache database: ` requires `0` but format call supplies `1`"
errorLine1=" Timber.e(&quot;Failed to delete old ambient cache database: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java"
line="113"
column="11"/>
</issue>
<issue
id="MissingTranslation"
message="&quot;`mapbox_attributionErrorNoBrowser`&quot; is not translated in &quot;ca&quot; (Catalan), &quot;es&quot; (Spanish), &quot;lt&quot; (Lithuanian), &quot;nl&quot; (Dutch), &quot;sv&quot; (Swedish), &quot;vi&quot; (Vietnamese)"
@@ -118,431 +30,6 @@
column="13"/>
</issue>
<issue
id="BinaryOperationInTimber"
message="Replace String concatenation with Timber&apos;s string formatting"
errorLine1=" Timber.v(&quot;Connected: &quot; + connected);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java"
line="85"
column="14"/>
</issue>
<issue
id="BinaryOperationInTimber"
message="Replace String concatenation with Timber&apos;s string formatting"
errorLine1=" Timber.e(&quot;Device returned an out of range width size, &quot;"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java"
line="178"
column="16"/>
</issue>
<issue
id="BinaryOperationInTimber"
message="Replace String concatenation with Timber&apos;s string formatting"
errorLine1=" Timber.e(&quot;Device returned an out of range height size, &quot;"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java"
line="185"
column="16"/>
</issue>
<issue
id="BinaryOperationInTimber"
message="Replace String concatenation with Timber&apos;s string formatting"
errorLine1=" Timber.d(&quot;Old ambient cache database deleted to save space: &quot; + path);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java"
line="110"
column="22"/>
</issue>
<issue
id="BinaryOperationInTimber"
message="Replace String concatenation with Timber&apos;s string formatting"
errorLine1=" Timber.e(&quot;Not setting minZoomPreference, value is in unsupported range: &quot; + minZoom);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/Transform.java"
line="349"
column="16"/>
</issue>
<issue
id="BinaryOperationInTimber"
message="Replace String concatenation with Timber&apos;s string formatting"
errorLine1=" Timber.e(&quot;Not setting maxZoomPreference, value is in unsupported range: &quot; + maxZoom);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/Transform.java"
line="361"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.e(String.format(&quot;Stops: %s is a different type: %s&quot;, stops.getClass(), exception));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/style/functions/Function.java"
line="282"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.v(String.format(&quot;[HTTP] Request was successful (code = %d).&quot;, response.code()));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="112"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.d(String.format("
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="116"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.d(String.format(MapboxConstants.MAPBOX_LOCALE,"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="163"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.i(String.format(MapboxConstants.MAPBOX_LOCALE,"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="166"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.w(String.format(MapboxConstants.MAPBOX_LOCALE,"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java"
line="170"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.e(String.format(&quot;Layer: %s is a different type: %s&quot;, layerId, exception));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java"
line="286"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.e(String.format(&quot;Source: %s is a different type: %s&quot;, sourceId, exception));"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java"
line="407"
column="16"/>
</issue>
<issue
id="StringFormatInTimber"
message="Using &apos;String#format&apos; inside of &apos;Timber&apos;"
errorLine1=" Timber.e(String.format(MapboxConstants.MAPBOX_LOCALE,"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java"
line="92"
column="16"/>
</issue>
<issue
id="ThrowableNotAtBeginning"
message="Throwable should be first argument"
errorLine1=" Timber.e(&quot;Failed to read the package metadata: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java"
line="75"
column="7"/>
</issue>
<issue
id="ThrowableNotAtBeginning"
message="Throwable should be first argument"
errorLine1=" Timber.e(&quot;Failed to read the storage key: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java"
line="77"
column="7"/>
</issue>
<issue
id="ThrowableNotAtBeginning"
message="Throwable should be first argument"
errorLine1=" Timber.e(&quot;Failed to obtain the external storage path: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java"
line="86"
column="9"/>
</issue>
<issue
id="ThrowableNotAtBeginning"
message="Throwable should be first argument"
errorLine1=" Timber.e(&quot;Failed to delete old ambient cache database: &quot;, exception);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java"
line="113"
column="11"/>
</issue>
<issue
id="StaticFieldLeak"
message="Do not place Android context classes in static fields (static reference to `ConnectivityReceiver` which has field `context` pointing to `Context`); this is a memory leak (and also breaks Instant Run)"
errorLine1=" private static ConnectivityReceiver INSTANCE;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/net/ConnectivityReceiver.java"
line="24"
column="3"/>
</issue>
<issue
id="StaticFieldLeak"
message="Do not place Android context classes in static fields (static reference to `IconFactory` which has field `context` pointing to `Context`); this is a memory leak (and also breaks Instant Run)"
errorLine1=" private static IconFactory instance;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/annotations/IconFactory.java"
line="38"
column="3"/>
</issue>
<issue
id="StaticFieldLeak"
message="Do not place Android context classes in static fields (static reference to `Mapbox` which has field `context` pointing to `Context`); this is a memory leak (and also breaks Instant Run)"
errorLine1=" private static Mapbox INSTANCE;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/com/mapbox/mapboxsdk/Mapbox.java"
line="29"
column="3"/>
</issue>
<issue
id="StaticFieldLeak"
message="Do not place Android context classes in static fields (static reference to `OfflineManager` which has field `context` pointing to `Context`); this is a memory leak (and also breaks Instant Run)"
errorLine1=" // This object is implemented as a singleton"
errorLine2=" ^">
<location
file="src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java"
line="42"
column="3"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.color.mapbox_my_location_ring` appears to be unused"
errorLine1=" &lt;color name=&quot;mapbox_my_location_ring&quot;>@color/mapbox_blue&lt;/color>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/colors.xml"
line="6"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_infowindow_offset` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_infowindow_offset&quot;>-2dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="5"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_infowindow_line_width` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_infowindow_line_width&quot;>1.5dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="6"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_attribution_icon_left_padding` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_attribution_icon_left_padding&quot;>@dimen/mapbox_two_dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="7"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_attribution_icon_top_padding` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_attribution_icon_top_padding&quot;>@dimen/mapbox_two_dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="8"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_attribution_icon_right_padding` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_attribution_icon_right_padding&quot;>@dimen/mapbox_two_dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="9"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_attribution_icon_bottom_padding` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_attribution_icon_bottom_padding&quot;>@dimen/mapbox_two_dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="10"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_two_dp` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_two_dp&quot;>2dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="11"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_ten_dp` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_ten_dp&quot;>10dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="14"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.dimen.mapbox_sixteen_dp` appears to be unused"
errorLine1=" &lt;dimen name=&quot;mapbox_sixteen_dp&quot;>16dp&lt;/dimen>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/dimens.xml"
line="15"
column="12"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.drawable.mapbox_infowindow_icon_bg` appears to be unused">
<location
file="src/main/res/drawable-xxxhdpi/mapbox_infowindow_icon_bg.9.png"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.color.mapbox_material_bg_selector` appears to be unused"
errorLine1="&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;>"
errorLine2="^">
<location
file="src/main/res/color/mapbox_material_bg_selector.xml"
line="2"
column="1"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.string.mapbox_style_outdoors` appears to be unused"
errorLine1=" &lt;string name=&quot;mapbox_style_outdoors&quot; translatable=&quot;false&quot;>mapbox://styles/mapbox/outdoors-v10&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="22"
column="13"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.string.mapbox_style_traffic_day` appears to be unused"
errorLine1=" &lt;string name=&quot;mapbox_style_traffic_day&quot; translatable=&quot;false&quot;>mapbox://styles/mapbox/traffic-day-v2&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="27"
column="13"/>
</issue>
<issue
id="UnusedResources"
message="The resource `R.string.mapbox_style_traffic_night` appears to be unused"
errorLine1=" &lt;string name=&quot;mapbox_style_traffic_night&quot; translatable=&quot;false&quot;>mapbox://styles/mapbox/traffic-night-v2&lt;/string>"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/values/strings.xml"
line="28"
column="13"/>
</issue>
<issue
id="UnusedIds"
message="The resource `R.id.infowindow_subdescription` appears to be unused"
errorLine1=" android:id=&quot;@+id/infowindow_subdescription&quot;"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/res/layout/mapbox_infowindow_content.xml"
line="43"
column="9"/>
</issue>
<issue
id="TypographyQuotes"
message="Replace straight quotes (&apos;&apos;) with directional quotes (‘’, &amp;#8216; and &amp;#8217;) ?"
@@ -554,76 +41,4 @@
column="55"/>
</issue>
<issue
id="IconDensities"
message="Missing the following drawables in `drawable-hdpi`: mapbox_infowindow_icon_bg.9.png, mapbox_mapview_preview.jpg">
<location
file="src/main/res/drawable-hdpi"/>
</issue>
<issue
id="IconDensities"
message="Missing the following drawables in `drawable-mdpi`: mapbox_infowindow_icon_bg.9.png, mapbox_mapview_preview.jpg">
<location
file="src/main/res/drawable-mdpi"/>
</issue>
<issue
id="IconDensities"
message="Missing the following drawables in `drawable-xhdpi`: mapbox_infowindow_icon_bg.9.png, mapbox_mapview_preview.jpg">
<location
file="src/main/res/drawable-xhdpi"/>
</issue>
<issue
id="IconDensities"
message="Missing the following drawables in `drawable-xxhdpi`: mapbox_infowindow_icon_bg.9.png (found in drawable-xxxhdpi)">
<location
file="src/main/res/drawable-xxhdpi"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
errorLine1="&lt;TextView"
errorLine2="^">
<location
file="src/main/res/layout/mapbox_attribution_list_item.xml"
line="2"
column="1"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
errorLine1=" &lt;TextView"
errorLine2=" ^">
<location
file="src/main/res/layout/mapbox_infowindow_content.xml"
line="21"
column="5"/>
</issue>
<issue
id="SelectableText"
message="Consider making the text value selectable by specifying `android:textIsSelectable=&quot;true&quot;`"
errorLine1=" &lt;TextView"
errorLine2=" ^">
<location
file="src/main/res/layout/mapbox_infowindow_content.xml"
line="31"
column="5"/>
</issue>
<issue
id="ContentDescription"
message="[Accessibility] Missing `contentDescription` attribute on image"
errorLine1="&lt;ImageView xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;"
errorLine2="^">
<location
file="src/main/res/layout/mapbox_view_image_marker.xml"
line="2"
column="1"/>
</issue>
</issues>

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;
}
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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();

View File

@@ -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: ");
}
}

View File

@@ -279,7 +279,7 @@ public class Function<I, O> {
// 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;
}
}

View File

@@ -83,11 +83,13 @@
<!-- Exposed styles -->
<public name="mapbox_style_mapbox_streets" type="string" />
<public name="mapbox_style_emerald" type="string" />
<public name="mapbox_style_outdoors" type="string" />
<public name="mapbox_style_light" type="string" />
<public name="mapbox_style_dark" type="string" />
<public name="mapbox_style_satellite" type="string" />
<public name="mapbox_style_satellite_streets" type="string" />
<public name="mapbox_style_traffic_day" type="string" />
<public name="mapbox_style_traffic_night" type="string" />
<!-- Exposed strings -->
<public name="mapbox_compassContentDescription" type="string" />

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?attr/colorPrimaryDark" android:state_pressed="true" />
<item android:color="?attr/colorPrimary" />
</selector>

View File

@@ -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"/>

View File

@@ -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"/>
<TextView
android:id="@+id/infowindow_subdescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxEms="17"

View File

@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@null"/>

View File

@@ -3,5 +3,4 @@
<color name="mapbox_gray">#7D7F80</color>
<color name="mapbox_gray_light">#EEEEEE</color>
<color name="mapbox_blue">#1E8CAB</color>
<color name="mapbox_my_location_ring">@color/mapbox_blue</color>
</resources>

View File

@@ -2,17 +2,8 @@
<resources>
<dimen name="mapbox_infowindow_tipview_width">8dp</dimen>
<dimen name="mapbox_infowindow_margin">8dp</dimen>
<dimen name="mapbox_infowindow_offset">-2dp</dimen>
<dimen name="mapbox_infowindow_line_width">1.5dp</dimen>
<dimen name="mapbox_attribution_icon_left_padding">@dimen/mapbox_two_dp</dimen>
<dimen name="mapbox_attribution_icon_top_padding">@dimen/mapbox_two_dp</dimen>
<dimen name="mapbox_attribution_icon_right_padding">@dimen/mapbox_two_dp</dimen>
<dimen name="mapbox_attribution_icon_bottom_padding">@dimen/mapbox_two_dp</dimen>
<dimen name="mapbox_two_dp">2dp</dimen>
<dimen name="mapbox_four_dp">4dp</dimen>
<dimen name="mapbox_eight_dp">8dp</dimen>
<dimen name="mapbox_ten_dp">10dp</dimen>
<dimen name="mapbox_sixteen_dp">16dp</dimen>
<dimen name="mapbox_ninety_two_dp">92dp</dimen>
<dimen name="mapbox_my_locationview_outer_circle">18dp</dimen>
</resources>