diff options
| -rw-r--r-- | main/res/values/changelog_master.xml | 3 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/DataStore.java | 5 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/activity/AbstractActivity.java | 9 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCParser.java | 17 | ||||
| -rw-r--r-- | play-services-base/lint.xml | 190 | ||||
| -rw-r--r-- | play-services-location/lint.xml | 190 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/GeocacheTest.java | 101 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java | 1 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC2CJPF.java | 1 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC2JVEH.java | 1 | ||||
| -rw-r--r-- | tests/src/cgeo/geocaching/test/mock/GC3XX5J.java | 1 |
11 files changed, 448 insertions, 71 deletions
diff --git a/main/res/values/changelog_master.xml b/main/res/values/changelog_master.xml index 1e3c3d4..0576519 100644 --- a/main/res/values/changelog_master.xml +++ b/main/res/values/changelog_master.xml @@ -2,5 +2,8 @@ <resources> <!-- changelog for the master branch --> <string name="changelog_master" translatable="false"> + <b>Next feature release:</b>\n + ยท Put features there\n + \n </string> </resources> diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java index 0f9f6bf..d36a9c9 100644 --- a/main/src/cgeo/geocaching/DataStore.java +++ b/main/src/cgeo/geocaching/DataStore.java @@ -3001,8 +3001,9 @@ public class DataStore { private static void clearPreparedStatements() { for (final PreparedStatement preparedStatement : statements) { - if (preparedStatement.statement != null) { - preparedStatement.statement.close(); + final SQLiteStatement statement = preparedStatement.statement; + if (statement != null) { + statement.close(); preparedStatement.statement = null; } } diff --git a/main/src/cgeo/geocaching/activity/AbstractActivity.java b/main/src/cgeo/geocaching/activity/AbstractActivity.java index ba11958..4cddfe6 100644 --- a/main/src/cgeo/geocaching/activity/AbstractActivity.java +++ b/main/src/cgeo/geocaching/activity/AbstractActivity.java @@ -231,7 +231,14 @@ public abstract class AbstractActivity extends ActionBarActivity implements IAbs @Override public NdefMessage createNdefMessage(final NfcEvent event) { final String uri = sharingInterface.getAndroidBeamUri(); - return uri != null ? new NdefMessage(new NdefRecord[]{NdefRecord.createUri(uri)}) : null; + if (uri == null) { + return null; + } + final NdefRecord[] records = { + NdefRecord.createUri(uri), + NdefRecord.createApplicationRecord(CgeoApplication.getInstance().getPackageName()) + }; + return new NdefMessage(records); } }, this); diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index badbc67..ab11df6 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -65,6 +65,7 @@ import android.text.Html; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; @@ -1695,28 +1696,22 @@ public abstract class GCParser { Log.e("GCParser.loadLogsFromDetails: error " + statusCode + " when requesting log information"); return Observable.empty(); } - final String rawResponse = Network.getResponseData(response); - if (rawResponse == null) { + final InputStream responseStream = Network.getResponseStream(response); + if (responseStream == null) { Log.e("GCParser.loadLogsFromDetails: unable to read whole response"); return Observable.empty(); } - return parseLogs(logType != Logs.ALL, rawResponse); + return parseLogs(logType != Logs.ALL, responseStream); } }).subscribeOn(RxUtils.networkScheduler); } - private static Observable<LogEntry> parseLogs(final boolean markAsFriendsLog, final String rawResponse) { + private static Observable<LogEntry> parseLogs(final boolean markAsFriendsLog, final InputStream responseStream) { return Observable.create(new OnSubscribe<LogEntry>() { @Override public void call(final Subscriber<? super LogEntry> subscriber) { - // for non logged in users the log book is not shown - if (StringUtils.isBlank(rawResponse)) { - subscriber.onCompleted(); - return; - } - try { - final ObjectNode resp = (ObjectNode) JsonUtils.reader.readTree(rawResponse); + final ObjectNode resp = (ObjectNode) JsonUtils.reader.readTree(responseStream); if (!resp.path("status").asText().equals("success")) { Log.e("GCParser.loadLogsFromDetails: status is " + resp.path("status").asText("[absent]")); subscriber.onCompleted(); diff --git a/play-services-base/lint.xml b/play-services-base/lint.xml new file mode 100644 index 0000000..715caf3 --- /dev/null +++ b/play-services-base/lint.xml @@ -0,0 +1,190 @@ +<?xml version="1.0" encoding="UTF-8"?> +<lint> + <issue id="AaptCrash" severity="ignore" /> + <issue id="AccidentalOctal" severity="ignore" /> + <issue id="AdapterViewChildren" severity="ignore" /> + <issue id="AddJavascriptInterface" severity="ignore" /> + <issue id="AllowBackup" severity="ignore" /> + <issue id="AlwaysShowAction" severity="ignore" /> + <issue id="AndroidGradlePluginVersion" severity="ignore" /> + <issue id="AppCompatMethod" severity="ignore" /> + <issue id="AppCompatResource" severity="ignore" /> + <issue id="Assert" severity="ignore" /> + <issue id="ButtonCase" severity="ignore" /> + <issue id="ButtonOrder" severity="ignore" /> + <issue id="ButtonStyle" severity="ignore" /> + <issue id="ByteOrderMark" severity="ignore" /> + <issue id="ClickableViewAccessibility" severity="ignore" /> + <issue id="CommitPrefEdits" severity="ignore" /> + <issue id="CommitTransaction" severity="ignore" /> + <issue id="ContentDescription" severity="ignore" /> + <issue id="CustomViewStyleable" severity="ignore" /> + <issue id="CutPasteId" severity="ignore" /> + <issue id="DalvikOverride" severity="ignore" /> + <issue id="DefaultLocale" severity="ignore" /> + <issue id="Deprecated" severity="ignore" /> + <issue id="DeviceAdmin" severity="ignore" /> + <issue id="DisableBaselineAlignment" severity="ignore" /> + <issue id="DrawAllocation" severity="ignore" /> + <issue id="DuplicateActivity" severity="ignore" /> + <issue id="DuplicateDefinition" severity="ignore" /> + <issue id="DuplicateIds" severity="ignore" /> + <issue id="DuplicateIncludedIds" severity="ignore" /> + <issue id="DuplicateUsesFeature" severity="ignore" /> + <issue id="EnforceUTF8" severity="ignore" /> + <issue id="ExportedContentProvider" severity="ignore" /> + <issue id="ExportedPreferenceActivity" severity="ignore" /> + <issue id="ExportedReceiver" severity="ignore" /> + <issue id="ExportedService" severity="ignore" /> + <issue id="ExtraText" severity="ignore" /> + <issue id="ExtraTranslation" severity="ignore" /> + <issue id="FloatMath" severity="ignore" /> + <issue id="GetInstance" severity="ignore" /> + <issue id="GifUsage" severity="ignore" /> + <issue id="GradleCompatible" severity="ignore" /> + <issue id="GradleDependency" severity="ignore" /> + <issue id="GradleDeprecated" severity="ignore" /> + <issue id="GradleDynamicVersion" severity="ignore" /> + <issue id="GradleGetter" severity="ignore" /> + <issue id="GradleIdeError" severity="ignore" /> + <issue id="GradleOverrides" severity="ignore" /> + <issue id="GradlePath" severity="ignore" /> + <issue id="GrantAllUris" severity="ignore" /> + <issue id="GridLayout" severity="ignore" /> + <issue id="HandlerLeak" severity="ignore" /> + <issue id="HardcodedDebugMode" severity="ignore" /> + <issue id="HardcodedText" severity="ignore" /> + <issue id="IconColors" severity="ignore" /> + <issue id="IconDensities" severity="ignore" /> + <issue id="IconDipSize" severity="ignore" /> + <issue id="IconDuplicates" severity="ignore" /> + <issue id="IconDuplicatesConfig" severity="ignore" /> + <issue id="IconExtension" severity="ignore" /> + <issue id="IconLauncherShape" severity="ignore" /> + <issue id="IconLocation" severity="ignore" /> + <issue id="IconMissingDensityFolder" severity="ignore" /> + <issue id="IconMixedNinePatch" severity="ignore" /> + <issue id="IconNoDpi" severity="ignore" /> + <issue id="IconXmlAndPng" severity="ignore" /> + <issue id="IllegalResourceRef" severity="ignore" /> + <issue id="ImpliedQuantity" severity="ignore" /> + <issue id="InOrMmUsage" severity="ignore" /> + <issue id="IncludeLayoutParam" severity="ignore" /> + <issue id="InconsistentArrays" severity="ignore" /> + <issue id="InconsistentLayout" severity="ignore" /> + <issue id="InefficientWeight" severity="ignore" /> + <issue id="InflateParams" severity="ignore" /> + <issue id="InlinedApi" severity="ignore" /> + <issue id="InnerclassSeparator" severity="ignore" /> + <issue id="Instantiatable" severity="ignore" /> + <issue id="InvalidId" severity="ignore" /> + <issue id="InvalidPackage" severity="ignore" /> + <issue id="JavascriptInterface" severity="ignore" /> + <issue id="LabelFor" severity="ignore" /> + <issue id="LibraryCustomView" severity="ignore" /> + <issue id="LocalSuppress" severity="ignore" /> + <issue id="LocaleFolder" severity="ignore" /> + <issue id="MangledCRLF" severity="ignore" /> + <issue id="ManifestOrder" severity="ignore" /> + <issue id="ManifestTypo" severity="ignore" /> + <issue id="MenuTitle" severity="ignore" /> + <issue id="MergeRootFrame" severity="ignore" /> + <issue id="MissingApplicationIcon" severity="ignore" /> + <issue id="MissingId" severity="ignore" /> + <issue id="MissingPrefix" severity="ignore" /> + <issue id="MissingQuantity" severity="ignore" /> + <issue id="MissingRegistered" severity="ignore" /> + <issue id="MissingSuperCall" severity="ignore" /> + <issue id="MissingTranslation" severity="ignore" /> + <issue id="MissingVersion" severity="ignore" /> + <issue id="MockLocation" severity="ignore" /> + <issue id="MultipleUsesSdk" severity="ignore" /> + <issue id="NamespaceTypo" severity="ignore" /> + <issue id="NestedScrolling" severity="ignore" /> + <issue id="NestedWeights" severity="ignore" /> + <issue id="NewApi" severity="ignore" /> + <issue id="NfcTechWhitespace" severity="ignore" /> + <issue id="NotSibling" severity="ignore" /> + <issue id="ObsoleteLayoutParam" severity="ignore" /> + <issue id="OldTargetApi" severity="ignore" /> + <issue id="OnClick" severity="ignore" /> + <issue id="Orientation" severity="ignore" /> + <issue id="Overdraw" severity="ignore" /> + <issue id="Override" severity="ignore" /> + <issue id="PackagedPrivateKey" severity="ignore" /> + <issue id="ParcelCreator" severity="ignore" /> + <issue id="PrivateResource" severity="ignore" /> + <issue id="Proguard" severity="ignore" /> + <issue id="ProguardSplit" severity="ignore" /> + <issue id="PropertyEscape" severity="ignore" /> + <issue id="ProtectedPermissions" severity="ignore" /> + <issue id="PxUsage" severity="ignore" /> + <issue id="Recycle" severity="ignore" /> + <issue id="ReferenceType" severity="ignore" /> + <issue id="Registered" severity="ignore" /> + <issue id="RequiredSize" severity="ignore" /> + <issue id="ResAuto" severity="ignore" /> + <issue id="ResourceAsColor" severity="ignore" /> + <issue id="ResourceCycle" severity="ignore" /> + <issue id="ResourceName" severity="ignore" /> + <issue id="RtlCompat" severity="ignore" /> + <issue id="RtlEnabled" severity="ignore" /> + <issue id="RtlHardcoded" severity="ignore" /> + <issue id="RtlSymmetry" severity="ignore" /> + <issue id="ScrollViewCount" severity="ignore" /> + <issue id="ScrollViewSize" severity="ignore" /> + <issue id="SdCardPath" severity="ignore" /> + <issue id="SecureRandom" severity="ignore" /> + <issue id="ServiceCast" severity="ignore" /> + <issue id="SetJavaScriptEnabled" severity="ignore" /> + <issue id="ShowToast" severity="ignore" /> + <issue id="SignatureOrSystemPermissions" severity="ignore" /> + <issue id="SimpleDateFormat" severity="ignore" /> + <issue id="SmallSp" severity="ignore" /> + <issue id="SpUsage" severity="ignore" /> + <issue id="StateListReachable" severity="ignore" /> + <issue id="StringFormatCount" severity="ignore" /> + <issue id="StringFormatInvalid" severity="ignore" /> + <issue id="StringFormatMatches" severity="ignore" /> + <issue id="StringShouldBeInt" severity="ignore" /> + <issue id="Suspicious0dp" severity="ignore" /> + <issue id="SuspiciousImport" severity="ignore" /> + <issue id="TextFields" severity="ignore" /> + <issue id="TextViewEdits" severity="ignore" /> + <issue id="TooDeepLayout" severity="ignore" /> + <issue id="TooManyViews" severity="ignore" /> + <issue id="TrulyRandom" severity="ignore" /> + <issue id="TypographyDashes" severity="ignore" /> + <issue id="TypographyEllipsis" severity="ignore" /> + <issue id="TypographyFractions" severity="ignore" /> + <issue id="TypographyOther" severity="ignore" /> + <issue id="Typos" severity="ignore" /> + <issue id="UniquePermission" severity="ignore" /> + <issue id="UnknownId" severity="ignore" /> + <issue id="UnknownIdInLayout" severity="ignore" /> + <issue id="UnlocalizedSms" severity="ignore" /> + <issue id="UnusedAttribute" severity="ignore" /> + <issue id="UnusedNamespace" severity="ignore" /> + <issue id="UnusedQuantity" severity="ignore" /> + <issue id="UnusedResources" severity="ignore" /> + <issue id="UseCheckPermission" severity="ignore" /> + <issue id="UseCompoundDrawables" severity="ignore" /> + <issue id="UseSparseArrays" severity="ignore" /> + <issue id="UseValueOf" severity="ignore" /> + <issue id="UselessLeaf" severity="ignore" /> + <issue id="UselessParent" severity="ignore" /> + <issue id="UsesMinSdkAttributes" severity="ignore" /> + <issue id="ValidFragment" severity="ignore" /> + <issue id="ViewConstructor" severity="ignore" /> + <issue id="ViewHolder" severity="ignore" /> + <issue id="ViewTag" severity="ignore" /> + <issue id="Wakelock" severity="ignore" /> + <issue id="WebViewLayout" severity="ignore" /> + <issue id="WorldReadableFiles" severity="ignore" /> + <issue id="WorldWriteableFiles" severity="ignore" /> + <issue id="WrongCall" severity="ignore" /> + <issue id="WrongCase" severity="ignore" /> + <issue id="WrongFolder" severity="ignore" /> + <issue id="WrongManifestParent" severity="ignore" /> + <issue id="WrongViewCast" severity="ignore" /> +</lint>
\ No newline at end of file diff --git a/play-services-location/lint.xml b/play-services-location/lint.xml new file mode 100644 index 0000000..715caf3 --- /dev/null +++ b/play-services-location/lint.xml @@ -0,0 +1,190 @@ +<?xml version="1.0" encoding="UTF-8"?> +<lint> + <issue id="AaptCrash" severity="ignore" /> + <issue id="AccidentalOctal" severity="ignore" /> + <issue id="AdapterViewChildren" severity="ignore" /> + <issue id="AddJavascriptInterface" severity="ignore" /> + <issue id="AllowBackup" severity="ignore" /> + <issue id="AlwaysShowAction" severity="ignore" /> + <issue id="AndroidGradlePluginVersion" severity="ignore" /> + <issue id="AppCompatMethod" severity="ignore" /> + <issue id="AppCompatResource" severity="ignore" /> + <issue id="Assert" severity="ignore" /> + <issue id="ButtonCase" severity="ignore" /> + <issue id="ButtonOrder" severity="ignore" /> + <issue id="ButtonStyle" severity="ignore" /> + <issue id="ByteOrderMark" severity="ignore" /> + <issue id="ClickableViewAccessibility" severity="ignore" /> + <issue id="CommitPrefEdits" severity="ignore" /> + <issue id="CommitTransaction" severity="ignore" /> + <issue id="ContentDescription" severity="ignore" /> + <issue id="CustomViewStyleable" severity="ignore" /> + <issue id="CutPasteId" severity="ignore" /> + <issue id="DalvikOverride" severity="ignore" /> + <issue id="DefaultLocale" severity="ignore" /> + <issue id="Deprecated" severity="ignore" /> + <issue id="DeviceAdmin" severity="ignore" /> + <issue id="DisableBaselineAlignment" severity="ignore" /> + <issue id="DrawAllocation" severity="ignore" /> + <issue id="DuplicateActivity" severity="ignore" /> + <issue id="DuplicateDefinition" severity="ignore" /> + <issue id="DuplicateIds" severity="ignore" /> + <issue id="DuplicateIncludedIds" severity="ignore" /> + <issue id="DuplicateUsesFeature" severity="ignore" /> + <issue id="EnforceUTF8" severity="ignore" /> + <issue id="ExportedContentProvider" severity="ignore" /> + <issue id="ExportedPreferenceActivity" severity="ignore" /> + <issue id="ExportedReceiver" severity="ignore" /> + <issue id="ExportedService" severity="ignore" /> + <issue id="ExtraText" severity="ignore" /> + <issue id="ExtraTranslation" severity="ignore" /> + <issue id="FloatMath" severity="ignore" /> + <issue id="GetInstance" severity="ignore" /> + <issue id="GifUsage" severity="ignore" /> + <issue id="GradleCompatible" severity="ignore" /> + <issue id="GradleDependency" severity="ignore" /> + <issue id="GradleDeprecated" severity="ignore" /> + <issue id="GradleDynamicVersion" severity="ignore" /> + <issue id="GradleGetter" severity="ignore" /> + <issue id="GradleIdeError" severity="ignore" /> + <issue id="GradleOverrides" severity="ignore" /> + <issue id="GradlePath" severity="ignore" /> + <issue id="GrantAllUris" severity="ignore" /> + <issue id="GridLayout" severity="ignore" /> + <issue id="HandlerLeak" severity="ignore" /> + <issue id="HardcodedDebugMode" severity="ignore" /> + <issue id="HardcodedText" severity="ignore" /> + <issue id="IconColors" severity="ignore" /> + <issue id="IconDensities" severity="ignore" /> + <issue id="IconDipSize" severity="ignore" /> + <issue id="IconDuplicates" severity="ignore" /> + <issue id="IconDuplicatesConfig" severity="ignore" /> + <issue id="IconExtension" severity="ignore" /> + <issue id="IconLauncherShape" severity="ignore" /> + <issue id="IconLocation" severity="ignore" /> + <issue id="IconMissingDensityFolder" severity="ignore" /> + <issue id="IconMixedNinePatch" severity="ignore" /> + <issue id="IconNoDpi" severity="ignore" /> + <issue id="IconXmlAndPng" severity="ignore" /> + <issue id="IllegalResourceRef" severity="ignore" /> + <issue id="ImpliedQuantity" severity="ignore" /> + <issue id="InOrMmUsage" severity="ignore" /> + <issue id="IncludeLayoutParam" severity="ignore" /> + <issue id="InconsistentArrays" severity="ignore" /> + <issue id="InconsistentLayout" severity="ignore" /> + <issue id="InefficientWeight" severity="ignore" /> + <issue id="InflateParams" severity="ignore" /> + <issue id="InlinedApi" severity="ignore" /> + <issue id="InnerclassSeparator" severity="ignore" /> + <issue id="Instantiatable" severity="ignore" /> + <issue id="InvalidId" severity="ignore" /> + <issue id="InvalidPackage" severity="ignore" /> + <issue id="JavascriptInterface" severity="ignore" /> + <issue id="LabelFor" severity="ignore" /> + <issue id="LibraryCustomView" severity="ignore" /> + <issue id="LocalSuppress" severity="ignore" /> + <issue id="LocaleFolder" severity="ignore" /> + <issue id="MangledCRLF" severity="ignore" /> + <issue id="ManifestOrder" severity="ignore" /> + <issue id="ManifestTypo" severity="ignore" /> + <issue id="MenuTitle" severity="ignore" /> + <issue id="MergeRootFrame" severity="ignore" /> + <issue id="MissingApplicationIcon" severity="ignore" /> + <issue id="MissingId" severity="ignore" /> + <issue id="MissingPrefix" severity="ignore" /> + <issue id="MissingQuantity" severity="ignore" /> + <issue id="MissingRegistered" severity="ignore" /> + <issue id="MissingSuperCall" severity="ignore" /> + <issue id="MissingTranslation" severity="ignore" /> + <issue id="MissingVersion" severity="ignore" /> + <issue id="MockLocation" severity="ignore" /> + <issue id="MultipleUsesSdk" severity="ignore" /> + <issue id="NamespaceTypo" severity="ignore" /> + <issue id="NestedScrolling" severity="ignore" /> + <issue id="NestedWeights" severity="ignore" /> + <issue id="NewApi" severity="ignore" /> + <issue id="NfcTechWhitespace" severity="ignore" /> + <issue id="NotSibling" severity="ignore" /> + <issue id="ObsoleteLayoutParam" severity="ignore" /> + <issue id="OldTargetApi" severity="ignore" /> + <issue id="OnClick" severity="ignore" /> + <issue id="Orientation" severity="ignore" /> + <issue id="Overdraw" severity="ignore" /> + <issue id="Override" severity="ignore" /> + <issue id="PackagedPrivateKey" severity="ignore" /> + <issue id="ParcelCreator" severity="ignore" /> + <issue id="PrivateResource" severity="ignore" /> + <issue id="Proguard" severity="ignore" /> + <issue id="ProguardSplit" severity="ignore" /> + <issue id="PropertyEscape" severity="ignore" /> + <issue id="ProtectedPermissions" severity="ignore" /> + <issue id="PxUsage" severity="ignore" /> + <issue id="Recycle" severity="ignore" /> + <issue id="ReferenceType" severity="ignore" /> + <issue id="Registered" severity="ignore" /> + <issue id="RequiredSize" severity="ignore" /> + <issue id="ResAuto" severity="ignore" /> + <issue id="ResourceAsColor" severity="ignore" /> + <issue id="ResourceCycle" severity="ignore" /> + <issue id="ResourceName" severity="ignore" /> + <issue id="RtlCompat" severity="ignore" /> + <issue id="RtlEnabled" severity="ignore" /> + <issue id="RtlHardcoded" severity="ignore" /> + <issue id="RtlSymmetry" severity="ignore" /> + <issue id="ScrollViewCount" severity="ignore" /> + <issue id="ScrollViewSize" severity="ignore" /> + <issue id="SdCardPath" severity="ignore" /> + <issue id="SecureRandom" severity="ignore" /> + <issue id="ServiceCast" severity="ignore" /> + <issue id="SetJavaScriptEnabled" severity="ignore" /> + <issue id="ShowToast" severity="ignore" /> + <issue id="SignatureOrSystemPermissions" severity="ignore" /> + <issue id="SimpleDateFormat" severity="ignore" /> + <issue id="SmallSp" severity="ignore" /> + <issue id="SpUsage" severity="ignore" /> + <issue id="StateListReachable" severity="ignore" /> + <issue id="StringFormatCount" severity="ignore" /> + <issue id="StringFormatInvalid" severity="ignore" /> + <issue id="StringFormatMatches" severity="ignore" /> + <issue id="StringShouldBeInt" severity="ignore" /> + <issue id="Suspicious0dp" severity="ignore" /> + <issue id="SuspiciousImport" severity="ignore" /> + <issue id="TextFields" severity="ignore" /> + <issue id="TextViewEdits" severity="ignore" /> + <issue id="TooDeepLayout" severity="ignore" /> + <issue id="TooManyViews" severity="ignore" /> + <issue id="TrulyRandom" severity="ignore" /> + <issue id="TypographyDashes" severity="ignore" /> + <issue id="TypographyEllipsis" severity="ignore" /> + <issue id="TypographyFractions" severity="ignore" /> + <issue id="TypographyOther" severity="ignore" /> + <issue id="Typos" severity="ignore" /> + <issue id="UniquePermission" severity="ignore" /> + <issue id="UnknownId" severity="ignore" /> + <issue id="UnknownIdInLayout" severity="ignore" /> + <issue id="UnlocalizedSms" severity="ignore" /> + <issue id="UnusedAttribute" severity="ignore" /> + <issue id="UnusedNamespace" severity="ignore" /> + <issue id="UnusedQuantity" severity="ignore" /> + <issue id="UnusedResources" severity="ignore" /> + <issue id="UseCheckPermission" severity="ignore" /> + <issue id="UseCompoundDrawables" severity="ignore" /> + <issue id="UseSparseArrays" severity="ignore" /> + <issue id="UseValueOf" severity="ignore" /> + <issue id="UselessLeaf" severity="ignore" /> + <issue id="UselessParent" severity="ignore" /> + <issue id="UsesMinSdkAttributes" severity="ignore" /> + <issue id="ValidFragment" severity="ignore" /> + <issue id="ViewConstructor" severity="ignore" /> + <issue id="ViewHolder" severity="ignore" /> + <issue id="ViewTag" severity="ignore" /> + <issue id="Wakelock" severity="ignore" /> + <issue id="WebViewLayout" severity="ignore" /> + <issue id="WorldReadableFiles" severity="ignore" /> + <issue id="WorldWriteableFiles" severity="ignore" /> + <issue id="WrongCall" severity="ignore" /> + <issue id="WrongCase" severity="ignore" /> + <issue id="WrongFolder" severity="ignore" /> + <issue id="WrongManifestParent" severity="ignore" /> + <issue id="WrongViewCast" severity="ignore" /> +</lint>
\ No newline at end of file diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java index 954b492..28f6620 100644 --- a/tests/src/cgeo/geocaching/GeocacheTest.java +++ b/tests/src/cgeo/geocaching/GeocacheTest.java @@ -66,13 +66,12 @@ public class GeocacheTest extends CGeoTestCase { } private void assertWaypointsParsed(final String note, final int expectedWaypoints) { - recordMapStoreFlags(); try { setMapStoreFlags(false, false); - Geocache cache = new Geocache(); + final Geocache cache = new Geocache(); final String geocode = "Test" + System.nanoTime(); cache.setGeocode(geocode); cache.setWaypoints(new ArrayList<Waypoint>(), false); @@ -95,21 +94,20 @@ public class GeocacheTest extends CGeoTestCase { } public static void testMergeDownloadedStored() { - - Geocache stored = new Geocache(); + final Geocache stored = new Geocache(); stored.setGeocode("GC12345"); stored.setDetailed(true); stored.setDisabled(true); stored.setType(CacheType.TRADITIONAL); stored.setCoords(new Geopoint(40.0, 8.0)); stored.setDescription("Test1"); - ArrayList<String> attributes = new ArrayList<String>(1); + final ArrayList<String> attributes = new ArrayList<String>(1); attributes.add("TestAttribute"); stored.setAttributes(attributes); stored.setShortDescription("Short"); stored.setHint("Hint"); - Geocache download = new Geocache(); + final Geocache download = new Geocache(); download.setGeocode("GC12345"); download.setDetailed(true); download.setDisabled(false); @@ -121,25 +119,23 @@ public class GeocacheTest extends CGeoTestCase { assertThat(download.isDetailed()).as("merged detailed").isTrue(); assertThat(download.isDisabled()).as("merged disabled").isFalse(); - assertEquals("Type not merged correctly", CacheType.MULTI, download.getType()); - assertEquals("Longitude not merged correctly", 9.0, download.getCoords().getLongitude(), 0.1); - assertEquals("Latitude not merged correctly", 41.0, download.getCoords().getLatitude(), 0.1); - assertEquals("Description not merged correctly", "Test2", download.getDescription()); - assertEquals("ShortDescription not merged correctly", "", download.getShortDescription()); - assertEquals("Attributes not merged correctly", new ArrayList<String>(0), download.getAttributes()); - assertEquals("Hint not merged correctly", "", download.getHint()); + assertThat(download.getType()).as("merged download").isEqualTo(CacheType.MULTI); + assertThat(download.getCoords()).as("merged coordinates").isEqualTo(new Geopoint(41.0, 9.0)); + assertThat(download.getDescription()).as("merged description").isEqualTo("Test2"); + assertThat(download.getShortDescription()).as("merged short description").isEmpty(); + assertThat(download.getAttributes()).as("merged attributes").isEmpty(); + assertThat(download.getHint()).as("merged hint").isEmpty(); } public static void testMergeLivemapStored() { - - Geocache stored = new Geocache(); + final Geocache stored = new Geocache(); stored.setGeocode("GC12345"); stored.setDetailed(true); stored.setDisabled(true); stored.setType(CacheType.TRADITIONAL); stored.setCoords(new Geopoint(40.0, 8.0)); - Geocache livemap = new Geocache(); + final Geocache livemap = new Geocache(); livemap.setGeocode("GC12345"); livemap.setType(CacheType.MULTI, 12); livemap.setCoords(new Geopoint(41.0, 9.0), 12); @@ -148,90 +144,81 @@ public class GeocacheTest extends CGeoTestCase { assertThat(livemap.isDetailed()).as("merged detailed").isTrue(); assertThat(livemap.isDisabled()).as("merged disabled").isTrue(); - assertEquals("Type not merged correctly", CacheType.TRADITIONAL, livemap.getType()); - assertEquals("Longitude not merged correctly", 8.0, livemap.getCoords().getLongitude(), 0.1); - assertEquals("Latitude not merged correctly", 40.0, livemap.getCoords().getLatitude(), 0.1); - assertEquals("Zoomlevel not merged correctly", stored.getCoordZoomLevel(), livemap.getCoordZoomLevel()); + assertThat(livemap.getType()).as("merged type").isEqualTo(CacheType.TRADITIONAL); + assertThat(livemap.getCoords()).as("merged coordinates").isEqualToComparingFieldByField(new Geopoint(40.0, 8.0)); + assertThat(livemap.getCoordZoomLevel()).as("merged zoomlevel").isEqualTo(stored.getCoordZoomLevel()); } public static void testMergeLivemapZoomin() { - - Geocache livemapFirst = new Geocache(); + final Geocache livemapFirst = new Geocache(); livemapFirst.setGeocode("GC12345"); livemapFirst.setType(CacheType.TRADITIONAL); livemapFirst.setCoords(new Geopoint(40.0, 8.0), 11); - Geocache livemapSecond = new Geocache(); + final Geocache livemapSecond = new Geocache(); livemapSecond.setGeocode("GC12345"); livemapSecond.setType(CacheType.MULTI); livemapSecond.setCoords(new Geopoint(41.0, 9.0), 12); livemapSecond.gatherMissingFrom(livemapFirst); - assertEquals("Type not merged correctly", CacheType.MULTI, livemapSecond.getType()); - assertEquals("Longitude not merged correctly", 9.0, livemapSecond.getCoords().getLongitude(), 0.1); - assertEquals("Latitude not merged correctly", 41.0, livemapSecond.getCoords().getLatitude(), 0.1); - assertEquals("Zoomlevel not merged correctly", 12, livemapSecond.getCoordZoomLevel()); + assertThat(livemapSecond.getType()).as("merged type").isEqualTo(CacheType.MULTI); + assertThat(livemapSecond.getCoords()).as("merged coordinates").isEqualTo(new Geopoint(41.0, 9.0)); + assertThat(livemapSecond.getCoordZoomLevel()).as("merged zoomlevel").isEqualTo(12); } public static void testMergeLivemapZoomout() { - - Geocache livemapFirst = new Geocache(); + final Geocache livemapFirst = new Geocache(); livemapFirst.setGeocode("GC12345"); livemapFirst.setType(CacheType.TRADITIONAL, 12); livemapFirst.setCoords(new Geopoint(40.0, 8.0), 12); - Geocache livemapSecond = new Geocache(); + final Geocache livemapSecond = new Geocache(); livemapSecond.setGeocode("GC12345"); livemapSecond.setType(CacheType.MULTI, 11); livemapSecond.setCoords(new Geopoint(41.0, 9.0), 11); livemapSecond.gatherMissingFrom(livemapFirst); - assertEquals("Type not merged correctly", CacheType.TRADITIONAL, livemapSecond.getType()); - assertEquals("Longitude not merged correctly", 8.0, livemapSecond.getCoords().getLongitude(), 0.1); - assertEquals("Latitude not merged correctly", 40.0, livemapSecond.getCoords().getLatitude(), 0.1); - assertEquals("Zoomlevel not merged correctly", 12, livemapSecond.getCoordZoomLevel()); + assertThat(livemapSecond.getType()).as("merged type").isEqualTo(CacheType.TRADITIONAL); + assertThat(livemapSecond.getCoords()).as("merged coordinates").isEqualTo(new Geopoint(40.0, 8.0)); + assertThat(livemapSecond.getCoordZoomLevel()).as("merged zoomlevel").isEqualTo(12); } public static void testMergePopupLivemap() { - - Geocache livemap = new Geocache(); + final Geocache livemap = new Geocache(); livemap.setGeocode("GC12345"); livemap.setCoords(new Geopoint(40.0, 8.0), 12); livemap.setFound(true); - Geocache popup = new Geocache(); + final Geocache popup = new Geocache(); popup.setGeocode("GC12345"); popup.setType(CacheType.MULTI); popup.gatherMissingFrom(livemap); - assertEquals("Type not merged correctly", CacheType.MULTI, popup.getType()); - assertEquals("Longitude not merged correctly", 8.0, popup.getCoords().getLongitude(), 0.1); - assertEquals("Latitude not merged correctly", 40.0, popup.getCoords().getLatitude(), 0.1); - assertThat(popup.isFound()).overridingErrorMessage("Found not merged correctly").isTrue(); - assertEquals("Zoomlevel not merged correctly", 12, popup.getCoordZoomLevel()); + assertThat(popup.getType()).as("merged type").isEqualTo(CacheType.MULTI); + assertThat(popup.getCoords()).as("merged coordinates").isEqualTo(new Geopoint(40.0, 8.0)); + assertThat(popup.isFound()).overridingErrorMessage("merged found").isTrue(); + assertThat(popup.getCoordZoomLevel()).as("merged zoomlevel").isEqualTo(12); } public static void testMergeLivemapBMSearched() { - - Geocache bmsearched = new Geocache(); + final Geocache bmsearched = new Geocache(); bmsearched.setGeocode("GC12345"); - Geocache livemap = new Geocache(); + final Geocache livemap = new Geocache(); livemap.setGeocode("GC12345"); livemap.setCoords(new Geopoint(40.0, 8.0), 12); livemap.gatherMissingFrom(bmsearched); - assertEquals("Longitude not merged correctly", 8.0, livemap.getCoords().getLongitude(), 0.1); - assertEquals("Latitude not merged correctly", 40.0, livemap.getCoords().getLatitude(), 0.1); - assertEquals("Zoomlevel not merged correctly", 12, livemap.getCoordZoomLevel()); + assertThat(livemap.getCoords()).as("merged coordinates").isEqualTo(new Geopoint(40.0, 8.0)); + assertThat(livemap.getCoordZoomLevel()).as("merged zoomlevel").isEqualTo(12); } public static void testNameForSorting() { - Geocache cache = new Geocache(); + final Geocache cache = new Geocache(); cache.setName("GR8 01-01"); assertThat(cache.getNameForSorting()).isEqualTo("GR000008 000001-000001"); } @@ -253,7 +240,7 @@ public class GeocacheTest extends CGeoTestCase { } public static void testGuessEventTimeShortDescription() { - Geocache cache = new Geocache(); + final Geocache cache = new Geocache(); cache.setType(CacheType.EVENT); cache.setDescription(StringUtils.EMPTY); cache.setShortDescription("text 14:20 text"); @@ -276,13 +263,13 @@ public class GeocacheTest extends CGeoTestCase { } public static void testGetPossibleLogTypes() throws Exception { - Geocache gcCache = new Geocache(); + final Geocache gcCache = new Geocache(); gcCache.setGeocode("GC123"); gcCache.setType(CacheType.WEBCAM); assertThat(gcCache.getPossibleLogTypes()).as("possible GC cache log types").contains(LogType.WEBCAM_PHOTO_TAKEN); assertThat(gcCache.getPossibleLogTypes()).as("possible GC cache log types").contains(LogType.NEEDS_MAINTENANCE); - Geocache ocCache = new Geocache(); + final Geocache ocCache = new Geocache(); ocCache.setGeocode("OC1234"); ocCache.setType(CacheType.TRADITIONAL); assertThat(ocCache.getPossibleLogTypes()).as("traditional cache possible log types").doesNotContain(LogType.WEBCAM_PHOTO_TAKEN); @@ -290,24 +277,24 @@ public class GeocacheTest extends CGeoTestCase { } public static void testLogTypeEventPast() throws Exception { - Calendar today = Calendar.getInstance(); + final Calendar today = Calendar.getInstance(); today.add(Calendar.DAY_OF_MONTH, -1); assertThat(createEventCache(today).getDefaultLogType()).isEqualTo(LogType.ATTENDED); } public static void testLogTypeEventToday() throws Exception { - Calendar today = Calendar.getInstance(); + final Calendar today = Calendar.getInstance(); assertThat(createEventCache(today).getDefaultLogType()).isEqualTo(LogType.ATTENDED); } public static void testLogTypeEventFuture() throws Exception { - Calendar today = Calendar.getInstance(); + final Calendar today = Calendar.getInstance(); today.add(Calendar.DAY_OF_MONTH, 1); assertThat(createEventCache(today).getDefaultLogType()).isEqualTo(LogType.WILL_ATTEND); } - private static Geocache createEventCache(Calendar calendar) { - Geocache cache = new Geocache(); + private static Geocache createEventCache(final Calendar calendar) { + final Geocache cache = new Geocache(); cache.setType(CacheType.EVENT); cache.setHidden(calendar.getTime()); return cache; diff --git a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java index 9580be8..4d74792 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java +++ b/tests/src/cgeo/geocaching/test/mock/GC1ZXX2.java @@ -97,6 +97,7 @@ public class GC1ZXX2 extends MockedCache { return null; } + @NonNull @Override public List<String> getAttributes() { final String[] attributes = new String[] { diff --git a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java index 5c65f37..7404e23 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java +++ b/tests/src/cgeo/geocaching/test/mock/GC2CJPF.java @@ -132,6 +132,7 @@ public class GC2CJPF extends MockedCache { return null; } + @NonNull @Override public List<String> getAttributes() { final String[] attributes = new String[] { diff --git a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java index 2525514..77f078b 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java +++ b/tests/src/cgeo/geocaching/test/mock/GC2JVEH.java @@ -100,6 +100,7 @@ public class GC2JVEH extends MockedCache { return null; } + @NonNull @Override public List<String> getAttributes() { final String[] attributes = new String[] { diff --git a/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java b/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java index 36e2358..c526d72 100644 --- a/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java +++ b/tests/src/cgeo/geocaching/test/mock/GC3XX5J.java @@ -98,6 +98,7 @@ public class GC3XX5J extends MockedCache { return null; } + @NonNull @Override public List<String> getAttributes() { final String[] attributes = new String[] { |
