From b2ffc2581c6630e313c4e623d0a40c8846e1e975 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 17 Mar 2015 08:37:59 +0100 Subject: Add missing final qualifiers in main module --- .../geocaching/activity/ActionBarListActivity.java | 4 +- .../cgeo/geocaching/activity/ActivityMixin.java | 2 +- main/src/cgeo/geocaching/activity/Progress.java | 2 +- .../cgeo/geocaching/apps/cache/WhereYouGoApp.java | 6 +-- .../geocaching/apps/cache/navi/GoogleMapsApp.java | 14 +++---- .../geocaching/apps/cache/navi/InternalMap.java | 6 +-- .../cgeo/geocaching/apps/cache/navi/LocusApp.java | 8 ++-- .../geocaching/apps/cache/navi/NavigonApp.java | 2 +- .../geocaching/apps/cache/navi/OruxMapsApp.java | 2 +- .../cgeo/geocaching/apps/cache/navi/RMapsApp.java | 8 ++-- .../geocaching/apps/cache/navi/StreetviewApp.java | 2 +- .../apps/cachelist/AbstractLocusCacheListApp.java | 6 +-- .../apps/cachelist/InternalCacheListMap.java | 2 +- .../cgeo/geocaching/connector/gc/IconDecoder.java | 2 +- .../geocaching/connector/gc/UncertainProperty.java | 6 +-- .../connector/oc/OCAuthorizationActivity.java | 8 ++-- .../cgeo/geocaching/connector/oc/OkapiError.java | 2 +- .../src/cgeo/geocaching/connector/oc/UserInfo.java | 6 +-- .../geocaching/connector/ox/OpenCachingApi.java | 8 ++-- .../connector/trackable/GeokretyParser.java | 6 +-- .../src/cgeo/geocaching/export/AbstractExport.java | 4 +- main/src/cgeo/geocaching/export/FieldNotes.java | 2 +- main/src/cgeo/geocaching/files/GPX10Parser.java | 4 +- main/src/cgeo/geocaching/files/GPX11Parser.java | 4 +- main/src/cgeo/geocaching/files/GPXParser.java | 2 +- .../files/InvalidXMLCharacterFilterReader.java | 12 +++--- .../cgeo/geocaching/files/NoCloseInputStream.java | 4 +- .../src/cgeo/geocaching/files/ParserException.java | 4 +- main/src/cgeo/geocaching/list/AbstractList.java | 2 +- .../loaders/HistoryGeocacheListLoader.java | 2 +- .../loaders/KeywordGeocacheListLoader.java | 2 +- .../loaders/NextPageGeocacheListLoader.java | 2 +- .../loaders/PocketGeocacheListLoader.java | 2 +- .../cgeo/geocaching/location/DistanceParser.java | 2 +- .../geocaching/maps/AbstractItemizedOverlay.java | 16 ++++---- .../cgeo/geocaching/maps/AbstractMapProvider.java | 2 +- main/src/cgeo/geocaching/maps/CGeoMap.java | 16 ++++---- main/src/cgeo/geocaching/maps/CachesOverlay.java | 38 ++++++++--------- main/src/cgeo/geocaching/maps/PositionDrawer.java | 48 +++++++++++----------- main/src/cgeo/geocaching/maps/PositionHistory.java | 6 +-- main/src/cgeo/geocaching/maps/ScaleDrawer.java | 6 +-- .../maps/google/v1/GoogleCacheOverlay.java | 26 ++++++------ .../maps/google/v1/GoogleCacheOverlayItem.java | 2 +- .../geocaching/maps/google/v1/GoogleGeoPoint.java | 2 +- .../maps/google/v1/GoogleMapActivity.java | 22 +++++----- .../maps/google/v1/GoogleMapController.java | 14 +++---- .../maps/google/v1/GoogleMapItemFactory.java | 2 +- .../maps/google/v1/GoogleMapProjection.java | 6 +-- .../maps/google/v1/GoogleMapProvider.java | 2 +- .../maps/mapsforge/MapsforgeCacheOverlay.java | 26 ++++++------ .../maps/mapsforge/MapsforgeCacheOverlayItem.java | 4 +- .../maps/mapsforge/MapsforgeGeoPoint.java | 2 +- .../maps/mapsforge/MapsforgeMapActivity.java | 22 +++++----- .../maps/mapsforge/MapsforgeMapController.java | 20 ++++----- .../maps/mapsforge/MapsforgeMapItemFactory.java | 2 +- .../maps/mapsforge/MapsforgeMapProjection.java | 6 +-- .../maps/mapsforge/MapsforgeMapSource.java | 2 +- main/src/cgeo/geocaching/network/Cookies.java | 2 +- .../settings/AbstractAttributeBasedPrefence.java | 10 ++--- .../AbstractCheckCredentialsPreference.java | 6 +-- .../settings/AbstractClickablePreference.java | 6 +-- .../settings/CapabilitiesPreference.java | 22 +++++----- .../settings/CheckBoxWithPopupPreference.java | 14 +++---- .../settings/CheckECCredentialsPreference.java | 4 +- .../settings/CheckGcCredentialsPreference.java | 4 +- .../settings/EditPasswordPreference.java | 8 ++-- .../cgeo/geocaching/settings/InfoPreference.java | 20 ++++----- .../settings/RegisterSend2CgeoPreference.java | 8 ++-- .../cgeo/geocaching/sorting/InverseComparator.java | 4 +- main/src/cgeo/geocaching/speech/TextFactory.java | 16 ++++---- .../ui/AbstractCachingListViewPageViewCreator.java | 14 +++---- .../cgeo/geocaching/ui/AbstractImageAdapter.java | 2 +- .../geocaching/ui/AbstractUserClickListener.java | 8 ++-- .../src/cgeo/geocaching/ui/AbstractViewHolder.java | 2 +- .../ui/AnchorAwareLinkMovementMethod.java | 4 +- .../geocaching/ui/CoordinatesFormatSwitcher.java | 6 +-- .../geocaching/ui/DecryptTextClickListener.java | 2 +- main/src/cgeo/geocaching/ui/DistanceView.java | 8 ++-- .../geocaching/ui/FileSelectionListAdapter.java | 2 +- .../ui/IndexOutOfBoundsAvoidingTextView.java | 18 ++++---- .../geocaching/ui/OwnerActionsClickListener.java | 4 +- main/src/cgeo/geocaching/ui/UrlPopup.java | 8 ++-- .../geocaching/ui/UserActionsClickListener.java | 6 +-- .../ui/dialog/LiveMapInfoDialogBuilder.java | 4 +- .../src/cgeo/geocaching/ui/logs/LogViewHolder.java | 2 +- main/src/cgeo/geocaching/utils/BundleUtils.java | 4 +- main/src/cgeo/geocaching/utils/CryptUtils.java | 40 +++++++++--------- main/src/cgeo/geocaching/utils/EditUtils.java | 6 +-- .../cgeo/geocaching/utils/LazyInitializedList.java | 2 +- .../geocaching/utils/LeastRecentlyUsedMap.java | 22 +++++----- .../geocaching/utils/LeastRecentlyUsedSet.java | 10 ++--- .../geocaching/utils/SynchronizedDateFormat.java | 2 +- .../cgeo/geocaching/utils/UnknownTagsHandler.java | 14 +++---- 93 files changed, 378 insertions(+), 378 deletions(-) diff --git a/main/src/cgeo/geocaching/activity/ActionBarListActivity.java b/main/src/cgeo/geocaching/activity/ActionBarListActivity.java index 07c7ec3..a2d3ddf 100644 --- a/main/src/cgeo/geocaching/activity/ActionBarListActivity.java +++ b/main/src/cgeo/geocaching/activity/ActionBarListActivity.java @@ -18,12 +18,12 @@ public class ActionBarListActivity extends ActionBarActivity { return mListView; } - protected void setListAdapter(ListAdapter adapter) { + protected void setListAdapter(final ListAdapter adapter) { getListView().setAdapter(adapter); } protected ListAdapter getListAdapter() { - ListAdapter adapter = getListView().getAdapter(); + final ListAdapter adapter = getListView().getAdapter(); if (adapter instanceof HeaderViewListAdapter) { return ((HeaderViewListAdapter)adapter).getWrappedAdapter(); } diff --git a/main/src/cgeo/geocaching/activity/ActivityMixin.java b/main/src/cgeo/geocaching/activity/ActivityMixin.java index 5b3be70..01fc62e 100644 --- a/main/src/cgeo/geocaching/activity/ActivityMixin.java +++ b/main/src/cgeo/geocaching/activity/ActivityMixin.java @@ -145,7 +145,7 @@ public final class ActivityMixin { final int end = Math.max(selectionStart, selectionEnd); final String content = editText.getText().toString(); - String completeText; + final String completeText; if (start > 0 && !Character.isWhitespace(content.charAt(start - 1))) { completeText = " " + insertText; } else { diff --git a/main/src/cgeo/geocaching/activity/Progress.java b/main/src/cgeo/geocaching/activity/Progress.java index 8ee88a7..e87eaa6 100644 --- a/main/src/cgeo/geocaching/activity/Progress.java +++ b/main/src/cgeo/geocaching/activity/Progress.java @@ -19,7 +19,7 @@ public class Progress { private int progressDivider = 1; final private boolean hideAbsolute; - public Progress(boolean hideAbsolute) { + public Progress(final boolean hideAbsolute) { this.hideAbsolute = hideAbsolute; } diff --git a/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java b/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java index b2a2cad..cdfbceb 100644 --- a/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java +++ b/main/src/cgeo/geocaching/apps/cache/WhereYouGoApp.java @@ -21,16 +21,16 @@ public class WhereYouGoApp extends AbstractGeneralApp { } @Override - public boolean isEnabled(Geocache cache) { + public boolean isEnabled(final Geocache cache) { return cache.getType() == CacheType.WHERIGO && StringUtils.isNotEmpty(getWhereIGoUrl(cache)); } @Override - public void navigate(Activity activity, Geocache cache) { + public void navigate(final Activity activity, final Geocache cache) { activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getWhereIGoUrl(cache)))); } - protected static String getWhereIGoUrl(Geocache cache) { + protected static String getWhereIGoUrl(final Geocache cache) { return TextUtils.getMatch(cache.getDescription(), PATTERN_CARTRIDGE, null); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java index 80609ce..c12b4ca 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/GoogleMapsApp.java @@ -25,20 +25,20 @@ class GoogleMapsApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint point) { + public void navigate(final Activity activity, final Geopoint point) { navigate(activity, point, activity.getString(R.string.waypoint)); } - private static void navigate(Activity activity, Geopoint point, String label) { + private static void navigate(final Activity activity, final Geopoint point, final String label) { try { - String latitude = GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, point); - String longitude = GeopointFormatter.format(Format.LON_DECDEGREE_RAW, point); + final String latitude = GeopointFormatter.format(GeopointFormatter.Format.LAT_DECDEGREE_RAW, point); + final String longitude = GeopointFormatter.format(Format.LON_DECDEGREE_RAW, point); final String geoLocation = "geo:" + latitude + "," + longitude; final String query = latitude + "," + longitude + "(" + label + ")"; final String uriString = geoLocation + "?q=" + Uri.encode(query); activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uriString))); return; - } catch (RuntimeException ignored) { + } catch (final RuntimeException ignored) { // nothing } Log.i("GoogleMapsApp.navigate: No maps application available."); @@ -47,12 +47,12 @@ class GoogleMapsApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geocache cache) { + public void navigate(final Activity activity, final Geocache cache) { navigate(activity, cache.getCoords(), cache.getName()); } @Override - public void navigate(Activity activity, Waypoint waypoint) { + public void navigate(final Activity activity, final Waypoint waypoint) { navigate(activity, waypoint.getCoords(), waypoint.getName()); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java index 2355d9d..03c6dc1 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java @@ -21,17 +21,17 @@ class InternalMap extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint coords) { + public void navigate(final Activity activity, final Geopoint coords) { CGeoMap.startActivityCoords(activity, coords, WaypointType.WAYPOINT, null); } @Override - public void navigate(Activity activity, Waypoint waypoint) { + public void navigate(final Activity activity, final Waypoint waypoint) { CGeoMap.startActivityCoords(activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName()); } @Override - public void navigate(Activity activity, Geocache cache) { + public void navigate(final Activity activity, final Geocache cache) { CGeoMap.startActivityGeoCode(activity, cache.getGeocode()); } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java index b60d78a..61445c3 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java @@ -20,12 +20,12 @@ class LocusApp extends AbstractLocusApp implements CacheNavigationApp, WaypointN } @Override - public boolean isEnabled(Waypoint waypoint) { + public boolean isEnabled(final Waypoint waypoint) { return waypoint.getCoords() != null; } @Override - public boolean isEnabled(Geocache cache) { + public boolean isEnabled(final Geocache cache) { return cache.getCoords() != null; } @@ -35,12 +35,12 @@ class LocusApp extends AbstractLocusApp implements CacheNavigationApp, WaypointN * */ @Override - public void navigate(Activity activity, Waypoint waypoint) { + public void navigate(final Activity activity, final Waypoint waypoint) { showInLocus(Collections.singletonList(waypoint), true, false, activity); } @Override - public void navigate(Activity activity, Geocache cache) { + public void navigate(final Activity activity, final Geocache cache) { showInLocus(Collections.singletonList(cache), true, false, activity); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java index 9f64070..9954382 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigonApp.java @@ -17,7 +17,7 @@ class NavigonApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint point) { + public void navigate(final Activity activity, final Geopoint point) { final Intent intent = new Intent(INTENT); /* diff --git a/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java index f710333..b3e21a3 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/OruxMapsApp.java @@ -17,7 +17,7 @@ class OruxMapsApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint point) { + public void navigate(final Activity activity, final Geopoint point) { final Intent intent = new Intent(INTENT); intent.putExtra(ORUXMAPS_EXTRA_LATITUDE, point.getLatitude());//latitude, wgs84 datum intent.putExtra(ORUXMAPS_EXTRA_LONGITUDE, point.getLongitude());//longitude, wgs84 datum diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java index b78caab..1eefdec 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java @@ -20,11 +20,11 @@ class RMapsApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Waypoint waypoint) { + public void navigate(final Activity activity, final Waypoint waypoint) { navigate(activity, waypoint.getCoords(), waypoint.getLookup(), waypoint.getName()); } - private static void navigate(Activity activity, Geopoint coords, String code, String name) { + private static void navigate(final Activity activity, final Geopoint coords, final String code, final String name) { final ArrayList locations = new ArrayList<>(); locations.add(coords.format(Format.LAT_LON_DECDEGREE_COMMA) + ";" + code + ";" + name); final Intent intent = new Intent(INTENT); @@ -33,12 +33,12 @@ class RMapsApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geocache cache) { + public void navigate(final Activity activity, final Geocache cache) { navigate(activity, cache.getCoords(), cache.getGeocode(), cache.getName()); } @Override - public void navigate(Activity activity, Geopoint coords) { + public void navigate(final Activity activity, final Geopoint coords) { navigate(activity, coords, "", ""); } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java index 584cca9..ca3aefe 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/StreetviewApp.java @@ -26,7 +26,7 @@ class StreetviewApp extends AbstractPointNavigationApp { } @Override - public void navigate(Activity activity, Geopoint point) { + public void navigate(final Activity activity, final Geopoint point) { try { activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("google.streetview:cbll=" + point.getLatitude() + "," + point.getLongitude()))); diff --git a/main/src/cgeo/geocaching/apps/cachelist/AbstractLocusCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/AbstractLocusCacheListApp.java index 6411758..d047d1a 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/AbstractLocusCacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/AbstractLocusCacheListApp.java @@ -14,9 +14,9 @@ import java.util.List; abstract class AbstractLocusCacheListApp extends AbstractLocusApp implements CacheListApp { - private boolean export; + private final boolean export; - public AbstractLocusCacheListApp(final int id, boolean export) { + public AbstractLocusCacheListApp(final int id, final boolean export) { super(getString(export ? R.string.caches_map_locus_export : R.string.caches_map_locus), id, Intent.ACTION_VIEW); this.export = export; } @@ -27,7 +27,7 @@ abstract class AbstractLocusCacheListApp extends AbstractLocusApp implements Cac * @see AbstractLocusApp#showInLocus */ @Override - public boolean invoke(List cacheList, Activity activity, final SearchResult search) { + public boolean invoke(final List cacheList, final Activity activity, final SearchResult search) { if (CollectionUtils.isEmpty(cacheList)) { return false; } diff --git a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java index 9216bc0..d364cda 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java +++ b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java @@ -22,7 +22,7 @@ class InternalCacheListMap extends AbstractApp implements CacheListApp { } @Override - public boolean invoke(List caches, Activity activity, final SearchResult search) { + public boolean invoke(final List caches, final Activity activity, final SearchResult search) { CGeoMap.startActivitySearch(activity, search, null); return true; } diff --git a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java index 793b715..95bb77d 100644 --- a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java +++ b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java @@ -60,7 +60,7 @@ abstract class IconDecoder { continue; } - int type; + final int type; if (zoomlevel < 12) { type = getCacheTypeFromPixel11(r, g, b); } else { diff --git a/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java b/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java index c9e01a2..204fc89 100644 --- a/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java +++ b/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java @@ -10,11 +10,11 @@ public class UncertainProperty { private final T value; private final int certaintyLevel; - public UncertainProperty(T value) { + public UncertainProperty(final T value) { this(value, Tile.ZOOMLEVEL_MAX + 1); } - public UncertainProperty(T value, int certaintyLevel) { + public UncertainProperty(final T value, final int certaintyLevel) { this.value = value; this.certaintyLevel = certaintyLevel; } @@ -41,7 +41,7 @@ public class UncertainProperty { return this; } - public static UncertainProperty getMergedProperty(UncertainProperty property, UncertainProperty otherProperty) { + public static UncertainProperty getMergedProperty(final UncertainProperty property, final UncertainProperty otherProperty) { if (null == property) { return otherProperty; } diff --git a/main/src/cgeo/geocaching/connector/oc/OCAuthorizationActivity.java b/main/src/cgeo/geocaching/connector/oc/OCAuthorizationActivity.java index 4d8bb57..c15ca6c 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCAuthorizationActivity.java +++ b/main/src/cgeo/geocaching/connector/oc/OCAuthorizationActivity.java @@ -23,9 +23,9 @@ public class OCAuthorizationActivity extends OAuthAuthorizationActivity { private int tempTokenSecretPrefKey; @Override - public void onCreate(Bundle savedInstanceState) { + public void onCreate(final Bundle savedInstanceState) { - Bundle extras = getIntent().getExtras(); + final Bundle extras = getIntent().getExtras(); if (extras != null) { titleResId = extras.getInt(Intents.EXTRA_OAUTH_TITLE_RES_ID); tokenPublicPrefKey = extras.getInt(Intents.EXTRA_OAUTH_TOKEN_PUBLIC_KEY); @@ -68,8 +68,8 @@ public class OCAuthorizationActivity extends OAuthAuthorizationActivity { * Return an extended error in case of an invalid time stamp */ @Override - protected String getExtendedErrorMsg(HttpResponse response) { - OkapiError error = OkapiClient.decodeErrorResponse(response); + protected String getExtendedErrorMsg(final HttpResponse response) { + final OkapiError error = OkapiClient.decodeErrorResponse(response); if (error.getResult() == OkapiErrors.INVALID_TIMESTAMP) { return res.getString(R.string.init_login_popup_invalid_timestamp); } diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiError.java b/main/src/cgeo/geocaching/connector/oc/OkapiError.java index b847207..f3234f8 100644 --- a/main/src/cgeo/geocaching/connector/oc/OkapiError.java +++ b/main/src/cgeo/geocaching/connector/oc/OkapiError.java @@ -26,7 +26,7 @@ public class OkapiError { @NonNull private final OkapiErrors state; @NonNull private final String message; - public OkapiError(@Nullable ObjectNode data) { + public OkapiError(@Nullable final ObjectNode data) { // A null-response is by definition an error (some exception occurred somewhere in the flow) if (data == null) { diff --git a/main/src/cgeo/geocaching/connector/oc/UserInfo.java b/main/src/cgeo/geocaching/connector/oc/UserInfo.java index c8b37cd..42249b0 100644 --- a/main/src/cgeo/geocaching/connector/oc/UserInfo.java +++ b/main/src/cgeo/geocaching/connector/oc/UserInfo.java @@ -15,11 +15,11 @@ public class UserInfo { public final int resId; - UserInfoStatus(int resId) { + UserInfoStatus(final int resId) { this.resId = resId; } - public static UserInfoStatus getFromOkapiError(OkapiErrors result) { + public static UserInfoStatus getFromOkapiError(final OkapiErrors result) { switch (result) { case NO_ERROR: return SUCCESSFUL; @@ -37,7 +37,7 @@ public class UserInfo { private final int finds; private final UserInfoStatus status; - UserInfo(String name, int finds, UserInfoStatus status) { + UserInfo(final String name, final int finds, final UserInfoStatus status) { this.name = name; this.finds = finds; this.status = status; diff --git a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java index c232ef5..a12a7fb 100644 --- a/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java +++ b/main/src/cgeo/geocaching/connector/ox/OpenCachingApi.java @@ -48,10 +48,10 @@ public class OpenCachingApi { if (response == null) { return Collections.emptyList(); } - Collection caches; + final Collection caches; try { caches = new OXGPXParser(StoredList.TEMPORARY_LIST.id, isDetailed).parse(response.getEntity().getContent(), null); - } catch (Exception e) { + } catch (final Exception e) { Log.e("Error importing from OpenCaching.com", e); return Collections.emptyList(); } @@ -81,10 +81,10 @@ public class OpenCachingApi { * Parameters to modify * @return True - query possible, False - no query, all caches excluded */ - private static boolean addTypeFilter(Parameters queryParameters) { + private static boolean addTypeFilter(final Parameters queryParameters) { boolean doQuery = true; if (Settings.getCacheType() != CacheType.ALL) { - String typeFilter; + final String typeFilter; switch (Settings.getCacheType()) { case TRADITIONAL: typeFilter = "Traditional Cache"; diff --git a/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java b/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java index 0e64abd..a6e63ca 100644 --- a/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java +++ b/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java @@ -26,7 +26,7 @@ public class GeokretyParser { geokret.setEndTextElementListener(new EndTextElementListener() { @Override - public void end(String name) { + public void end(final String name) { trackable.setName(name); } }); @@ -34,7 +34,7 @@ public class GeokretyParser { geokret.setStartElementListener(new StartElementListener() { @Override - public void start(Attributes attributes) { + public void start(final Attributes attributes) { try { final String kretyId = attributes.getValue("id"); if (StringUtils.isNumeric(kretyId)) { @@ -73,7 +73,7 @@ public class GeokretyParser { return null; } - protected static String getType(int type) { + protected static String getType(final int type) { switch (type) { case 0: return CgeoApplication.getInstance().getString(R.string.geokret_type_traditional); diff --git a/main/src/cgeo/geocaching/export/AbstractExport.java b/main/src/cgeo/geocaching/export/AbstractExport.java index 5d15ecb..94d0506 100644 --- a/main/src/cgeo/geocaching/export/AbstractExport.java +++ b/main/src/cgeo/geocaching/export/AbstractExport.java @@ -22,7 +22,7 @@ abstract class AbstractExport implements Export { * the resource id of the string * @return localized string */ - protected static String getString(int resourceId) { + protected static String getString(final int resourceId) { return CgeoApplication.getInstance().getString(resourceId); } @@ -35,7 +35,7 @@ abstract class AbstractExport implements Export { * The parameter * @return localized string */ - protected static String getString(int resourceId, Object... params) { + protected static String getString(final int resourceId, final Object... params) { return CgeoApplication.getInstance().getString(resourceId, params); } diff --git a/main/src/cgeo/geocaching/export/FieldNotes.java b/main/src/cgeo/geocaching/export/FieldNotes.java index 11d725a..fdc6210 100644 --- a/main/src/cgeo/geocaching/export/FieldNotes.java +++ b/main/src/cgeo/geocaching/export/FieldNotes.java @@ -41,7 +41,7 @@ class FieldNotes { return buffer.toString(); } - File writeToDirectory(File exportLocation) { + File writeToDirectory(final File exportLocation) { if (!LocalStorage.isExternalStorageAvailable()) { return null; } diff --git a/main/src/cgeo/geocaching/files/GPX10Parser.java b/main/src/cgeo/geocaching/files/GPX10Parser.java index 0ca2606..815d577 100644 --- a/main/src/cgeo/geocaching/files/GPX10Parser.java +++ b/main/src/cgeo/geocaching/files/GPX10Parser.java @@ -4,12 +4,12 @@ import android.sax.Element; public class GPX10Parser extends GPXParser { - public GPX10Parser(int listIdIn) { + public GPX10Parser(final int listIdIn) { super(listIdIn, "http://www.topografix.com/GPX/1/0", "1.0"); } @Override - protected Element getCacheParent(Element waypoint) { + protected Element getCacheParent(final Element waypoint) { return waypoint; } diff --git a/main/src/cgeo/geocaching/files/GPX11Parser.java b/main/src/cgeo/geocaching/files/GPX11Parser.java index 52a6ae3..6ac152c 100644 --- a/main/src/cgeo/geocaching/files/GPX11Parser.java +++ b/main/src/cgeo/geocaching/files/GPX11Parser.java @@ -4,12 +4,12 @@ import android.sax.Element; public final class GPX11Parser extends GPXParser { - public GPX11Parser(int listIdIn) { + public GPX11Parser(final int listIdIn) { super(listIdIn, "http://www.topografix.com/GPX/1/1", "1.1"); } @Override - protected Element getCacheParent(Element waypoint) { + protected Element getCacheParent(final Element waypoint) { return waypoint.getChild(namespace, "extensions"); } diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java index e4bb7e1..aed82e6 100644 --- a/main/src/cgeo/geocaching/files/GPXParser.java +++ b/main/src/cgeo/geocaching/files/GPXParser.java @@ -225,7 +225,7 @@ public abstract class GPXParser extends FileParser { return null; // id not found } // get text for string - String stringName; + final String stringName; try { stringName = CgeoApplication.getInstance().getResources().getResourceName(stringId); } catch (final NullPointerException ignored) { diff --git a/main/src/cgeo/geocaching/files/InvalidXMLCharacterFilterReader.java b/main/src/cgeo/geocaching/files/InvalidXMLCharacterFilterReader.java index 5204140..eea14c3 100644 --- a/main/src/cgeo/geocaching/files/InvalidXMLCharacterFilterReader.java +++ b/main/src/cgeo/geocaching/files/InvalidXMLCharacterFilterReader.java @@ -13,7 +13,7 @@ import java.io.Reader; public class InvalidXMLCharacterFilterReader extends FilterReader { - public InvalidXMLCharacterFilterReader(Reader in) { + public InvalidXMLCharacterFilterReader(final Reader in) { super(in); } @@ -28,8 +28,8 @@ public class InvalidXMLCharacterFilterReader extends FilterReader * underling reader was reached. */ @Override - public int read(char[] cbuf, int off, int len) throws IOException { - int read = super.read(cbuf, off, len); + public int read(final char[] cbuf, final int off, final int len) throws IOException { + final int read = super.read(cbuf, off, len); // check for end if (read == -1) { return -1; @@ -48,11 +48,11 @@ public class InvalidXMLCharacterFilterReader extends FilterReader case ';': pos++; if (entityStart >= 0) { - int entityLength = readPos - entityStart + 1; + final int entityLength = readPos - entityStart + 1; if (entityLength <= 5) { - String entity = new String(cbuf, entityStart, entityLength); + final String entity = new String(cbuf, entityStart, entityLength); if (StringUtils.startsWith(entity, "&#")) { - String numberString = StringUtils.substringBetween(entity, "&#", ";"); + final String numberString = StringUtils.substringBetween(entity, "&#", ";"); final int value; if (StringUtils.startsWith(numberString, "x")) { value = Integer.parseInt(numberString.substring(1), 16); diff --git a/main/src/cgeo/geocaching/files/NoCloseInputStream.java b/main/src/cgeo/geocaching/files/NoCloseInputStream.java index 5a72607..493f6ca 100644 --- a/main/src/cgeo/geocaching/files/NoCloseInputStream.java +++ b/main/src/cgeo/geocaching/files/NoCloseInputStream.java @@ -9,9 +9,9 @@ import java.io.InputStream; * one input stream (e.g. ZipInputStream) because SAX parser closes stream. */ public class NoCloseInputStream extends FilterInputStream { - private static ClosedInputStream closedInputStream = new ClosedInputStream(); + private static final ClosedInputStream closedInputStream = new ClosedInputStream(); - public NoCloseInputStream(InputStream in) { + public NoCloseInputStream(final InputStream in) { super(in); } diff --git a/main/src/cgeo/geocaching/files/ParserException.java b/main/src/cgeo/geocaching/files/ParserException.java index c0076cc..6c8cfda 100644 --- a/main/src/cgeo/geocaching/files/ParserException.java +++ b/main/src/cgeo/geocaching/files/ParserException.java @@ -9,11 +9,11 @@ public class ParserException extends Exception { public ParserException() { } - public ParserException(String detailMessage) { + public ParserException(final String detailMessage) { super(detailMessage); } - public ParserException(String detailMessage, Throwable throwable) { + public ParserException(final String detailMessage, final Throwable throwable) { super(detailMessage, throwable); } diff --git a/main/src/cgeo/geocaching/list/AbstractList.java b/main/src/cgeo/geocaching/list/AbstractList.java index 5a20b9d..5836e6c 100644 --- a/main/src/cgeo/geocaching/list/AbstractList.java +++ b/main/src/cgeo/geocaching/list/AbstractList.java @@ -25,7 +25,7 @@ public abstract class AbstractList { public abstract int getNumberOfCaches(); @Nullable - public static AbstractList getListById(int listId) { + public static AbstractList getListById(final int listId) { return LISTS.get(listId); } diff --git a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java index 74d5e8a..53e5de1 100644 --- a/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/HistoryGeocacheListLoader.java @@ -11,7 +11,7 @@ import android.content.Context; public class HistoryGeocacheListLoader extends AbstractSearchLoader { private final Geopoint coords; - public HistoryGeocacheListLoader(Context context, Geopoint coords) { + public HistoryGeocacheListLoader(final Context context, final Geopoint coords) { super(context); this.coords = coords; } diff --git a/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java index 45b264f..4c3baf5 100644 --- a/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/KeywordGeocacheListLoader.java @@ -13,7 +13,7 @@ public class KeywordGeocacheListLoader extends AbstractSearchLoader { private final @NonNull String keyword; - public KeywordGeocacheListLoader(Context context, final @NonNull String keyword) { + public KeywordGeocacheListLoader(final Context context, final @NonNull String keyword) { super(context); this.keyword = keyword; } diff --git a/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java index 05eac18..cd81619 100644 --- a/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/NextPageGeocacheListLoader.java @@ -9,7 +9,7 @@ import android.content.Context; public class NextPageGeocacheListLoader extends AbstractSearchLoader { private final SearchResult search; - public NextPageGeocacheListLoader(Context context, SearchResult search) { + public NextPageGeocacheListLoader(final Context context, final SearchResult search) { super(context); this.search = search; } diff --git a/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java index 32fb020..47472be 100644 --- a/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java +++ b/main/src/cgeo/geocaching/loaders/PocketGeocacheListLoader.java @@ -9,7 +9,7 @@ import android.content.Context; public class PocketGeocacheListLoader extends AbstractSearchLoader { private final String guid; - public PocketGeocacheListLoader(Context context, String guid) { + public PocketGeocacheListLoader(final Context context, final String guid) { super(context); this.guid = guid; } diff --git a/main/src/cgeo/geocaching/location/DistanceParser.java b/main/src/cgeo/geocaching/location/DistanceParser.java index 1fb8fc7..7cbc19f 100644 --- a/main/src/cgeo/geocaching/location/DistanceParser.java +++ b/main/src/cgeo/geocaching/location/DistanceParser.java @@ -22,7 +22,7 @@ public final class DistanceParser { * @throws NumberFormatException * if the given number is invalid */ - public static float parseDistance(String distanceText, final boolean metricUnit) + public static float parseDistance(final String distanceText, final boolean metricUnit) throws NumberFormatException { final MatcherWrapper matcher = new MatcherWrapper(pattern, distanceText); diff --git a/main/src/cgeo/geocaching/maps/AbstractItemizedOverlay.java b/main/src/cgeo/geocaching/maps/AbstractItemizedOverlay.java index 747618b..9436b2a 100644 --- a/main/src/cgeo/geocaching/maps/AbstractItemizedOverlay.java +++ b/main/src/cgeo/geocaching/maps/AbstractItemizedOverlay.java @@ -17,9 +17,9 @@ import android.graphics.drawable.Drawable; */ public abstract class AbstractItemizedOverlay implements GeneralOverlay { - private ItemizedOverlayImpl ovlImpl; + private final ItemizedOverlayImpl ovlImpl; - protected AbstractItemizedOverlay(ItemizedOverlayImpl ovlImplIn) { + protected AbstractItemizedOverlay(final ItemizedOverlayImpl ovlImplIn) { ovlImpl = ovlImplIn; } @@ -27,26 +27,26 @@ public abstract class AbstractItemizedOverlay implements GeneralOverlay { ovlImpl.superPopulate(); } - public boolean onTap(int index) { + public boolean onTap(final int index) { return ovlImpl.superOnTap(index); } - Drawable boundCenterBottom(Drawable markerIn) { + Drawable boundCenterBottom(final Drawable markerIn) { return ovlImpl.superBoundCenterBottom(markerIn); } - void setLastFocusedItemIndex(int index) { + void setLastFocusedItemIndex(final int index) { ovlImpl.superSetLastFocusedItemIndex(index); } @Override - public void draw(Canvas canvas, MapViewImpl mapView, boolean shadow) { + public void draw(final Canvas canvas, final MapViewImpl mapView, final boolean shadow) { ovlImpl.superDraw(canvas, mapView, shadow); } @Override - public void drawOverlayBitmap(Canvas canvas, Point drawPosition, - MapProjectionImpl projection, byte drawZoomLevel) { + public void drawOverlayBitmap(final Canvas canvas, final Point drawPosition, + final MapProjectionImpl projection, final byte drawZoomLevel) { ovlImpl.superDrawOverlayBitmap(canvas, drawPosition, projection, drawZoomLevel); } diff --git a/main/src/cgeo/geocaching/maps/AbstractMapProvider.java b/main/src/cgeo/geocaching/maps/AbstractMapProvider.java index 620b953..bd42223 100644 --- a/main/src/cgeo/geocaching/maps/AbstractMapProvider.java +++ b/main/src/cgeo/geocaching/maps/AbstractMapProvider.java @@ -6,7 +6,7 @@ import cgeo.geocaching.maps.interfaces.MapSource; public abstract class AbstractMapProvider implements MapProvider { @Override - public void registerMapSource(MapSource mapSource) { + public void registerMapSource(final MapSource mapSource) { MapProviderFactory.registerMapSource(mapSource); } } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index c808ffd..42e41b1 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -194,12 +194,12 @@ public class CGeoMap extends AbstractMap implements ViewFactory { */ private static final int MIN_LIVEMAP_ZOOM = 12; // Thread pooling - private static BlockingQueue displayQueue = new ArrayBlockingQueue<>(1); - private static ThreadPoolExecutor displayExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, displayQueue, new ThreadPoolExecutor.DiscardOldestPolicy()); - private static BlockingQueue downloadQueue = new ArrayBlockingQueue<>(1); - private static ThreadPoolExecutor downloadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, downloadQueue, new ThreadPoolExecutor.DiscardOldestPolicy()); - private static BlockingQueue loadQueue = new ArrayBlockingQueue<>(1); - private static ThreadPoolExecutor loadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, loadQueue, new ThreadPoolExecutor.DiscardOldestPolicy()); + private static final BlockingQueue displayQueue = new ArrayBlockingQueue<>(1); + private static final ThreadPoolExecutor displayExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, displayQueue, new ThreadPoolExecutor.DiscardOldestPolicy()); + private static final BlockingQueue downloadQueue = new ArrayBlockingQueue<>(1); + private static final ThreadPoolExecutor downloadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, downloadQueue, new ThreadPoolExecutor.DiscardOldestPolicy()); + private static final BlockingQueue loadQueue = new ArrayBlockingQueue<>(1); + private static final ThreadPoolExecutor loadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, loadQueue, new ThreadPoolExecutor.DiscardOldestPolicy()); // handlers /** Updates the titles */ @@ -382,7 +382,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { if (msg.what == UPDATE_PROGRESS) { if (waitDialog != null) { final int secondsElapsed = (int) ((System.currentTimeMillis() - detailProgressTime) / 1000); - int secondsRemaining; + final int secondsRemaining; if (detailProgress > 0) { secondsRemaining = (detailTotal - detailProgress) * secondsElapsed / detailProgress; } else { @@ -1234,7 +1234,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory { showProgressHandler.sendEmptyMessage(SHOW_PROGRESS); loadThreadRun = System.currentTimeMillis(); - SearchResult searchResult; + final SearchResult searchResult; if (mapMode == MapMode.LIVE) { searchResult = isLiveEnabled ? new SearchResult() : new SearchResult(DataStore.loadStoredInViewport(mapView.getViewport(), Settings.getCacheType())); } else { diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java index 048217e..9649c0d 100644 --- a/main/src/cgeo/geocaching/maps/CachesOverlay.java +++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java @@ -43,13 +43,13 @@ public class CachesOverlay extends AbstractItemizedOverlay { private List items = new ArrayList<>(); private Context context = null; private boolean displayCircles = false; - private Progress progress = new Progress(); + private final Progress progress = new Progress(); private Paint blockedCircle = null; private PaintFlagsDrawFilter setFilter = null; private PaintFlagsDrawFilter removeFilter = null; private MapItemFactory mapItemFactory = null; - public CachesOverlay(ItemizedOverlayImpl ovlImpl, Context contextIn) { + public CachesOverlay(final ItemizedOverlayImpl ovlImpl, final Context contextIn) { super(ovlImpl); populate(); @@ -60,19 +60,19 @@ public class CachesOverlay extends AbstractItemizedOverlay { mapItemFactory = mapProvider.getMapItemFactory(); } - void updateItems(CachesOverlayItemImpl item) { - List itemsPre = new ArrayList<>(); + void updateItems(final CachesOverlayItemImpl item) { + final List itemsPre = new ArrayList<>(); itemsPre.add(item); updateItems(itemsPre); } - void updateItems(List itemsPre) { + void updateItems(final List itemsPre) { if (itemsPre == null) { return; } - for (CachesOverlayItemImpl item : itemsPre) { + for (final CachesOverlayItemImpl item : itemsPre) { item.setMarker(boundCenterBottom(item.getMarker(0))); } @@ -97,7 +97,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { } @Override - public void draw(Canvas canvas, MapViewImpl mapView, boolean shadow) { + public void draw(final Canvas canvas, final MapViewImpl mapView, final boolean shadow) { drawInternal(canvas, mapView.getMapProjection()); @@ -105,15 +105,15 @@ public class CachesOverlay extends AbstractItemizedOverlay { } @Override - public void drawOverlayBitmap(Canvas canvas, Point drawPosition, - MapProjectionImpl projection, byte drawZoomLevel) { + public void drawOverlayBitmap(final Canvas canvas, final Point drawPosition, + final MapProjectionImpl projection, final byte drawZoomLevel) { drawInternal(canvas, projection); super.drawOverlayBitmap(canvas, drawPosition, projection, drawZoomLevel); } - private void drawInternal(Canvas canvas, MapProjectionImpl projection) { + private void drawInternal(final Canvas canvas, final MapProjectionImpl projection) { if (!displayCircles || items.isEmpty()) { return; } @@ -129,7 +129,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { final int radius = calculateDrawingRadius(projection); final Point center = new Point(); - for (CachesOverlayItemImpl item : items) { + for (final CachesOverlayItemImpl item : items) { if (item.applyDistanceRule()) { final Geopoint itemCoord = item.getCoord().getCoords(); final GeoPointImpl itemGeo = mapItemFactory.getGeoPointBase(itemCoord); @@ -159,8 +159,8 @@ public class CachesOverlay extends AbstractItemizedOverlay { * levels which are used to see the circles. * */ - private int calculateDrawingRadius(MapProjectionImpl projection) { - float[] distanceArray = new float[1]; + private int calculateDrawingRadius(final MapProjectionImpl projection) { + final float[] distanceArray = new float[1]; final Geopoint itemCoord = items.get(0).getCoord().getCoords(); Location.distanceBetween(itemCoord.getLatitude(), itemCoord.getLongitude(), @@ -200,7 +200,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { } @Override - public boolean onTap(int index) { + public boolean onTap(final int index) { try { if (items.size() <= index) { @@ -230,7 +230,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { if (StringUtils.equalsIgnoreCase(coordType, "cache") && StringUtils.isNotBlank(coordinate.getGeocode())) { final Geocache cache = DataStore.loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB); if (cache != null) { - RequestDetailsThread requestDetailsThread = new RequestDetailsThread(cache); + final RequestDetailsThread requestDetailsThread = new RequestDetailsThread(cache); if (!requestDetailsThread.requestRequired()) { // don't show popup if we have enough details progress.dismiss(); @@ -251,7 +251,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { } progress.dismiss(); - } catch (NotFoundException e) { + } catch (final NotFoundException e) { Log.e("CachesOverlay.onTap", e); progress.dismiss(); } @@ -260,10 +260,10 @@ public class CachesOverlay extends AbstractItemizedOverlay { } @Override - public CachesOverlayItemImpl createItem(int index) { + public CachesOverlayItemImpl createItem(final int index) { try { return items.get(index); - } catch (Exception e) { + } catch (final Exception e) { Log.e("CachesOverlay.createItem", e); } @@ -274,7 +274,7 @@ public class CachesOverlay extends AbstractItemizedOverlay { public int size() { try { return items.size(); - } catch (Exception e) { + } catch (final Exception e) { Log.e("CachesOverlay.size", e); } diff --git a/main/src/cgeo/geocaching/maps/PositionDrawer.java b/main/src/cgeo/geocaching/maps/PositionDrawer.java index 6a45e62..c7d1734 100644 --- a/main/src/cgeo/geocaching/maps/PositionDrawer.java +++ b/main/src/cgeo/geocaching/maps/PositionDrawer.java @@ -28,21 +28,21 @@ public class PositionDrawer { private Paint accuracyCircle = null; private Paint historyLine = null; private Paint historyLineShadow = null; - private Point center = new Point(); - private Point left = new Point(); + private final Point center = new Point(); + private final Point left = new Point(); private Bitmap arrow = null; private int widthArrowHalf = 0; private int heightArrowHalf = 0; private PaintFlagsDrawFilter setfil = null; private PaintFlagsDrawFilter remfil = null; - private PositionHistory positionHistory = new PositionHistory(); - private MapItemFactory mapItemFactory; + private final PositionHistory positionHistory = new PositionHistory(); + private final MapItemFactory mapItemFactory; public PositionDrawer() { this.mapItemFactory = Settings.getMapProvider().getMapItemFactory(); } - void drawPosition(Canvas canvas, MapProjectionImpl projection) { + void drawPosition(final Canvas canvas, final MapProjectionImpl projection) { if (coordinates == null || location == null) { return; } @@ -76,20 +76,20 @@ public class PositionDrawer { canvas.setDrawFilter(setfil); - double latitude = coordinates.getLatitude(); - double longitude = coordinates.getLongitude(); - float accuracy = coordinates.getAccuracy(); + final double latitude = coordinates.getLatitude(); + final double longitude = coordinates.getLongitude(); + final float accuracy = coordinates.getAccuracy(); - float[] result = new float[1]; + final float[] result = new float[1]; Location.distanceBetween(latitude, longitude, latitude, longitude + 1, result); - float longitudeLineDistance = result[0]; + final float longitudeLineDistance = result[0]; final Geopoint leftCoords = new Geopoint(latitude, longitude - accuracy / longitudeLineDistance); - GeoPointImpl leftGeo = mapItemFactory.getGeoPointBase(leftCoords); + final GeoPointImpl leftGeo = mapItemFactory.getGeoPointBase(leftCoords); projection.toPixels(leftGeo, left); projection.toPixels(location, center); - int radius = center.x - left.x; + final int radius = center.x - left.x; accuracyCircle.setColor(0x66000000); accuracyCircle.setStyle(Style.STROKE); @@ -106,23 +106,23 @@ public class PositionDrawer { final ArrayList paintHistory = new ArrayList<>(positionHistory.getHistory()); paintHistory.add(coordinates); - int size = paintHistory.size(); + final int size = paintHistory.size(); if (size > 1) { int alphaCnt = size - 201; if (alphaCnt < 1) { alphaCnt = 1; } - Point pointNow = new Point(); - Point pointPrevious = new Point(); - Location prev = paintHistory.get(0); + final Point pointNow = new Point(); + final Point pointPrevious = new Point(); + final Location prev = paintHistory.get(0); projection.toPixels(mapItemFactory.getGeoPointBase(new Geopoint(prev)), pointPrevious); for (int cnt = 1; cnt < size; cnt++) { - Location now = paintHistory.get(cnt); + final Location now = paintHistory.get(cnt); projection.toPixels(mapItemFactory.getGeoPointBase(new Geopoint(now)), pointNow); - int alpha; + final int alpha; if ((alphaCnt - cnt) > 0) { alpha = 255 / (alphaCnt - cnt); } @@ -147,10 +147,10 @@ public class PositionDrawer { heightArrowHalf = arrow.getHeight() / 2; } - int marginLeft = center.x - widthArrowHalf; - int marginTop = center.y - heightArrowHalf; + final int marginLeft = center.x - widthArrowHalf; + final int marginTop = center.y - heightArrowHalf; - Matrix matrix = new Matrix(); + final Matrix matrix = new Matrix(); matrix.setRotate(heading, widthArrowHalf, heightArrowHalf); matrix.postTranslate(marginLeft, marginTop); @@ -163,11 +163,11 @@ public class PositionDrawer { return positionHistory.getHistory(); } - public void setHistory(ArrayList history) { + public void setHistory(final ArrayList history) { positionHistory.setHistory(history); } - public void setHeading(float bearingNow) { + public void setHeading(final float bearingNow) { heading = bearingNow; } @@ -175,7 +175,7 @@ public class PositionDrawer { return heading; } - public void setCoordinates(Location coordinatesIn) { + public void setCoordinates(final Location coordinatesIn) { coordinates = coordinatesIn; location = mapItemFactory.getGeoPointBase(new Geopoint(coordinates)); } diff --git a/main/src/cgeo/geocaching/maps/PositionHistory.java b/main/src/cgeo/geocaching/maps/PositionHistory.java index af13740..4394eba 100644 --- a/main/src/cgeo/geocaching/maps/PositionHistory.java +++ b/main/src/cgeo/geocaching/maps/PositionHistory.java @@ -24,7 +24,7 @@ public class PositionHistory { /** * Adds the current position to the trail history to be able to show the trail on the map. */ - void rememberTrailPosition(Location coordinates) { + void rememberTrailPosition(final Location coordinates) { if (coordinates.getAccuracy() >= 50f) { return; } @@ -36,7 +36,7 @@ public class PositionHistory { return; } - Location historyRecent = history.get(history.size() - 1); + final Location historyRecent = history.get(history.size() - 1); if (historyRecent.distanceTo(coordinates) <= MINIMUM_DISTANCE_METERS) { return; } @@ -56,7 +56,7 @@ public class PositionHistory { return history; } - public void setHistory(ArrayList history) { + public void setHistory(final ArrayList history) { this.history = history; } diff --git a/main/src/cgeo/geocaching/maps/ScaleDrawer.java b/main/src/cgeo/geocaching/maps/ScaleDrawer.java index 04398b4..e905873 100644 --- a/main/src/cgeo/geocaching/maps/ScaleDrawer.java +++ b/main/src/cgeo/geocaching/maps/ScaleDrawer.java @@ -25,8 +25,8 @@ public class ScaleDrawer { private float pixelDensity = 0; public ScaleDrawer() { - DisplayMetrics metrics = new DisplayMetrics(); - WindowManager windowManager = (WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE); + final DisplayMetrics metrics = new DisplayMetrics(); + final WindowManager windowManager = (WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(metrics); pixelDensity = metrics.density; } @@ -36,7 +36,7 @@ public class ScaleDrawer { return scale * Math.floor(distance / scale); } - void drawScale(Canvas canvas, MapViewImpl mapView) { + void drawScale(final Canvas canvas, final MapViewImpl mapView) { final double span = mapView.getLongitudeSpan() / 1e6; final GeoPointImpl center = mapView.getMapViewCenter(); diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlay.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlay.java index 9b18c2d..3d2b83c 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlay.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlay.java @@ -21,10 +21,10 @@ import java.util.concurrent.locks.ReentrantLock; */ public class GoogleCacheOverlay extends ItemizedOverlay implements ItemizedOverlayImpl { - private CachesOverlay base; - private Lock lock = new ReentrantLock(); + private final CachesOverlay base; + private final Lock lock = new ReentrantLock(); - public GoogleCacheOverlay(Context contextIn, Drawable markerIn) { + public GoogleCacheOverlay(final Context contextIn, final Drawable markerIn) { super(boundCenterBottom(markerIn)); base = new CachesOverlay(this, contextIn); } @@ -35,7 +35,7 @@ public class GoogleCacheOverlay extends ItemizedOverlay } @Override - protected GoogleCacheOverlayItem createItem(int i) { + protected GoogleCacheOverlayItem createItem(final int i) { if (base == null) { return null; } @@ -53,7 +53,7 @@ public class GoogleCacheOverlay extends ItemizedOverlay } @Override - protected boolean onTap(int arg0) { + protected boolean onTap(final int arg0) { if (base == null) { return false; } @@ -62,11 +62,11 @@ public class GoogleCacheOverlay extends ItemizedOverlay } @Override - public void draw(Canvas canvas, MapView mapView, boolean shadow) { + public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) { base.draw(canvas, castMapViewImpl(mapView), shadow); } - private static MapViewImpl castMapViewImpl(MapView mapView) { + private static MapViewImpl castMapViewImpl(final MapView mapView) { assert mapView instanceof MapViewImpl; return (MapViewImpl) mapView; } @@ -77,28 +77,28 @@ public class GoogleCacheOverlay extends ItemizedOverlay } @Override - public Drawable superBoundCenterBottom(Drawable marker) { + public Drawable superBoundCenterBottom(final Drawable marker) { return ItemizedOverlay.boundCenterBottom(marker); } @Override - public void superSetLastFocusedItemIndex(int i) { + public void superSetLastFocusedItemIndex(final int i) { super.setLastFocusedIndex(i); } @Override - public boolean superOnTap(int index) { + public boolean superOnTap(final int index) { return super.onTap(index); } @Override - public void superDraw(Canvas canvas, MapViewImpl mapView, boolean shadow) { + public void superDraw(final Canvas canvas, final MapViewImpl mapView, final boolean shadow) { super.draw(canvas, (MapView) mapView, shadow); } @Override - public void superDrawOverlayBitmap(Canvas canvas, Point drawPosition, - MapProjectionImpl projection, byte drawZoomLevel) { + public void superDrawOverlayBitmap(final Canvas canvas, final Point drawPosition, + final MapProjectionImpl projection, final byte drawZoomLevel) { // Nothing to do here... } diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlayItem.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlayItem.java index 463aae9..977d67c 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlayItem.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleCacheOverlayItem.java @@ -10,7 +10,7 @@ public class GoogleCacheOverlayItem extends OverlayItem implements CachesOverlay final private IWaypoint coord; final private boolean applyDistanceRule; - public GoogleCacheOverlayItem(final IWaypoint coordinate, boolean applyDistanceRule) { + public GoogleCacheOverlayItem(final IWaypoint coordinate, final boolean applyDistanceRule) { super(new GeoPoint(coordinate.getCoords().getLatitudeE6(), coordinate.getCoords().getLongitudeE6()), coordinate.getName(), ""); this.coord = coordinate; diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleGeoPoint.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleGeoPoint.java index 7fbfac2..3f89807 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleGeoPoint.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleGeoPoint.java @@ -7,7 +7,7 @@ import com.google.android.maps.GeoPoint; public class GoogleGeoPoint extends GeoPoint implements GeoPointImpl { - public GoogleGeoPoint(int latitudeE6, int longitudeE6) { + public GoogleGeoPoint(final int latitudeE6, final int longitudeE6) { super(latitudeE6, longitudeE6); } diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapActivity.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapActivity.java index 374e7b0..04078cb 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapActivity.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapActivity.java @@ -16,7 +16,7 @@ import android.view.View; public class GoogleMapActivity extends MapActivity implements MapActivityImpl, FilteredActivity { - private AbstractMap mapBase; + private final AbstractMap mapBase; public GoogleMapActivity() { mapBase = new CGeoMap(this); @@ -33,7 +33,7 @@ public class GoogleMapActivity extends MapActivity implements MapActivityImpl, F } @Override - protected void onCreate(Bundle icicle) { + protected void onCreate(final Bundle icicle) { mapBase.onCreate(icicle); } @@ -58,17 +58,17 @@ public class GoogleMapActivity extends MapActivity implements MapActivityImpl, F } @Override - public boolean onCreateOptionsMenu(Menu menu) { + public boolean onCreateOptionsMenu(final Menu menu) { return mapBase.onCreateOptionsMenu(menu); } @Override - public boolean onOptionsItemSelected(MenuItem item) { + public boolean onOptionsItemSelected(final MenuItem item) { return mapBase.onOptionsItemSelected(item); } @Override - public boolean onPrepareOptionsMenu(Menu menu) { + public boolean onPrepareOptionsMenu(final Menu menu) { return mapBase.onPrepareOptionsMenu(menu); } @@ -78,12 +78,12 @@ public class GoogleMapActivity extends MapActivity implements MapActivityImpl, F } @Override - public void superOnCreate(Bundle savedInstanceState) { + public void superOnCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override - public boolean superOnCreateOptionsMenu(Menu menu) { + public boolean superOnCreateOptionsMenu(final Menu menu) { return super.onCreateOptionsMenu(menu); } @@ -93,12 +93,12 @@ public class GoogleMapActivity extends MapActivity implements MapActivityImpl, F } @Override - public boolean superOnOptionsItemSelected(MenuItem item) { + public boolean superOnOptionsItemSelected(final MenuItem item) { return super.onOptionsItemSelected(item); } @Override - public void navigateUp(View view) { + public void navigateUp(final View view) { ActivityMixin.navigateUp(this); } @@ -118,12 +118,12 @@ public class GoogleMapActivity extends MapActivity implements MapActivityImpl, F } @Override - public boolean superOnPrepareOptionsMenu(Menu menu) { + public boolean superOnPrepareOptionsMenu(final Menu menu) { return super.onPrepareOptionsMenu(menu); } @Override - public void showFilterMenu(View view) { + public void showFilterMenu(final View view) { // do nothing, the filter bar only shows the global filter } } diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapController.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapController.java index ea95676..a533a76 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapController.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapController.java @@ -8,34 +8,34 @@ import com.google.android.maps.MapController; public class GoogleMapController implements MapControllerImpl { - private MapController mapController; + private final MapController mapController; - public GoogleMapController(MapController mapControllerIn) { + public GoogleMapController(final MapController mapControllerIn) { mapController = mapControllerIn; } @Override - public void animateTo(GeoPointImpl geoPoint) { + public void animateTo(final GeoPointImpl geoPoint) { mapController.animateTo(castToGeoPointImpl(geoPoint)); } - private static GeoPoint castToGeoPointImpl(GeoPointImpl geoPoint) { + private static GeoPoint castToGeoPointImpl(final GeoPointImpl geoPoint) { assert geoPoint instanceof GeoPoint; return (GeoPoint) geoPoint; } @Override - public void setCenter(GeoPointImpl geoPoint) { + public void setCenter(final GeoPointImpl geoPoint) { mapController.setCenter(castToGeoPointImpl(geoPoint)); } @Override - public void setZoom(int mapzoom) { + public void setZoom(final int mapzoom) { mapController.setZoom(mapzoom); } @Override - public void zoomToSpan(int latSpanE6, int lonSpanE6) { + public void zoomToSpan(final int latSpanE6, final int lonSpanE6) { mapController.zoomToSpan(latSpanE6, lonSpanE6); } diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapItemFactory.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapItemFactory.java index 5fedf69..a35eda8 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapItemFactory.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapItemFactory.java @@ -14,7 +14,7 @@ public class GoogleMapItemFactory implements MapItemFactory { } @Override - public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, boolean applyDistanceRule) { + public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, final boolean applyDistanceRule) { return new GoogleCacheOverlayItem(coordinate, applyDistanceRule); } } diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProjection.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProjection.java index 901a369..8a03bbb 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProjection.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProjection.java @@ -10,14 +10,14 @@ import android.graphics.Point; public class GoogleMapProjection implements MapProjectionImpl { - private Projection projection; + private final Projection projection; - public GoogleMapProjection(Projection projectionIn) { + public GoogleMapProjection(final Projection projectionIn) { projection = projectionIn; } @Override - public void toPixels(GeoPointImpl leftGeo, Point left) { + public void toPixels(final GeoPointImpl leftGeo, final Point left) { projection.toPixels((GeoPoint) leftGeo, left); } diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProvider.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProvider.java index 884e076..8c9dd4d 100644 --- a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProvider.java +++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapProvider.java @@ -83,7 +83,7 @@ public final class GoogleMapProvider extends AbstractMapProvider { private static final class GoogleSatelliteSource extends AbstractGoogleMapSource { - public GoogleSatelliteSource(MapProvider mapProvider, String name) { + public GoogleSatelliteSource(final MapProvider mapProvider, final String name) { super(GOOGLE_SATELLITE_ID, mapProvider, name); } diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java index b9e40d7..02e4243 100644 --- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java +++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java @@ -18,10 +18,10 @@ import java.util.concurrent.locks.ReentrantLock; public class MapsforgeCacheOverlay extends ItemizedOverlay implements ItemizedOverlayImpl { - private CachesOverlay base; - private Lock lock = new ReentrantLock(); + private final CachesOverlay base; + private final Lock lock = new ReentrantLock(); - public MapsforgeCacheOverlay(Context contextIn, Drawable markerIn) { + public MapsforgeCacheOverlay(final Context contextIn, final Drawable markerIn) { super(boundCenterBottom(markerIn)); base = new CachesOverlay(this, contextIn); } @@ -32,7 +32,7 @@ public class MapsforgeCacheOverlay extends ItemizedOverlay= farFarAway) { // example: "5 kilometers" - always without decimal digits final int quantity = Math.round(farDistance); @@ -84,15 +84,15 @@ public class TextFactory { return getQuantityString(nearId, quantity, String.valueOf(quantity)); } - private static String getString(int resourceId, Object... formatArgs) { + private static String getString(final int resourceId, final Object... formatArgs) { return CgeoApplication.getInstance().getString(resourceId, formatArgs); } - private static String getQuantityString(int resourceId, int quantity, Object... formatArgs) { + private static String getQuantityString(final int resourceId, final int quantity, final Object... formatArgs) { return CgeoApplication.getInstance().getResources().getQuantityString(resourceId, quantity, formatArgs); } - private static String getDirection(Geopoint position, Geopoint target, float direction) { + private static String getDirection(final Geopoint position, final Geopoint target, final float direction) { final int bearing = (int) position.bearingTo(target); final int degrees = (int) AngleUtils.normalize(bearing - direction); diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java index 06fa1fa..40d077e 100644 --- a/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java +++ b/main/src/cgeo/geocaching/ui/AbstractCachingListViewPageViewCreator.java @@ -30,10 +30,10 @@ public abstract class AbstractCachingListViewPageViewCreator extends AbstractCac if (view == null) { return null; } - int position = view.getFirstVisiblePosition(); - View child = view.getChildAt(0); - int positionFromTop = (child == null) ? 0 : child.getTop(); - Bundle state = new Bundle(); + final int position = view.getFirstVisiblePosition(); + final View child = view.getChildAt(0); + final int positionFromTop = (child == null) ? 0 : child.getTop(); + final Bundle state = new Bundle(); state.putInt(STATE_POSITION, position); state.putInt(STATE_POSITION_FROM_TOP, positionFromTop); return state; @@ -44,12 +44,12 @@ public abstract class AbstractCachingListViewPageViewCreator extends AbstractCac * */ @Override - public void setViewState(@NonNull Bundle state) { + public void setViewState(@NonNull final Bundle state) { if (view == null) { return; } - int logViewPosition = state.getInt(STATE_POSITION); - int logViewPositionFromTop = state.getInt(STATE_POSITION_FROM_TOP); + final int logViewPosition = state.getInt(STATE_POSITION); + final int logViewPositionFromTop = state.getInt(STATE_POSITION_FROM_TOP); view.setSelectionFromTop(logViewPosition, logViewPositionFromTop); } diff --git a/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java b/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java index 075bfe6..22ec603 100644 --- a/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java +++ b/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java @@ -48,7 +48,7 @@ public abstract class AbstractImageAdapter extends BaseAdapter { // create a new ImageView for each item referenced by the Adapter @Override public View getView(final int position, final View convertView, final ViewGroup parent) { - ImageView imageView; + final ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = (ImageView) LayoutInflater.from(context).inflate(R.layout.grid_image, null); } else { diff --git a/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java b/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java index f26cb53..1efa15e 100644 --- a/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java +++ b/main/src/cgeo/geocaching/ui/AbstractUserClickListener.java @@ -24,7 +24,7 @@ abstract class AbstractUserClickListener implements View.OnClickListener { } @Override - public void onClick(View view) { + public void onClick(final View view) { if (view == null) { return; } @@ -45,8 +45,8 @@ abstract class AbstractUserClickListener implements View.OnClickListener { final AbstractActivity activity = (AbstractActivity) view.getContext(); final Resources res = activity.getResources(); - ArrayList labels = new ArrayList<>(userActions.size()); - for (UserAction action : userActions) { + final ArrayList labels = new ArrayList<>(userActions.size()); + for (final UserAction action : userActions) { labels.add(res.getString(action.displayResourceId)); } final CharSequence[] items = labels.toArray(new String[labels.size()]); @@ -55,7 +55,7 @@ abstract class AbstractUserClickListener implements View.OnClickListener { builder.setTitle(res.getString(R.string.user_menu_title) + " " + userName); builder.setItems(items, new DialogInterface.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int item) { + public void onClick(final DialogInterface dialog, final int item) { userActions.get(item).run(new Context(userName, activity)); } }); diff --git a/main/src/cgeo/geocaching/ui/AbstractViewHolder.java b/main/src/cgeo/geocaching/ui/AbstractViewHolder.java index b1cb719..0233bf0 100644 --- a/main/src/cgeo/geocaching/ui/AbstractViewHolder.java +++ b/main/src/cgeo/geocaching/ui/AbstractViewHolder.java @@ -11,7 +11,7 @@ import android.view.View; */ public abstract class AbstractViewHolder { - protected AbstractViewHolder(View view) { + protected AbstractViewHolder(final View view) { ButterKnife.inject(this, view); view.setTag(this); } diff --git a/main/src/cgeo/geocaching/ui/AnchorAwareLinkMovementMethod.java b/main/src/cgeo/geocaching/ui/AnchorAwareLinkMovementMethod.java index 870eef1..57c9db0 100644 --- a/main/src/cgeo/geocaching/ui/AnchorAwareLinkMovementMethod.java +++ b/main/src/cgeo/geocaching/ui/AnchorAwareLinkMovementMethod.java @@ -26,10 +26,10 @@ public class AnchorAwareLinkMovementMethod extends LinkMovementMethod { } @Override - public boolean onTouchEvent(TextView widget, Spannable buffer, MotionEvent event) { + public boolean onTouchEvent(final TextView widget, final Spannable buffer, final MotionEvent event) { try { return super.onTouchEvent(widget, buffer, event); - } catch (Exception ignored) { + } catch (final Exception ignored) { // local links to anchors don't work } return false; diff --git a/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java b/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java index 581942a..db299a2 100644 --- a/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java +++ b/main/src/cgeo/geocaching/ui/CoordinatesFormatSwitcher.java @@ -13,7 +13,7 @@ import android.widget.TextView; */ public class CoordinatesFormatSwitcher implements OnClickListener { - private static GeopointFormatter.Format[] availableFormats = new GeopointFormatter.Format[] { + private static final GeopointFormatter.Format[] availableFormats = new GeopointFormatter.Format[] { GeopointFormatter.Format.LAT_LON_DECMINUTE, GeopointFormatter.Format.LAT_LON_DECSECOND, GeopointFormatter.Format.LAT_LON_DECDEGREE @@ -28,10 +28,10 @@ public class CoordinatesFormatSwitcher implements OnClickListener { } @Override - public void onClick(View view) { + public void onClick(final View view) { assert view instanceof TextView; position = (position + 1) % availableFormats.length; - TextView textView = (TextView) view; + final TextView textView = (TextView) view; // rotate coordinate formats on click textView.setText(coordinates.format(availableFormats[position])); } diff --git a/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java b/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java index 421d7aa..30b0e5a 100644 --- a/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java +++ b/main/src/cgeo/geocaching/ui/DecryptTextClickListener.java @@ -24,7 +24,7 @@ public class DecryptTextClickListener implements View.OnClickListener { return; } - CharSequence text = targetView.getText(); + final CharSequence text = targetView.getText(); if (text instanceof Spannable) { targetView.setText(CryptUtils.rot13((Spannable) text)); } else { diff --git a/main/src/cgeo/geocaching/ui/DistanceView.java b/main/src/cgeo/geocaching/ui/DistanceView.java index b5e47e1..fb40ab4 100644 --- a/main/src/cgeo/geocaching/ui/DistanceView.java +++ b/main/src/cgeo/geocaching/ui/DistanceView.java @@ -12,15 +12,15 @@ import android.widget.TextView; public class DistanceView extends TextView { private Geopoint cacheCoords = null; - public DistanceView(Context context) { + public DistanceView(final Context context) { super(context); } - public DistanceView(Context context, AttributeSet attrs) { + public DistanceView(final Context context, final AttributeSet attrs) { super(context, attrs); } - public DistanceView(Context context, AttributeSet attrs, int defStyle) { + public DistanceView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); } @@ -35,7 +35,7 @@ public class DistanceView extends TextView { setText(Units.getDistanceFromKilometers(coords.distanceTo(cacheCoords))); } - public void setDistance(Float distance) { + public void setDistance(final Float distance) { setText("~" + Units.getDistanceFromKilometers(distance)); } } \ No newline at end of file diff --git a/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java b/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java index e07bbc3..6f7f587 100644 --- a/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java +++ b/main/src/cgeo/geocaching/ui/FileSelectionListAdapter.java @@ -40,7 +40,7 @@ public class FileSelectionListAdapter extends ArrayAdapter { View v = rowView; - ViewHolder holder; + final ViewHolder holder; if (v == null) { v = inflater.inflate(R.layout.mapfile_item, parent, false); holder = new ViewHolder(v); diff --git a/main/src/cgeo/geocaching/ui/IndexOutOfBoundsAvoidingTextView.java b/main/src/cgeo/geocaching/ui/IndexOutOfBoundsAvoidingTextView.java index 30778a1..4727bf9 100644 --- a/main/src/cgeo/geocaching/ui/IndexOutOfBoundsAvoidingTextView.java +++ b/main/src/cgeo/geocaching/ui/IndexOutOfBoundsAvoidingTextView.java @@ -12,43 +12,43 @@ import android.widget.TextView; */ public class IndexOutOfBoundsAvoidingTextView extends TextView { - public IndexOutOfBoundsAvoidingTextView(Context context, AttributeSet attrs, int defStyle) { + public IndexOutOfBoundsAvoidingTextView(final Context context, final AttributeSet attrs, final int defStyle) { super(context, attrs, defStyle); } - public IndexOutOfBoundsAvoidingTextView(Context context, AttributeSet attrs) { + public IndexOutOfBoundsAvoidingTextView(final Context context, final AttributeSet attrs) { super(context, attrs); } - public IndexOutOfBoundsAvoidingTextView(Context context) { + public IndexOutOfBoundsAvoidingTextView(final Context context) { super(context); } @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) { try{ super.onMeasure(widthMeasureSpec, heightMeasureSpec); - } catch (IndexOutOfBoundsException ignored) { + } catch (final IndexOutOfBoundsException ignored) { setText(getText().toString()); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } @Override - public void setGravity(int gravity){ + public void setGravity(final int gravity){ try{ super.setGravity(gravity); - } catch (IndexOutOfBoundsException ignored) { + } catch (final IndexOutOfBoundsException ignored) { setText(getText().toString()); super.setGravity(gravity); } } @Override - public void setText(CharSequence text, BufferType type) { + public void setText(final CharSequence text, final BufferType type) { try{ super.setText(text, type); - } catch (IndexOutOfBoundsException ignored) { + } catch (final IndexOutOfBoundsException ignored) { setText(text.toString()); } } diff --git a/main/src/cgeo/geocaching/ui/OwnerActionsClickListener.java b/main/src/cgeo/geocaching/ui/OwnerActionsClickListener.java index acd43cb..9aa6bec 100644 --- a/main/src/cgeo/geocaching/ui/OwnerActionsClickListener.java +++ b/main/src/cgeo/geocaching/ui/OwnerActionsClickListener.java @@ -15,13 +15,13 @@ public class OwnerActionsClickListener extends AbstractUserClickListener { private final Geocache cache; - public OwnerActionsClickListener(Geocache cache) { + public OwnerActionsClickListener(final Geocache cache) { super(ConnectorFactory.getConnector(cache).getUserActions()); this.cache = cache; } @Override - protected String getUserName(View view) { + protected String getUserName(final View view) { // Use real owner name vice the one owner chose to display if (StringUtils.isNotBlank(cache.getOwnerUserId())) { return cache.getOwnerUserId(); diff --git a/main/src/cgeo/geocaching/ui/UrlPopup.java b/main/src/cgeo/geocaching/ui/UrlPopup.java index 5a8dba4..18d57d5 100644 --- a/main/src/cgeo/geocaching/ui/UrlPopup.java +++ b/main/src/cgeo/geocaching/ui/UrlPopup.java @@ -17,20 +17,20 @@ public class UrlPopup { } public void show(final String title, final String message, final String url, final String urlButtonTitle) { - AlertDialog.Builder builder = new AlertDialog.Builder(context); + final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(message) .setIcon(android.R.drawable.ic_dialog_info) .setTitle(title) .setPositiveButton(R.string.err_none, new DialogInterface.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int id) { + public void onClick(final DialogInterface dialog, final int id) { dialog.cancel(); } }) .setNegativeButton(urlButtonTitle, new DialogInterface.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int id) { - Intent i = new Intent(Intent.ACTION_VIEW); + public void onClick(final DialogInterface dialog, final int id) { + final Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); context.startActivity(i); } diff --git a/main/src/cgeo/geocaching/ui/UserActionsClickListener.java b/main/src/cgeo/geocaching/ui/UserActionsClickListener.java index 19946bc..68c5493 100644 --- a/main/src/cgeo/geocaching/ui/UserActionsClickListener.java +++ b/main/src/cgeo/geocaching/ui/UserActionsClickListener.java @@ -12,16 +12,16 @@ import android.widget.TextView; */ public class UserActionsClickListener extends AbstractUserClickListener { - public UserActionsClickListener(Geocache cache) { + public UserActionsClickListener(final Geocache cache) { super(ConnectorFactory.getConnector(cache).getUserActions()); } - public UserActionsClickListener(Trackable trackable) { + public UserActionsClickListener(final Trackable trackable) { super(ConnectorFactory.getConnector(trackable).getUserActions()); } @Override - protected String getUserName(View view) { + protected String getUserName(final View view) { return ((TextView) view).getText().toString(); } } diff --git a/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java b/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java index 9858c28..d4720bf 100644 --- a/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java +++ b/main/src/cgeo/geocaching/ui/dialog/LiveMapInfoDialogBuilder.java @@ -15,7 +15,7 @@ import android.view.View; public class LiveMapInfoDialogBuilder { - public static AlertDialog create(Activity activity) { + public static AlertDialog create(final Activity activity) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); final Context themedContext; @@ -32,7 +32,7 @@ public class LiveMapInfoDialogBuilder { builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int which) { + public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); CgeoApplication.getInstance().setLiveMapHintShownInThisSession(); } diff --git a/main/src/cgeo/geocaching/ui/logs/LogViewHolder.java b/main/src/cgeo/geocaching/ui/logs/LogViewHolder.java index 16f5537..302f86c 100644 --- a/main/src/cgeo/geocaching/ui/logs/LogViewHolder.java +++ b/main/src/cgeo/geocaching/ui/logs/LogViewHolder.java @@ -20,7 +20,7 @@ public class LogViewHolder extends AbstractViewHolder { private int position; - public LogViewHolder(View rowView) { + public LogViewHolder(final View rowView) { super(rowView); } diff --git a/main/src/cgeo/geocaching/utils/BundleUtils.java b/main/src/cgeo/geocaching/utils/BundleUtils.java index 9c4255b..e61e45e 100644 --- a/main/src/cgeo/geocaching/utils/BundleUtils.java +++ b/main/src/cgeo/geocaching/utils/BundleUtils.java @@ -7,8 +7,8 @@ import android.os.Bundle; public class BundleUtils { @NonNull - public static String getString(Bundle bundle, @NonNull String key, @NonNull String defaultValue) { - String res = bundle.getString(key); + public static String getString(final Bundle bundle, @NonNull final String key, @NonNull final String defaultValue) { + final String res = bundle.getString(key); if (res != null) { return res; } diff --git a/main/src/cgeo/geocaching/utils/CryptUtils.java b/main/src/cgeo/geocaching/utils/CryptUtils.java index 70d5895..4aec509 100644 --- a/main/src/cgeo/geocaching/utils/CryptUtils.java +++ b/main/src/cgeo/geocaching/utils/CryptUtils.java @@ -58,7 +58,7 @@ public final class CryptUtils { } else if (result == ']') { plaintext = false; } else if (!plaintext) { - int capitalized = result & 32; + final int capitalized = result & 32; result &= ~capitalized; result = ((result >= 'A') && (result <= 'Z') ? ((result - 'A' + 13) % 26 + 'A') : result) | capitalized; @@ -68,22 +68,22 @@ public final class CryptUtils { } @NonNull - public static String rot13(String text) { + public static String rot13(final String text) { if (text == null) { return StringUtils.EMPTY; } final StringBuilder result = new StringBuilder(); - Rot13Encryption rot13 = new Rot13Encryption(); + final Rot13Encryption rot13 = new Rot13Encryption(); final int length = text.length(); for (int index = 0; index < length; index++) { - char c = text.charAt(index); + final char c = text.charAt(index); result.append(rot13.getNextEncryptedCharacter(c)); } return result.toString(); } - public static String md5(String text) { + public static String md5(final String text) { try { final MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(text.getBytes(CharEncoding.UTF_8), 0, text.length()); @@ -95,7 +95,7 @@ public final class CryptUtils { return StringUtils.EMPTY; } - public static byte[] hashHmac(String text, String salt) { + public static byte[] hashHmac(final String text, final String salt) { try { final SecretKeySpec secretKeySpec = new SecretKeySpec(salt.getBytes(CharEncoding.UTF_8), "HmacSHA1"); @@ -113,32 +113,32 @@ public final class CryptUtils { // a SpannableStringBuilder instead of the pure text and we must replace each character inline. // Otherwise we loose all the images, colors and so on... final SpannableStringBuilder buffer = new SpannableStringBuilder(span); - Rot13Encryption rot13 = new Rot13Encryption(); + final Rot13Encryption rot13 = new Rot13Encryption(); final int length = span.length(); for (int index = 0; index < length; index++) { - char c = span.charAt(index); + final char c = span.charAt(index); buffer.replace(index, index + 1, String.valueOf(rot13.getNextEncryptedCharacter(c))); } return buffer; } - public static String base64Encode(byte[] in) { - int iLen = in.length; - int oDataLen = (iLen * 4 + 2) / 3; // output length without padding - int oLen = ((iLen + 2) / 3) * 4; // output length including padding - char[] out = new char[oLen]; + public static String base64Encode(final byte[] in) { + final int iLen = in.length; + final int oDataLen = (iLen * 4 + 2) / 3; // output length without padding + final int oLen = ((iLen + 2) / 3) * 4; // output length including padding + final char[] out = new char[oLen]; int ip = 0; int op = 0; while (ip < iLen) { - int i0 = in[ip++] & 0xff; - int i1 = ip < iLen ? in[ip++] & 0xff : 0; - int i2 = ip < iLen ? in[ip++] & 0xff : 0; - int o0 = i0 >>> 2; - int o1 = ((i0 & 3) << 4) | (i1 >>> 4); - int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6); - int o3 = i2 & 0x3F; + final int i0 = in[ip++] & 0xff; + final int i1 = ip < iLen ? in[ip++] & 0xff : 0; + final int i2 = ip < iLen ? in[ip++] & 0xff : 0; + final int o0 = i0 >>> 2; + final int o1 = ((i0 & 3) << 4) | (i1 >>> 4); + final int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6); + final int o3 = i2 & 0x3F; out[op++] = BASE64MAP1[o0]; out[op++] = BASE64MAP1[o1]; out[op] = op < oDataLen ? BASE64MAP1[o2] : '='; diff --git a/main/src/cgeo/geocaching/utils/EditUtils.java b/main/src/cgeo/geocaching/utils/EditUtils.java index 0bfe2ea..455ce4d 100644 --- a/main/src/cgeo/geocaching/utils/EditUtils.java +++ b/main/src/cgeo/geocaching/utils/EditUtils.java @@ -17,7 +17,7 @@ public final class EditUtils { editText.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override - public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { + public boolean onEditorAction(final TextView v, final int actionId, final KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_GO) { runnable.run(); return true; @@ -30,7 +30,7 @@ public final class EditUtils { editText.setOnKeyListener(new View.OnKeyListener() { @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { + public boolean onKey(final View v, final int keyCode, final KeyEvent event) { // If the event is a key-down event on the "enter" button if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { runnable.run(); @@ -42,7 +42,7 @@ public final class EditUtils { } - public static void disableSuggestions(EditText edit) { + public static void disableSuggestions(final EditText edit) { edit.setInputType(edit.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_FILTER); diff --git a/main/src/cgeo/geocaching/utils/LazyInitializedList.java b/main/src/cgeo/geocaching/utils/LazyInitializedList.java index b0e2e46..866acad 100644 --- a/main/src/cgeo/geocaching/utils/LazyInitializedList.java +++ b/main/src/cgeo/geocaching/utils/LazyInitializedList.java @@ -49,7 +49,7 @@ public abstract class LazyInitializedList extends AbstractList extends LinkedHashMap { final int initialCapacity; final float loadFactor; - protected LeastRecentlyUsedMap(int maxEntries, int initialCapacity, float loadFactor, OperationModes opMode) { + protected LeastRecentlyUsedMap(final int maxEntries, final int initialCapacity, final float loadFactor, final OperationModes opMode) { super(initialCapacity, loadFactor, (opMode==OperationModes.LRU_CACHE)); this.initialCapacity = initialCapacity; this.loadFactor = loadFactor; @@ -38,12 +38,12 @@ public abstract class LeastRecentlyUsedMap extends LinkedHashMap { this.opMode = opMode; } - protected LeastRecentlyUsedMap(int maxEntries, OperationModes opMode) { + protected LeastRecentlyUsedMap(final int maxEntries, final OperationModes opMode) { this(maxEntries, 16, 0.75f, opMode); } @Override - public V put(K key, V value) { + public V put(final K key, final V value) { // in case the underlying Map is not running with accessOrder==true, the map won't notice any changes // of existing keys, so for the normal BOUNDED mode we remove and put the value to get its order updated. if (opMode == OperationModes.BOUNDED && containsKey(key)) { @@ -57,7 +57,7 @@ public abstract class LeastRecentlyUsedMap extends LinkedHashMap { } @Override - protected boolean removeEldestEntry(Map.Entry eldest) { + protected boolean removeEldestEntry(final Map.Entry eldest) { return size() > maxEntries; } @@ -66,9 +66,9 @@ public abstract class LeastRecentlyUsedMap extends LinkedHashMap { } @Override - public V remove(Object key) { + public V remove(final Object key) { - V removed = super.remove(key); + final V removed = super.remove(key); if (removed != null && removeHandler != null) { removeHandler.onRemove(removed); @@ -84,18 +84,18 @@ public abstract class LeastRecentlyUsedMap extends LinkedHashMap { * @param removeHandler * The new handler to receive notifications or null to remove a handler */ - public void setRemoveHandler(RemoveHandler removeHandler) { + public void setRemoveHandler(final RemoveHandler removeHandler) { this.removeHandler = removeHandler; } public static class LruCache extends LeastRecentlyUsedMap { private static final long serialVersionUID = 9028478916221334454L; - public LruCache(int maxEntries, int initialCapacity, float loadFactor) { + public LruCache(final int maxEntries, final int initialCapacity, final float loadFactor) { super(maxEntries, initialCapacity, loadFactor, OperationModes.LRU_CACHE); } - public LruCache(int maxEntries) { + public LruCache(final int maxEntries) { super(maxEntries, OperationModes.LRU_CACHE); } } @@ -104,11 +104,11 @@ public abstract class LeastRecentlyUsedMap extends LinkedHashMap { private static final long serialVersionUID = -1476389304214398315L; - public Bounded(int maxEntries, int initialCapacity, float loadFactor) { + public Bounded(final int maxEntries, final int initialCapacity, final float loadFactor) { super(maxEntries, initialCapacity, loadFactor, OperationModes.BOUNDED); } - public Bounded(int maxEntries) { + public Bounded(final int maxEntries) { super(maxEntries, OperationModes.BOUNDED); } } diff --git a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java index d4cf16e..c139136 100644 --- a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java +++ b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedSet.java @@ -25,13 +25,13 @@ public class LeastRecentlyUsedSet extends AbstractSet { private final LeastRecentlyUsedMap map; private static final Object PRESENT = new Object(); - public LeastRecentlyUsedSet(int maxEntries, int initialCapacity, float loadFactor) { + public LeastRecentlyUsedSet(final int maxEntries, final int initialCapacity, final float loadFactor) { // because we don't use any Map.get() methods from the Set, BOUNDED and LRU_CACHE have the exact same Behaviour // So we use LRU_CACHE mode because it should perform a bit better (as it doesn't re-add explicitly) map = new LeastRecentlyUsedMap.LruCache<>(maxEntries, initialCapacity, loadFactor); } - public LeastRecentlyUsedSet(int maxEntries) { + public LeastRecentlyUsedSet(final int maxEntries) { map = new LeastRecentlyUsedMap.LruCache<>(maxEntries); } @@ -76,7 +76,7 @@ public class LeastRecentlyUsedSet extends AbstractSet { * @see HashSet */ @Override - public synchronized boolean contains(Object o) { + public synchronized boolean contains(final Object o) { return map.containsKey(o); } @@ -87,7 +87,7 @@ public class LeastRecentlyUsedSet extends AbstractSet { * @see HashSet */ @Override - public synchronized boolean add(E e) { + public synchronized boolean add(final E e) { if (e == null) { throw new IllegalArgumentException("LeastRecentlyUsedSet cannot take null element"); } @@ -101,7 +101,7 @@ public class LeastRecentlyUsedSet extends AbstractSet { * @see HashSet */ @Override - public synchronized boolean remove(Object o) { + public synchronized boolean remove(final Object o) { return map.remove(o) == PRESENT; } diff --git a/main/src/cgeo/geocaching/utils/SynchronizedDateFormat.java b/main/src/cgeo/geocaching/utils/SynchronizedDateFormat.java index 7848d1a..5963e2e 100644 --- a/main/src/cgeo/geocaching/utils/SynchronizedDateFormat.java +++ b/main/src/cgeo/geocaching/utils/SynchronizedDateFormat.java @@ -13,7 +13,7 @@ public class SynchronizedDateFormat { format = new SimpleDateFormat(pattern, locale); } - public SynchronizedDateFormat(String pattern, TimeZone timeZone, Locale locale) { + public SynchronizedDateFormat(final String pattern, final TimeZone timeZone, final Locale locale) { format = new SimpleDateFormat(pattern, locale); format.setTimeZone(timeZone); } diff --git a/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java b/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java index 3cb4f16..d518ac8 100644 --- a/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java +++ b/main/src/cgeo/geocaching/utils/UnknownTagsHandler.java @@ -22,8 +22,8 @@ public class UnknownTagsHandler implements TagHandler { private ListType listType = ListType.Unordered; @Override - public void handleTag(boolean opening, String tag, Editable output, - XMLReader xmlReader) { + public void handleTag(final boolean opening, final String tag, final Editable output, + final XMLReader xmlReader) { if (tag.equalsIgnoreCase("strike") || tag.equals("s")) { handleStrike(opening, output); } else if (tag.equalsIgnoreCase("table")) { @@ -41,7 +41,7 @@ public class UnknownTagsHandler implements TagHandler { } } - private void handleStrike(boolean opening, Editable output) { + private void handleStrike(final boolean opening, final Editable output) { final int length = output.length(); if (opening) { strikePos = length; @@ -61,7 +61,7 @@ public class UnknownTagsHandler implements TagHandler { problematicDetected = true; } - private void handleTd(boolean opening, Editable output) { + private void handleTd(final boolean opening, final Editable output) { // insert bar for each table column, see https://en.wikipedia.org/wiki/Box-drawing_characters if (opening) { if (countCells++ > 0) { @@ -70,7 +70,7 @@ public class UnknownTagsHandler implements TagHandler { } } - private void handleTr(boolean opening, Editable output) { + private void handleTr(final boolean opening, final Editable output) { // insert new line for each table row if (opening) { output.append('\n'); @@ -80,7 +80,7 @@ public class UnknownTagsHandler implements TagHandler { // Ordered lists are handled in a simple manner. They are rendered as Arabic numbers starting at 1 // with no handling for alpha or Roman numbers or arbitrary numbering. - private void handleOl(boolean opening) { + private void handleOl(final boolean opening) { if (opening) { listIndex = 1; listType = ListType.Ordered; @@ -89,7 +89,7 @@ public class UnknownTagsHandler implements TagHandler { } } - private void handleLi(boolean opening, Editable output) { + private void handleLi(final boolean opening, final Editable output) { if (opening) { if (listType == ListType.Ordered) { output.append("\n ").append(String.valueOf(listIndex++)).append(". "); -- cgit v1.1