aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.idea/codeStyleSettings.xml4
-rw-r--r--.idea/inspectionProfiles/c_geo_standards.xml64
-rw-r--r--README.md2
-rw-r--r--cgeo-calendar/.classpath1
-rw-r--r--cgeo-calendar/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs29
-rw-r--r--cgeo-calendar/proguard-project.txt5
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java6
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AddEntry.java4
-rw-r--r--cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java4
-rw-r--r--cgeo-calendar/src/cgeo/calendar/CalendarActivity.java5
-rw-r--r--cgeo-calendar/src/cgeo/calendar/CalendarEntry.java23
-rw-r--r--cgeo-calendar/src/cgeo/calendar/Compatibility.java4
-rw-r--r--cgeo-contacts/.classpath2
-rw-r--r--cgeo-contacts/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs29
-rw-r--r--cgeo-contacts/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jarbin14613 -> 0 bytes
-rw-r--r--cgeo-contacts/src/cgeo/contacts/ContactsActivity.java15
-rw-r--r--main/.factorypath2
-rw-r--r--main/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--main/.settings/org.eclipse.jdt.ui.prefs10
-rw-r--r--main/AndroidManifest.xml415
-rw-r--r--main/build.gradle14
-rw-r--r--main/libs/butterknife-6.0.0.jarbin48889 -> 0 bytes
-rw-r--r--main/libs/butterknife-6.0.0.jar.properties2
-rw-r--r--main/libs/butterknife-6.1.0.jarbin0 -> 50414 bytes
-rw-r--r--main/libs/butterknife-6.1.0.jar.properties2
-rw-r--r--main/libs/jackson-annotations-2.4.4.jarbin38597 -> 0 bytes
-rw-r--r--main/libs/jackson-annotations-2.4.4.jar.properties2
-rw-r--r--main/libs/jackson-annotations-2.5.1.jarbin0 -> 39817 bytes
-rw-r--r--main/libs/jackson-annotations-2.5.1.jar.properties2
-rw-r--r--main/libs/jackson-core-2.4.4.jarbin225302 -> 0 bytes
-rw-r--r--main/libs/jackson-core-2.4.4.jar.properties2
-rw-r--r--main/libs/jackson-core-2.5.1.jarbin0 -> 229860 bytes
-rw-r--r--main/libs/jackson-core-2.5.1.jar.properties2
-rw-r--r--main/libs/jackson-databind-2.4.4.jarbin1076926 -> 0 bytes
-rw-r--r--main/libs/jackson-databind-2.4.4.jar.properties2
-rw-r--r--main/libs/jackson-databind-2.5.1.jarbin0 -> 1138921 bytes
-rw-r--r--main/libs/jackson-databind-2.5.1.jar.properties2
-rw-r--r--main/libs/mapsforge-map-0.2.4.jarbin392417 -> 0 bytes
-rw-r--r--main/libs/rxjava-1.0.4.jarbin693936 -> 0 bytes
-rw-r--r--main/libs/rxjava-1.0.4.jar.properties2
-rw-r--r--main/libs/rxjava-1.0.8.jarbin0 -> 738300 bytes
-rw-r--r--main/libs/rxjava-1.0.8.jar.properties2
-rw-r--r--main/libs/rxjava-async-util-0.21.0.jarbin48422 -> 0 bytes
-rw-r--r--main/libs/rxjava-async-util-0.21.0.jar.properties2
-rw-r--r--main/libs/src/butterknife-6.0.0-javadoc.jarbin109554 -> 0 bytes
-rw-r--r--main/libs/src/butterknife-6.0.0-sources.jarbin28805 -> 0 bytes
-rw-r--r--main/libs/src/butterknife-6.1.0-javadoc.jarbin0 -> 113755 bytes
-rw-r--r--main/libs/src/butterknife-6.1.0-sources.jarbin0 -> 29195 bytes
-rw-r--r--main/libs/src/jackson-annotations-2.4.4-javadoc.jarbin268700 -> 0 bytes
-rw-r--r--main/libs/src/jackson-annotations-2.4.4-sources.jarbin42638 -> 0 bytes
-rw-r--r--main/libs/src/jackson-annotations-2.5.1-javadoc.jarbin0 -> 277589 bytes
-rw-r--r--main/libs/src/jackson-annotations-2.5.1-sources.jarbin0 -> 44580 bytes
-rw-r--r--main/libs/src/jackson-core-2.4.4-javadoc.jarbin799738 -> 0 bytes
-rw-r--r--main/libs/src/jackson-core-2.4.4-sources.jarbin235527 -> 0 bytes
-rw-r--r--main/libs/src/jackson-core-2.5.1-javadoc.jarbin0 -> 819576 bytes
-rw-r--r--main/libs/src/jackson-core-2.5.1-sources.jarbin0 -> 240812 bytes
-rw-r--r--main/libs/src/jackson-databind-2.4.4-javadoc.jarbin4057097 -> 0 bytes
-rw-r--r--main/libs/src/jackson-databind-2.4.4-sources.jarbin772236 -> 0 bytes
-rw-r--r--main/libs/src/jackson-databind-2.5.1-javadoc.jarbin0 -> 4275310 bytes
-rw-r--r--main/libs/src/jackson-databind-2.5.1-sources.jarbin0 -> 820494 bytes
-rw-r--r--main/libs/src/rxjava-1.0.4-javadoc.jarbin419128 -> 0 bytes
-rw-r--r--main/libs/src/rxjava-1.0.4-sources.jarbin386283 -> 0 bytes
-rw-r--r--main/libs/src/rxjava-1.0.8-javadoc.jarbin0 -> 416919 bytes
-rw-r--r--main/libs/src/rxjava-1.0.8-sources.jarbin0 -> 403090 bytes
-rw-r--r--main/libs/src/rxjava-async-util-0.21.0-javadoc.jarbin63620 -> 0 bytes
-rw-r--r--main/libs/src/rxjava-async-util-0.21.0-sources.jarbin16355 -> 0 bytes
-rw-r--r--main/project.properties2
-rw-r--r--main/project/libraries/pom.xml20
-rwxr-xr-xmain/project/libraries/update-libs.sh11
-rw-r--r--main/res/layout/about_changes_page.xml15
-rw-r--r--main/res/layout/about_help_page.xml258
-rw-r--r--main/res/layout/about_system_page.xml6
-rw-r--r--main/res/layout/cacheslist_item.xml12
-rw-r--r--main/res/layout/filter_activity.xml30
-rw-r--r--main/res/layout/filter_list_child.xml9
-rw-r--r--main/res/layout/grid_image.xml11
-rw-r--r--main/res/layout/images_gridview.xml15
-rw-r--r--main/res/layout/map_mapsforge_old.xml44
-rw-r--r--main/res/menu/cache_list_context.xml26
-rw-r--r--main/res/menu/cache_list_options.xml8
-rw-r--r--main/res/menu/cache_options.xml14
-rw-r--r--main/res/menu/compass_activity_options.xml5
-rw-r--r--main/res/menu/details_context.xml2
-rw-r--r--main/res/menu/filter_options.xml12
-rw-r--r--main/res/menu/images_list_context.xml10
-rw-r--r--main/res/menu/map_activity.xml13
-rw-r--r--main/res/menu/navigate_any_point_activity_options.xml2
-rw-r--r--main/res/menu/search_activity_options.xml5
-rw-r--r--main/res/menu/static_maps_activity_options.xml6
-rw-r--r--main/res/menu/waypoint_options.xml7
-rw-r--r--main/res/values-ca/strings.xml18
-rw-r--r--main/res/values-cs/strings.xml42
-rw-r--r--main/res/values-da/strings.xml5
-rw-r--r--main/res/values-de/strings.xml25
-rw-r--r--main/res/values-es/strings.xml17
-rw-r--r--main/res/values-fr/strings.xml27
-rw-r--r--main/res/values-hu/strings.xml6
-rw-r--r--main/res/values-it/strings.xml25
-rw-r--r--main/res/values-ja/strings.xml5
-rw-r--r--main/res/values-lt/strings.xml24
-rw-r--r--main/res/values-nb/strings.xml5
-rw-r--r--main/res/values-nl/strings.xml6
-rw-r--r--main/res/values-pl/strings.xml6
-rw-r--r--main/res/values-pt/strings.xml6
-rw-r--r--main/res/values-ro/strings.xml6
-rw-r--r--main/res/values-sk/strings.xml6
-rw-r--r--main/res/values-sl/strings.xml6
-rw-r--r--main/res/values-sv/strings.xml6
-rw-r--r--main/res/values/changelog_master.xml28
-rw-r--r--main/res/values/strings.xml27
-rw-r--r--main/res/values/strings_not_translatable.xml5
-rw-r--r--main/res/values/themes.xml2
-rw-r--r--main/src/cgeo/calendar/CalendarAddon.java12
-rw-r--r--main/src/cgeo/calendar/ICalendar.java27
-rw-r--r--main/src/cgeo/contacts/ContactsAddon.java4
-rw-r--r--main/src/cgeo/contacts/IContacts.java10
-rw-r--r--main/src/cgeo/geocaching/AboutActivity.java75
-rw-r--r--main/src/cgeo/geocaching/AbstractDialogFragment.java2
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java108
-rw-r--r--main/src/cgeo/geocaching/CacheListActivity.java88
-rw-r--r--main/src/cgeo/geocaching/CacheMenuHandler.java4
-rw-r--r--main/src/cgeo/geocaching/CompassActivity.java10
-rw-r--r--main/src/cgeo/geocaching/CreateShortcutActivity.java8
-rw-r--r--main/src/cgeo/geocaching/DataStore.java56
-rw-r--r--main/src/cgeo/geocaching/EditWaypointActivity.java1
-rw-r--r--main/src/cgeo/geocaching/Geocache.java48
-rw-r--r--main/src/cgeo/geocaching/Image.java8
-rw-r--r--main/src/cgeo/geocaching/ImageSelectActivity.java1
-rw-r--r--main/src/cgeo/geocaching/ImagesActivity.java14
-rw-r--r--main/src/cgeo/geocaching/Intents.java2
-rw-r--r--main/src/cgeo/geocaching/LogCacheActivity.java8
-rw-r--r--main/src/cgeo/geocaching/LogTrackableActivity.java1
-rw-r--r--main/src/cgeo/geocaching/NavigateAnyPointActivity.java2
-rw-r--r--main/src/cgeo/geocaching/SearchActivity.java2
-rw-r--r--main/src/cgeo/geocaching/SearchResult.java13
-rw-r--r--main/src/cgeo/geocaching/StaticMapsProvider.java21
-rw-r--r--main/src/cgeo/geocaching/TrackableActivity.java34
-rw-r--r--main/src/cgeo/geocaching/UsefulAppsActivity.java26
-rw-r--r--main/src/cgeo/geocaching/Waypoint.java4
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractActivity.java46
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractListActivity.java2
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java2
-rw-r--r--main/src/cgeo/geocaching/activity/ActivityMixin.java26
-rw-r--r--main/src/cgeo/geocaching/activity/ShowcaseViewBuilder.java1
-rw-r--r--main/src/cgeo/geocaching/apps/AbstractApp.java23
-rw-r--r--main/src/cgeo/geocaching/apps/AbstractAppFactory.java16
-rw-r--r--main/src/cgeo/geocaching/apps/AbstractLocusApp.java38
-rw-r--r--main/src/cgeo/geocaching/apps/App.java5
-rw-r--r--main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java6
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java16
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java9
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java21
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationSelectionActionProvider.java18
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java89
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/CacheListApps.java29
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/ListNavigationSelectionActionProvider.java60
-rw-r--r--main/src/cgeo/geocaching/apps/cachelist/MapsWithMeCacheListApp.java1
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel11.java15
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java12
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java9
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel13.java5
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel13Emulation.java5
-rw-r--r--main/src/cgeo/geocaching/compatibility/AndroidLevel13Interface.java1
-rw-r--r--main/src/cgeo/geocaching/compatibility/Compatibility.java13
-rw-r--r--main/src/cgeo/geocaching/connector/AbstractConnector.java8
-rw-r--r--main/src/cgeo/geocaching/connector/ConnectorFactory.java17
-rw-r--r--main/src/cgeo/geocaching/connector/IConnector.java45
-rw-r--r--main/src/cgeo/geocaching/connector/ILoggingManager.java5
-rw-r--r--main/src/cgeo/geocaching/connector/UnknownConnector.java8
-rw-r--r--main/src/cgeo/geocaching/connector/WaymarkingConnector.java17
-rw-r--r--main/src/cgeo/geocaching/connector/capability/ILogin.java4
-rw-r--r--main/src/cgeo/geocaching/connector/capability/IgnoreCapability.java14
-rw-r--r--main/src/cgeo/geocaching/connector/ec/ECConnector.java10
-rw-r--r--main/src/cgeo/geocaching/connector/ec/ECLogin.java1
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConnector.java18
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCLogin.java8
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCMap.java23
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java47
-rw-r--r--main/src/cgeo/geocaching/connector/gc/Tile.java29
-rw-r--r--main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java1
-rw-r--r--main/src/cgeo/geocaching/connector/gc/UncertainProperty.java1
-rw-r--r--main/src/cgeo/geocaching/connector/oc/IOCAuthParams.java9
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCCZConnector.java34
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OCConnector.java22
-rw-r--r--main/src/cgeo/geocaching/connector/oc/OkapiClient.java12
-rw-r--r--main/src/cgeo/geocaching/connector/ox/OXConnector.java11
-rw-r--r--main/src/cgeo/geocaching/connector/ox/OXGPXParser.java1
-rw-r--r--main/src/cgeo/geocaching/connector/trackable/GeokretyConnector.java10
-rw-r--r--main/src/cgeo/geocaching/connector/trackable/SwaggieConnector.java51
-rw-r--r--main/src/cgeo/geocaching/connector/trackable/SwaggieParser.java55
-rw-r--r--main/src/cgeo/geocaching/connector/trackable/TrackableConnector.java1
-rw-r--r--main/src/cgeo/geocaching/connector/trackable/TravelBugConnector.java1
-rw-r--r--main/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnector.java2
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheAttribute.java14
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheListType.java6
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheSize.java8
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheType.java47
-rw-r--r--main/src/cgeo/geocaching/enumerations/LoadFlags.java4
-rw-r--r--main/src/cgeo/geocaching/enumerations/LogType.java7
-rw-r--r--main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java1
-rw-r--r--main/src/cgeo/geocaching/enumerations/StatusCode.java3
-rw-r--r--main/src/cgeo/geocaching/enumerations/WaypointType.java2
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java3
-rw-r--r--main/src/cgeo/geocaching/export/GpxSerializer.java15
-rw-r--r--main/src/cgeo/geocaching/files/AbstractFileListActivity.java1
-rw-r--r--main/src/cgeo/geocaching/files/GPXImporter.java2
-rw-r--r--main/src/cgeo/geocaching/files/GPXParser.java4
-rw-r--r--main/src/cgeo/geocaching/files/LocalStorage.java18
-rw-r--r--main/src/cgeo/geocaching/filter/AbstractFilter.java15
-rw-r--r--main/src/cgeo/geocaching/filter/AttributeFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/DistanceFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/FilterActivity.java154
-rw-r--r--main/src/cgeo/geocaching/filter/FilterRegistry.java86
-rw-r--r--main/src/cgeo/geocaching/filter/FilterUserInterface.java133
-rw-r--r--main/src/cgeo/geocaching/filter/IFilter.java6
-rw-r--r--main/src/cgeo/geocaching/filter/ModifiedFilter.java3
-rw-r--r--main/src/cgeo/geocaching/filter/OfflineLogFilter.java19
-rw-r--r--main/src/cgeo/geocaching/filter/OriginFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/OwnRatingFilter.java3
-rw-r--r--main/src/cgeo/geocaching/filter/PersonalDataFilterFactory.java2
-rw-r--r--main/src/cgeo/geocaching/filter/PersonalNoteFilter.java3
-rw-r--r--main/src/cgeo/geocaching/filter/PopularityFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/PopularityRatioFilter.java2
-rw-r--r--main/src/cgeo/geocaching/filter/RatingFilter.java14
-rw-r--r--main/src/cgeo/geocaching/filter/SizeFilter.java5
-rw-r--r--main/src/cgeo/geocaching/filter/StateFilter.java156
-rw-r--r--main/src/cgeo/geocaching/filter/StateFilterFactory.java145
-rw-r--r--main/src/cgeo/geocaching/filter/TrackablesFilter.java14
-rw-r--r--main/src/cgeo/geocaching/filter/TypeFilter.java8
-rw-r--r--main/src/cgeo/geocaching/gcvote/GCVoteDialog.java3
-rw-r--r--main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java1
-rw-r--r--main/src/cgeo/geocaching/location/Geopoint.java62
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java176
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java2
-rw-r--r--main/src/cgeo/geocaching/maps/DirectionDrawer.java60
-rw-r--r--main/src/cgeo/geocaching/maps/DistanceDrawer.java131
-rw-r--r--main/src/cgeo/geocaching/maps/LiveMapStrategy.java48
-rw-r--r--main/src/cgeo/geocaching/maps/LivemapStrategy.java45
-rw-r--r--main/src/cgeo/geocaching/maps/PositionAndScaleOverlay.java43
-rw-r--r--main/src/cgeo/geocaching/maps/google/v1/GoogleMapView.java43
-rw-r--r--main/src/cgeo/geocaching/maps/google/v1/GoogleOverlay.java9
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapActivityImpl.java3
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java3
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java50
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java55
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java11
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java113
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlayItem.java37
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeGeoPoint.java18
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java124
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapController.java55
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java20
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapProjection.java29
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java254
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOverlay.java54
-rw-r--r--main/src/cgeo/geocaching/network/AndroidBeam.java93
-rw-r--r--main/src/cgeo/geocaching/playservices/LocationProvider.java4
-rw-r--r--main/src/cgeo/geocaching/sensors/RotationProvider.java1
-rw-r--r--main/src/cgeo/geocaching/settings/AbstractAttributeBasedPrefence.java1
-rw-r--r--main/src/cgeo/geocaching/settings/AbstractCheckCredentialsPreference.java7
-rw-r--r--main/src/cgeo/geocaching/settings/InfoPreference.java2
-rw-r--r--main/src/cgeo/geocaching/settings/Settings.java10
-rw-r--r--main/src/cgeo/geocaching/settings/SettingsActivity.java5
-rw-r--r--main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java8
-rw-r--r--main/src/cgeo/geocaching/sorting/DateComparator.java16
-rw-r--r--main/src/cgeo/geocaching/sorting/EventDateComparator.java14
-rw-r--r--main/src/cgeo/geocaching/sorting/NameComparator.java7
-rw-r--r--main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java1
-rw-r--r--main/src/cgeo/geocaching/ui/AbstractImageAdapter.java66
-rw-r--r--main/src/cgeo/geocaching/ui/AbstractMenuActionProvider.java24
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListAdapter.java11
-rw-r--r--main/src/cgeo/geocaching/ui/CompassMiniView.java21
-rw-r--r--main/src/cgeo/geocaching/ui/NavigationActionProvider.java4
-rw-r--r--main/src/cgeo/geocaching/ui/WeakReferenceHandler.java1
-rw-r--r--main/src/cgeo/geocaching/ui/dialog/Dialogs.java1
-rw-r--r--main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java51
-rw-r--r--main/src/cgeo/geocaching/ui/logs/EditOfflineLogListener.java25
-rw-r--r--main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java12
-rw-r--r--main/src/cgeo/geocaching/ui/logs/TrackableLogsViewCreator.java1
-rw-r--r--main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java14
-rw-r--r--main/src/cgeo/geocaching/utils/CalendarUtils.java (renamed from main/src/cgeo/geocaching/utils/DateUtils.java)23
-rw-r--r--main/src/cgeo/geocaching/utils/CheckerUtils.java35
-rw-r--r--main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java49
-rw-r--r--main/src/cgeo/geocaching/utils/DebugUtils.java7
-rw-r--r--main/src/cgeo/geocaching/utils/FileUtils.java43
-rw-r--r--main/src/cgeo/geocaching/utils/Formatter.java24
-rw-r--r--main/src/cgeo/geocaching/utils/HtmlUtils.java5
-rw-r--r--main/src/cgeo/geocaching/utils/LeastRecentlyUsedMap.java1
-rw-r--r--main/src/cgeo/geocaching/utils/Log.java1
-rw-r--r--main/src/cgeo/geocaching/utils/LogTemplateProvider.java2
-rw-r--r--main/src/cgeo/geocaching/utils/MatcherWrapper.java2
-rw-r--r--main/src/cgeo/geocaching/utils/ProcessUtils.java38
-rw-r--r--main/src/cgeo/geocaching/utils/RxUtils.java69
-rw-r--r--main/src/cgeo/geocaching/utils/TextUtils.java4
-rw-r--r--main/src/cgeo/geocaching/utils/XmlUtils.java2
-rw-r--r--main/thirdparty/menion/android/locus/LocusDataStorageProvider.java (renamed from main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java)2
-rw-r--r--mapswithme-api/build.gradle39
-rw-r--r--mapswithme-api/project.properties2
-rw-r--r--mapswithme-api/res/layout/dlg_install_mwm.xml10
-rw-r--r--mapswithme-api/res/values/strings.xml9
-rw-r--r--mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java3
-rw-r--r--play-services-base/project.properties2
-rw-r--r--play-services-location/project.properties2
-rw-r--r--tests/.settings/org.eclipse.jdt.core.prefs2
-rw-r--r--tests/.settings/org.eclipse.jdt.ui.prefs22
-rw-r--r--tests/res/layout/cgeo_tests_activity.xml3
-rw-r--r--tests/src/cgeo/CGeoTestCase.java8
-rw-r--r--tests/src/cgeo/geocaching/CgeoApplicationTest.java24
-rw-r--r--tests/src/cgeo/geocaching/GeocacheTest.java7
-rw-r--r--tests/src/cgeo/geocaching/StaticMapsProviderTest.java3
-rw-r--r--tests/src/cgeo/geocaching/connector/WaymarkingConnectorTest.java21
-rw-r--r--tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java4
-rw-r--r--tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java3
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OCCZConnectorTest.java14
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java11
-rw-r--r--tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java11
-rw-r--r--tests/src/cgeo/geocaching/connector/ox/OXConnectorTest.java6
-rw-r--r--tests/src/cgeo/geocaching/connector/trackable/SwaggieConnectorTest.java29
-rw-r--r--tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java34
-rw-r--r--tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java6
-rw-r--r--tests/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnectorTest.java44
-rw-r--r--tests/src/cgeo/geocaching/export/ExportTest.java17
-rw-r--r--tests/src/cgeo/geocaching/export/GpxSerializerTest.java24
-rw-r--r--tests/src/cgeo/geocaching/files/GPXImporterTest.java6
-rw-r--r--tests/src/cgeo/geocaching/files/GPXParserTest.java9
-rw-r--r--tests/src/cgeo/geocaching/filter/StateArchivedFilterTest.java5
-rw-r--r--tests/src/cgeo/geocaching/filter/StateDisabledFilterTest.java5
-rw-r--r--tests/src/cgeo/geocaching/filter/StateFoundFilterTest.java5
-rw-r--r--tests/src/cgeo/geocaching/filter/StateNonPremiumFilterTest.java5
-rw-r--r--tests/src/cgeo/geocaching/filter/StateNotFoundFilterTest.java5
-rw-r--r--tests/src/cgeo/geocaching/filter/StatePremiumFilterTest.java5
-rw-r--r--tests/src/cgeo/geocaching/filter/StateStoredFilterTest.java10
-rw-r--r--tests/src/cgeo/geocaching/sorting/NameComparatorTest.java9
-rw-r--r--tests/src/cgeo/geocaching/test/WhitespaceTest.java4
-rw-r--r--tests/src/cgeo/geocaching/utils/CalendarUtilsTest.java (renamed from tests/src/cgeo/geocaching/utils/DateUtilsTest.java)22
-rw-r--r--tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java25
-rw-r--r--tests/src/cgeo/geocaching/utils/FileUtilsTest.java49
-rw-r--r--tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java4
-rw-r--r--tests/src/cgeo/geocaching/utils/RxUtilsTest.java11
-rw-r--r--tests/src/cgeo/junit/CgeoTestRunner.java39
343 files changed, 3915 insertions, 2766 deletions
diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml
index e355fde..c84cc54 100644
--- a/.idea/codeStyleSettings.xml
+++ b/.idea/codeStyleSettings.xml
@@ -46,6 +46,9 @@
<option name="JD_KEEP_EMPTY_RETURN" value="false" />
<option name="JD_PARAM_DESCRIPTION_ON_NEW_LINE" value="true" />
<option name="WRAP_COMMENTS" value="true" />
+ <JavaCodeStyleSettings>
+ <option name="DO_NOT_WRAP_AFTER_SINGLE_ANNOTATION" value="true" />
+ </JavaCodeStyleSettings>
<XML>
<option name="XML_KEEP_LINE_BREAKS" value="false" />
<option name="XML_ALIGN_ATTRIBUTES" value="false" />
@@ -63,6 +66,7 @@
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
+ <option name="FIELD_ANNOTATION_WRAP" value="1" />
</codeStyleSettings>
<codeStyleSettings language="XML">
<indentOptions>
diff --git a/.idea/inspectionProfiles/c_geo_standards.xml b/.idea/inspectionProfiles/c_geo_standards.xml
index e839710..f77d24e 100644
--- a/.idea/inspectionProfiles/c_geo_standards.xml
+++ b/.idea/inspectionProfiles/c_geo_standards.xml
@@ -194,6 +194,68 @@
</inspection_tool>
<inspection_tool class="IteratorHasNextCallsIteratorNext" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="IteratorNextDoesNotThrowNoSuchElementException" enabled="true" level="WARNING" enabled_by_default="true" />
+ <inspection_tool class="JavaDoc" enabled="true" level="WARNING" enabled_by_default="true">
+ <scope name="cgeo project sources" level="ERROR" enabled="true">
+ <option name="TOP_LEVEL_CLASS_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="" />
+ </value>
+ </option>
+ <option name="INNER_CLASS_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="" />
+ </value>
+ </option>
+ <option name="METHOD_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
+ </value>
+ </option>
+ <option name="FIELD_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="" />
+ </value>
+ </option>
+ <option name="IGNORE_DEPRECATED" value="false" />
+ <option name="IGNORE_JAVADOC_PERIOD" value="true" />
+ <option name="IGNORE_DUPLICATED_THROWS" value="false" />
+ <option name="IGNORE_POINT_TO_ITSELF" value="false" />
+ <option name="myAdditionalJavadocTags" value="" />
+ </scope>
+ <option name="TOP_LEVEL_CLASS_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="" />
+ </value>
+ </option>
+ <option name="INNER_CLASS_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="" />
+ </value>
+ </option>
+ <option name="METHOD_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" />
+ </value>
+ </option>
+ <option name="FIELD_OPTIONS">
+ <value>
+ <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" />
+ <option name="REQUIRED_TAGS" value="" />
+ </value>
+ </option>
+ <option name="IGNORE_DEPRECATED" value="false" />
+ <option name="IGNORE_JAVADOC_PERIOD" value="true" />
+ <option name="IGNORE_DUPLICATED_THROWS" value="false" />
+ <option name="IGNORE_POINT_TO_ITSELF" value="false" />
+ <option name="myAdditionalJavadocTags" value="" />
+ </inspection_tool>
<inspection_tool class="KeySetIterationMayUseEntrySet" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="LengthOneStringInIndexOf" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ListIndexOfReplaceableByContains" enabled="true" level="WARNING" enabled_by_default="true" />
@@ -454,7 +516,7 @@
<inspection_tool class="UnnecessaryCallToStringValueOf" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryConstructor" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UnnecessaryEnumModifier" enabled="true" level="WARNING" enabled_by_default="true" />
- <inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WARNING" enabled_by_default="true">
+ <inspection_tool class="UnnecessaryFullyQualifiedName" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="m_ignoreJavadoc" value="false" />
</inspection_tool>
<inspection_tool class="UnnecessaryInheritDoc" enabled="true" level="WARNING" enabled_by_default="true" />
diff --git a/README.md b/README.md
index dbe8d86..1219a48 100644
--- a/README.md
+++ b/README.md
@@ -103,4 +103,4 @@ c:geo is distributed under [Apache License, Version 2.0](http://www.apache.org/l
- Google+: https://plus.google.com/105588163414303246956
- Google Play: https://play.google.com/store/apps/details?id=cgeo.geocaching
- Live status: http://status.cgeo.org/
-- Developer chat: #cgeo on freenode.net (e.g. https://webchat.freenode.net/)
+- Developer chat: [#cgeo on freenode.net](https://webchat.freenode.net/?channels=%23cgeo)
diff --git a/cgeo-calendar/.classpath b/cgeo-calendar/.classpath
index 2f1c26a..004d749 100644
--- a/cgeo-calendar/.classpath
+++ b/cgeo-calendar/.classpath
@@ -10,5 +10,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/cgeo"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
+ <classpathentry kind="lib" path="/cgeo/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
diff --git a/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs b/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs
index 10b38b3..4ef7c1f 100644
--- a/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs
+++ b/cgeo-calendar/.settings/org.eclipse.jdt.core.prefs
@@ -51,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
diff --git a/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs b/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs
index 7616a5b..06e562c 100644
--- a/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs
+++ b/cgeo-calendar/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,3 @@
-#Wed Sep 14 20:41:07 CEST 2011
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_cgeo
@@ -9,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
@@ -20,15 +19,17 @@ sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=true
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=true
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
@@ -36,15 +37,16 @@ sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
@@ -52,10 +54,13 @@ sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/cgeo-calendar/proguard-project.txt b/cgeo-calendar/proguard-project.txt
index 453d1a6..c4cb930 100644
--- a/cgeo-calendar/proguard-project.txt
+++ b/cgeo-calendar/proguard-project.txt
@@ -29,4 +29,7 @@
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
public void set*(...);
-} \ No newline at end of file
+}
+
+# Null analysis annotations of Eclipse JDT are just used by the Eclipse compiler, so ignore them here
+-dontwarn org.eclipse.jdt.annotation.**
diff --git a/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java b/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java
index 893161c..e35ed19 100644
--- a/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java
+++ b/cgeo-calendar/src/cgeo/calendar/AbstractAddEntry.java
@@ -1,13 +1,17 @@
package cgeo.calendar;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.util.Log;
abstract class AbstractAddEntry {
+ @NonNull
protected final CalendarEntry entry;
+ @NonNull
protected final CalendarActivity activity;
- public AbstractAddEntry(final CalendarEntry entry, final CalendarActivity activity) {
+ public AbstractAddEntry(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity) {
this.entry = entry;
this.activity = activity;
}
diff --git a/cgeo-calendar/src/cgeo/calendar/AddEntry.java b/cgeo-calendar/src/cgeo/calendar/AddEntry.java
index 30af346..a267e47 100644
--- a/cgeo-calendar/src/cgeo/calendar/AddEntry.java
+++ b/cgeo-calendar/src/cgeo/calendar/AddEntry.java
@@ -1,5 +1,7 @@
package cgeo.calendar;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.content.ContentValues;
import android.net.Uri;
import android.text.Html;
@@ -16,7 +18,7 @@ class AddEntry extends AbstractAddEntry {
* @param calendarId
* The selected calendar
*/
- public AddEntry(final CalendarEntry entry, final CalendarActivity activity, final int calendarId) {
+ public AddEntry(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity, final int calendarId) {
super(entry, activity);
this.calendarId = calendarId;
}
diff --git a/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java b/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java
index 11820b4..731a0f8 100644
--- a/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java
+++ b/cgeo-calendar/src/cgeo/calendar/AddEntryLevel14.java
@@ -1,5 +1,7 @@
package cgeo.calendar;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.content.Intent;
import android.text.Html;
@@ -12,7 +14,7 @@ import java.util.Date;
*/
class AddEntryLevel14 extends AbstractAddEntry {
- public AddEntryLevel14(final CalendarEntry entry, final CalendarActivity activity) {
+ public AddEntryLevel14(@NonNull final CalendarEntry entry, @NonNull final CalendarActivity activity) {
super(entry, activity);
}
diff --git a/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java b/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java
index 2f0c08d..e21de2b 100644
--- a/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java
+++ b/cgeo-calendar/src/cgeo/calendar/CalendarActivity.java
@@ -1,5 +1,7 @@
package cgeo.calendar;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
@@ -47,7 +49,7 @@ public final class CalendarActivity extends Activity {
* @param entry
* new entry to be stored
*/
- private void selectCalendarForAdding(final CalendarEntry entry) {
+ private void selectCalendarForAdding(@NonNull final CalendarEntry entry) {
final SparseArray<String> calendars = queryCalendars();
if (calendars.size() == 0) {
@@ -80,6 +82,7 @@ public final class CalendarActivity extends Activity {
builder.create().show();
}
+ @NonNull
private SparseArray<String> queryCalendars() {
final SparseArray<String> calendars = new SparseArray<>();
diff --git a/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java b/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java
index 1e37d6b..8308b7b 100644
--- a/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java
+++ b/cgeo-calendar/src/cgeo/calendar/CalendarEntry.java
@@ -3,6 +3,7 @@ package cgeo.calendar;
import cgeo.geocaching.utils.Log;
import org.apache.commons.lang3.CharEncoding;
+import org.eclipse.jdt.annotation.NonNull;
import android.net.Uri;
import android.text.Html;
@@ -16,16 +17,23 @@ import java.util.Date;
class CalendarEntry {
+ @NonNull
private final String shortDesc;
+ @NonNull
private final String hiddenDate;
+ @NonNull
private final String url;
+ @NonNull
private final String personalNote;
+ @NonNull
private final String name;
+ @NonNull
private final String coords;
private int startTimeMinutes = -1;
+ @NonNull
private final Uri uri;
- public CalendarEntry(final Uri uri) {
+ public CalendarEntry(@NonNull final Uri uri) {
this.uri = uri;
this.shortDesc = getParameter(ICalendar.PARAM_SHORT_DESC);
this.hiddenDate = getParameter(ICalendar.PARAM_HIDDEN_DATE);
@@ -43,7 +51,8 @@ class CalendarEntry {
}
}
- private String getParameter(final String paramKey) {
+ @NonNull
+ private String getParameter(@NonNull final String paramKey) {
try {
final String param = uri.getQueryParameter(paramKey);
if (param == null) {
@@ -60,18 +69,22 @@ class CalendarEntry {
return getName().length() > 0 && getHiddenDate().length() > 0;
}
+ @NonNull
public String getHiddenDate() {
return hiddenDate;
}
+ @NonNull
public String getUrl() {
return url;
}
+ @NonNull
public String getPersonalNote() {
return personalNote;
}
+ @NonNull
public String getShortDesc() {
return shortDesc;
}
@@ -79,6 +92,7 @@ class CalendarEntry {
/**
* @return <code>Date</code> based on hidden date. Time is set to 00:00:00.
*/
+ @NonNull
protected Date parseDate() {
try {
final Calendar cal = Calendar.getInstance();
@@ -90,13 +104,14 @@ class CalendarEntry {
return cal.getTime();
} catch (final NumberFormatException e) {
// cannot happen normally, but static code analysis does not know
+ throw new IllegalStateException("hidden date must be a valid date for cache calendar entries");
}
- return null;
}
/**
* @return description string with images removed and personal note included
*/
+ @NonNull
protected String parseDescription() {
final StringBuilder description = new StringBuilder();
description.append(getUrl());
@@ -121,6 +136,7 @@ class CalendarEntry {
return description.toString();
}
+ @NonNull
public String getName() {
return name;
}
@@ -129,6 +145,7 @@ class CalendarEntry {
return startTimeMinutes;
}
+ @NonNull
public String getCoords() {
return coords;
}
diff --git a/cgeo-calendar/src/cgeo/calendar/Compatibility.java b/cgeo-calendar/src/cgeo/calendar/Compatibility.java
index ff14a0f..61ea636 100644
--- a/cgeo-calendar/src/cgeo/calendar/Compatibility.java
+++ b/cgeo-calendar/src/cgeo/calendar/Compatibility.java
@@ -1,5 +1,7 @@
package cgeo.calendar;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.net.Uri;
import android.os.Build;
@@ -9,10 +11,12 @@ public final class Compatibility {
private final static boolean IS_LEVEL_8 = SDK_VERSION >= 8;
private final static boolean IS_LEVEL_14 = SDK_VERSION >= 14;
+ @NonNull
public static Uri getCalendarProviderURI() {
return Uri.parse(IS_LEVEL_8 ? "content://com.android.calendar/calendars" : "content://calendar/calendars");
}
+ @NonNull
public static Uri getCalendarEventsProviderURI() {
return Uri.parse(IS_LEVEL_8 ? "content://com.android.calendar/events" : "content://calendar/events");
}
diff --git a/cgeo-contacts/.classpath b/cgeo-contacts/.classpath
index 448b12e..004d749 100644
--- a/cgeo-contacts/.classpath
+++ b/cgeo-contacts/.classpath
@@ -10,6 +10,6 @@
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry combineaccessrules="false" kind="src" path="/cgeo"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
- <classpathentry kind="lib" path="org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/>
+ <classpathentry kind="lib" path="/cgeo/compile-libs/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
diff --git a/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs b/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs
index 859272c..f8876c8 100644
--- a/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs
+++ b/cgeo-contacts/.settings/org.eclipse.jdt.core.prefs
@@ -51,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
diff --git a/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs b/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs
index 7616a5b..06e562c 100644
--- a/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs
+++ b/cgeo-contacts/.settings/org.eclipse.jdt.ui.prefs
@@ -1,4 +1,3 @@
-#Wed Sep 14 20:41:07 CEST 2011
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_cgeo
@@ -9,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
@@ -20,15 +19,17 @@ sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.convert_functional_interfaces=false
+sp_cleanup.convert_to_enhanced_for_loop=true
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=true
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
@@ -36,15 +37,16 @@ sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
@@ -52,10 +54,13 @@ sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=false
+sp_cleanup.use_anonymous_class_creation=false
+sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/cgeo-contacts/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar b/cgeo-contacts/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar
deleted file mode 100644
index daca164..0000000
--- a/cgeo-contacts/org.eclipse.jdt.annotation_1.1.0.v20130513-1648.jar
+++ /dev/null
Binary files differ
diff --git a/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java b/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java
index 7d2f1e1..74b2617 100644
--- a/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java
+++ b/cgeo-contacts/src/cgeo/contacts/ContactsActivity.java
@@ -7,6 +7,7 @@ import org.eclipse.jdt.annotation.NonNull;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.database.Cursor;
@@ -72,7 +73,7 @@ public final class ContactsActivity extends Activity {
}
}
- private void selectContact(final List<Pair<Integer, String>> contacts) {
+ private void selectContact(@NonNull final List<Pair<Integer, String>> contacts) {
final List<String> list = new ArrayList<>();
for (final Pair<Integer, String> p : contacts) {
list.add(p.second);
@@ -89,6 +90,14 @@ public final class ContactsActivity extends Activity {
openContactAndFinish(contactId);
}
})
+ .setOnCancelListener(new OnCancelListener() {
+
+ @Override
+ public void onCancel(final DialogInterface dialog) {
+ dialog.dismiss();
+ finish();
+ }
+ })
.create().show();
}
@@ -100,6 +109,7 @@ public final class ContactsActivity extends Activity {
finish();
}
+ @NonNull
private List<Pair<Integer, String>> getContacts(final @NonNull String searchName, final Uri uri, final @NonNull String idColumnName, final @NonNull String selectionColumnName, final boolean like) {
final String[] projection = new String[] { idColumnName, selectionColumnName };
final String selection = selectionColumnName + (like ? " LIKE" : " =") + " ? COLLATE NOCASE";
@@ -131,7 +141,8 @@ public final class ContactsActivity extends Activity {
toast.show();
}
- private static String getParameter(final Uri uri, final String paramKey) {
+ @NonNull
+ private static String getParameter(@NonNull final Uri uri, @NonNull final String paramKey) {
try {
final String param = uri.getQueryParameter(paramKey);
if (param == null) {
diff --git a/main/.factorypath b/main/.factorypath
index 16ea046..289e9ae 100644
--- a/main/.factorypath
+++ b/main/.factorypath
@@ -1,4 +1,4 @@
<factorypath>
- <factorypathentry kind="WKSPJAR" id="/cgeo/libs/butterknife-6.0.0.jar" enabled="true" runInBatchMode="false"/>
+ <factorypathentry kind="WKSPJAR" id="/cgeo/libs/butterknife-6.1.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="WKSPJAR" id="/cgeo/compile-libs/androidannotations-3.2.jar" enabled="true" runInBatchMode="false"/>
</factorypath>
diff --git a/main/.settings/org.eclipse.jdt.core.prefs b/main/.settings/org.eclipse.jdt.core.prefs
index 92b431a..70c3ee6 100644
--- a/main/.settings/org.eclipse.jdt.core.prefs
+++ b/main/.settings/org.eclipse.jdt.core.prefs
@@ -61,7 +61,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
diff --git a/main/.settings/org.eclipse.jdt.ui.prefs b/main/.settings/org.eclipse.jdt.ui.prefs
index 4d4a905..4c0bdef 100644
--- a/main/.settings/org.eclipse.jdt.ui.prefs
+++ b/main/.settings/org.eclipse.jdt.ui.prefs
@@ -6,13 +6,15 @@ org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=cgeo;com;org;android;java;javax;
+org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.overrideannotation=true
org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * \n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * \n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
@@ -41,15 +43,15 @@ sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
diff --git a/main/AndroidManifest.xml b/main/AndroidManifest.xml
index ca3026a..372e4b9 100644
--- a/main/AndroidManifest.xml
+++ b/main/AndroidManifest.xml
@@ -7,7 +7,7 @@
<uses-sdk
android:minSdkVersion="9"
- android:targetSdkVersion="19" />
+ android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -280,6 +280,34 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
+
+ <!-- extremcaching.com -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="extremcaching.com"
+ android:pathPrefix="/index.php/output-2/"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.extremcaching.com"
+ android:pathPrefix="/index.php/output-2/"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- geocaching.com -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
@@ -328,6 +356,46 @@
android:pathPrefix="/seek/cache_details.aspx"
android:scheme="http" />
</intent-filter>
+
+ <!-- opencaching.CZ -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.cz"
+ android:pathPrefix="/OZ"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.cz"
+ android:pathPrefix="/OZ"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.cz"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.DE -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
@@ -364,6 +432,46 @@
android:pathPrefix="/viewcache.php"
android:scheme="http" />
</intent-filter>
+
+ <!-- opencaching.ES -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencachingspain.es"
+ android:pathPrefix="/OC"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencachingspain.es"
+ android:pathPrefix="/OC"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencachingspain.es"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.FR -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
@@ -400,7 +508,274 @@
android:pathPrefix="/viewcache.php"
android:scheme="http" />
</intent-filter>
+
+ <!-- opencaching.IT -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.it"
+ android:pathPrefix="/OC"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.it"
+ android:pathPrefix="/OC"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.it"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.NO -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.no"
+ android:pathPrefix="/OC"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.no"
+ android:pathPrefix="/OC"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.no"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.NL -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.nl"
+ android:pathPrefix="/OB"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.nl"
+ android:pathPrefix="/OB"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.nl"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.PL -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.pl"
+ android:pathPrefix="/OP"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.pl"
+ android:pathPrefix="/OP"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.pl"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.ORG.UK -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.org.uk"
+ android:pathPrefix="/OK"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.org.uk"
+ android:pathPrefix="/OK"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.org.uk"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.RO -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.ro"
+ android:pathPrefix="/OR"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.ro"
+ android:pathPrefix="/OR"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.ro"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- opencaching.US -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="opencaching.us"
+ android:pathPrefix="/OU"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.us"
+ android:pathPrefix="/OU"
+ android:scheme="http" />
+ </intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="www.opencaching.us"
+ android:pathPrefix="/viewcache.php"
+ android:scheme="http" />
+ </intent-filter>
</activity>
+
<activity
android:name="cgeo.geocaching.TrackableActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
@@ -458,7 +833,21 @@
android:scheme="http" />
</intent-filter>
- <!-- GeoKrety URLs -->
+ <!-- geocaching.com.au swaggies -->
+ <intent-filter>
+ <action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
+
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+
+ <data
+ android:host="geocaching.com.au"
+ android:pathPrefix="/swaggie/sw"
+ android:scheme="http" />
+ </intent-filter>
+
+ <!-- GeoKrety.org -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
@@ -484,31 +873,32 @@
android:scheme="http" />
</intent-filter>
- <!--
- Geokrety QR code URLs, not yet implemented
+ <!-- GeoKretyMap.org -->
<intent-filter>
<action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
- android:host="geokrety.org"
- android:pathPrefix="/m/qr.php"
+ android:host="geokretymap.org"
+ android:pathPrefix="/"
android:scheme="http" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
+ <action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
- android:host="www.geokrety.org"
- android:pathPrefix="/m/qr.php"
+ android:host="www.geokretymap.org"
+ android:pathPrefix="/"
android:scheme="http" />
</intent-filter>
- -->
+
</activity>
<activity
android:name=".CompassActivity"
@@ -585,9 +975,14 @@
</activity>
+ <activity
+ android:name=".filter.FilterActivity_"
+ android:label="@string/caches_filter_title" >
+ </activity>
+
<!-- provide enhanced meta data for caches (and waypoints) when invoking Locus from c:geo -->
<provider
- android:name=".apps.LocusDataStorageProvider"
+ android:name="menion.android.locus.LocusDataStorageProvider"
android:authorities="cgeo.geocaching.apps.locusdatastorageprovider" />
<!-- search suggestions for the search bar at the top -->
diff --git a/main/build.gradle b/main/build.gradle
index 9034c74..2cc9769 100644
--- a/main/build.gradle
+++ b/main/build.gradle
@@ -27,12 +27,11 @@ gradle connectedCheck
//https://github.com/stephanenicolas/Quality-Tools-for-Android
def AAVersion = '3.2'
-def RXJavaVersion = '1.0.4'
+def RXJavaVersion = '1.0.8'
def RXAndroidVersion = '0.24.0'
-def RXJavaAsyncUtilVersion = '0.21.0'
-def JacksonCoreVersion = '2.4.4'
-def JacksonDatabindVersion = '2.4.4'
-def JacksonAnnotationsVersion = '2.4.4'
+def JacksonCoreVersion = '2.5.1'
+def JacksonDatabindVersion = '2.5.1'
+def JacksonAnnotationsVersion = '2.5.1'
def CommonsCollections4Version = '4.0'
def CommonsLang3Version = '3.3.2'
def CommonsIoVersion = '2.4'
@@ -160,7 +159,7 @@ dependencies {
compile 'com.android.support:appcompat-v7:19.1.0'
compile 'com.google.android.gms:play-services:6.5.+'
- compile 'com.jakewharton:butterknife:6.0.0'
+ compile 'com.jakewharton:butterknife:6.1.0'
compile "org.apache.commons:commons-collections4:$CommonsCollections4Version"
compile "org.apache.commons:commons-lang3:$CommonsLang3Version"
compile "commons-io:commons-io:$CommonsIoVersion"
@@ -168,7 +167,6 @@ dependencies {
compile "io.reactivex:rxjava:$RXJavaVersion"
compile "io.reactivex:rxandroid:$RXAndroidVersion"
- compile "io.reactivex:rxjava-async-util:$RXJavaAsyncUtilVersion"
compile "com.fasterxml.jackson.core:jackson-core:$JacksonCoreVersion"
compile "com.fasterxml.jackson.core:jackson-databind:$JacksonDatabindVersion"
@@ -260,7 +258,7 @@ dependencies {
unitTestCompile 'com.google.android:android-test:4.1.1.4'
unitTestCompile 'com.googlecode.androidannotations:androidannotations-api:$AAVersion'
- unitTestCompile 'com.jakewharton:butterknife:6.0.0'
+ unitTestCompile 'com.jakewharton:butterknife:6.1.0'
unitTestCompile 'org.apache.commons:commons-collections4:4.0'
unitTestCompile 'commons-io:commons-io:2.4'
unitTestCompile 'org.apache.commons:commons-lang3:$CommonsLang3Version'
diff --git a/main/libs/butterknife-6.0.0.jar b/main/libs/butterknife-6.0.0.jar
deleted file mode 100644
index 356d62d..0000000
--- a/main/libs/butterknife-6.0.0.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/butterknife-6.0.0.jar.properties b/main/libs/butterknife-6.0.0.jar.properties
deleted file mode 100644
index d7282cc..0000000
--- a/main/libs/butterknife-6.0.0.jar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-src=src/butterknife-6.0.0-sources.jar
-doc=src/butterknife-6.0.0-javadoc.jar
diff --git a/main/libs/butterknife-6.1.0.jar b/main/libs/butterknife-6.1.0.jar
new file mode 100644
index 0000000..699077a
--- /dev/null
+++ b/main/libs/butterknife-6.1.0.jar
Binary files differ
diff --git a/main/libs/butterknife-6.1.0.jar.properties b/main/libs/butterknife-6.1.0.jar.properties
new file mode 100644
index 0000000..3db4372
--- /dev/null
+++ b/main/libs/butterknife-6.1.0.jar.properties
@@ -0,0 +1,2 @@
+src=src/butterknife-6.1.0-sources.jar
+doc=src/butterknife-6.1.0-javadoc.jar
diff --git a/main/libs/jackson-annotations-2.4.4.jar b/main/libs/jackson-annotations-2.4.4.jar
deleted file mode 100644
index 4779188..0000000
--- a/main/libs/jackson-annotations-2.4.4.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/jackson-annotations-2.4.4.jar.properties b/main/libs/jackson-annotations-2.4.4.jar.properties
deleted file mode 100644
index 1a86cc6..0000000
--- a/main/libs/jackson-annotations-2.4.4.jar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-src=src/jackson-annotations-2.4.4-sources.jar
-doc=src/jackson-annotations-2.4.4-javadoc.jar
diff --git a/main/libs/jackson-annotations-2.5.1.jar b/main/libs/jackson-annotations-2.5.1.jar
new file mode 100644
index 0000000..9bce595
--- /dev/null
+++ b/main/libs/jackson-annotations-2.5.1.jar
Binary files differ
diff --git a/main/libs/jackson-annotations-2.5.1.jar.properties b/main/libs/jackson-annotations-2.5.1.jar.properties
new file mode 100644
index 0000000..d96e699
--- /dev/null
+++ b/main/libs/jackson-annotations-2.5.1.jar.properties
@@ -0,0 +1,2 @@
+src=src/jackson-annotations-2.5.1-sources.jar
+doc=src/jackson-annotations-2.5.1-javadoc.jar
diff --git a/main/libs/jackson-core-2.4.4.jar b/main/libs/jackson-core-2.4.4.jar
deleted file mode 100644
index da2a877..0000000
--- a/main/libs/jackson-core-2.4.4.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/jackson-core-2.4.4.jar.properties b/main/libs/jackson-core-2.4.4.jar.properties
deleted file mode 100644
index 20bc2ea..0000000
--- a/main/libs/jackson-core-2.4.4.jar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-src=src/jackson-core-2.4.4-sources.jar
-doc=src/jackson-core-2.4.4-javadoc.jar
diff --git a/main/libs/jackson-core-2.5.1.jar b/main/libs/jackson-core-2.5.1.jar
new file mode 100644
index 0000000..8c9c4e0
--- /dev/null
+++ b/main/libs/jackson-core-2.5.1.jar
Binary files differ
diff --git a/main/libs/jackson-core-2.5.1.jar.properties b/main/libs/jackson-core-2.5.1.jar.properties
new file mode 100644
index 0000000..c32e143
--- /dev/null
+++ b/main/libs/jackson-core-2.5.1.jar.properties
@@ -0,0 +1,2 @@
+src=src/jackson-core-2.5.1-sources.jar
+doc=src/jackson-core-2.5.1-javadoc.jar
diff --git a/main/libs/jackson-databind-2.4.4.jar b/main/libs/jackson-databind-2.4.4.jar
deleted file mode 100644
index e945e5e..0000000
--- a/main/libs/jackson-databind-2.4.4.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/jackson-databind-2.4.4.jar.properties b/main/libs/jackson-databind-2.4.4.jar.properties
deleted file mode 100644
index b9316cd..0000000
--- a/main/libs/jackson-databind-2.4.4.jar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-src=src/jackson-databind-2.4.4-sources.jar
-doc=src/jackson-databind-2.4.4-javadoc.jar
diff --git a/main/libs/jackson-databind-2.5.1.jar b/main/libs/jackson-databind-2.5.1.jar
new file mode 100644
index 0000000..9b82e3f
--- /dev/null
+++ b/main/libs/jackson-databind-2.5.1.jar
Binary files differ
diff --git a/main/libs/jackson-databind-2.5.1.jar.properties b/main/libs/jackson-databind-2.5.1.jar.properties
new file mode 100644
index 0000000..8fefb06
--- /dev/null
+++ b/main/libs/jackson-databind-2.5.1.jar.properties
@@ -0,0 +1,2 @@
+src=src/jackson-databind-2.5.1-sources.jar
+doc=src/jackson-databind-2.5.1-javadoc.jar
diff --git a/main/libs/mapsforge-map-0.2.4.jar b/main/libs/mapsforge-map-0.2.4.jar
deleted file mode 100644
index ec9aa4c..0000000
--- a/main/libs/mapsforge-map-0.2.4.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/rxjava-1.0.4.jar b/main/libs/rxjava-1.0.4.jar
deleted file mode 100644
index feed10f..0000000
--- a/main/libs/rxjava-1.0.4.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/rxjava-1.0.4.jar.properties b/main/libs/rxjava-1.0.4.jar.properties
deleted file mode 100644
index 944cfad..0000000
--- a/main/libs/rxjava-1.0.4.jar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-src=src/rxjava-1.0.4-sources.jar
-doc=src/rxjava-1.0.4-javadoc.jar
diff --git a/main/libs/rxjava-1.0.8.jar b/main/libs/rxjava-1.0.8.jar
new file mode 100644
index 0000000..f60ebe1
--- /dev/null
+++ b/main/libs/rxjava-1.0.8.jar
Binary files differ
diff --git a/main/libs/rxjava-1.0.8.jar.properties b/main/libs/rxjava-1.0.8.jar.properties
new file mode 100644
index 0000000..757e3be
--- /dev/null
+++ b/main/libs/rxjava-1.0.8.jar.properties
@@ -0,0 +1,2 @@
+src=src/rxjava-1.0.8-sources.jar
+doc=src/rxjava-1.0.8-javadoc.jar
diff --git a/main/libs/rxjava-async-util-0.21.0.jar b/main/libs/rxjava-async-util-0.21.0.jar
deleted file mode 100644
index 9b57574..0000000
--- a/main/libs/rxjava-async-util-0.21.0.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/rxjava-async-util-0.21.0.jar.properties b/main/libs/rxjava-async-util-0.21.0.jar.properties
deleted file mode 100644
index 5a9fc9e..0000000
--- a/main/libs/rxjava-async-util-0.21.0.jar.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-src=src/rxjava-async-util-0.21.0-sources.jar
-doc=src/rxjava-async-util-0.21.0-javadoc.jar
diff --git a/main/libs/src/butterknife-6.0.0-javadoc.jar b/main/libs/src/butterknife-6.0.0-javadoc.jar
deleted file mode 100644
index 1aef6df..0000000
--- a/main/libs/src/butterknife-6.0.0-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/butterknife-6.0.0-sources.jar b/main/libs/src/butterknife-6.0.0-sources.jar
deleted file mode 100644
index 3b29f50..0000000
--- a/main/libs/src/butterknife-6.0.0-sources.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/butterknife-6.1.0-javadoc.jar b/main/libs/src/butterknife-6.1.0-javadoc.jar
new file mode 100644
index 0000000..44577e4
--- /dev/null
+++ b/main/libs/src/butterknife-6.1.0-javadoc.jar
Binary files differ
diff --git a/main/libs/src/butterknife-6.1.0-sources.jar b/main/libs/src/butterknife-6.1.0-sources.jar
new file mode 100644
index 0000000..f980a1d
--- /dev/null
+++ b/main/libs/src/butterknife-6.1.0-sources.jar
Binary files differ
diff --git a/main/libs/src/jackson-annotations-2.4.4-javadoc.jar b/main/libs/src/jackson-annotations-2.4.4-javadoc.jar
deleted file mode 100644
index f98e974..0000000
--- a/main/libs/src/jackson-annotations-2.4.4-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/jackson-annotations-2.4.4-sources.jar b/main/libs/src/jackson-annotations-2.4.4-sources.jar
deleted file mode 100644
index 27e6839..0000000
--- a/main/libs/src/jackson-annotations-2.4.4-sources.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/jackson-annotations-2.5.1-javadoc.jar b/main/libs/src/jackson-annotations-2.5.1-javadoc.jar
new file mode 100644
index 0000000..d4d2c55
--- /dev/null
+++ b/main/libs/src/jackson-annotations-2.5.1-javadoc.jar
Binary files differ
diff --git a/main/libs/src/jackson-annotations-2.5.1-sources.jar b/main/libs/src/jackson-annotations-2.5.1-sources.jar
new file mode 100644
index 0000000..a7f0358
--- /dev/null
+++ b/main/libs/src/jackson-annotations-2.5.1-sources.jar
Binary files differ
diff --git a/main/libs/src/jackson-core-2.4.4-javadoc.jar b/main/libs/src/jackson-core-2.4.4-javadoc.jar
deleted file mode 100644
index 61fc085..0000000
--- a/main/libs/src/jackson-core-2.4.4-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/jackson-core-2.4.4-sources.jar b/main/libs/src/jackson-core-2.4.4-sources.jar
deleted file mode 100644
index c722e6f..0000000
--- a/main/libs/src/jackson-core-2.4.4-sources.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/jackson-core-2.5.1-javadoc.jar b/main/libs/src/jackson-core-2.5.1-javadoc.jar
new file mode 100644
index 0000000..a7f96ce
--- /dev/null
+++ b/main/libs/src/jackson-core-2.5.1-javadoc.jar
Binary files differ
diff --git a/main/libs/src/jackson-core-2.5.1-sources.jar b/main/libs/src/jackson-core-2.5.1-sources.jar
new file mode 100644
index 0000000..fd77726
--- /dev/null
+++ b/main/libs/src/jackson-core-2.5.1-sources.jar
Binary files differ
diff --git a/main/libs/src/jackson-databind-2.4.4-javadoc.jar b/main/libs/src/jackson-databind-2.4.4-javadoc.jar
deleted file mode 100644
index c7b788a..0000000
--- a/main/libs/src/jackson-databind-2.4.4-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/jackson-databind-2.4.4-sources.jar b/main/libs/src/jackson-databind-2.4.4-sources.jar
deleted file mode 100644
index ca120e8..0000000
--- a/main/libs/src/jackson-databind-2.4.4-sources.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/jackson-databind-2.5.1-javadoc.jar b/main/libs/src/jackson-databind-2.5.1-javadoc.jar
new file mode 100644
index 0000000..1ea90be
--- /dev/null
+++ b/main/libs/src/jackson-databind-2.5.1-javadoc.jar
Binary files differ
diff --git a/main/libs/src/jackson-databind-2.5.1-sources.jar b/main/libs/src/jackson-databind-2.5.1-sources.jar
new file mode 100644
index 0000000..8ca50ff
--- /dev/null
+++ b/main/libs/src/jackson-databind-2.5.1-sources.jar
Binary files differ
diff --git a/main/libs/src/rxjava-1.0.4-javadoc.jar b/main/libs/src/rxjava-1.0.4-javadoc.jar
deleted file mode 100644
index 92dc0fc..0000000
--- a/main/libs/src/rxjava-1.0.4-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/rxjava-1.0.4-sources.jar b/main/libs/src/rxjava-1.0.4-sources.jar
deleted file mode 100644
index c77e946..0000000
--- a/main/libs/src/rxjava-1.0.4-sources.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/rxjava-1.0.8-javadoc.jar b/main/libs/src/rxjava-1.0.8-javadoc.jar
new file mode 100644
index 0000000..59c118d
--- /dev/null
+++ b/main/libs/src/rxjava-1.0.8-javadoc.jar
Binary files differ
diff --git a/main/libs/src/rxjava-1.0.8-sources.jar b/main/libs/src/rxjava-1.0.8-sources.jar
new file mode 100644
index 0000000..4fc97d2
--- /dev/null
+++ b/main/libs/src/rxjava-1.0.8-sources.jar
Binary files differ
diff --git a/main/libs/src/rxjava-async-util-0.21.0-javadoc.jar b/main/libs/src/rxjava-async-util-0.21.0-javadoc.jar
deleted file mode 100644
index 28b1b63..0000000
--- a/main/libs/src/rxjava-async-util-0.21.0-javadoc.jar
+++ /dev/null
Binary files differ
diff --git a/main/libs/src/rxjava-async-util-0.21.0-sources.jar b/main/libs/src/rxjava-async-util-0.21.0-sources.jar
deleted file mode 100644
index 3337f37..0000000
--- a/main/libs/src/rxjava-async-util-0.21.0-sources.jar
+++ /dev/null
Binary files differ
diff --git a/main/project.properties b/main/project.properties
index 4dc8ffb..4fed171 100644
--- a/main/project.properties
+++ b/main/project.properties
@@ -11,7 +11,7 @@
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt:../play-services-base/proguard.txt:../play-services-location/proguard.txt
# Project target.
-target=Google Inc.:Google APIs:19
+target=Google Inc.:Google APIs:21
android.library.reference.1=../mapswithme-api
android.library.reference.2=../android-support-v7-appcompat
android.library.reference.3=../showcaseview
diff --git a/main/project/libraries/pom.xml b/main/project/libraries/pom.xml
index a86c3c7..b59d4af 100644
--- a/main/project/libraries/pom.xml
+++ b/main/project/libraries/pom.xml
@@ -18,7 +18,7 @@
<properties>
<AndroidAnnotationsVersion>3.2</AndroidAnnotationsVersion>
- <ButterKnifeVersion>6.0.0</ButterKnifeVersion>
+ <ButterKnifeVersion>6.1.0</ButterKnifeVersion>
<CommonsCollections4Version>4.0</CommonsCollections4Version>
<CommonsIoVersion>2.4</CommonsIoVersion>
@@ -26,13 +26,12 @@
<FindbugsAnnotationsVersion>3.0.0</FindbugsAnnotationsVersion>
- <JacksonAnnotationsVersion>2.4.4</JacksonAnnotationsVersion>
- <JacksonCoreVersion>2.4.4</JacksonCoreVersion>
- <JacksonDatabindVersion>2.4.4</JacksonDatabindVersion>
+ <JacksonAnnotationsVersion>2.5.1</JacksonAnnotationsVersion>
+ <JacksonCoreVersion>2.5.1</JacksonCoreVersion>
+ <JacksonDatabindVersion>2.5.1</JacksonDatabindVersion>
- <RXAndroidVersion>0.23.0</RXAndroidVersion>
- <RXJavaVersion>1.0.3</RXJavaVersion>
- <RXJavaAsyncUtilVersion>0.21.0</RXJavaAsyncUtilVersion>
+ <RXAndroidVersion>0.24.0</RXAndroidVersion>
+ <RXJavaVersion>1.0.7</RXJavaVersion>
</properties>
<dependencies>
@@ -98,11 +97,6 @@
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
- <artifactId>rxjava-async-util</artifactId>
- <version>${RXJavaAsyncUtilVersion}</version>
- </dependency>
- <dependency>
- <groupId>io.reactivex</groupId>
<artifactId>rxandroid</artifactId>
<version>${RXAndroidVersion}</version>
</dependency>
@@ -125,7 +119,7 @@
</execution>
<execution>
<id>update-properties</id>
- <phase>install</phase>
+ <phase>package</phase>
<goals>
<goal>update-properties</goal>
</goals>
diff --git a/main/project/libraries/update-libs.sh b/main/project/libraries/update-libs.sh
index b49dbef..4c66254 100755
--- a/main/project/libraries/update-libs.sh
+++ b/main/project/libraries/update-libs.sh
@@ -1,12 +1,11 @@
#! /bin/sh
#
-RXJAVA=1.0.4
+RXJAVA=1.0.8
RXANDROID=0.24.0
-RXJAVAASYNCUTIL=0.21.0
-JACKSONCORE=2.4.4
-JACKSONDATABIND=2.4.4
-JACKSONANNOTATIONS=2.4.4
+JACKSONCORE=2.5.1
+JACKSONDATABIND=2.5.1
+JACKSONANNOTATIONS=2.5.1
COMMONSCOLLECTIONS4=4.0
COMMONSLANG3=3.3.2
COMMONSIO=2.4
@@ -39,8 +38,6 @@ updatelib io/reactivex rxjava $RXJAVA
fixgradle RXJavaVersion $RXJAVA
updatelib io/reactivex rxandroid $RXANDROID
fixgradle RXAndroidVersion $RXANDROID
-updatelib io/reactivex rxjava-async-util $RXJAVAASYNCUTIL
-fixgradle RXJavaAsyncUtilVersion $RXJAVAASYNCUTIL
updatelib com/fasterxml/jackson/core jackson-core $JACKSONCORE
fixgradle JacksonCoreVersion $JACKSONCORE
diff --git a/main/res/layout/about_changes_page.xml b/main/res/layout/about_changes_page.xml
index 355ce90..04b5ff3 100644
--- a/main/res/layout/about_changes_page.xml
+++ b/main/res/layout/about_changes_page.xml
@@ -37,6 +37,21 @@
android:textColor="?text_color"
android:textColorLink="?text_color_link"
android:textSize="12sp" />
+
+ <TextView
+ android:id="@+id/changelog_github"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="true"
+ android:text="@string/changelog_github"
+ android:textColor="?text_color_link"
+ android:textColorLink="?text_color_link"
+ android:textSize="12sp" />
</LinearLayout>
</ScrollView> \ No newline at end of file
diff --git a/main/res/layout/about_help_page.xml b/main/res/layout/about_help_page.xml
index 8985ffa..ed64b92 100644
--- a/main/res/layout/about_help_page.xml
+++ b/main/res/layout/about_help_page.xml
@@ -7,106 +7,178 @@
android:padding="4dip"
tools:context=".AboutActivity$HelpViewCreator" >
- <LinearLayout
- android:layout_width="fill_parent"
+ <TableLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical" >
+ android:paddingLeft="10dp" >
- <TextView
- android:id="@+id/faq"
+ <TableRow
+ android:id="@+id/tableRow1"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:clickable="true"
- android:focusable="true"
- android:linksClickable="false"
- android:text="@string/faq"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:textSize="14sp" />
-
- <TextView
- android:id="@+id/website"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/faq_title"
+ android:textColor="?text_color"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/faq"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="false"
+ android:text="@string/faq_link"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14sp" />
+ </TableRow>
+
+ <TableRow
+ android:id="@+id/tableRow2"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:clickable="true"
- android:focusable="true"
- android:linksClickable="false"
- android:text="@string/website"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:textSize="14sp" />
-
- <TextView
- android:id="@+id/facebook"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/website_title"
+ android:textColor="?text_color"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/website"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="false"
+ android:text="@string/website_link"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14sp" />
+ </TableRow>
+
+ <TableRow
+ android:id="@+id/tableRow3"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:clickable="true"
- android:focusable="true"
- android:linksClickable="false"
- android:text="@string/facebook"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:textSize="14sp" />
-
- <TextView
- android:id="@+id/twitter"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/facebook_title"
+ android:textColor="?text_color"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/facebook"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="false"
+ android:text="@string/facebook_link"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14sp" />
+ </TableRow>
+
+ <TableRow
+ android:id="@+id/tableRow4"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:clickable="true"
- android:focusable="true"
- android:linksClickable="false"
- android:text="@string/twitter"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:textSize="14sp" />
-
- <TextView
- android:id="@+id/support"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/twitter_title"
+ android:textColor="?text_color"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/twitter"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="false"
+ android:text="@string/twitter_link"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14sp" />
+ </TableRow>
+
+ <TableRow
+ android:id="@+id/tableRow5"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:clickable="true"
- android:focusable="true"
- android:linksClickable="false"
- android:text="@string/support"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:textSize="14sp" />
-
- <TextView
- android:id="@+id/market"
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/support_title"
+ android:textColor="?text_color"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/support"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="false"
+ android:text="@string/support_link"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14sp" />
+ </TableRow>
+
+ <TableRow
+ android:id="@+id/tableRow6"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="left"
- android:layout_marginBottom="5dip"
- android:layout_marginLeft="10dip"
- android:layout_marginRight="10dip"
- android:clickable="true"
- android:focusable="true"
- android:linksClickable="false"
- android:text="@string/market"
- android:textColor="?text_color"
- android:textColorLink="?text_color_link"
- android:textSize="14sp" />
- </LinearLayout>
+ android:layout_height="wrap_content" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/market_title"
+ android:textColor="?text_color"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/market"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="5dip"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="10dip"
+ android:clickable="true"
+ android:focusable="true"
+ android:linksClickable="false"
+ android:text="@string/market_link"
+ android:textColor="?text_color"
+ android:textColorLink="?text_color_link"
+ android:textSize="14sp" />
+ </TableRow>
+ </TableLayout>
</ScrollView> \ No newline at end of file
diff --git a/main/res/layout/about_system_page.xml b/main/res/layout/about_system_page.xml
index 7c98ca6..0fd9624 100644
--- a/main/res/layout/about_system_page.xml
+++ b/main/res/layout/about_system_page.xml
@@ -11,6 +11,12 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
+ <Button android:id="@+id/copy"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/copy_to_clipboard"
+ android:layout_gravity="center_horizontal"
+ android:padding="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/main/res/layout/cacheslist_item.xml b/main/res/layout/cacheslist_item.xml
index efb622e..9c5ca28 100644
--- a/main/res/layout/cacheslist_item.xml
+++ b/main/res/layout/cacheslist_item.xml
@@ -140,15 +140,23 @@
android:layout_marginBottom="1dip"
android:layout_marginTop="1dip" >
- <ImageView
+ <TextView
android:id="@+id/inventory"
android:layout_width="35dip"
android:layout_height="22dip"
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical|center_horizontal"
android:background="?inventory"
+ android:drawableLeft="@drawable/trackable_all"
+ android:drawablePadding="-10sp"
+ android:gravity="center"
android:scaleType="center"
- android:src="@drawable/trackable_all" />
+ android:singleLine="true"
+ android:text=""
+ android:textColor="?text_color"
+ android:textIsSelectable="false"
+ android:textSize="12sp"
+ android:textStyle="bold" />
<TextView
android:id="@+id/favorite"
diff --git a/main/res/layout/filter_activity.xml b/main/res/layout/filter_activity.xml
new file mode 100644
index 0000000..8858452
--- /dev/null
+++ b/main/res/layout/filter_activity.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical"
+ tools:context=".filter.FilterActivity" >
+
+ <ScrollView
+ android:id="@+id/scrollView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <LinearLayout
+ android:id="@+id/filters"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
+
+ </LinearLayout>
+ </ScrollView>
+
+
+ <ExpandableListView
+ android:id="@+id/filterList"
+ android:layout_width="match_parent"
+ android:layout_height="fill_parent" >
+ </ExpandableListView>
+
+</LinearLayout> \ No newline at end of file
diff --git a/main/res/layout/filter_list_child.xml b/main/res/layout/filter_list_child.xml
new file mode 100644
index 0000000..7978269
--- /dev/null
+++ b/main/res/layout/filter_list_child.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="start"
+ android:layout_marginTop="6dip"
+ android:textAlignment="viewStart"
+ android:textAppearance="?android:attr/textAppearanceLarge" />
diff --git a/main/res/layout/grid_image.xml b/main/res/layout/grid_image.xml
new file mode 100644
index 0000000..4e145f5
--- /dev/null
+++ b/main/res/layout/grid_image.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="0dp"
+ android:scaleType="fitCenter"
+ android:src="@drawable/type_traditional"
+ tools:context=".filter.FilterActivity" >
+
+</ImageView> \ No newline at end of file
diff --git a/main/res/layout/images_gridview.xml b/main/res/layout/images_gridview.xml
new file mode 100644
index 0000000..b3993af
--- /dev/null
+++ b/main/res/layout/images_gridview.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<GridView xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/gridView"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:columnWidth="80dp"
+ android:gravity="center"
+ android:horizontalSpacing="0dp"
+ android:numColumns="auto_fit"
+ android:stretchMode="spacingWidth"
+ android:verticalSpacing="0dp"
+ tools:listitem="@layout/grid_image" >
+
+</GridView>
diff --git a/main/res/layout/map_mapsforge_old.xml b/main/res/layout/map_mapsforge_old.xml
deleted file mode 100644
index 9ed6596..0000000
--- a/main/res/layout/map_mapsforge_old.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- tools:context=".maps.mapsforge.MapsforgeMapProvider" >
-
- <include layout="@layout/actionbar_maps" />
-
- <include layout="@layout/filter_bar" />
-
- <RelativeLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
-
- <TextView
- android:id="@+id/number"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_margin="5dip"
- android:background="@drawable/icon_bcg"
- android:ellipsize="marquee"
- android:gravity="center_horizontal"
- android:lines="1"
- android:paddingLeft="5dip"
- android:paddingRight="5dip"
- android:scrollHorizontally="true"
- android:singleLine="true"
- android:textColor="@color/text_icon"
- android:textSize="12sp"
- android:visibility="gone" />
-
- <view
- android:id="@+id/mfmap_old"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- class="cgeo.geocaching.maps.mapsforge.v024.MapsforgeMapView024"
- android:clickable="true"
- android:enabled="true"
- android:keepScreenOn="true" />
- </RelativeLayout>
-
-</LinearLayout> \ No newline at end of file
diff --git a/main/res/menu/cache_list_context.xml b/main/res/menu/cache_list_context.xml
index c086709..86fd6f6 100644
--- a/main/res/menu/cache_list_context.xml
+++ b/main/res/menu/cache_list_context.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/menu_default_navigation"
@@ -21,37 +21,37 @@
<item
android:id="@+id/menu_log_visit_offline"
android:icon="@drawable/ic_menu_edit"
- app:showAsAction="ifRoom|withText"
- android:title="@string/cache_menu_visit_offline">
+ android:title="@string/cache_menu_visit_offline"
+ app:showAsAction="ifRoom|withText">
</item>
<item
android:id="@+id/menu_log_visit"
android:icon="@drawable/ic_menu_edit"
- app:showAsAction="ifRoom|withText"
- android:title="@string/cache_menu_visit">
+ android:title="@string/cache_menu_visit"
+ app:showAsAction="ifRoom|withText">
</item>
<item
android:id="@+id/menu_drop_cache"
- app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_menu_delete"
- android:title="@string/cache_offline_drop">
+ android:title="@string/cache_offline_drop"
+ app:showAsAction="ifRoom|withText">
</item>
<item
android:id="@+id/menu_move_to_list"
- app:showAsAction="ifRoom|withText"
- android:title="@string/cache_menu_move_list">
+ android:title="@string/cache_menu_move_list"
+ app:showAsAction="ifRoom|withText">
</item>
<item
android:id="@+id/menu_refresh"
- app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_menu_refresh"
- android:title="@string/cache_menu_refresh">
+ android:title="@string/cache_menu_refresh"
+ app:showAsAction="ifRoom|withText">
</item>
<item
android:id="@+id/menu_store_cache"
- app:showAsAction="ifRoom|withText"
android:icon="@drawable/ic_menu_save"
- android:title="@string/cache_offline_store">
+ android:title="@string/cache_offline_store"
+ app:showAsAction="ifRoom|withText">
</item>
</menu> \ No newline at end of file
diff --git a/main/res/menu/cache_list_options.xml b/main/res/menu/cache_list_options.xml
index 8c2b066..19a6882 100644
--- a/main/res/menu/cache_list_options.xml
+++ b/main/res/menu/cache_list_options.xml
@@ -53,12 +53,12 @@
android:visible="false">
</item>
<item
- android:id="@+id/submenu_cache_list_app"
+ android:id="@+id/menu_cache_list_app_provider"
+ android:actionProviderClass="cgeo.geocaching.apps.cachelist.ListNavigationSelectionActionProvider"
android:icon="@drawable/ic_menu_goto"
android:title="@string/caches_on_map"
- android:visible="false">
- <menu>
- </menu>
+ android:visible="false"
+ app:actionProviderClass="cgeo.geocaching.apps.cachelist.ListNavigationSelectionActionProvider">
</item>
<item
android:id="@+id/menu_create_list"
diff --git a/main/res/menu/cache_options.xml b/main/res/menu/cache_options.xml
index 8b40765..f6ac51c 100644
--- a/main/res/menu/cache_options.xml
+++ b/main/res/menu/cache_options.xml
@@ -83,5 +83,17 @@
app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
app:showAsAction="ifRoom">
</item>
-
+ <item
+ android:id="@+id/menu_checker"
+ android:title="@string/cache_menu_checker"
+ android:visible="false"
+ app:showAsAction="ifRoom">
+ </item>
+ <item
+ android:id="@+id/menu_ignore"
+ android:title="@string/cache_menu_ignore"
+ android:visible="false"
+ app:showAsAction="ifRoom">
+ </item>
+
</menu> \ No newline at end of file
diff --git a/main/res/menu/compass_activity_options.xml b/main/res/menu/compass_activity_options.xml
index d70c637..d3887af 100644
--- a/main/res/menu/compass_activity_options.xml
+++ b/main/res/menu/compass_activity_options.xml
@@ -9,6 +9,11 @@
app:showAsAction="ifRoom|withText">
</item>
<item
+ android:id="@+id/menu_hint"
+ android:title="@string/cache_hint"
+ app:showAsAction="ifRoom|withText">
+ </item>
+ <item
android:id="@+id/menu_tts_start"
android:icon="@drawable/ic_menu_start_conversation"
android:title="@string/tts_start"
diff --git a/main/res/menu/details_context.xml b/main/res/menu/details_context.xml
index 0bfb1a5..12afc22 100644
--- a/main/res/menu/details_context.xml
+++ b/main/res/menu/details_context.xml
@@ -10,8 +10,8 @@
</item>
<item
android:id="@+id/menu_cache_share_field"
- android:title="@string/cache_share_field"
android:icon="@drawable/ic_menu_share"
+ android:title="@string/cache_share_field"
app:showAsAction="ifRoom">
</item>
<item
diff --git a/main/res/menu/filter_options.xml b/main/res/menu/filter_options.xml
new file mode 100644
index 0000000..60733a6
--- /dev/null
+++ b/main/res/menu/filter_options.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
+
+ <item
+ android:id="@+id/menu_reset_filter"
+ android:icon="@drawable/ic_menu_delete"
+ android:title="@string/caches_filter_clear"
+ app:showAsAction="ifRoom|withText">
+ </item>
+
+</menu> \ No newline at end of file
diff --git a/main/res/menu/images_list_context.xml b/main/res/menu/images_list_context.xml
index 8d3869b..8f3d6b6 100644
--- a/main/res/menu/images_list_context.xml
+++ b/main/res/menu/images_list_context.xml
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/image_open_file"
- app:showAsAction="ifRoom|withText"
- android:title="@string/cache_image_open_file">
+ android:title="@string/cache_image_open_file"
+ app:showAsAction="ifRoom|withText">
</item>
<item
android:id="@+id/image_open_browser"
- app:showAsAction="ifRoom|withText"
- android:title="@string/cache_image_open_browser">
+ android:title="@string/cache_image_open_browser"
+ app:showAsAction="ifRoom|withText">
</item>
</menu> \ No newline at end of file
diff --git a/main/res/menu/map_activity.xml b/main/res/menu/map_activity.xml
index 04ccd98..4a97c0a 100644
--- a/main/res/menu/map_activity.xml
+++ b/main/res/menu/map_activity.xml
@@ -30,6 +30,19 @@
app:showAsAction="ifRoom|withText">
</item>
<item
+ android:id="@+id/menu_hint"
+ android:title="@string/cache_hint"
+ android:visible="false"
+ app:showAsAction="ifRoom|withText">
+ </item>
+ <item
+ android:id="@+id/menu_compass"
+ android:icon="@drawable/ic_menu_compass"
+ android:title="@string/compass_title"
+ android:visible="false"
+ app:showAsAction="ifRoom|withText">
+ </item>
+ <item
android:id="@+id/menu_store_caches"
android:icon="@drawable/ic_menu_set_as"
android:showAsAction="ifRoom|withText"
diff --git a/main/res/menu/navigate_any_point_activity_options.xml b/main/res/menu/navigate_any_point_activity_options.xml
index d4e4b9e..be9f589 100644
--- a/main/res/menu/navigate_any_point_activity_options.xml
+++ b/main/res/menu/navigate_any_point_activity_options.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/menu_default_navigation"
diff --git a/main/res/menu/search_activity_options.xml b/main/res/menu/search_activity_options.xml
index 300be94..ed84ebe 100644
--- a/main/res/menu/search_activity_options.xml
+++ b/main/res/menu/search_activity_options.xml
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/menu_search_own_caches"
android:icon="@drawable/ic_menu_myplaces"
android:title="@string/search_own_caches"
- app:showAsAction="ifRoom|withText"
- >
+ app:showAsAction="ifRoom|withText">
</item>
</menu> \ No newline at end of file
diff --git a/main/res/menu/static_maps_activity_options.xml b/main/res/menu/static_maps_activity_options.xml
index fb98f54..fdd7800 100644
--- a/main/res/menu/static_maps_activity_options.xml
+++ b/main/res/menu/static_maps_activity_options.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
<item
android:id="@+id/menu_refresh"
android:icon="@drawable/ic_menu_refresh"
- app:showAsAction="ifRoom"
- android:title="@string/cache_offline_refresh">
+ android:title="@string/cache_offline_refresh"
+ app:showAsAction="ifRoom">
</item>
</menu> \ No newline at end of file
diff --git a/main/res/menu/waypoint_options.xml b/main/res/menu/waypoint_options.xml
index 7df48f8..93333ed 100644
--- a/main/res/menu/waypoint_options.xml
+++ b/main/res/menu/waypoint_options.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto">
-
+ xmlns:app="http://schemas.android.com/apk/res-auto" >
+
<item
android:id="@+id/menu_waypoint_reset_cache_coords"
android:title="@string/waypoint_reset_cache_coords">
@@ -30,4 +30,5 @@
android:id="@+id/menu_waypoint_caches_around"
android:title="@string/cache_menu_around">
</item>
-</menu>
+
+</menu> \ No newline at end of file
diff --git a/main/res/values-ca/strings.xml b/main/res/values-ca/strings.xml
index 83555a3..4aa6343 100644
--- a/main/res/values-ca/strings.xml
+++ b/main/res/values-ca/strings.xml
@@ -79,6 +79,7 @@
<string name="log_saving_and_uploading">S\'està enviant el registre i pujant la imatge…</string>
<string name="log_clear">Esborra</string>
<string name="log_post_not_possible">S\'està carregant la pàgina del registre…</string>
+ <string name="log_date_future_not_allowed">No estan permesos els registres amb data futura.</string>
<string name="log_add">Afegeix</string>
<string name="log_repeat">Repeteix l\'últim registre</string>
<string name="log_no_rating">Sense puntuació</string>
@@ -297,6 +298,7 @@
<string name="caches_filter_track">Amb traçables</string>
<string name="caches_filter_clear">Neteja els filtres</string>
<string name="caches_filter_modified">Amb les coordenades modificades</string>
+ <string name="caches_filter_offline_log">Amb registre fora de línia</string>
<string name="caches_filter_origin">Origen</string>
<string name="caches_filter_distance">Distància</string>
<string name="caches_filter_personal_note">Amb una nota personal</string>
@@ -459,6 +461,8 @@
<string name="init_backup_success">La base de dades del c:geo s\'ha copiat amb èxit a:</string>
<string name="init_backup_failed">Ha fallat la còpia de seguretat de la base de dades de c:geo.</string>
<string name="init_backup_unnecessary">La base de dades està buida, no cal fer una còpia de seguretat.</string>
+ <string name="backup_confirm_overwrite">Voleu sobreescriure la còpia de seguretat existent de %s?</string>
+ <string name="restore_confirm_overwrite">Voleu sobreescriure %s al dispositiu amb la còpia de seguretat?</string>
<string name="init_restore_success">La restauració s\'ha completat.</string>
<string name="init_restore_failed">Ha fallat la restauració.</string>
<string name="init_restore_running">S\'està restaurant la base de dades dels catxés…</string>
@@ -1138,13 +1142,15 @@
<string name="attribute_offset_cache_no">No és un catxé offset</string>
<string name="quote">Per fer el geocatxing més fàcil, per fer els usuaris més dropos.</string>
<string name="powered_by">Carnero</string>
- <string name="support">Suport: <a href="">support@cgeo.org</a></string>
- <string name="website">Lloc web: <a href=""> cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">Pàgina del c:geo</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">El c:geo a Google Play</a></string>
+ <string name="support_title">Ajut</string>
+ <string name="website_title">Lloc web</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href="">Pàgina del c:geo</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href=""> c:geo a Google Play</a></string>
<string name="about_twitter">Voleu que <b>el c:geo</b> publiqui un nou estatus al Twitter cada vegada que registreu un catxé?</string>
- <string name="faq">PMF: <a href=""> faq.cgeo.org</a></string>
+ <string name="faq_title">Preguntes freqüents</string>
<string name="status_new_release" tools:ignore="UnusedResources">Nova versió disponible.\nCliqueu per instal·lar-la.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nova versió nightly build disponible.\nCliqueu per instal·lar-la.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Nova versió candidate disponible.\nCliqueu per instal·lar-la.</string>
diff --git a/main/res/values-cs/strings.xml b/main/res/values-cs/strings.xml
index e2321a2..41f24e8 100644
--- a/main/res/values-cs/strings.xml
+++ b/main/res/values-cs/strings.xml
@@ -78,6 +78,7 @@
<string name="log_saving_and_uploading">Odesílání Logu a nahrávání obrázku…</string>
<string name="log_clear">Vyčistit</string>
<string name="log_post_not_possible">Načítání stránky s Logovacím formulářem…</string>
+ <string name="log_date_future_not_allowed">Log s nadcházejícím datem není povolen.</string>
<string name="log_add">Přidat</string>
<string name="log_repeat">Opakovat poslední log</string>
<string name="log_no_rating">Bez hodnocení</string>
@@ -216,7 +217,7 @@
<string name="loc_no_addr">Neznámá adresa</string>
<string name="loc_gps_disabled">GPS zakázáno</string>
<string name="menu_centerposition">Vycentrovat na mou polohu</string>
- <string name="menu_about">O programu</string>
+ <string name="menu_about">O aplikaci</string>
<string name="menu_helpers">Pomocné programy</string>
<string name="menu_settings">Nastavení</string>
<string name="menu_history">Historie</string>
@@ -269,7 +270,17 @@
<string name="caches_nearby">Blízké</string>
<string name="caches_manage">Správa</string>
<string name="caches_remove_all">Odstranit vše</string>
+ <plurals name="caches_remove_all_confirm">
+ <item quantity="one">Opravdu chceš smazat tuto keš z aktuálního seznamu?</item>
+ <item quantity="few">Opravdu chceš smazat všechny keše (%d) ze seznamu?</item>
+ <item quantity="other">Opravdu chceš smazat všechny keše (%d) ze seznamu?</item>
+ </plurals>
<string name="caches_remove_selected">Odstranit vybrané</string>
+ <plurals name="caches_remove_selected_confirm">
+ <item quantity="one">Opravdu chceš tuto keš odstranit z tvého zařízení?</item>
+ <item quantity="few">Opravdu chceš odstranit vybrané keše (%d) z tvého zařízení?</item>
+ <item quantity="other">Opravdu chceš odstranit vybrané keše (%d) z tvého zařízení?</item>
+ </plurals>
<string name="caches_remove_progress">Odstraňování keší</string>
<string name="caches_delete_events">Vymazat staré události</string>
<string name="caches_refresh_selected">Aktualizovat vybrané</string>
@@ -289,6 +300,7 @@
<string name="caches_filter_track">Se sledovatelnými předměty</string>
<string name="caches_filter_clear">Vymazat filtry</string>
<string name="caches_filter_modified">S upravenými souřadnicemi</string>
+ <string name="caches_filter_offline_log">S offline logy</string>
<string name="caches_filter_origin">Původ keše</string>
<string name="caches_filter_distance">Vzdálenost</string>
<string name="caches_filter_personal_note">S osobní poznámkou</string>
@@ -313,7 +325,7 @@
<string name="list_dialog_create_ok">Nový seznam byl vytvořen</string>
<string name="list_dialog_create_err">c:geo nedokázalo vytvořit nový seznam</string>
<string name="list_dialog_remove_title">Odstranit seznam</string>
- <string name="list_dialog_remove_description">Chceš odstranit aktuální seznam keší? Všechny zbývající keše budou přesunuty do seznamu \"Uložené\".</string>
+ <string name="list_dialog_remove_description">Chceš odstranit aktuální seznam keší? Všechny zbývající keše budou přesunuty do seznamu „Uložené“.</string>
<string name="list_dialog_remove">Odstranit</string>
<string name="list_dialog_remove_ok">Seznam byl odstraněn</string>
<string name="list_dialog_remove_err">c:geo nedokázalo odstranit aktuální seznam</string>
@@ -330,6 +342,7 @@
<string name="about_apache_license"><a href=""> licence Apache, verze 2.0</a></string>
<string name="about_help">Nápověda</string>
<string name="about_system_include">Při odesílání hlášení o chybě nebo žádosti o další informace uveďte prosím následující systémové informace:</string>
+ <string name="changelog_github">Seznam všech změn</string>
<string name="settings_title_services">Služby</string>
<string name="settings_summary_services">Nastavení uživatelského účtu a přístupu k volitelným službám.</string>
<string name="settings_title_appearance">Vzhled</string>
@@ -452,6 +465,8 @@
<string name="init_backup_success">Databáze c:geo byla úspěšně zkopírována do souboru</string>
<string name="init_backup_failed">Zálohování databáze c:geo selhalo.</string>
<string name="init_backup_unnecessary">Databáze je prázdná, takže není třeba zálohovat.</string>
+ <string name="backup_confirm_overwrite">Opravdu chceš přesat existující zálohu z %s?</string>
+ <string name="restore_confirm_overwrite">Chceš přepsat %s na svém zařízení zálohou?</string>
<string name="init_restore_success">Obnova dokončena.</string>
<string name="init_restore_failed">Obnova selhala.</string>
<string name="init_restore_running">Obnovování databáze keší…</string>
@@ -459,7 +474,7 @@
<string name="init_backup_last">Dostupná záloha z</string>
<string name="init_backup_last_no">Nenalezen žádný soubor se zálohou.</string>
<string name="settings_info_offline_maps_title">Info o Offline mapách</string>
- <string name="settings_info_offline_maps">c:geo podporuje používání offline map. Mapy si můžeš stáhnout z Mapsforge a nebo si vytvořit vlastní z dat Open Street Map (OSM). Aby bylo možné offline mapy používat, musíš nejprve zvolit místo jejich uložení.</string>
+ <string name="settings_info_offline_maps">c:geo podporuje používání offline mapových podkladů, které si můžeš stáhnout z Mapsforge a nebo si vytvořit vlastní z dat Open Street Map (OSM). Aby bylo možné offline mapy používat, musíš nejprve zvolit místo jejich umístění (volba „Složka s offline mapami“).</string>
<string name="settings_info_themes_title">Info o stylech mapy</string>
<string name="settings_info_themes">c:geo podporuje vlastní styly pro offline mapy. Ty mohou být použity pro změnu barevného stylu mapy (např. noční mapa), pro zvýraznění důležitých objektů (jako jsou např. cykloztezky) nebo pro určení šířky čar.</string>
<string name="init_mapsource_select">Vyber mapový zdroj</string>
@@ -554,7 +569,7 @@
<string name="auth_again">Znovu autorizovat</string>
<string name="auth_dialog_waiting">Čekání na %s…</string>
<string name="auth_explain_short">Následující proces umožní <b>c:geu</b> přístup k %s.</string>
- <string name="auth_explain_long">Stisknutím tlačítka \"Autorizovat c:geo\" bude proces zahájen. Tento proces otevře webový prohlížeč se stránkou %s. Na této stránce se přihlaš a povol <b>c:geu</b> přistupovat k tvému účtu. To je vše.</string>
+ <string name="auth_explain_long">Stisknutím tlačítka „Autorizovat c:geo“ bude proces zahájen. Tento proces otevře webový prohlížeč se stránkou %s. Na této stránce se přihlaš a povol <b>c:geu</b> přistupovat k tvému účtu. To je vše.</string>
<string name="auth_dialog_completed_twitter">c:geo nyní může posílat zprávy na Tvůj Twitter.</string>
<string name="auth_ocde">Opencaching.de</string>
<string name="auth_ocpl">opencaching.pl</string>
@@ -655,7 +670,7 @@
<string name="cache_menu_streetview">Street View</string>
<string name="cache_menu_browser">Otevřít v prohlížečí</string>
<string name="cache_menu_visit">Zalogovat návštěvu</string>
- <string name="cache_menu_visit_offline">Offline log jedním klepnutím</string>
+ <string name="cache_menu_visit_offline">Rychlý offline log</string>
<string name="cache_menu_spoilers">Obrázky</string>
<string name="cache_menu_around">Keš v okolí</string>
<string name="cache_menu_event">Přidat do kalendáře</string>
@@ -778,6 +793,7 @@
<string name="search_history_cleared">Historie vymazána</string>
<string name="waypoint_coordinate_formats_plain">Prostý</string>
<string name="from_clipboard">Ze schránky</string>
+ <string name="copy_to_clipboard">Kopírovat do schránky</string>
<string name="visit_tweet">Oznámit nález na Twitteru</string>
<string name="map_map">Mapa</string>
<string name="map_live">Aktivní mapa</string>
@@ -800,7 +816,7 @@
<string name="map_strategy_fast">Rychlá</string>
<string name="map_strategy_auto">Závislá na rychlosti</string>
<string name="map_strategy_detailed">Detailní</string>
- <string name="live_map_notification">Na nové Aktivní mapě nemusí být souřadnice vždy přesné. Případné nepřesné souřadnice jsou na mapě označeny oranžovým kruhem.\nPři otevření detailů keše nebo jejím uložení pro Offline použití jsou již souřadnice přesné.\n\nVíce informací o všech změnách lze najít na stránce \"O programu\" v aplikaci.</string>
+ <string name="live_map_notification">Na nové Aktivní mapě nemusí být souřadnice vždy přesné. Případné nepřesné souřadnice jsou na mapě označeny oranžovým kruhem.\nPři otevření detailů keše nebo jejím uložení pro Offline použití jsou již souřadnice přesné.\n\nVíce informací o všech změnách lze najít v aplikaci na stránce „O aplikaci“.</string>
<string name="search_bar_hint">Hledaní kešek</string>
<string name="search_bar_desc">Keše (GC-kód, klíčové slovo), Sledovatelné předměty (TB-kód)</string>
<string name="search_coordinates">Souřadnice</string>
@@ -1134,13 +1150,15 @@
<string name="attribute_offset_cache_no">Není to Offset keš</string>
<string name="quote">Učinit Geocaching lehčí a uživatele línější.</string>
<string name="powered_by">carnero</string>
- <string name="support">Podpora: <a href="">support@cgeo.org</a></string>
- <string name="website">Stránka: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">Stránka c:geo</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo na Google Play</a></string>
+ <string name="support_title">Podpora</string>
+ <string name="website_title">Webové stránky</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href="">stránka c:geo</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo na Google Play</a></string>
<string name="about_twitter">Má <b>c:geo</b> publikovat nový status na Twitteru vždy, když zaloguješ keš?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
+ <string name="faq_title">FAQ</string>
<string name="status_new_release" tools:ignore="UnusedResources">Dostupné nové vydání.\nKlepni pro instalaci.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Dostupné nové \"noční sestavení\"\nKlepni pro instalaci.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Dostupný nový kandidát na vydání.\nKlepni pro instalaci.</string>
diff --git a/main/res/values-da/strings.xml b/main/res/values-da/strings.xml
index e44c258..31d641c 100644
--- a/main/res/values-da/strings.xml
+++ b/main/res/values-da/strings.xml
@@ -1118,11 +1118,6 @@
<string name="attribute_offset_cache_yes">Offset-cache</string>
<string name="attribute_offset_cache_no">Ikke en offset-cache</string>
<string name="quote">To make geocaching easier, to make users lazier.</string>
- <string name="support">Support: <a href="mailto:support@cgeo.org">support@cgeo.org</a></string>
- <string name="website">Hjemmeside: <a href="http://cgeo.org/">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="http://www.facebook.com/pages/cgeo/297269860090">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="http://twitter.com/android_gc">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo på Google Play</a></string>
<string name="about_twitter">Skal <b>c:geo</b> sende status til Twitter hver gang du logger en cache?</string>
<string name="status_new_release" tools:ignore="UnusedResources">Ny udgave er tilgængelig.\nKlik for at installere.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nyt nightly build af c:geo er tilgængelig.\nKlik for at installere.</string>
diff --git a/main/res/values-de/strings.xml b/main/res/values-de/strings.xml
index df275f1..ae2473e 100644
--- a/main/res/values-de/strings.xml
+++ b/main/res/values-de/strings.xml
@@ -79,6 +79,7 @@
<string name="log_saving_and_uploading">Log und Bild werden gesendet…</string>
<string name="log_clear">Leeren</string>
<string name="log_post_not_possible">Lade Log-Seite…</string>
+ <string name="log_date_future_not_allowed">Logs in der Zukunft sind nicht erlaubt.</string>
<string name="log_add">Hinzufügen</string>
<string name="log_repeat">Verwende das letzte Log erneut</string>
<string name="log_no_rating">Keine Bewertung</string>
@@ -108,6 +109,7 @@
<string name="log_password_title">Log-Passwort:</string>
<string name="log_hint_log_password">Log-Passwort eingeben</string>
<string name="log_oc_team_comment">OC Team Bemerkung</string>
+ <string name="log_your_saved_log">Dein gespeichertes Log</string>
<string-array name="log_image_scales">
<item>Keine Skalierung</item>
<item>512 px</item>
@@ -297,6 +299,7 @@
<string name="caches_filter_track">Mit Trackables</string>
<string name="caches_filter_clear">Filter zurücksetzen</string>
<string name="caches_filter_modified">Mit geänderten Koordinaten</string>
+ <string name="caches_filter_offline_log">Mit Offline-Log</string>
<string name="caches_filter_origin">Herkunft</string>
<string name="caches_filter_distance">Entfernung</string>
<string name="caches_filter_personal_note">Mit persönlicher Notiz</string>
@@ -338,6 +341,7 @@
<string name="about_apache_license"><a href="">Apache License, Version 2.0</a></string>
<string name="about_help">Hilfe</string>
<string name="about_system_include">Bitte die folgende Systeminformation bei jedem Fehlerbericht oder bei Informationsanfragen zu c:geo mitsenden:</string>
+ <string name="changelog_github">Liste aller Änderungen</string>
<string name="settings_title_services">Dienste</string>
<string name="settings_summary_services">Konfiguriere Zugangsdaten und den Zugriff auf optionale Dienste.</string>
<string name="settings_title_appearance">Erscheinungsbild</string>
@@ -459,6 +463,8 @@
<string name="init_backup_success">Datenbank von c:geo wurde erfolgreich kopiert nach:</string>
<string name="init_backup_failed">Sicherung der Datenbank von c:geo fehlgeschlagen.</string>
<string name="init_backup_unnecessary">Datenbank ist leer, keine Sicherung notwendig.</string>
+ <string name="backup_confirm_overwrite">Möchtest du das existierende Backup vom %s überschreiben?</string>
+ <string name="restore_confirm_overwrite">Möchtest du %s auf deinem Gerät mit dem Backup überschreiben?</string>
<string name="init_restore_success">Wiederherstellung fertig.</string>
<string name="init_restore_failed">Wiederherstellung fehlgeschlagen.</string>
<string name="init_restore_running">Wiederherstellung der Cache-Datenbank…</string>
@@ -617,6 +623,7 @@
</plurals>
<string name="cache_waypoints_add">Wegpunkt hinzufügen</string>
<string name="cache_hint">Hinweis</string>
+ <string name="cache_hint_not_available">Kein Hinweis verfügbar</string>
<string name="cache_logs">Logbuch</string>
<string name="cache_logs_friends_and_own">Logbuch (Freunde/Eigene)</string>
<string name="cache_dialog_loading_details">Lade Cache-Details…</string>
@@ -659,6 +666,7 @@
<string name="cache_menu_visit_offline">Offline loggen</string>
<string name="cache_menu_spoilers">Hinweisbild</string>
<string name="cache_menu_around">Caches im Umkreis</string>
+ <string name="around">In der Nähe von %s</string>
<string name="cache_menu_event">Zum Kalender hinzufügen</string>
<string name="cache_menu_details">Details</string>
<string name="cache_menu_refresh">Aktualisieren</string>
@@ -669,6 +677,8 @@
<string name="cache_menu_navigon">Navigon</string>
<string name="cache_menu_pebble">Pebble Smartwatch</string>
<string name="cache_menu_vote">Bewerten</string>
+ <string name="cache_menu_checker">Öffne Geochecker</string>
+ <string name="cache_menu_ignore">Cache ignorieren</string>
<string name="cache_status">Status</string>
<string name="cache_status_offline_log">Gespeicherter Log</string>
<string name="cache_status_found">Gefunden</string>
@@ -779,6 +789,7 @@
<string name="search_history_cleared">Verlauf gelöscht</string>
<string name="waypoint_coordinate_formats_plain">Schlicht</string>
<string name="from_clipboard">Aus der Zwischenablage</string>
+ <string name="copy_to_clipboard">In Zwischenablage kopieren</string>
<string name="visit_tweet">Diesen Eintrag auf Twitter veröffentlichen</string>
<string name="map_map">Karte</string>
<string name="map_live">Live-Karte</string>
@@ -1135,13 +1146,15 @@
<string name="attribute_offset_cache_no">Kein Offset Cache</string>
<string name="quote">Um Geocachen einfacher zu machen, um es Anwendern bequemer zu machen.</string>
<string name="powered_by">carnero</string>
- <string name="support">Support: <a href="">support@cgeo.org</a></string>
- <string name="website">Webseite: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo auf Google Play</a></string>
+ <string name="support_title">Support</string>
+ <string name="website_title">Webseite</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href="">Seite von c:geo</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo bei Google Play</a></string>
<string name="about_twitter">Soll jeder neue Fund auf Twitter veröffentlicht werden, wenn er über <b>c:geo</b> geloggt wird?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
+ <string name="faq_title">FAQs</string>
<string name="status_new_release" tools:ignore="UnusedResources">Neuer Release verfügbar.\nKlicken zum Installieren.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Neuer Nightly Build verfügbar.\nKlicken zum Installieren.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Neuer Release Candidate verfügbar.\nKlicken zum Installieren.</string>
diff --git a/main/res/values-es/strings.xml b/main/res/values-es/strings.xml
index 890b4c0..cf463bb 100644
--- a/main/res/values-es/strings.xml
+++ b/main/res/values-es/strings.xml
@@ -79,6 +79,7 @@
<string name="log_saving_and_uploading">Enviando registro y subiendo imagen…</string>
<string name="log_clear">Limpiar</string>
<string name="log_post_not_possible">Cargando página de registro…</string>
+ <string name="log_date_future_not_allowed">No se permiten registros con fechas futuras.</string>
<string name="log_add">Añadir</string>
<string name="log_repeat">Repetir el último registro</string>
<string name="log_no_rating">Sin puntuación</string>
@@ -297,6 +298,7 @@
<string name="caches_filter_track">Con rastreables</string>
<string name="caches_filter_clear">Limpiar filtros</string>
<string name="caches_filter_modified">Con las coordenadas modificadas</string>
+ <string name="caches_filter_offline_log">Con registro sin conexión</string>
<string name="caches_filter_origin">Coordenadas originales</string>
<string name="caches_filter_distance">Distancia</string>
<string name="caches_filter_personal_note">Con nota personal</string>
@@ -660,6 +662,8 @@
<string name="cache_menu_oruxmaps">OruxMaps</string>
<string name="cache_menu_pebble">Pebble</string>
<string name="cache_menu_vote">Votar</string>
+ <string name="cache_menu_checker">Abrir geochecker</string>
+ <string name="cache_menu_ignore">Ignorar caché</string>
<string name="cache_status">Estado</string>
<string name="cache_status_offline_log">Registro guardado</string>
<string name="cache_status_found">Encontrado</string>
@@ -758,7 +762,7 @@
<string name="waypoint_being_saved">Se está guardando el waypoint…</string>
<string name="waypoint_coordinates_couldnt_be_modified_on_website">El sitio web no permite modificar las coordenadas del caché.</string>
<string name="waypoint_coordinates_upload_error">Ha ocurrido un error mientras se modificaban las coordenadas en la web.</string>
- <string name="waypoint_coordinates_uploading_to_website">Subiendo coordenadas a la página %s.</string>
+ <string name="waypoint_coordinates_uploading_to_website">Subiendo coordenadas %s a la web.</string>
<string name="waypoint_coordinates_has_been_modified_on_website">Las coordenadas del caché en la web modificadas a: %s.</string>
<string name="waypoint_done">Hecho</string>
<string name="waypoint_duplicate">Duplicar</string>
@@ -770,6 +774,7 @@
<string name="search_history_cleared">Historial borrado</string>
<string name="waypoint_coordinate_formats_plain">Sencillo</string>
<string name="from_clipboard">Desde portapapeles</string>
+ <string name="copy_to_clipboard">Copiar al portapapeles</string>
<string name="visit_tweet">Publicar en Twitter</string>
<string name="map_map">Mapa</string>
<string name="map_live">Mapa activo</string>
@@ -1125,11 +1130,11 @@
<string name="attribute_offset_cache_yes">Caché offset</string>
<string name="attribute_offset_cache_no">No es caché offset</string>
<string name="quote">Para hacer el geocaching más sencillo, para hacer a los usuarios más vagos.</string>
- <string name="support">Soporte: <a href="">support@cgeo.org</a></string>
- <string name="website">Web: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo en Google Play</a></string>
+ <string name="website_title">Sitio Web</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo en Google Play</a></string>
<string name="about_twitter">¿Debe <b>c:geo</b> publicar el nuevo estado en Twitter cuando registras un caché?</string>
<string name="status_new_release" tools:ignore="UnusedResources">Nueva versión disponible. \nClick para instalar.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nueva versión nightly build disponible.\nHaz clic para instalar.</string>
diff --git a/main/res/values-fr/strings.xml b/main/res/values-fr/strings.xml
index 41e1341..3970045 100644
--- a/main/res/values-fr/strings.xml
+++ b/main/res/values-fr/strings.xml
@@ -5,7 +5,7 @@
<string name="cache">Cache</string>
<string name="detail">Détails</string>
<string name="search">Rechercher</string>
- <string name="helpers">Aide à l\'installation</string>
+ <string name="helpers">Applications utiles</string>
<string name="about">À propos de c:geo</string>
<string name="latitude">Latitude</string>
<string name="longitude">Longitude</string>
@@ -79,6 +79,7 @@
<string name="log_saving_and_uploading">Envoi de la note et de l\'image…</string>
<string name="log_clear">Effacer</string>
<string name="log_post_not_possible">Chargement de la page…</string>
+ <string name="log_date_future_not_allowed">Les entrées de carnet dans le futur sont interdites.</string>
<string name="log_add">Ajouter</string>
<string name="log_repeat">Recopier la dernière entrée</string>
<string name="log_no_rating">Pas de note</string>
@@ -108,6 +109,7 @@
<string name="log_password_title">Mot de passe du carnet :</string>
<string name="log_hint_log_password">Entrez votre mot de passe pour le carnet</string>
<string name="log_oc_team_comment">Commentaire de l\'équipe OC</string>
+ <string name="log_your_saved_log">Votre journal enregistré</string>
<string-array name="log_image_scales">
<item>Taille originale</item>
<item>512 px</item>
@@ -297,6 +299,7 @@
<string name="caches_filter_track">Avec des objets voyageurs</string>
<string name="caches_filter_clear">Effacer les filtres</string>
<string name="caches_filter_modified">Avec les coordonnées modifiées</string>
+ <string name="caches_filter_offline_log">Avec entrée de carnet hors connexion</string>
<string name="caches_filter_origin">Avec les coordonées originales</string>
<string name="caches_filter_distance">Distance</string>
<string name="caches_filter_personal_note">Avec une note personnelle</string>
@@ -338,6 +341,7 @@
<string name="about_apache_license"><a href="">Apache License, Version 2.0</a></string>
<string name="about_help">Aide</string>
<string name="about_system_include">Merci d\'inclure systématiquement les informations suivantes lorsque vous signalez un problème ou demandez plus d\'information à propos de c:geo:</string>
+ <string name="changelog_github">Liste de toutes les modifications</string>
<string name="settings_title_services">Services</string>
<string name="settings_summary_services">Configuration des données de connexion et des services optionnels.</string>
<string name="settings_title_appearance">Apparence</string>
@@ -460,6 +464,8 @@
<string name="init_backup_success">La base de données de c:geo a été sauvegardée dans un fichier</string>
<string name="init_backup_failed">La sauvegarde de la base de données de c:geo a échouée.</string>
<string name="init_backup_unnecessary">La base de données est vide, sauvegarde non nécessaire.</string>
+ <string name="backup_confirm_overwrite">Voulez-vous remplacer la sauvegarde existante de %s ?</string>
+ <string name="restore_confirm_overwrite">Voulez vous remplacer %s sur votre appareil par la sauvegarde ?</string>
<string name="init_restore_success">Restauration terminée.</string>
<string name="init_restore_failed">Échec de la restauration.</string>
<string name="init_restore_running">Restauration de la base de données des caches…</string>
@@ -618,6 +624,7 @@
</plurals>
<string name="cache_waypoints_add">Ajouter une étape</string>
<string name="cache_hint">Indice</string>
+ <string name="cache_hint_not_available">Aucun indice disponible</string>
<string name="cache_logs">Carnet de bord</string>
<string name="cache_logs_friends_and_own">Vous / amis</string>
<string name="cache_dialog_loading_details">Chargement des détails…</string>
@@ -660,6 +667,7 @@
<string name="cache_menu_visit_offline">Journal hors connexion en un clic</string>
<string name="cache_menu_spoilers">Images indices</string>
<string name="cache_menu_around">Alentours</string>
+ <string name="around">Autour de %s</string>
<string name="cache_menu_event">Ajouter à l\'agenda</string>
<string name="cache_menu_details">Détails</string>
<string name="cache_menu_refresh">Recharger</string>
@@ -670,6 +678,8 @@
<string name="cache_menu_navigon">Navigon</string>
<string name="cache_menu_pebble">Pebble</string>
<string name="cache_menu_vote">Noter</string>
+ <string name="cache_menu_checker">Ouvrir le vérificateur</string>
+ <string name="cache_menu_ignore">Ignorer la cache</string>
<string name="cache_status">Statut</string>
<string name="cache_status_offline_log">Visite sauvée hors-ligne</string>
<string name="cache_status_found">Trouvée</string>
@@ -780,6 +790,7 @@
<string name="search_history_cleared">Historique effacé</string>
<string name="waypoint_coordinate_formats_plain">Texte</string>
<string name="from_clipboard">Depuis le presse-papiers</string>
+ <string name="copy_to_clipboard">Copier dans le presse-papiers</string>
<string name="visit_tweet">Publier votre découverte sur Twitter</string>
<string name="map_map">Carte</string>
<string name="map_live">Carte active</string>
@@ -1136,13 +1147,15 @@
<string name="attribute_offset_cache_no">Pas de cache relative</string>
<string name="quote">Pour faciliter le géocaching.</string>
<string name="powered_by">carnero</string>
- <string name="support">support: <a href="">support@cgeo.org</a></string>
- <string name="website">site: <a href="">cgeo.org</a></string>
- <string name="facebook">facebook: <a href="">page c:geo</a></string>
- <string name="twitter">twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo sur Google Play</a></string>
+ <string name="support_title">Assistance</string>
+ <string name="website_title">Site web</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href="">Page de c:geo</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo sur Google Play</a></string>
<string name="about_twitter">Voulez-vous publier un nouveau statut sur Twitter à chaque nouvelle cache découverte sous <b>c:geo</b>?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
+ <string name="faq_title">FAQ</string>
<string name="status_new_release" tools:ignore="UnusedResources">Nouvelle version disponible.\nCliquer pour installer.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nouvelle version de test disponible.\nCliquer pour installer.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Nouvelle version candidate disponible.\nCliquer pour installer.</string>
diff --git a/main/res/values-hu/strings.xml b/main/res/values-hu/strings.xml
index dc98879..a8c4fb0 100644
--- a/main/res/values-hu/strings.xml
+++ b/main/res/values-hu/strings.xml
@@ -1141,13 +1141,7 @@
<string name="attribute_offset_cache_no">Nem offset láda</string>
<string name="quote">Az egyszerűbb ládázásért, a lustább játékosokért.</string>
<string name="powered_by">carnero</string>
- <string name="support">Támogatás: <a href="">support@cgeo.org</a></string>
- <string name="website">Weboldal: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Androidra: <a href="">c:geo a Google Play-en</a></string>
<string name="about_twitter">Akarod, hogy a <b>c:geo</b> új bejegyzést írjon a Twitter-re, amikor megtalálsz egy ládát?</string>
- <string name="faq">GYIK: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Új kiadás jelent meg.\nKattints a telepítéshez.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Új napi frissítés jelent meg.\nKattints a telepítéshez.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Új kiadás előtti verzió jelent meg.\nKattints a telepítéshez.</string>
diff --git a/main/res/values-it/strings.xml b/main/res/values-it/strings.xml
index 73c02d7..29d94d1 100644
--- a/main/res/values-it/strings.xml
+++ b/main/res/values-it/strings.xml
@@ -79,6 +79,7 @@
<string name="log_saving_and_uploading">Invio log e immagine…</string>
<string name="log_clear">Azzera</string>
<string name="log_post_not_possible">Connessione…</string>
+ <string name="log_date_future_not_allowed">Non sono ammesse date future per i log.</string>
<string name="log_add">Aggiungi</string>
<string name="log_repeat">Ripeti l\'ultimo log</string>
<string name="log_no_rating">Nessun voto</string>
@@ -108,6 +109,7 @@
<string name="log_password_title">Log Password:</string>
<string name="log_hint_log_password">Inserisci la password per il log</string>
<string name="log_oc_team_comment">Commenti del Team OC</string>
+ <string name="log_your_saved_log">I tuoi log salvati</string>
<string-array name="log_image_scales">
<item>Dimensioni originali</item>
<item>512 px</item>
@@ -293,6 +295,7 @@
<string name="caches_filter_track">Con oggetti trackables</string>
<string name="caches_filter_clear">Rimuovi filtri</string>
<string name="caches_filter_modified">Con coordinate modificate</string>
+ <string name="caches_filter_offline_log">Con log offline</string>
<string name="caches_filter_origin">Origine</string>
<string name="caches_filter_distance">Distanza</string>
<string name="caches_filter_personal_note">Con una nota personale</string>
@@ -334,6 +337,7 @@
<string name="about_apache_license"><a href="">Licenza Apache, versione 2.0</a></string>
<string name="about_help">Guida</string>
<string name="about_system_include">Si prega di includere le seguenti informazioni di sistema quando si invia una segnalazione di bug o per chiedere ulteriori informazioni su c:geo:</string>
+ <string name="changelog_github">Elenco di tutte le modifiche</string>
<string name="settings_title_services">Servizi</string>
<string name="settings_summary_services">Configura le informazioni utente dell\'account ed accede a servizi opzionali.</string>
<string name="settings_title_appearance">Aspetto</string>
@@ -452,6 +456,8 @@
<string name="init_backup_success">Il database di c:geo è stato salvato con successo nel file: </string>
<string name="init_backup_failed">Backup del database di c:geo fallito.</string>
<string name="init_backup_unnecessary">Il database è vuoto, il backup non è necessario.</string>
+ <string name="backup_confirm_overwrite">Vuoi sovrascrivere il backup esistente da %s?</string>
+ <string name="restore_confirm_overwrite">Vuoi sovrascrivere %s sul tuo dispositivo con il backup?</string>
<string name="init_restore_success">Ripristino completato.</string>
<string name="init_restore_failed">Ripristino fallito.</string>
<string name="init_restore_running">Ripristino del database dei cache…</string>
@@ -610,6 +616,7 @@
</plurals>
<string name="cache_waypoints_add">Aggiungi waypoint</string>
<string name="cache_hint">Aiuto (spoiler)</string>
+ <string name="cache_hint_not_available">Nessun aiuto disponibile</string>
<string name="cache_logs">Logbook</string>
<string name="cache_logs_friends_and_own">Log tuoi e degli amici</string>
<string name="cache_dialog_loading_details">Caricamento dettagli del cache…</string>
@@ -652,6 +659,7 @@
<string name="cache_menu_visit_offline">Log offline con un solo click</string>
<string name="cache_menu_spoilers">Immagini spoiler</string>
<string name="cache_menu_around">Cache qui intorno</string>
+ <string name="around">Nei dintorni di %s</string>
<string name="cache_menu_event">Aggiungi al calendario</string>
<string name="cache_menu_details">Dettagli</string>
<string name="cache_menu_refresh">Aggiorna</string>
@@ -662,6 +670,8 @@
<string name="cache_menu_navigon">Navigon</string>
<string name="cache_menu_pebble">Pebble</string>
<string name="cache_menu_vote">Vota</string>
+ <string name="cache_menu_checker">Apri geo checker</string>
+ <string name="cache_menu_ignore">Ignora cache</string>
<string name="cache_status">Stato</string>
<string name="cache_status_offline_log">Log salvato</string>
<string name="cache_status_found">Trovato</string>
@@ -772,6 +782,7 @@
<string name="search_history_cleared">Cronologia azzerata</string>
<string name="waypoint_coordinate_formats_plain">Plain</string>
<string name="from_clipboard">Dagli appunti</string>
+ <string name="copy_to_clipboard">Copia nella Clipboard</string>
<string name="visit_tweet">Segnala questo ritrovamento su Twitter</string>
<string name="map_map">Mappa</string>
<string name="map_live">Mappa Live</string>
@@ -1128,13 +1139,15 @@
<string name="attribute_offset_cache_no">Non è un offset cache</string>
<string name="quote">Per rendere il geocaching più facile e gli utenti più pigri.</string>
<string name="powered_by">carnero</string>
- <string name="support">Supporto: <a href="">support@cgeo.org</a></string>
- <string name="website">Sito: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">Pagina c:geo</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo su Google Play</a></string>
+ <string name="support_title">Aiuto</string>
+ <string name="website_title">Sito Internet</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href="">pagina c:geo</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo su Google Play</a></string>
<string name="about_twitter">Può <b>c:geo</b> pubblicare su Twitter ogni volta che logghi un cache?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
+ <string name="faq_title">FAQ</string>
<string name="status_new_release" tools:ignore="UnusedResources">Una nuova versione è disponibile.\nClicca per installarla.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Una nuova versione nightly è disponibile.\nClicca per installarla.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Una nuova release candidate è disponibile.\nClicca per installarla.</string>
diff --git a/main/res/values-ja/strings.xml b/main/res/values-ja/strings.xml
index e88c35a..2a52220 100644
--- a/main/res/values-ja/strings.xml
+++ b/main/res/values-ja/strings.xml
@@ -992,11 +992,6 @@ Google翻訳アプリで各言語の辞書をダウンロードしておけば
<string name="attribute_geotour_no">ジオツアーの一部ではない</string>
<string name="quote">To make geocaching easier, to make users lazier.</string>
<string name="powered_by">carnero</string>
- <string name="support">サポート: <a href="">support@cgeo.org</a></string>
- <string name="website">Webサイト: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">Google Playのc:geo</a></string>
<string name="about_twitter">キャッシュのログを書いたら<b>c:geo</b>にTwitterでつぶやいてほしい?</string>
<string name="status_new_release" tools:ignore="UnusedResources">新しいバージョンがあります。\nクリックしてインストールしてください。</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">新しいナイトリービルドがあります。\nクリックしてインストールしてください。</string>
diff --git a/main/res/values-lt/strings.xml b/main/res/values-lt/strings.xml
index a326429..927ebeb 100644
--- a/main/res/values-lt/strings.xml
+++ b/main/res/values-lt/strings.xml
@@ -79,6 +79,7 @@
<string name="log_saving_and_uploading">Siunčiamas įrašas ir įkeliama nuotrauka…</string>
<string name="log_clear">Išvalyti</string>
<string name="log_post_not_possible">Įkeliamas įrašo puslapis…</string>
+ <string name="log_date_future_not_allowed">Būsimos datos įrašai negalimi.</string>
<string name="log_add">Pridėti</string>
<string name="log_repeat">Pakartoti paskutinį įrašą</string>
<string name="log_no_rating">Nėra reitingo</string>
@@ -108,6 +109,7 @@
<string name="log_password_title">Įrašo slaptažodis:</string>
<string name="log_hint_log_password">Įveskite savo įrašo slaptažodį</string>
<string name="log_oc_team_comment">OC komandos komentaras</string>
+ <string name="log_your_saved_log">Jūsų išsaugotas įrašas</string>
<string-array name="log_image_scales">
<item>Nekeisti dydžio</item>
<item>512 px</item>
@@ -300,6 +302,7 @@
<string name="caches_filter_track">Su keliauninkais</string>
<string name="caches_filter_clear">Valyti filtrus</string>
<string name="caches_filter_modified">Su pakeistomis koordinatėmis</string>
+ <string name="caches_filter_offline_log">Su išsaugotu įrašu</string>
<string name="caches_filter_origin">Šaltinis</string>
<string name="caches_filter_distance">Atstumas</string>
<string name="caches_filter_personal_note">Su asmenine pastaba</string>
@@ -341,6 +344,7 @@
<string name="about_apache_license"><a href=""> Apache licencija, versija 2.0</a></string>
<string name="about_help">Pagalba</string>
<string name="about_system_include">Pridėkite papildomą sisteminę informaciją, kai siunčiate klaidos pranešimą arba norite gauti daugiau informacijos apie c:geo:</string>
+ <string name="changelog_github">Pakeitimų sąrašas</string>
<string name="settings_title_services">Paslaugos</string>
<string name="settings_summary_services">Nustatyk naudotojo paskyros informaciją ir prieiga prie pasirinktinų paslaugų.</string>
<string name="settings_title_appearance">Išvaizda</string>
@@ -453,6 +457,8 @@
<string name="init_backup_success">c:geo duomenų bazė sėkmingai nukopijuota į:</string>
<string name="init_backup_failed">Nepavyko sukurti atsarginės c:geo duomenų bazės kopijos.</string>
<string name="init_backup_unnecessary">Duomenų bazė tuščia, atsarginė kopija nereikalinga.</string>
+ <string name="backup_confirm_overwrite">Ar norite perrašyti esamą atsarginę kopiją nuo %s?</string>
+ <string name="restore_confirm_overwrite">Ar norite perrašyti %s įrenginyje su atsargine kopija?</string>
<string name="init_restore_success">Atkūrimas baigtas.</string>
<string name="init_restore_failed">Atkurti nepavyko.</string>
<string name="init_restore_running">Atkuriama slėptuvių duomenų bazė…</string>
@@ -611,6 +617,7 @@
</plurals>
<string name="cache_waypoints_add">Pridėti papildomą tašką</string>
<string name="cache_hint">Užuomina</string>
+ <string name="cache_hint_not_available">Užuomina nepateikiama</string>
<string name="cache_logs">Įrašai</string>
<string name="cache_logs_friends_and_own">Draugų/savi įrašai</string>
<string name="cache_dialog_loading_details">Įkeliama slėptuvės informacija…</string>
@@ -653,6 +660,7 @@
<string name="cache_menu_visit_offline">Vienu paspaudimu žurnalo įrašo išsaugojimas</string>
<string name="cache_menu_spoilers">Užuominų nuotraukos</string>
<string name="cache_menu_around">Slėptuvės aplink</string>
+ <string name="around">Aplink %s</string>
<string name="cache_menu_event">Įtraukti į kalendorių</string>
<string name="cache_menu_details">Informacija</string>
<string name="cache_menu_refresh">Atnaujinti</string>
@@ -662,6 +670,8 @@
<string name="cache_menu_oruxmaps">OruxMaps</string>
<string name="cache_menu_pebble">Pebble</string>
<string name="cache_menu_vote">Balsuoti</string>
+ <string name="cache_menu_checker">Atidaryti geo tikrintuvą</string>
+ <string name="cache_menu_ignore">Ignoruoti slėptuvę</string>
<string name="cache_status">Būsena</string>
<string name="cache_status_offline_log">Išsaugotas įrašas</string>
<string name="cache_status_found">Rasta</string>
@@ -772,6 +782,7 @@
<string name="search_history_cleared">Istorija išvalyta</string>
<string name="waypoint_coordinate_formats_plain">Paprastas</string>
<string name="from_clipboard">Iš mainų srities</string>
+ <string name="copy_to_clipboard">Kopijuoti į mainų sritį</string>
<string name="visit_tweet">Skelbti radybas Twitter paskytoje</string>
<string name="map_map">Išsaugotos slėptuvės</string>
<string name="map_live">Slėptuvės iš interneto</string>
@@ -1127,12 +1138,15 @@
<string name="attribute_offset_cache_yes">Offset cache</string>
<string name="attribute_offset_cache_no">No offset cache</string>
<string name="quote">To make geocaching easier, to make users lazier.</string>
- <string name="support">Palaikymas: <a href="">support@cgeo.org</a></string>
- <string name="website">Tinklapis: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo on Google Play</a></string>
+ <string name="support_title">Palaikymas</string>
+ <string name="website_title">Tinklapis</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href=""> c:Geo puslapis</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo Google Play</a></string>
<string name="about_twitter">Kaskart registruojant slėptuvę <b>c:geo</b> paskelbs nauja statusą Twitter paskyroje.</string>
+ <string name="faq_title">FAQ</string>
<string name="status_new_release" tools:ignore="UnusedResources">Galima nauja versija. \nPaspauskite čia ir įdiekite.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Galima nauja naktinė versija.\nPaspauskite čia ir įdiekite.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Galima nauja versija. \nPaspauskite čia ir įdiekite.</string>
diff --git a/main/res/values-nb/strings.xml b/main/res/values-nb/strings.xml
index 4c55e8b..1243470 100644
--- a/main/res/values-nb/strings.xml
+++ b/main/res/values-nb/strings.xml
@@ -1124,11 +1124,6 @@
<string name="attribute_offset_cache_no">Ikke offset-cache</string>
<string name="quote">For å gjøre geocaching enklere og brukerne latere.</string>
<string name="powered_by">carnero</string>
- <string name="support">e-post adresse: <a href="mailto:support@cgeo.org">support@cgeo.org</a></string>
- <string name="website">web-side: <a href="http://cgeo.org/">cgeo.org</a></string>
- <string name="facebook">facebook: <a href="http://www.facebook.com/pages/cgeo/297269860090">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo i Google Play</a></string>
<string name="about_twitter">Ønsker du at <b>c:geo</b> skal poste en status på Twitter hver gang du logger ett funn via <b>c:geo</b>?</string>
<string name="status_new_release" tools:ignore="UnusedResources">Ny versjon tilgjengelig. \nKlikk for å installere.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Ny \"nightly build\" er tilgjengelig.\nKlikk for å installere.</string>
diff --git a/main/res/values-nl/strings.xml b/main/res/values-nl/strings.xml
index bcf8c74..e5303cb 100644
--- a/main/res/values-nl/strings.xml
+++ b/main/res/values-nl/strings.xml
@@ -1133,13 +1133,7 @@
<string name="attribute_offset_cache_no">Geen offset cache</string>
<string name="quote">Om geocaching makkelijker en gebruikers luier te maken.</string>
<string name="powered_by">carnero</string>
- <string name="support">Support: <a href="">support@cgeo.org</a></string>
- <string name="website">Website: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo op Google Play</a></string>
<string name="about_twitter">Moet <b>c:geo</b> elke cache vondst publiceren naar Twitter?</string>
- <string name="faq">FAQ: <a href=""> faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Nieuwe release beschikbaar.\nTik om te installeren.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nieuwe nightly-release beschikbaar.\nTik om te installeren.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Nieuwe release-candidaad beschikbaar.\nTik om te installeren.</string>
diff --git a/main/res/values-pl/strings.xml b/main/res/values-pl/strings.xml
index 4cd8bb8..2aeb9aa 100644
--- a/main/res/values-pl/strings.xml
+++ b/main/res/values-pl/strings.xml
@@ -1127,13 +1127,7 @@
<string name="attribute_offset_cache_no">Nie jest to skrzynka Offset</string>
<string name="quote">Aby uczynić geocaching prostszym, a użytkowników bardziej leniwymi.</string>
<string name="powered_by">carnero</string>
- <string name="support">Wsparcie: <a href="">support@cgeo.org</a></string>
- <string name="website">Website: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo strona</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo w Google Play</a></string>
<string name="about_twitter">Czy chczesz aby <b>c:geo</b> publikował nowy status na Twitter za każdym razem kiedy znajdziesz skrzynkę?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Dostępna nowa wersja.\nKliknij aby zainstalować.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Dostępna nowa codzienna wersja.\nKliknij aby zainstalować.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Dostępny nowy kandydat na nową wersję.\nKliknij aby zainstalować.</string>
diff --git a/main/res/values-pt/strings.xml b/main/res/values-pt/strings.xml
index 9848860..0bec864 100644
--- a/main/res/values-pt/strings.xml
+++ b/main/res/values-pt/strings.xml
@@ -1131,13 +1131,7 @@
<string name="attribute_offset_cache_no">Cache sem offset de translação</string>
<string name="quote">Para tornar o geocaching mais fácil, para tornar os utilizadores mais preguiçosos.</string>
<string name="powered_by">carnero</string>
- <string name="support">Suporte: <a href="">support@cgeo.org</a></string>
- <string name="website">Site na internet: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">página do c:geo</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo no Google Play</a></string>
<string name="about_twitter">O <b>c:geo</b> deve publicar no Twitter de cada vez que uma cache foi registrada?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Nova versão disponível.\nClique para instalar.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nova \'nightly build\' disponível.\nClique para instalar.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Nova \'release candidate\' disponível .\nClique para instalar.</string>
diff --git a/main/res/values-ro/strings.xml b/main/res/values-ro/strings.xml
index 64dfdb5..51e1208 100644
--- a/main/res/values-ro/strings.xml
+++ b/main/res/values-ro/strings.xml
@@ -1132,13 +1132,7 @@
<string name="attribute_offset_cache_no">Nu este geocutie decalată</string>
<string name="quote">Pentru geocaching mai uşor, pentru căutători mai leneşi.</string>
<string name="powered_by">carnero</string>
- <string name="support">Suport: <a href="">support@cgeo.org</a></string>
- <string name="website">Site: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">pagina c:geo</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo pe Google Play</a></string>
<string name="about_twitter">Ar trebui ca <b>c:geo</b> să publice un statut nou pe Twitter de fiecare dată când scrii o însemnare pentru o geocutie?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">A apărut o versiune nouă.\nApasă aici pentru a instala.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">A apărut o nouă versiune zilnică.\nApasă aici pentru a instala.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">A apărut o un candidat pentru o versiune nouă.\nApasă aici pentru a instala.</string>
diff --git a/main/res/values-sk/strings.xml b/main/res/values-sk/strings.xml
index 447fb28..41afadd 100644
--- a/main/res/values-sk/strings.xml
+++ b/main/res/values-sk/strings.xml
@@ -1135,13 +1135,7 @@
<string name="attribute_offset_cache_no">Nie je offset cache</string>
<string name="quote">Pre jednoduchšie hľadanie skrýš a používateľov lenivších.</string>
<string name="powered_by">carnero</string>
- <string name="support">Podpora: <a href="">support@cgeo.org</a></string>
- <string name="website">Web: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href=""> c:geo na Google Play</a></string>
<string name="about_twitter">Chcete, aby <b>c:geo</b> napísalo na váš Twitter vždy, keď zapíšete nájdenie skrýše?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Je dostupné nové vydanie.\nKliknite pre inštaláciu.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Je dostupná nová nočná zostava.\nKliknite pre inštaláciu.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Je dostupná nová verzia „release candidate“.\nKliknite pre inštaláciu.</string>
diff --git a/main/res/values-sl/strings.xml b/main/res/values-sl/strings.xml
index 71816d7..0d20fae 100644
--- a/main/res/values-sl/strings.xml
+++ b/main/res/values-sl/strings.xml
@@ -1110,13 +1110,7 @@
<string name="attribute_offset_cache_no">Ni Offset zaklad</string>
<string name="quote">Za lažji geocaching in bolj lene zakladolovce.</string>
<string name="powered_by">carnero</string>
- <string name="support">Podpora: <a href="">support@cgeo.org</a></string>
- <string name="website">Spletna stran: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo stran</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo na Google Play</a></string>
<string name="about_twitter">Naj <b>c:geo</b> objavi nov status na Twitter, ko objavite nov zapis pri zakladu?</string>
- <string name="faq">Pogosto zastavljena vprašanja: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Na voljo je nova različica.\nKliknite za namestitev.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Na voljo je nova dnevna različica.\nKliknite za namestitev.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Na voljo je nova preizkusna različica.\nKliknite za namestitev.</string>
diff --git a/main/res/values-sv/strings.xml b/main/res/values-sv/strings.xml
index 684d7cf..a2cefcd 100644
--- a/main/res/values-sv/strings.xml
+++ b/main/res/values-sv/strings.xml
@@ -1137,13 +1137,7 @@
<string name="attribute_offset_cache_no">Ingen offset cache</string>
<string name="quote">To make geocaching easier, to make users lazier.</string>
<string name="powered_by">carnero</string>
- <string name="support">Support: <a href="">support@cgeo.org</a></string>
- <string name="website">Hemsida: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo på Google Play</a></string>
<string name="about_twitter">Ska <b>c:geo</b> publicera ny status på Twitter varje gång en cache loggas?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
<string name="status_new_release" tools:ignore="UnusedResources">Ny officiell version finns tillgänglig.\nKlicka för att installera.</string>
<string name="status_new_nightly" tools:ignore="UnusedResources">Nytt nattligt bygge finns tillgängligt.\nKlicka för att installera.</string>
<string name="status_new_rc" tools:ignore="UnusedResources">Ny kandidat till officiellt bygge finns tillgängligt.\nKlicka för att installera.</string>
diff --git a/main/res/values/changelog_master.xml b/main/res/values/changelog_master.xml
index 1e3c3d4..bb5d07a 100644
--- a/main/res/values/changelog_master.xml
+++ b/main/res/values/changelog_master.xml
@@ -2,5 +2,33 @@
<resources>
<!-- changelog for the master branch -->
<string name="changelog_master" translatable="false">
+ <b>Next feature release:</b>\n
+ · New: Distance and direction shown on map\n
+ · New: Show own saved log first in logbook\n
+ · New: Show hint in compass and map action bar\n
+ · New: Sort events of same date by time (if recognized from cache description)\n
+ · New: Show number of trackables in cache list\n
+ · New: Weekday shown in event lists\n
+ · New: Show rudimentary details for geocaching.com.au swaggies\n
+ · New: Filter for caches with offline logs\n
+ · New: Allow export of waypoints without coords to Locus\n
+ · New: Confirmation on backup/restore\n
+ · New: Links in personal notes can be clicked\n
+ · New: Menu in cache details to open geo checker\n
+ · New: Menu in cache details to put cache on ignore list (but not to remove)\n
+ · New: Map title shows more details\n
+ · Fix: Improve detection pattern for event start time\n
+ · Fix: Android Beam working with trackables again\n
+ · Fix: Disable Android Beam when not useful\n
+ · Fix: Don\'t allow logs in the future\n
+ · Fix: Allow shortcut creation for All caches list\n
+ · Fix: Some menus not available when invoking map from compass\n
+ · Fix: Do not limit to 10 logs for OC caches\n
+ · Fix: Recognize more hyperlinks of opencaching caches\n
+ · Fix: Remove empty space in some opencaching logs\n
+ · Fix: Allow up navigation when opening the app from a link\n
+ · Fix: Opening coord.info links from some mail clients was not working\n
+ · Removed: No longer support loading mapsforge 0.24 maps\n
+ \n
</string>
</resources>
diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml
index 2d8bdf7..48b2a9b 100644
--- a/main/res/values/strings.xml
+++ b/main/res/values/strings.xml
@@ -91,6 +91,7 @@
<string name="log_saving_and_uploading">Sending log and uploading image…</string>
<string name="log_clear">Clear</string>
<string name="log_post_not_possible">Loading Log Page…</string>
+ <string name="log_date_future_not_allowed">Future log dates are not allowed.</string>
<string name="log_add">Add</string>
<string name="log_repeat">Repeat last log</string>
<string name="log_no_rating">No rating</string>
@@ -120,7 +121,8 @@
<string name="log_password_title">Log Password:</string>
<string name="log_hint_log_password">Enter your log password</string>
<string name="log_oc_team_comment">OC Team comment</string>
-
+ <string name="log_your_saved_log">Your saved log</string>
+
<string-array name="log_image_scales">
<item>No scaling</item>
<item>512 px</item>
@@ -325,6 +327,7 @@
<string name="caches_filter_track">With Trackables</string>
<string name="caches_filter_clear">Clear filters</string>
<string name="caches_filter_modified">With modified coordinates</string>
+ <string name="caches_filter_offline_log">With offline log</string>
<string name="caches_filter_origin">Origin</string>
<string name="caches_filter_distance">Distance</string>
<string name="caches_filter_personal_note">With personal note</string>
@@ -370,6 +373,7 @@
<string name="about_apache_license"><a href="">Apache License, Version 2.0</a></string>
<string name="about_help">Help</string>
<string name="about_system_include">Please include the following system information when sending a bug report or asking for more information about c:geo:</string>
+ <string name="changelog_github">List of all changes</string>
<!-- settings -->
<string name="settings_title_services">Services</string>
@@ -497,6 +501,8 @@
<string name="init_backup_success">c:geo\'s database was successfully copied to:</string>
<string name="init_backup_failed">Backup of c:geo\'s database failed.</string>
<string name="init_backup_unnecessary">Database is empty, no backup necessary.</string>
+ <string name="backup_confirm_overwrite">Do you want to overwrite the existing backup from %s?</string>
+ <string name="restore_confirm_overwrite">Do you want to overwrite %s on your device with the backup?</string>
<string name="init_restore_success">Restoration completed.</string>
<string name="init_restore_failed">Restoration failed.</string>
<string name="init_restore_running">Restoring cache database…</string>
@@ -672,6 +678,7 @@
<string name="cache_waypoints_add">Add Waypoint</string>
<string name="cache_hint">Hint</string>
+ <string name="cache_hint_not_available">No hint available</string>
<string name="cache_logs">Logbook</string>
<string name="cache_logs_friends_and_own">Friends/Own Logs</string>
<string name="cache_dialog_loading_details">Loading cache details…</string>
@@ -714,6 +721,7 @@
<string name="cache_menu_visit_offline">One click offline log</string>
<string name="cache_menu_spoilers">Spoiler images</string>
<string name="cache_menu_around">Caches around</string>
+ <string name="around">Around %s</string>
<string name="cache_menu_event">Add to calendar</string>
<string name="cache_menu_details">Details</string>
<string name="cache_menu_refresh">Refresh</string>
@@ -725,6 +733,8 @@
<string name="cache_menu_pebble">Pebble</string>
<string name="cache_menu_android_wear">Android Wear</string>
<string name="cache_menu_vote">Vote</string>
+ <string name="cache_menu_checker">Open geo checker</string>
+ <string name="cache_menu_ignore">Ignore cache</string>
<string name="cache_status">Status</string>
<string name="cache_status_offline_log">Saved Log</string>
<string name="cache_status_found">Found</string>
@@ -852,6 +862,7 @@
<string name="search_history_cleared">History cleared</string>
<string name="waypoint_coordinate_formats_plain">Plain</string>
<string name="from_clipboard">From clipboard</string>
+ <string name="copy_to_clipboard">Copy to clipboard</string>
<!-- visit -->
<string name="visit_tweet">Post this find to Twitter</string>
@@ -1234,13 +1245,15 @@
<string name="quote">To make geocaching easier, to make users lazier.</string>
<string name="powered_by">carnero</string>
<!-- Note: Links here are just for appearance. See AboutActivity to make changes -->
- <string name="support">Support: <a href="">support@cgeo.org</a></string>
- <string name="website">Website: <a href="">cgeo.org</a></string>
- <string name="facebook">Facebook: <a href="">c:geo page</a></string>
- <string name="twitter">Twitter: <a href="">@android_GC</a></string>
- <string name="market">Android: <a href="">c:geo on Google Play</a></string>
+ <string name="support_title">Support</string>
+ <string name="website_title">Website</string>
+ <string name="facebook_title">Facebook</string>
+ <string name="facebook_link"><a href="">c:geo page</a></string>
+ <string name="twitter_title">Twitter</string>
+ <string name="market_title">Google Play</string>
+ <string name="market_link"><a href="">c:geo on Google Play</a></string>
<string name="about_twitter">Should <b>c:geo</b> publish a new status on Twitter every time you log a cache?</string>
- <string name="faq">FAQ: <a href="">faq.cgeo.org</a></string>
+ <string name="faq_title">FAQ</string>
<!-- status (used via string based resource loading) -->
<string name="status_new_release" tools:ignore="UnusedResources">New release available.\nClick to install.</string>
diff --git a/main/res/values/strings_not_translatable.xml b/main/res/values/strings_not_translatable.xml
index 35fef08..d699f62 100644
--- a/main/res/values/strings_not_translatable.xml
+++ b/main/res/values/strings_not_translatable.xml
@@ -90,5 +90,10 @@
<string name="caches_map_mapswithme" translatable="false">Maps.me</string>
<string name="cache_menu_mapswithme" translatable="false">Maps.me</string>
+ <string name="faq_link"><a href="">faq.cgeo.org</a></string>
+ <string name="website_link"><a href="">cgeo.org</a></string>
+ <string name="twitter_link"><a href="">@android_GC</a></string>
+ <string name="support_link"><a href="">support@cgeo.org</a></string>
+
</resources>
diff --git a/main/res/values/themes.xml b/main/res/values/themes.xml
index 50485b3..751f325 100644
--- a/main/res/values/themes.xml
+++ b/main/res/values/themes.xml
@@ -9,7 +9,7 @@
<style name="cgeo_main.base" parent="@style/Theme.AppCompat">
- <!-- copy the style elements of the Wallpaper theme since AppCombat has no Wallpaper theme -->
+ <!-- copy the style elements of the Wallpaper theme since AppCompat has no Wallpaper theme -->
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:colorBackgroundCacheHint">@null</item>
<item name="android:windowShowWallpaper">true</item>
diff --git a/main/src/cgeo/calendar/CalendarAddon.java b/main/src/cgeo/calendar/CalendarAddon.java
index 8737447..88c67a8 100644
--- a/main/src/cgeo/calendar/CalendarAddon.java
+++ b/main/src/cgeo/calendar/CalendarAddon.java
@@ -8,6 +8,7 @@ import cgeo.geocaching.ui.dialog.Dialogs;
import cgeo.geocaching.utils.ProcessUtils;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
import android.app.Activity;
import android.content.DialogInterface;
@@ -27,10 +28,11 @@ public class CalendarAddon {
return ProcessUtils.isIntentAvailable(ICalendar.INTENT, Uri.parse(ICalendar.URI_SCHEME + "://" + ICalendar.URI_HOST));
}
- public static void addToCalendarWithIntent(final Activity activity, final Geocache cache) {
+ public static void addToCalendarWithIntent(@NonNull final Activity activity, @NonNull final Geocache cache) {
final Resources res = activity.getResources();
if (CalendarAddon.isAvailable()) {
final Date hiddenDate = cache.getHiddenDate();
+ final String startTime = cache.guessEventTimeMinutes() >= 0 ? String.valueOf(cache.guessEventTimeMinutes()) : StringUtils.EMPTY;
final Parameters params = new Parameters(
ICalendar.PARAM_NAME, cache.getName(),
ICalendar.PARAM_NOTE, StringUtils.defaultString(cache.getPersonalNote()),
@@ -39,7 +41,7 @@ public class CalendarAddon {
ICalendar.PARAM_COORDS, cache.getCoords() == null ? "" : cache.getCoords().format(GeopointFormatter.Format.LAT_LON_DECMINUTE_RAW),
ICalendar.PARAM_LOCATION, StringUtils.defaultString(cache.getLocation()),
ICalendar.PARAM_SHORT_DESC, StringUtils.defaultString(cache.getShortDescription()),
- ICalendar.PARAM_START_TIME_MINUTES, StringUtils.defaultString(cache.guessEventTimeMinutes())
+ ICalendar.PARAM_START_TIME_MINUTES, startTime
);
activity.startActivity(new Intent(ICalendar.INTENT,
@@ -51,10 +53,8 @@ public class CalendarAddon {
.append(res.getString(R.string.addon_download_prompt))
.toString(), new DialogInterface.OnClickListener() {
@Override
- public void onClick(DialogInterface dialog, int id) {
- final Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(Uri.parse(ICalendar.CALENDAR_ADDON_URI));
- activity.startActivity(intent);
+ public void onClick(final DialogInterface dialog, final int id) {
+ ProcessUtils.openMarket(activity, "cgeo.calendar");
}
});
}
diff --git a/main/src/cgeo/calendar/ICalendar.java b/main/src/cgeo/calendar/ICalendar.java
index 6ecb6d5..9001198 100644
--- a/main/src/cgeo/calendar/ICalendar.java
+++ b/main/src/cgeo/calendar/ICalendar.java
@@ -1,19 +1,22 @@
package cgeo.calendar;
+import org.eclipse.jdt.annotation.NonNull;
+
public interface ICalendar {
- static final String CALENDAR_ADDON_URI = "market://details?id=cgeo.calendar";
+ @Deprecated
+ @NonNull static final String CALENDAR_ADDON_URI = "market://details?id=cgeo.calendar";
- static final String INTENT = "cgeo.calendar.RESERVE";
+ @NonNull static final String INTENT = "cgeo.calendar.RESERVE";
- static final String URI_SCHEME = "add";
- static final String URI_HOST = "cgeo.org";
+ @NonNull static final String URI_SCHEME = "add";
+ @NonNull static final String URI_HOST = "cgeo.org";
- static final String PARAM_SHORT_DESC = "shortDesc"; // cache short description
- static final String PARAM_HIDDEN_DATE = "hiddenDate"; // cache hidden date in milliseconds
- static final String PARAM_URL = "url"; // cache URL
- static final String PARAM_NOTE = "note"; // personal note
- static final String PARAM_NAME = "name"; // cache name
- static final String PARAM_LOCATION = "location"; // cache location, or empty string
- static final String PARAM_COORDS = "coords"; // cache coordinates, or empty string
- static final String PARAM_START_TIME_MINUTES = "time"; // time of start
+ @NonNull static final String PARAM_SHORT_DESC = "shortDesc"; // cache short description
+ @NonNull static final String PARAM_HIDDEN_DATE = "hiddenDate"; // cache hidden date in milliseconds
+ @NonNull static final String PARAM_URL = "url"; // cache URL
+ @NonNull static final String PARAM_NOTE = "note"; // personal note
+ @NonNull static final String PARAM_NAME = "name"; // cache name
+ @NonNull static final String PARAM_LOCATION = "location"; // cache location, or empty string
+ @NonNull static final String PARAM_COORDS = "coords"; // cache coordinates, or empty string
+ @NonNull static final String PARAM_START_TIME_MINUTES = "time"; // time of start
}
diff --git a/main/src/cgeo/contacts/ContactsAddon.java b/main/src/cgeo/contacts/ContactsAddon.java
index 7165a77..6c0dd21 100644
--- a/main/src/cgeo/contacts/ContactsAddon.java
+++ b/main/src/cgeo/contacts/ContactsAddon.java
@@ -3,6 +3,8 @@ package cgeo.contacts;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.utils.ProcessUtils;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
@@ -13,7 +15,7 @@ public class ContactsAddon {
// utility class
}
- public static void openContactCard(Activity context, String userName) {
+ public static void openContactCard(@NonNull final Activity context, @NonNull final String userName) {
final Parameters params = new Parameters(
IContacts.PARAM_NAME, userName
);
diff --git a/main/src/cgeo/contacts/IContacts.java b/main/src/cgeo/contacts/IContacts.java
index d68b78a..5a6c04d 100644
--- a/main/src/cgeo/contacts/IContacts.java
+++ b/main/src/cgeo/contacts/IContacts.java
@@ -1,10 +1,12 @@
package cgeo.contacts;
+import org.eclipse.jdt.annotation.NonNull;
+
public interface IContacts {
- static final String INTENT = "cgeo.contacts.FIND";
+ @NonNull static final String INTENT = "cgeo.contacts.FIND";
- static final String URI_SCHEME = "find";
- static final String URI_HOST = "cgeo.org";
+ @NonNull static final String URI_SCHEME = "find";
+ @NonNull static final String URI_HOST = "cgeo.org";
- static final String PARAM_NAME = "name"; // user name
+ @NonNull static final String PARAM_NAME = "name"; // user name
}
diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java
index ceafc31..90961d5 100644
--- a/main/src/cgeo/geocaching/AboutActivity.java
+++ b/main/src/cgeo/geocaching/AboutActivity.java
@@ -3,13 +3,20 @@ package cgeo.geocaching;
import butterknife.ButterKnife;
import butterknife.InjectView;
+import cgeo.calendar.CalendarAddon;
+import cgeo.contacts.ContactsAddon;
import cgeo.geocaching.activity.AbstractViewPagerActivity;
+import cgeo.geocaching.compatibility.Compatibility;
+import cgeo.geocaching.connector.ConnectorFactory;
+import cgeo.geocaching.connector.capability.ILogin;
import cgeo.geocaching.sensors.OrientationProvider;
import cgeo.geocaching.sensors.RotationProvider;
import cgeo.geocaching.sensors.Sensors;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.ui.AbstractCachingPageViewCreator;
import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod;
+import cgeo.geocaching.utils.ClipboardUtils;
+import cgeo.geocaching.utils.ProcessUtils;
import cgeo.geocaching.utils.Version;
import org.apache.commons.io.IOUtils;
@@ -25,13 +32,16 @@ import android.os.Build;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.view.View;
+import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
import java.util.Scanner;
public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page> {
@@ -71,6 +81,7 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
@InjectView(R.id.changelog_master) protected TextView changeLogMaster;
@InjectView(R.id.changelog_release) protected TextView changeLogRelease;
+ @InjectView(R.id.changelog_github) protected TextView changeLogLink;
@Override
public ScrollView getDispatchedView(final ViewGroup parentView) {
@@ -83,6 +94,13 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
} else {
changeLogMaster.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance());
}
+ changeLogLink.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(final View v) {
+ startUrl("https://github.com/cgeo/cgeo/releases");
+ }
+ });
return view;
}
@@ -91,13 +109,23 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
class SystemViewCreator extends AbstractCachingPageViewCreator<ScrollView> {
@InjectView(R.id.system) protected TextView system;
+ @InjectView(R.id.copy) protected Button copy;
@Override
public ScrollView getDispatchedView(final ViewGroup parentView) {
final ScrollView view = (ScrollView) getLayoutInflater().inflate(R.layout.about_system_page, parentView, false);
ButterKnife.inject(this, view);
- system.setText(systemInformation(AboutActivity.this));
+ final String systemInfo = systemInformation(AboutActivity.this);
+ system.setText(systemInfo);
system.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance());
+ Compatibility.setTextIsSelectable(system, true);
+ copy.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(final View view) {
+ ClipboardUtils.copyToClipboard(systemInfo);
+ showShortToast(getString(R.string.clipboard_copy_ok));
+ }
+ });
return view;
}
}
@@ -125,7 +153,7 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
@Override
public void onClick(final View v) {
- market();
+ ProcessUtils.openMarket(AboutActivity.this, getPackageName());
}
});
return view;
@@ -190,12 +218,6 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
}
- final void market() {
- final Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName()));
- marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
- startActivity(marketIntent);
- }
-
@Override
protected final cgeo.geocaching.activity.AbstractViewPagerActivity.PageViewCreator createViewCreator(final Page page) {
switch (page) {
@@ -248,7 +270,6 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
fromActivity.startActivity(intent);
}
-
private static String presence(final Boolean present) {
return present ? "present" : "absent";
}
@@ -260,17 +281,41 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
.append("\nAndroid version: ").append(VERSION.RELEASE)
.append("\nAndroid build: ").append(Build.DISPLAY)
.append("\nCgeo version: ").append(Version.getVersionName(context))
- .append("\nPlay services: ").append(presence(googlePlayServicesAvailable));
- if (googlePlayServicesAvailable) {
- body.append("\nUse Play services: ").append(Settings.useGooglePlayServices() ? "yes" : "no");
- }
- body
+ .append("\nGoogle Play services: ").append(googlePlayServicesAvailable ? (Settings.useGooglePlayServices() ? "enabled" : "disabled") : "unavailable")
.append("\nLow power mode: ").append(Settings.useLowPowerMode() ? "active" : "inactive")
.append("\nCompass capabilities: ").append(Sensors.getInstance().hasCompassCapabilities() ? "yes" : "no")
.append("\nRotation sensor: ").append(presence(RotationProvider.hasRotationSensor(context)))
.append("\nGeomagnetic rotation sensor: ").append(presence(RotationProvider.hasGeomagneticRotationSensor(context)))
.append("\nOrientation sensor: ").append(presence(OrientationProvider.hasOrientationSensor(context)))
- .append("\n--- End of system information ---\n");
+ .append("\nHide own/found: ").append(Settings.isExcludeMyCaches())
+ .append("\nMap strategy: ").append(Settings.getLiveMapStrategy().toString().toLowerCase(Locale.getDefault()))
+ .append("\nHW-acceleration: ").append(Settings.useHardwareAcceleration() ? "enabled" : "disabled")
+ .append(" (").append(Settings.useHardwareAcceleration() != Settings.HW_ACCEL_DISABLED_BY_DEFAULT ? "default state" : "manually changed").append(")");
+ for (final ILogin connector : ConnectorFactory.getActiveLiveConnectors()) {
+ body.append('\n').append(connector.getName()).append(": ").append(connector.isLoggedIn() ? "logged in" : "not logged in")
+ .append(" (").append(connector.getLoginStatusString()).append(')');
+ if (connector.getName().equals("geocaching.com") && connector.isLoggedIn()) {
+ body.append(" / ").append(Settings.getGCMemberStatus());
+ }
+ }
+ body.append("\nSystem language: ").append(Locale.getDefault());
+ if (Settings.isUseEnglish()) {
+ body.append(" (cgeo forced to English)");
+ }
+ final boolean calendarAddonAvailable = CalendarAddon.isAvailable();
+ final boolean contactsAddonAvailable = ContactsAddon.isAvailable();
+ body.append("\nInstalled cgeo plugins:");
+ if (calendarAddonAvailable || contactsAddonAvailable) {
+ if (calendarAddonAvailable) {
+ body.append(" calendar");
+ }
+ if (contactsAddonAvailable) {
+ body.append(" contacts");
+ }
+ } else {
+ body.append(" none");
+ }
+ body.append("\n--- End of system information ---\n");
return body.toString();
}
diff --git a/main/src/cgeo/geocaching/AbstractDialogFragment.java b/main/src/cgeo/geocaching/AbstractDialogFragment.java
index d81dde5..6e58bd3 100644
--- a/main/src/cgeo/geocaching/AbstractDialogFragment.java
+++ b/main/src/cgeo/geocaching/AbstractDialogFragment.java
@@ -340,7 +340,7 @@ public abstract class AbstractDialogFragment extends DialogFragment implements C
showToast(res.getString(R.string.err_location_unknown));
return;
}
- CacheListActivity.startActivityCoordinates((AbstractActivity) getActivity(), coords);
+ CacheListActivity.startActivityCoordinates((AbstractActivity) getActivity(), coords, cache != null ? cache.getName() : null);
getActivity().finish();
}
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 22bd500..244080b 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -5,7 +5,6 @@ import butterknife.InjectView;
import cgeo.calendar.CalendarAddon;
import cgeo.geocaching.activity.AbstractActivity;
-import cgeo.geocaching.activity.AbstractActivity.ActivitySharingInterface;
import cgeo.geocaching.activity.AbstractViewPagerActivity;
import cgeo.geocaching.activity.INavigationSource;
import cgeo.geocaching.activity.Progress;
@@ -14,6 +13,7 @@ import cgeo.geocaching.apps.cache.navi.NavigationSelectionActionProvider;
import cgeo.geocaching.apps.cachelist.MapsWithMeCacheListApp;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.IConnector;
+import cgeo.geocaching.connector.capability.IgnoreCapability;
import cgeo.geocaching.connector.gc.GCConnector;
import cgeo.geocaching.connector.gc.GCConstants;
import cgeo.geocaching.enumerations.CacheAttribute;
@@ -24,6 +24,7 @@ import cgeo.geocaching.gcvote.GCVote;
import cgeo.geocaching.gcvote.GCVoteDialog;
import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.location.Units;
+import cgeo.geocaching.network.AndroidBeam;
import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.network.Network;
import cgeo.geocaching.network.SmileyImage;
@@ -45,6 +46,7 @@ import cgeo.geocaching.ui.OwnerActionsClickListener;
import cgeo.geocaching.ui.WeakReferenceHandler;
import cgeo.geocaching.ui.dialog.Dialogs;
import cgeo.geocaching.ui.logs.CacheLogsViewCreator;
+import cgeo.geocaching.utils.CheckerUtils;
import cgeo.geocaching.utils.CryptUtils;
import cgeo.geocaching.utils.Formatter;
import cgeo.geocaching.utils.ImageUtils;
@@ -57,11 +59,11 @@ import cgeo.geocaching.utils.TextUtils;
import cgeo.geocaching.utils.UnknownTagsHandler;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.io.Charsets;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
+import org.eclipse.jdt.annotation.Nullable;
import rx.Observable;
import rx.Observable.OnSubscribe;
@@ -86,8 +88,6 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
-import android.nfc.NdefMessage;
-import android.nfc.NfcAdapter;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
@@ -102,6 +102,7 @@ import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
+import android.text.util.Linkify;
import android.util.TypedValue;
import android.view.ContextMenu;
import android.view.Menu;
@@ -137,7 +138,7 @@ import java.util.regex.Pattern;
* e.g. details, description, logs, waypoints, inventory...
*/
public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailActivity.Page>
- implements CacheMenuHandler.ActivityInterface, INavigationSource, ActivitySharingInterface, EditNoteDialogListener {
+ implements CacheMenuHandler.ActivityInterface, INavigationSource, AndroidBeam.ActivitySharingInterface, EditNoteDialogListener {
private static final int MESSAGE_FAILED = -1;
private static final int MESSAGE_SUCCEEDED = 1;
@@ -186,17 +187,14 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
// get parameters
final Bundle extras = getIntent().getExtras();
- Uri uri = getIntent().getData();
+ final Uri uri = AndroidBeam.getUri(getIntent());
// try to get data from extras
String name = null;
String geocode = null;
String guid = null;
- if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {
- final NdefMessage msg = (NdefMessage) extras.getParcelableArray(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
- uri = Uri.parse("http://" + new String(msg.getRecords()[0].getPayload(), Charsets.UTF_8));
- } else if (extras != null) {
+ if (extras != null) {
geocode = extras.getString(Intents.EXTRA_GEOCODE);
name = extras.getString(Intents.EXTRA_NAME);
guid = extras.getString(Intents.EXTRA_GUID);
@@ -207,6 +205,10 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
geocode = MapsWithMeCacheListApp.getCacheFromMapsWithMe(this, getIntent());
}
+ if (geocode == null && uri != null) {
+ geocode = ConnectorFactory.getGeocodeFromURL(uri.toString());
+ }
+
// try to get data from URI
if (geocode == null && guid == null && uri != null) {
final String uriHost = uri.getHost().toLowerCase(Locale.US);
@@ -238,31 +240,6 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
return;
}
}
- } else if (uriHost.contains("coord.info")) {
- if (StringUtils.startsWith(uriPath, "/gc")) {
- geocode = uriPath.substring(1).toUpperCase(Locale.US);
- } else {
- showToast(res.getString(R.string.err_detail_open));
- finish();
- return;
- }
- } else if (uriHost.contains("opencaching.de") || uriHost.contains("opencaching.fr")) {
- if (StringUtils.startsWith(uriPath, "/oc")) {
- geocode = uriPath.substring(1).toUpperCase(Locale.US);
- } else {
- geocode = uri.getQueryParameter("wp");
- if (StringUtils.isNotBlank(geocode)) {
- geocode = geocode.toUpperCase(Locale.US);
- } else {
- showToast(res.getString(R.string.err_detail_open));
- finish();
- return;
- }
- }
- } else {
- showToast(res.getString(R.string.err_detail_open));
- finish();
- return;
}
}
@@ -306,6 +283,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
}
requireGeodata = getPage(position) == Page.DETAILS;
startOrStopGeoDataListener();
+
+ // cancel contextual actions on page change
+ if (currentActionMode != null) {
+ currentActionMode.finish();
+ }
}
});
requireGeodata = pageToOpen == 1;
@@ -323,10 +305,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
locationUpdater = new CacheDetailsGeoDirHandler(this);
// If we have a newer Android device setup Android Beam for easy cache sharing
- initializeAndroidBeam(this);
+ AndroidBeam.enable(this, this);
}
@Override
+ @Nullable
public String getAndroidBeamUri() {
return cache != null ? cache.getCgeoUrl() : null;
}
@@ -467,7 +450,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
return true;
case R.id.menu_waypoint_caches_around:
if (selectedWaypoint != null) {
- CacheListActivity.startActivityCoordinates(this, selectedWaypoint.getCoords());
+ CacheListActivity.startActivityCoordinates(this, selectedWaypoint.getCoords(), selectedWaypoint.getName());
}
return true;
case R.id.menu_waypoint_reset_cache_coords:
@@ -495,13 +478,12 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
CacheMenuHandler.addMenuItems(this, menu, cache);
- MenuItem menuItem = menu.findItem(R.id.menu_default_navigation);
+ final MenuItem menuItem = menu.findItem(R.id.menu_default_navigation);
final NavigationActionProvider navAction = (NavigationActionProvider) MenuItemCompat.getActionProvider(menuItem);
if (navAction != null) {
navAction.setNavigationSource(this);
}
- menuItem = menu.findItem(R.id.menu_navigate);
- NavigationSelectionActionProvider.initialize(menuItem, cache);
+ NavigationSelectionActionProvider.initialize(menu.findItem(R.id.menu_navigate), cache);
return true;
}
@@ -513,6 +495,13 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
menu.findItem(R.id.menu_delete).setVisible(cache != null && cache.isOffline());
menu.findItem(R.id.menu_refresh).setVisible(cache != null && cache.isOffline());
menu.findItem(R.id.menu_gcvote).setVisible(cache != null && GCVote.isVotingPossible(cache));
+ menu.findItem(R.id.menu_checker).setVisible(cache != null && StringUtils.isNotEmpty(CheckerUtils.getCheckerUrl(cache)));
+ if (cache != null) {
+ final IConnector connector = ConnectorFactory.getConnector(cache);
+ if (connector instanceof IgnoreCapability) {
+ menu.findItem(R.id.menu_ignore).setVisible(((IgnoreCapability) connector).canIgnoreCache(cache));
+ }
+ }
return super.onPrepareOptionsMenu(menu);
}
@@ -537,6 +526,12 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
case R.id.menu_gcvote:
showVoteDialog();
return true;
+ case R.id.menu_checker:
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(CheckerUtils.getCheckerUrl(cache))));
+ return true;
+ case R.id.menu_ignore:
+ ignoreCache();
+ return true;
default:
if (NavigationAppFactory.onMenuItemSelected(item, this, cache)) {
return true;
@@ -550,6 +545,15 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
return super.onOptionsItemSelected(item);
}
+ private void ignoreCache() {
+ RxUtils.networkScheduler.createWorker().schedule(new Action0() {
+ @Override
+ public void call() {
+ ((IgnoreCapability) ConnectorFactory.getConnector(cache)).ignoreCache(cache);
+ }
+ });
+ }
+
private void showVoteDialog() {
GCVoteDialog.show(this, cache, new Runnable() {
@Override
@@ -1288,6 +1292,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
});
+ /**
+ * Reflect the (contextual) action mode of the action bar.
+ */
+ protected ActionMode currentActionMode;
+
protected class DescriptionViewCreator extends AbstractCachingPageViewCreator<ScrollView> {
@InjectView(R.id.personalnote) protected TextView personalNoteView;
@@ -1463,9 +1472,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
if (unknownTagsHandler.isProblematicDetected()) {
final int startPos = description.length();
final IConnector connector = ConnectorFactory.getConnector(cache);
- final Spanned tableNote = Html.fromHtml(res.getString(R.string.cache_description_table_note, "<a href=\"" + cache.getUrl() + "\">" + connector.getName() + "</a>"));
- ((Editable) description).append("\n\n").append(tableNote);
- ((Editable) description).setSpan(new StyleSpan(Typeface.ITALIC), startPos, description.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ if (StringUtils.isNotEmpty(cache.getUrl())) {
+ final Spanned tableNote = Html.fromHtml(res.getString(R.string.cache_description_table_note, "<a href=\"" + cache.getUrl() + "\">" + connector.getName() + "</a>"));
+ ((Editable) description).append("\n\n").append(tableNote);
+ ((Editable) description).setSpan(new StyleSpan(Typeface.ITALIC), startPos, description.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
+ }
}
}
/**
@@ -1786,7 +1797,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
@Override
public boolean onLongClick(final View v) {
- startSupportActionMode(new ActionMode.Callback() {
+ currentActionMode = startSupportActionMode(new ActionMode.Callback() {
@Override
public boolean onPrepareActionMode(final ActionMode actionMode, final Menu menu) {
@@ -1835,7 +1846,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
@Override
public void onDestroyActionMode(final ActionMode actionMode) {
- // do nothing
+ currentActionMode = null;
}
@Override
@@ -2177,6 +2188,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
personalNoteView.setText(personalNote, TextView.BufferType.SPANNABLE);
if (StringUtils.isNotBlank(personalNote)) {
personalNoteView.setVisibility(View.VISIBLE);
+ Linkify.addLinks(personalNoteView, Linkify.ALL);
} else {
personalNoteView.setVisibility(View.GONE);
}
@@ -2194,6 +2206,10 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
@Override
public void cachesAround() {
- CacheListActivity.startActivityCoordinates(this, cache.getCoords());
+ CacheListActivity.startActivityCoordinates(this, cache.getCoords(), cache.getName());
+ }
+
+ public void setNeedsRefresh() {
+ refreshOnResume = true;
}
}
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java
index 9090a4e..96a0ac1 100644
--- a/main/src/cgeo/geocaching/CacheListActivity.java
+++ b/main/src/cgeo/geocaching/CacheListActivity.java
@@ -9,7 +9,9 @@ import cgeo.geocaching.activity.FilteredActivity;
import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.activity.ShowcaseViewBuilder;
import cgeo.geocaching.apps.cache.navi.NavigationAppFactory;
-import cgeo.geocaching.apps.cachelist.CacheListAppFactory;
+import cgeo.geocaching.apps.cachelist.CacheListApp;
+import cgeo.geocaching.apps.cachelist.CacheListApps;
+import cgeo.geocaching.apps.cachelist.ListNavigationSelectionActionProvider;
import cgeo.geocaching.compatibility.Compatibility;
import cgeo.geocaching.connector.gc.RecaptchaHandler;
import cgeo.geocaching.enumerations.CacheListType;
@@ -19,7 +21,7 @@ import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.export.FieldnoteExport;
import cgeo.geocaching.export.GpxExport;
import cgeo.geocaching.files.GPXImporter;
-import cgeo.geocaching.filter.FilterUserInterface;
+import cgeo.geocaching.filter.FilterActivity;
import cgeo.geocaching.filter.IFilter;
import cgeo.geocaching.list.AbstractList;
import cgeo.geocaching.list.ListNameMemento;
@@ -54,8 +56,8 @@ import cgeo.geocaching.ui.WeakReferenceHandler;
import cgeo.geocaching.ui.dialog.Dialogs;
import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.AsyncTaskWithProgress;
+import cgeo.geocaching.utils.CalendarUtils;
import cgeo.geocaching.utils.CancellableHandler;
-import cgeo.geocaching.utils.DateUtils;
import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.RxUtils;
@@ -558,7 +560,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
public boolean onCreateOptionsMenu(final Menu menu) {
getMenuInflater().inflate(R.menu.cache_list_options, menu);
- CacheListAppFactory.addMenuItems(menu, this, res);
sortProvider = (SortActionProvider) MenuItemCompat.getActionProvider(menu.findItem(R.id.menu_sort));
assert sortProvider != null; // We set it in the XML file
sortProvider.setSelection(adapter.getCacheComparator());
@@ -579,6 +580,15 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
sortProvider.setSelection(selectedComparator);
}
});
+
+ ListNavigationSelectionActionProvider.initialize(menu.findItem(R.id.menu_cache_list_app_provider), new ListNavigationSelectionActionProvider.Callback() {
+
+ @Override
+ public void onListNavigationSelected(final CacheListApp app) {
+ app.invoke(cacheList, CacheListActivity.this, getFilteredSearch());
+ }
+ });
+
return true;
}
@@ -639,6 +649,11 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
setMenuItemLabel(menu, R.id.menu_remove_from_history, R.string.cache_remove_from_history, R.string.cache_clear_history);
menu.findItem(R.id.menu_import_android).setVisible(Compatibility.isStorageAccessFrameworkAvailable() && isOffline);
+
+ final List<CacheListApp> listNavigationApps = CacheListApps.getActiveApps();
+ menu.findItem(R.id.menu_cache_list_app_provider).setVisible(listNavigationApps.size() > 1);
+ menu.findItem(R.id.menu_cache_list_app).setVisible(listNavigationApps.size() == 1);
+
} catch (final RuntimeException e) {
Log.e("CacheListActivity.onPrepareOptionsMenu", e);
}
@@ -648,7 +663,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
private boolean containsPastEvents() {
for (final Geocache cache : adapter.getCheckedOrAllCaches()) {
- if (DateUtils.isPastEvent(cache)) {
+ if (CalendarUtils.isPastEvent(cache)) {
return true;
}
}
@@ -679,9 +694,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
- if (super.onOptionsItemSelected(item)) {
- return true;
- }
switch (item.getItemId()) {
case R.id.menu_show_on_map:
goMap();
@@ -705,23 +717,23 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
case R.id.menu_import_android:
importGpxFromAndroid();
invalidateOptionsMenuCompatible();
- return false;
+ return true;
case R.id.menu_create_list:
new StoredList.UserInterface(this).promptForListCreation(getListSwitchingRunnable(), listNameMemento.getTerm());
refreshSpinnerAdapter();
invalidateOptionsMenuCompatible();
- return false;
+ return true;
case R.id.menu_drop_list:
removeList(false);
invalidateOptionsMenuCompatible();
- return false;
+ return true;
case R.id.menu_rename_list:
renameList();
- return false;
+ return true;
case R.id.menu_invert_selection:
adapter.invertSelection();
invalidateOptionsMenuCompatible();
- return false;
+ return true;
case R.id.menu_filter:
showFilterMenu(null);
return true;
@@ -737,7 +749,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
case R.id.menu_remove_from_history:
removeFromHistoryCheck();
invalidateOptionsMenuCompatible();
- return false;
+ return true;
case R.id.menu_move_to_list:
moveCachesToOtherList();
invalidateOptionsMenuCompatible();
@@ -751,13 +763,12 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
invalidateOptionsMenuCompatible();
return true;
case R.id.menu_cache_list_app:
- if (!cacheToShow()) {
- return false;
+ if (cacheToShow()) {
+ CacheListApps.getActiveApps().get(0).invoke(cacheList, this, getFilteredSearch());
}
- return CacheListAppFactory.onMenuItemSelected(item, cacheList, this, getFilteredSearch());
- default:
- return CacheListAppFactory.onMenuItemSelected(item, cacheList, this, search);
+ return true;
}
+ return super.onOptionsItemSelected(item);
}
private boolean cacheToShow() {
@@ -775,7 +786,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
private void deletePastEvents() {
final List<Geocache> deletion = new ArrayList<>();
for (final Geocache cache : adapter.getCheckedOrAllCaches()) {
- if (DateUtils.isPastEvent(cache)) {
+ if (CalendarUtils.isPastEvent(cache)) {
deletion.add(cache);
}
}
@@ -798,12 +809,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
*/
@Override
public void showFilterMenu(final View view) {
- new FilterUserInterface(this).selectFilter(new Action1<IFilter>() {
- @Override
- public void call(@Nullable final IFilter selectedFilter) {
- setFilter(selectedFilter);
- }
- });
+ FilterActivity.selectFilter(this);
}
private void setComparator(final CacheComparator comparator) {
@@ -1048,6 +1054,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
new GPXImporter(this, listId, importGpxAttachementFinishedHandler).importGPX(uri, null, getDisplayName(uri));
}
}
+ else if (requestCode == FilterActivity.REQUEST_SELECT_FILTER && resultCode == Activity.RESULT_OK) {
+ final int[] filterIndex = data.getIntArrayExtra(FilterActivity.EXTRA_FILTER_RESULT);
+ setFilter(FilterActivity.getFilterFromPosition(filterIndex[0], filterIndex[1]));
+ }
refreshCurrentList();
}
@@ -1384,12 +1394,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
// apply filter settings (if there's a filter)
final SearchResult searchToUse = getFilteredSearch();
- final int count = searchToUse.getCount();
- String mapTitle = title;
- if (count > 0) {
- mapTitle = title + " [" + count + "]";
- }
- CGeoMap.startActivitySearch(this, searchToUse, mapTitle);
+ CGeoMap.startActivitySearch(this, searchToUse, title);
}
private void refreshCurrentList() {
@@ -1463,13 +1468,23 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
context.startActivity(addressIntent);
}
- public static void startActivityCoordinates(final AbstractActivity context, final Geopoint coords) {
+ /**
+ * start list activity, by searching around the given point.
+ *
+ * @param name
+ * name of coordinates, will lead to a title like "Around ..." instead of directly showing the
+ * coordinates as title
+ */
+ public static void startActivityCoordinates(final AbstractActivity context, final Geopoint coords, @Nullable final String name) {
if (!isValidCoords(context, coords)) {
return;
}
final Intent cachesIntent = new Intent(context, CacheListActivity.class);
Intents.putListType(cachesIntent, CacheListType.COORDINATE);
cachesIntent.putExtra(Intents.EXTRA_COORDS, coords);
+ if (StringUtils.isNotEmpty(name)) {
+ cachesIntent.putExtra(Intents.EXTRA_TITLE, context.getString(R.string.around, name));
+ }
context.startActivity(cachesIntent);
}
@@ -1600,6 +1615,10 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
loader = new PocketGeocacheListLoader(app, guid);
break;
}
+ // if there is a title given in the activity start request, use this one instead of the default
+ if (extras != null && StringUtils.isNotBlank(extras.getString(Intents.EXTRA_TITLE))) {
+ title = extras.getString(Intents.EXTRA_TITLE);
+ }
updateTitle();
showProgress(true);
showFooterLoadingCaches();
@@ -1639,8 +1658,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
/**
* Allow the title bar spinner to show the same subtitle like the activity itself would show.
*
- * @param list
- * @return
*/
public CharSequence getCacheListSubtitle(@NonNull final AbstractList list) {
// if this is the current list, be aware of filtering
@@ -1658,7 +1675,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
/**
* Calculate the subtitle of the current list depending on (optional) filters.
*
- * @return
*/
private CharSequence getCurrentSubtitle() {
final ArrayList<String> numbers = new ArrayList<>();
diff --git a/main/src/cgeo/geocaching/CacheMenuHandler.java b/main/src/cgeo/geocaching/CacheMenuHandler.java
index fa2f994..fbd8771 100644
--- a/main/src/cgeo/geocaching/CacheMenuHandler.java
+++ b/main/src/cgeo/geocaching/CacheMenuHandler.java
@@ -6,6 +6,8 @@ import cgeo.geocaching.apps.cache.navi.NavigationSelectionActionProvider;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.ui.AbstractUIFactory;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.app.Activity;
import android.support.v4.app.Fragment;
import android.support.v4.view.MenuItemCompat;
@@ -38,7 +40,7 @@ public final class CacheMenuHandler extends AbstractUIFactory {
}
- public static boolean onMenuItemSelected(final MenuItem item, final CacheMenuHandler.ActivityInterface activityInterface, final Geocache cache) {
+ public static boolean onMenuItemSelected(final MenuItem item, @NonNull final CacheMenuHandler.ActivityInterface activityInterface, final Geocache cache) {
assert activityInterface instanceof Activity || activityInterface instanceof Fragment;
final Activity activity;
if (activityInterface instanceof Activity) {
diff --git a/main/src/cgeo/geocaching/CompassActivity.java b/main/src/cgeo/geocaching/CompassActivity.java
index 27dbb4a..d481d58 100644
--- a/main/src/cgeo/geocaching/CompassActivity.java
+++ b/main/src/cgeo/geocaching/CompassActivity.java
@@ -182,7 +182,12 @@ public class CompassActivity extends AbstractActionBarActivity {
final int id = item.getItemId();
switch (id) {
case R.id.menu_map:
- CGeoMap.startActivityCoords(this, dstCoords, null, null);
+ if (cache != null) {
+ CGeoMap.startActivityGeoCode(this, cache.getGeocode());
+ }
+ else {
+ CGeoMap.startActivityCoords(this, dstCoords, null, null);
+ }
return true;
case R.id.menu_compass_sensor_gps:
Settings.setUseCompass(false);
@@ -203,6 +208,9 @@ public class CompassActivity extends AbstractActionBarActivity {
case R.id.menu_compass_cache:
setTarget(cache);
return true;
+ case R.id.menu_hint:
+ cache.showHintToast(this);
+ return true;
default:
if (LoggingUI.onMenuItemSelected(item, this, cache)) {
return true;
diff --git a/main/src/cgeo/geocaching/CreateShortcutActivity.java b/main/src/cgeo/geocaching/CreateShortcutActivity.java
index 70ab900..ecb7dc4 100644
--- a/main/src/cgeo/geocaching/CreateShortcutActivity.java
+++ b/main/src/cgeo/geocaching/CreateShortcutActivity.java
@@ -1,6 +1,7 @@
package cgeo.geocaching;
import cgeo.geocaching.activity.AbstractActionBarActivity;
+import cgeo.geocaching.list.PseudoList;
import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.maps.MapActivity;
import cgeo.geocaching.ui.dialog.Dialogs;
@@ -67,8 +68,11 @@ public class CreateShortcutActivity extends AbstractActionBarActivity {
// shortcuts.add(new Shortcut(R.string.cache_menu_visit, new Intent(this, LogCacheActivity.class)));
// shortcuts.add(new Shortcut(R.string.trackable_log_touch, new Intent(this, LogTrackableActivity.class)));
- final Shortcut offlineShortcut = new Shortcut(R.string.stored_caches_button, R.drawable.main_stored, null);
+ final Shortcut offlineShortcut = new Shortcut(R.string.list_title, R.drawable.main_stored, null);
shortcuts.add(offlineShortcut);
+ final Intent allIntent = new Intent(this, CacheListActivity.class);
+ allIntent.putExtra(Intents.EXTRA_LIST_ID, PseudoList.ALL_LIST.id);
+ shortcuts.add(new Shortcut(R.string.list_all_lists, R.drawable.main_stored, allIntent));
shortcuts.add(new Shortcut(R.string.advanced_search_button, R.drawable.main_search, new Intent(this, SearchActivity.class)));
shortcuts.add(new Shortcut(R.string.any_button, R.drawable.main_any, new Intent(this, NavigateAnyPointActivity.class)));
shortcuts.add(new Shortcut(R.string.menu_history, R.drawable.main_stored, CacheListActivity.getHistoryIntent(this)));
@@ -94,7 +98,7 @@ public class CreateShortcutActivity extends AbstractActionBarActivity {
public void call(final Integer listId) {
createOfflineListShortcut(listId);
}
- }, true, -1);
+ }, true, PseudoList.NEW_LIST.id);
}
protected void createOfflineListShortcut(final int listId) {
diff --git a/main/src/cgeo/geocaching/DataStore.java b/main/src/cgeo/geocaching/DataStore.java
index 02f48a0..b7ca577 100644
--- a/main/src/cgeo/geocaching/DataStore.java
+++ b/main/src/cgeo/geocaching/DataStore.java
@@ -39,7 +39,6 @@ import rx.functions.Action1;
import rx.functions.Func0;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
-import rx.util.async.Async;
import android.app.Activity;
import android.app.ProgressDialog;
@@ -403,16 +402,15 @@ public class DataStore {
* Move the database to/from external cgdata in a new thread,
* showing a progress window
*
- * @param fromActivity
*/
public static void moveDatabase(final Activity fromActivity) {
final ProgressDialog dialog = ProgressDialog.show(fromActivity, fromActivity.getString(R.string.init_dbmove_dbmove), fromActivity.getString(R.string.init_dbmove_running), true, false);
- AppObservable.bindActivity(fromActivity, Async.fromCallable(new Func0<Boolean>() {
+ AppObservable.bindActivity(fromActivity, Observable.defer(new Func0<Observable<Boolean>>() {
@Override
- public Boolean call() {
+ public Observable<Boolean> call() {
if (!LocalStorage.isExternalStorageAvailable()) {
Log.w("Database was not moved: external memory not available");
- return false;
+ return Observable.just(false);
}
closeDb();
@@ -421,7 +419,7 @@ public class DataStore {
if (!LocalStorage.copy(source, target)) {
Log.e("Database could not be moved to " + target);
init();
- return false;
+ return Observable.just(false);
}
if (!FileUtils.delete(source)) {
Log.e("Original database could not be deleted during move");
@@ -430,7 +428,7 @@ public class DataStore {
Log.i("Database was moved to " + target);
init();
- return true;
+ return Observable.just(true);
}
})).subscribeOn(Schedulers.io()).subscribe(new Action1<Boolean>() {
@Override
@@ -884,7 +882,7 @@ public class DataStore {
final File[] files = LocalStorage.getStorage().listFiles();
if (ArrayUtils.isNotEmpty(files)) {
final Pattern oldFilePattern = Pattern.compile("^[GC|TB|EC|GK|O][A-Z0-9]{4,7}$");
- final SQLiteStatement select = db.compileStatement("select count(*) from " + dbTableCaches + " where geocode = ?");
+ final SQLiteStatement select = PreparedStatement.CHECK_IF_PRESENT.getStatement();
final ArrayList<File> toRemove = new ArrayList<>(files.length);
for (final File file : files) {
if (file.isDirectory()) {
@@ -907,7 +905,7 @@ public class DataStore {
public void call() {
for (final File dir : toRemove) {
Log.i("Removing obsolete cache directory for " + dir.getName());
- LocalStorage.deleteDirectory(dir);
+ FileUtils.deleteDirectory(dir);
}
}
});
@@ -1062,7 +1060,6 @@ public class DataStore {
*
* @param cache
* the Cache to save in the CacheCache/DB
- * @param saveFlags
*
*/
public static void saveCache(final Geocache cache, final Set<LoadFlags.SaveFlag> saveFlags) {
@@ -1074,7 +1071,6 @@ public class DataStore {
*
* @param caches
* the caches to save in the CacheCache/DB
- * @param saveFlags
*
*/
public static void saveCaches(final Collection<Geocache> caches, final Set<LoadFlags.SaveFlag> saveFlags) {
@@ -1313,7 +1309,6 @@ public class DataStore {
/**
* remove all waypoints of the given cache, where the id is not in the given list
*
- * @param cache
* @param remainingWaypointIds
* ids of waypoints which shall not be deleted
*/
@@ -1563,7 +1558,6 @@ public class DataStore {
/**
* Load caches.
*
- * @param geocodes
* @return Set of loaded caches. Never null.
*/
@NonNull
@@ -1619,8 +1613,6 @@ public class DataStore {
/**
* Load caches.
*
- * @param geocodes
- * @param loadFlags
* @return Set of loaded caches. Never null.
*/
@NonNull
@@ -1710,9 +1702,6 @@ public class DataStore {
/**
* Builds a where for a viewport with the size enhanced by 50%.
*
- * @param dbTable
- * @param viewport
- * @return
*/
@NonNull
@@ -1723,7 +1712,6 @@ public class DataStore {
/**
* creates a Cache from the cursor. Doesn't next.
*
- * @param cursor
* @return Cache from DB
*/
@NonNull
@@ -1939,7 +1927,6 @@ public class DataStore {
}
/**
- * @param geocode
* @return an immutable, non null list of logs
*/
@NonNull
@@ -2089,9 +2076,6 @@ public class DataStore {
/**
* Number of caches stored for a given type and/or list
*
- * @param cacheType
- * @param list
- * @return
*/
public static int getAllStoredCachesCount(final CacheType cacheType, final int list) {
if (cacheType == null) {
@@ -2177,8 +2161,6 @@ public class DataStore {
*
* @param coords
* the current coordinates to sort by distance, or null to sort by geocode
- * @param cacheType
- * @param listId
* @return a non-null set of geocodes
*/
@NonNull
@@ -2374,7 +2356,7 @@ public class DataStore {
database.delete(dbTableLogImages, "log_id NOT IN (SELECT _id FROM " + dbTableLogs + ")", null);
// Remove the obsolete "_others" directory where the user avatar used to be stored.
- LocalStorage.deleteDirectory(LocalStorage.getStorageDir("_others"));
+ FileUtils.deleteDirectory(LocalStorage.getStorageDir("_others"));
if (version > -1) {
Settings.setVersion(version);
@@ -2391,8 +2373,6 @@ public class DataStore {
/**
* remove all geocodes from the given list of geocodes where an offline log exists
*
- * @param geocodes
- * @return
*/
@NonNull
private static Set<String> exceptCachesWithOfflineLog(@NonNull final Set<String> geocodes) {
@@ -2472,7 +2452,7 @@ public class DataStore {
// Delete cache directories
for (final String geocode : geocodes) {
- LocalStorage.deleteDirectory(LocalStorage.getStorageDir(geocode));
+ FileUtils.deleteDirectory(LocalStorage.getStorageDir(geocode));
}
}
}
@@ -2739,7 +2719,6 @@ public class DataStore {
/**
* Remove a list. Caches in the list are moved to the standard list.
*
- * @param listId
* @return true if the list got deleted, false else
*/
public static boolean removeList(final int listId) {
@@ -2831,8 +2810,6 @@ public class DataStore {
/**
* Load the lazily initialized fields of a cache and return them as partial cache (all other fields unset).
*
- * @param geocode
- * @return
*/
@NonNull
public static Geocache loadCacheTexts(final String geocode) {
@@ -2909,10 +2886,6 @@ public class DataStore {
/**
* Loads all Waypoints in the coordinate rectangle.
*
- * @param excludeDisabled
- * @param excludeMine
- * @param type
- * @return
*/
@NonNull
@@ -2951,7 +2924,7 @@ public class DataStore {
private static enum PreparedStatement {
- HISTORY_COUNT("select count(_id) from " + dbTableCaches + " where visiteddate > 0"),
+ HISTORY_COUNT("SELECT COUNT(_id) FROM " + dbTableCaches + " WHERE visiteddate > 0"),
MOVE_TO_STANDARD_LIST("UPDATE " + dbTableCaches + " SET reason = " + StoredList.STANDARD_LIST_ID + " WHERE reason = ?"),
MOVE_TO_LIST("UPDATE " + dbTableCaches + " SET reason = ? WHERE geocode = ?"),
UPDATE_VISIT_DATE("UPDATE " + dbTableCaches + " SET visiteddate = ? WHERE geocode = ?"),
@@ -2967,10 +2940,11 @@ public class DataStore {
LIST_ID_OF_GUID("SELECT reason FROM " + dbTableCaches + " WHERE guid = ?"),
GEOCODE_OF_GUID("SELECT geocode FROM " + dbTableCaches + " WHERE guid = ?"),
INSERT_SEARCH_DESTINATION("INSERT INTO " + dbTableSearchDestinationHistory + " (date, latitude, longitude) VALUES (?, ?, ?)"),
- COUNT_TYPE_ALL_LIST("select count(_id) from " + dbTableCaches + " where detailed = 1 and type = ? and reason > 0"), // See use of COUNT_TYPE_LIST for synchronization
- COUNT_ALL_TYPES_ALL_LIST("select count(_id) from " + dbTableCaches + " where detailed = 1 and reason > 0"), // See use of COUNT_TYPE_LIST for synchronization
- COUNT_TYPE_LIST("select count(_id) from " + dbTableCaches + " where detailed = 1 and type = ? and reason = ?"),
- COUNT_ALL_TYPES_LIST("select count(_id) from " + dbTableCaches + " where detailed = 1 and reason = ?"); // See use of COUNT_TYPE_LIST for synchronization
+ COUNT_TYPE_ALL_LIST("SELECT COUNT(_id) FROM " + dbTableCaches + " WHERE detailed = 1 AND type = ? AND reason > 0"), // See use of COUNT_TYPE_LIST for synchronization
+ COUNT_ALL_TYPES_ALL_LIST("SELECT COUNT(_id) FROM " + dbTableCaches + " WHERE detailed = 1 AND reason > 0"), // See use of COUNT_TYPE_LIST for synchronization
+ COUNT_TYPE_LIST("SELECT COUNT(_id) FROM " + dbTableCaches + " WHERE detailed = 1 AND type = ? AND reason = ?"),
+ COUNT_ALL_TYPES_LIST("SELECT COUNT(_id) FROM " + dbTableCaches + " WHERE detailed = 1 AND reason = ?"), // See use of COUNT_TYPE_LIST for synchronization
+ CHECK_IF_PRESENT("SELECT COUNT(*) FROM " + dbTableCaches + " WHERE geocode = ?");
private static final List<PreparedStatement> statements = new ArrayList<>();
diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java
index 8cb947a..ce279bf 100644
--- a/main/src/cgeo/geocaching/EditWaypointActivity.java
+++ b/main/src/cgeo/geocaching/EditWaypointActivity.java
@@ -331,7 +331,6 @@ public class EditWaypointActivity extends AbstractActionBarActivity implements C
* @param type
* type to create a new default name for
*
- * @return
*/
private String getDefaultWaypointName(final WaypointType type) {
final ArrayList<String> wpNames = new ArrayList<>();
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index ccec153..033196c 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -24,8 +24,8 @@ import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.settings.Settings;
+import cgeo.geocaching.utils.CalendarUtils;
import cgeo.geocaching.utils.CancellableHandler;
-import cgeo.geocaching.utils.DateUtils;
import cgeo.geocaching.utils.ImageUtils;
import cgeo.geocaching.utils.LazyInitializedList;
import cgeo.geocaching.utils.Log;
@@ -85,6 +85,8 @@ public class Geocache implements IWaypoint {
private long visitedDate = 0;
private int listId = StoredList.TEMPORARY_LIST.id;
private boolean detailed = false;
+
+ @NonNull
private String geocode = "";
private String cacheId = "";
private String guid = "";
@@ -484,6 +486,9 @@ public class Geocache implements IWaypoint {
}
public void openInBrowser(final Activity fromActivity) {
+ if (getUrl() == null) {
+ return;
+ }
final Intent viewIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getLongUrl()));
// Check if cgeo is the default, show the chooser to let the user choose a browser
@@ -696,11 +701,7 @@ public class Geocache implements IWaypoint {
return getConnector() instanceof ISearchByCenter;
}
- public void shareCache(final Activity fromActivity, final Resources res) {
- if (geocode == null) {
- return;
- }
-
+ public void shareCache(@NonNull final Activity fromActivity, final Resources res) {
final Intent intent = getShareIntent();
fromActivity.startActivity(Intent.createChooser(intent, res.getText(R.string.cache_menu_share)));
@@ -717,22 +718,22 @@ public class Geocache implements IWaypoint {
final Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SUBJECT, subject.toString());
- intent.putExtra(Intent.EXTRA_TEXT, getUrl());
+ intent.putExtra(Intent.EXTRA_TEXT, StringUtils.defaultString(getUrl()));
return intent;
}
- @NonNull
+ @Nullable
public String getUrl() {
return getConnector().getCacheUrl(this);
}
- @NonNull
+ @Nullable
public String getLongUrl() {
return getConnector().getLongCacheUrl(this);
}
- @NonNull
+ @Nullable
public String getCgeoUrl() {
return getConnector().getCacheUrl(this);
}
@@ -1060,7 +1061,7 @@ public class Geocache implements IWaypoint {
this.directionImg = directionImg;
}
- public void setGeocode(final String geocode) {
+ public void setGeocode(@NonNull final String geocode) {
this.geocode = StringUtils.upperCase(geocode);
}
@@ -1634,10 +1635,9 @@ public class Geocache implements IWaypoint {
*
* @return start time in minutes after midnight
*/
- @Nullable
- public String guessEventTimeMinutes() {
+ public int guessEventTimeMinutes() {
if (!isEventCache()) {
- return null;
+ return -1;
}
final String hourLocalized = CgeoApplication.getInstance().getString(R.string.cache_time_full_hours);
@@ -1649,7 +1649,7 @@ public class Geocache implements IWaypoint {
// 17 - 20 o'clock
patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?" + "\\s*(?:-|[a-z]+)\\s*" + "(?:\\d{1,2})(?:\\.00)?" + "\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
// 12 o'clock, 12.00 o'clock
- patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
+ patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.(00|15|30|45))?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
}
final String searchText = getShortDescription() + ' ' + getDescription();
@@ -1659,18 +1659,18 @@ public class Geocache implements IWaypoint {
try {
final int hours = Integer.parseInt(matcher.group(1));
int minutes = 0;
- if (matcher.groupCount() >= 2) {
+ if (matcher.groupCount() >= 2 && !StringUtils.isEmpty(matcher.group(2))) {
minutes = Integer.parseInt(matcher.group(2));
}
if (hours >= 0 && hours < 24 && minutes >= 0 && minutes < 60) {
- return String.valueOf(hours * 60 + minutes);
+ return hours * 60 + minutes;
}
} catch (final NumberFormatException ignored) {
// cannot happen, but static code analysis doesn't know
}
}
}
- return null;
+ return -1;
}
public boolean hasStaticMap() {
@@ -1774,9 +1774,9 @@ public class Geocache implements IWaypoint {
public LogType getDefaultLogType() {
if (isEventCache()) {
final Date eventDate = getHiddenDate();
- final boolean expired = DateUtils.isPastEvent(this);
+ final boolean expired = CalendarUtils.isPastEvent(this);
- if (hasOwnLog(LogType.WILL_ATTEND) || expired || (eventDate != null && DateUtils.daysSince(eventDate.getTime()) == 0)) {
+ if (hasOwnLog(LogType.WILL_ATTEND) || expired || (eventDate != null && CalendarUtils.daysSince(eventDate.getTime()) == 0)) {
return hasOwnLog(LogType.ATTENDED) ? LogType.NOTE : LogType.ATTENDED;
}
return LogType.WILL_ATTEND;
@@ -1808,4 +1808,12 @@ public class Geocache implements IWaypoint {
return geocodes;
}
+ /**
+ * Show the hint as toast message. If no hint is available, a default "no hint available" will be shown instead.
+ */
+ public void showHintToast(final Activity activity) {
+ final String hint = getHint();
+ ActivityMixin.showToast(activity, StringUtils.defaultIfBlank(hint, activity.getString(R.string.cache_hint_not_available)));
+ }
+
}
diff --git a/main/src/cgeo/geocaching/Image.java b/main/src/cgeo/geocaching/Image.java
index f592fc1..5c0e4f0 100644
--- a/main/src/cgeo/geocaching/Image.java
+++ b/main/src/cgeo/geocaching/Image.java
@@ -31,7 +31,7 @@ public class Image implements Parcelable {
}
public Image(final File file) {
- this("file://" + file.getAbsolutePath(), file.getName(), null);
+ this(FileUtils.fileToUrl(file), file.getName(), null);
}
public Image(final Parcel in) {
@@ -46,7 +46,7 @@ public class Image implements Parcelable {
}
@Override
- public void writeToParcel(Parcel dest, int flags) {
+ public void writeToParcel(final Parcel dest, final int flags) {
dest.writeString(url);
dest.writeString(title);
dest.writeString(description);
@@ -54,12 +54,12 @@ public class Image implements Parcelable {
public static final Parcelable.Creator<Image> CREATOR = new Parcelable.Creator<Image>() {
@Override
- public Image createFromParcel(Parcel in) {
+ public Image createFromParcel(final Parcel in) {
return new Image(in);
}
@Override
- public Image[] newArray(int size) {
+ public Image[] newArray(final int size) {
return new Image[size];
}
};
diff --git a/main/src/cgeo/geocaching/ImageSelectActivity.java b/main/src/cgeo/geocaching/ImageSelectActivity.java
index 26f105e..9d1c1e0 100644
--- a/main/src/cgeo/geocaching/ImageSelectActivity.java
+++ b/main/src/cgeo/geocaching/ImageSelectActivity.java
@@ -293,7 +293,6 @@ public class ImageSelectActivity extends AbstractActionBarActivity {
/**
* Scales and writes the scaled image.
*
- * @param filePath
* @return the scaled image path, or <tt>null</tt> if the image cannot be decoded
*/
@Nullable
diff --git a/main/src/cgeo/geocaching/ImagesActivity.java b/main/src/cgeo/geocaching/ImagesActivity.java
index b75e5eb..975a720 100644
--- a/main/src/cgeo/geocaching/ImagesActivity.java
+++ b/main/src/cgeo/geocaching/ImagesActivity.java
@@ -6,6 +6,7 @@ import cgeo.geocaching.ui.ImagesList;
import cgeo.geocaching.ui.ImagesList.ImageType;
import org.apache.commons.collections4.CollectionUtils;
+
import rx.Subscription;
import android.content.Context;
@@ -28,7 +29,7 @@ public class ImagesActivity extends AbstractActionBarActivity {
private Subscription subscription;
@Override
- public void onCreate(Bundle savedInstanceState) {
+ public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// get parameters
@@ -78,11 +79,12 @@ public class ImagesActivity extends AbstractActionBarActivity {
super.onStop();
}
- public static void startActivityLogImages(final Context fromActivity, final String geocode, List<Image> logImages) {
+ public static void startActivityLogImages(final Context fromActivity, final String geocode, final List<Image> logImages) {
startActivity(fromActivity, geocode, logImages, ImageType.LogImages);
}
- private static void startActivity(final Context fromActivity, final String geocode, List<Image> logImages, ImageType imageType) {
+ @SuppressWarnings("deprecation")
+ private static void startActivity(final Context fromActivity, final String geocode, final List<Image> logImages, final ImageType imageType) {
final Intent logImgIntent = new Intent(fromActivity, ImagesActivity.class);
// if resuming our app within this activity, finish it and return to the cache activity
logImgIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET)
@@ -95,18 +97,18 @@ public class ImagesActivity extends AbstractActionBarActivity {
fromActivity.startActivity(logImgIntent);
}
- public static void startActivitySpoilerImages(final Context fromActivity, String geocode, List<Image> spoilers) {
+ public static void startActivitySpoilerImages(final Context fromActivity, final String geocode, final List<Image> spoilers) {
startActivity(fromActivity, geocode, spoilers, ImageType.SpoilerImages);
}
@Override
- public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+ public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
imagesList.onCreateContextMenu(menu, v);
}
@Override
- public boolean onContextItemSelected(MenuItem item) {
+ public boolean onContextItemSelected(final MenuItem item) {
if (imagesList.onContextItemSelected(item)) {
return true;
}
diff --git a/main/src/cgeo/geocaching/Intents.java b/main/src/cgeo/geocaching/Intents.java
index 5b57aba..cbf2346 100644
--- a/main/src/cgeo/geocaching/Intents.java
+++ b/main/src/cgeo/geocaching/Intents.java
@@ -35,7 +35,7 @@ public class Intents {
public static final String EXTRA_WPTTYPE = PREFIX + "wpttype";
public static final String EXTRA_MAPSTATE = PREFIX + "mapstate";
- public static final String EXTRA_MAP_TITLE = PREFIX + "mapTitle";
+ public static final String EXTRA_TITLE = PREFIX + "title";
public static final String EXTRA_MAP_MODE = PREFIX + "mapMode";
public static final String EXTRA_LIVE_ENABLED = PREFIX + "liveEnabled";
diff --git a/main/src/cgeo/geocaching/LogCacheActivity.java b/main/src/cgeo/geocaching/LogCacheActivity.java
index 1d31e27..2f50232 100644
--- a/main/src/cgeo/geocaching/LogCacheActivity.java
+++ b/main/src/cgeo/geocaching/LogCacheActivity.java
@@ -19,7 +19,7 @@ import cgeo.geocaching.twitter.Twitter;
import cgeo.geocaching.ui.dialog.DateDialog;
import cgeo.geocaching.ui.dialog.Dialogs;
import cgeo.geocaching.utils.AsyncTaskWithProgress;
-import cgeo.geocaching.utils.DateUtils;
+import cgeo.geocaching.utils.CalendarUtils;
import cgeo.geocaching.utils.Formatter;
import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.LogTemplateProvider;
@@ -301,7 +301,7 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
rating = GCVote.NO_RATING;
typeSelected = cache.getDefaultLogType();
// it this is an attended event log, use the event date by default instead of the current date
- if (cache.isEventCache() && DateUtils.isPastEvent(cache) && typeSelected == LogType.ATTENDED) {
+ if (cache.isEventCache() && CalendarUtils.isPastEvent(cache) && typeSelected == LogType.ATTENDED) {
date.setTime(cache.getHiddenDate());
}
text = null;
@@ -618,6 +618,10 @@ public class LogCacheActivity extends AbstractLoggingActivity implements DateDia
Dialogs.message(this, R.string.log_post_not_possible);
return;
}
+ if (CalendarUtils.isFuture(date)) {
+ Dialogs.message(this, R.string.log_date_future_not_allowed);
+ return;
+ }
if (typeSelected.mustConfirmLog()) {
Dialogs.confirm(this, R.string.confirm_log_title, res.getString(R.string.confirm_log_message, typeSelected.getL10n()), new OnClickListener() {
diff --git a/main/src/cgeo/geocaching/LogTrackableActivity.java b/main/src/cgeo/geocaching/LogTrackableActivity.java
index fc4a066..5f0b8c5 100644
--- a/main/src/cgeo/geocaching/LogTrackableActivity.java
+++ b/main/src/cgeo/geocaching/LogTrackableActivity.java
@@ -334,7 +334,6 @@ public class LogTrackableActivity extends AbstractLoggingActivity implements Dat
* Adds the new log to the list of log entries for this trackable to be able to show it in the trackable activity.
*
*
- * @param logText
*/
private void addLocalTrackableLog(final String logText) {
final LogEntry logEntry = new LogEntry(date.getTimeInMillis(), typeSelected, logText);
diff --git a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
index d92e441..b0d413d 100644
--- a/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
+++ b/main/src/cgeo/geocaching/NavigateAnyPointActivity.java
@@ -457,7 +457,7 @@ public class NavigateAnyPointActivity extends AbstractActionBarActivity implemen
return;
}
- CacheListActivity.startActivityCoordinates(this, coords);
+ CacheListActivity.startActivityCoordinates(this, coords, null);
finish();
}
diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java
index 8842603..ea91857 100644
--- a/main/src/cgeo/geocaching/SearchActivity.java
+++ b/main/src/cgeo/geocaching/SearchActivity.java
@@ -315,7 +315,7 @@ public class SearchActivity extends AbstractActionBarActivity implements Coordin
buttonLongitude.setText(geo.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE));
} else {
try {
- CacheListActivity.startActivityCoordinates(this, new Geopoint(latText, lonText));
+ CacheListActivity.startActivityCoordinates(this, new Geopoint(latText, lonText), null);
} catch (final Geopoint.ParseException e) {
showToast(res.getString(e.resource));
}
diff --git a/main/src/cgeo/geocaching/SearchResult.java b/main/src/cgeo/geocaching/SearchResult.java
index 64ed46e..5de1298 100644
--- a/main/src/cgeo/geocaching/SearchResult.java
+++ b/main/src/cgeo/geocaching/SearchResult.java
@@ -19,7 +19,6 @@ import rx.Observable;
import rx.functions.Func0;
import rx.functions.Func1;
import rx.functions.Func2;
-import rx.util.async.Async;
import android.os.Parcel;
import android.os.Parcelable;
@@ -217,10 +216,6 @@ public class SearchResult implements Parcelable {
}
/**
- * @param excludeDisabled
- * @param excludeMine
- * @param cacheType
- * @return
*/
public SearchResult filterSearchResults(final boolean excludeDisabled, final boolean excludeMine, final CacheType cacheType) {
@@ -319,12 +314,12 @@ public class SearchResult implements Parcelable {
return Observable.from(connectors).flatMap(new Func1<C, Observable<SearchResult>>() {
@Override
public Observable<SearchResult> call(final C connector) {
- return connector.isActive() ? Async.start(new Func0<SearchResult>() {
+ return connector.isActive() ? Observable.defer(new Func0<Observable<SearchResult>>() {
@Override
- public SearchResult call() {
- return func.call(connector);
+ public Observable<SearchResult> call() {
+ return Observable.just(func.call(connector));
}
- }, RxUtils.networkScheduler) : Observable.<SearchResult>empty();
+ }).subscribeOn(RxUtils.networkScheduler) : Observable.<SearchResult>empty();
}
}).reduce(new SearchResult(), new Func2<SearchResult, SearchResult, SearchResult>() {
@Override
diff --git a/main/src/cgeo/geocaching/StaticMapsProvider.java b/main/src/cgeo/geocaching/StaticMapsProvider.java
index 5184f71..8c399af 100644
--- a/main/src/cgeo/geocaching/StaticMapsProvider.java
+++ b/main/src/cgeo/geocaching/StaticMapsProvider.java
@@ -16,9 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import rx.Observable;
-import rx.functions.Action0;
import rx.functions.Func0;
-import rx.util.async.Async;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -86,9 +84,9 @@ public final class StaticMapsProvider {
final int requestWidth = Math.min(width / scale, GOOGLE_MAPS_MAX_SIZE);
final int requestHeight = (aspectRatio > 1) ? Math.round(requestWidth / aspectRatio) : requestWidth;
final int requestZoom = Math.min((scale == 2) ? zoom + 1 : zoom, GOOGLE_MAX_ZOOM);
- return checkDownloadPermission(Async.fromAction(new Action0() {
+ return checkDownloadPermission(Observable.defer(new Func0<Observable<String>>() {
@Override
- public void call() {
+ public Observable<String> call() {
final Parameters params = new Parameters(
"center", latlonMap,
"zoom", String.valueOf(requestZoom),
@@ -104,7 +102,7 @@ public final class StaticMapsProvider {
if (httpResponse == null) {
Log.e("StaticMapsProvider.downloadMap: httpResponse is null");
- return;
+ return Observable.just(prefix);
}
final int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != 200) {
@@ -112,7 +110,7 @@ public final class StaticMapsProvider {
if (statusCode == 403) {
last403 = System.currentTimeMillis();
}
- return;
+ return Observable.just(prefix);
}
final File file = getMapFile(geocode, prefix, true);
if (LocalStorage.saveEntityToFile(httpResponse, file)) {
@@ -122,8 +120,9 @@ public final class StaticMapsProvider {
FileUtils.deleteIgnoringFailure(file);
}
}
+ return Observable.just(prefix);
}
- }, prefix, RxUtils.networkScheduler));
+ }).subscribeOn(RxUtils.networkScheduler));
}
public static Observable<String> downloadMaps(final Geocache cache) {
@@ -216,9 +215,8 @@ public final class StaticMapsProvider {
public static Observable<String> storeCachePreviewMap(final Geocache cache) {
final String latlonMap = cache.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA);
final Point displaySize = Compatibility.getDisplaySize();
- final int minSize = Math.min(displaySize.x, displaySize.y);
final String markerUrl = MARKERS_URL + "my_location_mdpi.png";
- return downloadMap(cache.getGeocode(), 15, ROADMAP, markerUrl, PREFIX_PREVIEW, "shadow:false|", latlonMap, minSize, minSize, null);
+ return downloadMap(cache.getGeocode(), 15, ROADMAP, markerUrl, PREFIX_PREVIEW, "shadow:false|", latlonMap, displaySize.x, displaySize.y, null);
}
private static Observable<String> downloadMaps(final String geocode, final String markerUrl, final String prefix,
@@ -261,7 +259,6 @@ public final class StaticMapsProvider {
/**
* Check if at least one map file exists for the given cache.
*
- * @param cache
* @return <code>true</code> if at least one map file exists; <code>false</code> otherwise
*/
public static boolean hasStaticMap(@NonNull final Geocache cache) {
@@ -281,8 +278,6 @@ public final class StaticMapsProvider {
/**
* Checks if at least one map file exists for the given geocode and waypoint ID.
*
- * @param geocode
- * @param waypoint
* @return <code>true</code> if at least one map file exists; <code>false</code> otherwise
*/
public static boolean hasStaticMapForWaypoint(final String geocode, final Waypoint waypoint) {
@@ -300,8 +295,6 @@ public final class StaticMapsProvider {
/**
* Checks if all map files exist for the given geocode and waypoint ID.
*
- * @param geocode
- * @param waypoint
* @return <code>true</code> if all map files exist; <code>false</code> otherwise
*/
public static boolean hasAllStaticMapsForWaypoint(final String geocode, final Waypoint waypoint) {
diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java
index 139b136..e04fe9f 100644
--- a/main/src/cgeo/geocaching/TrackableActivity.java
+++ b/main/src/cgeo/geocaching/TrackableActivity.java
@@ -4,13 +4,13 @@ import butterknife.ButterKnife;
import butterknife.InjectView;
import cgeo.geocaching.activity.AbstractActivity;
-import cgeo.geocaching.activity.AbstractActivity.ActivitySharingInterface;
import cgeo.geocaching.activity.AbstractViewPagerActivity;
import cgeo.geocaching.connector.ConnectorFactory;
import cgeo.geocaching.connector.trackable.TrackableConnector;
import cgeo.geocaching.connector.trackable.TravelBugConnector;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Units;
+import cgeo.geocaching.network.AndroidBeam;
import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.ui.AbstractCachingPageViewCreator;
import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod;
@@ -26,10 +26,10 @@ import cgeo.geocaching.utils.RxUtils;
import cgeo.geocaching.utils.UnknownTagsHandler;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.io.Charsets;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
+import org.eclipse.jdt.annotation.Nullable;
import rx.Observable;
import rx.android.app.AppObservable;
@@ -43,8 +43,6 @@ import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
-import android.nfc.NdefMessage;
-import android.nfc.NfcAdapter;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.view.ActionMode;
@@ -65,7 +63,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
-public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivity.Page> implements ActivitySharingInterface {
+public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivity.Page> implements AndroidBeam.ActivitySharingInterface {
private CompositeSubscription createSubscriptions;
@@ -107,19 +105,13 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
// get parameters
final Bundle extras = getIntent().getExtras();
- final Uri uri;
- if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {
- final NdefMessage msg = (NdefMessage) extras.getParcelableArray(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
- uri = Uri.parse("http://" + new String(msg.getRecords()[0].getPayload(), Charsets.UTF_8));
- } else if (extras != null) {
+ final Uri uri = AndroidBeam.getUri(getIntent());
+ if (extras != null) {
// try to get data from extras
geocode = extras.getString(Intents.EXTRA_GEOCODE);
name = extras.getString(Intents.EXTRA_NAME);
guid = extras.getString(Intents.EXTRA_GUID);
id = extras.getString(Intents.EXTRA_ID);
- uri = getIntent().getData();
- } else {
- uri = null;
}
// try to get data from URI
@@ -127,7 +119,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
geocode = ConnectorFactory.getTrackableFromURL(uri.toString());
final String uriHost = uri.getHost().toLowerCase(Locale.US);
- if (uriHost.contains("geocaching.com")) {
+ if (uriHost.endsWith("geocaching.com")) {
geocode = uri.getQueryParameter("tracker");
guid = uri.getQueryParameter("guid");
id = uri.getQueryParameter("id");
@@ -149,17 +141,6 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
finish();
return;
}
- } else if (uriHost.contains("coord.info")) {
- final String uriPath = uri.getPath().toLowerCase(Locale.US);
- if (StringUtils.startsWith(uriPath, "/tb")) {
- geocode = uriPath.substring(1).toUpperCase(Locale.US);
- guid = null;
- id = null;
- } else {
- showToast(res.getString(R.string.err_tb_details_open));
- finish();
- return;
- }
}
}
@@ -180,7 +161,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
}
// If we have a newer Android device setup Android Beam for easy cache sharing
- initializeAndroidBeam(this);
+ AndroidBeam.enable(this, this);
createViewPager(0, new OnPageSelectedListener() {
@Override
@@ -201,6 +182,7 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
}));
}
+ @Nullable
@Override
public String getAndroidBeamUri() {
return trackable != null ? trackable.getUrl() : null;
diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java
index dd92350..d4517dc 100644
--- a/main/src/cgeo/geocaching/UsefulAppsActivity.java
+++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java
@@ -5,8 +5,10 @@ import butterknife.InjectView;
import cgeo.geocaching.activity.AbstractActionBarActivity;
import cgeo.geocaching.ui.AbstractViewHolder;
+import cgeo.geocaching.utils.ProcessUtils;
+
+import org.eclipse.jdt.annotation.NonNull;
-import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
@@ -36,27 +38,16 @@ public class UsefulAppsActivity extends AbstractActionBarActivity {
private final int titleId;
private final int descriptionId;
private final int iconId;
+ @NonNull
private final String packageName;
- public HelperApp(final int title, final int description, final int icon, final String packageName) {
+ public HelperApp(final int title, final int description, final int icon, @NonNull final String packageName) {
this.titleId = title;
this.descriptionId = description;
this.iconId = icon;
this.packageName = packageName;
}
- private void installFromMarket(final Activity activity) {
- try {
- // allow also opening pure http URLs in addition to market packages
- final String url = (packageName.startsWith("http:")) ? packageName : "market://details?id=" + packageName;
- final Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
- marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
- activity.startActivity(marketIntent);
-
- } catch (final RuntimeException ignored) {
- // market not available in standard emulator
- }
- }
}
private static final HelperApp[] HELPER_APPS = {
@@ -106,7 +97,12 @@ public class UsefulAppsActivity extends AbstractActionBarActivity {
@Override
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) {
final HelperApp helperApp = HELPER_APPS[position];
- helperApp.installFromMarket(UsefulAppsActivity.this);
+ if (helperApp.packageName.startsWith("http")) {
+ startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(helperApp.packageName)));
+ }
+ else {
+ ProcessUtils.openMarket(UsefulAppsActivity.this, helperApp.packageName);
+ }
}
});
}
diff --git a/main/src/cgeo/geocaching/Waypoint.java b/main/src/cgeo/geocaching/Waypoint.java
index 5cac4db..cc00b1c 100644
--- a/main/src/cgeo/geocaching/Waypoint.java
+++ b/main/src/cgeo/geocaching/Waypoint.java
@@ -37,8 +37,6 @@ public class Waypoint implements IWaypoint {
/**
* require name and type for every waypoint
*
- * @param name
- * @param type
*/
public Waypoint(final String name, final WaypointType type, final boolean own) {
this.name = name;
@@ -49,7 +47,6 @@ public class Waypoint implements IWaypoint {
/**
* copy constructor
*
- * @param other
*/
public Waypoint(final Waypoint other) {
merge(other);
@@ -262,7 +259,6 @@ public class Waypoint implements IWaypoint {
/**
* Delegates the creation of the waypoint-id for gpx-export to the waypoint
*
- * @return
*/
public String getGpxId() {
diff --git a/main/src/cgeo/geocaching/activity/AbstractActivity.java b/main/src/cgeo/geocaching/activity/AbstractActivity.java
index 4cddfe6..6ceead0 100644
--- a/main/src/cgeo/geocaching/activity/AbstractActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractActivity.java
@@ -6,6 +6,7 @@ import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.enumerations.CacheType;
+import cgeo.geocaching.network.AndroidBeam;
import cgeo.geocaching.network.Cookies;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.ClipboardUtils;
@@ -20,14 +21,8 @@ import org.eclipse.jdt.annotation.Nullable;
import rx.Subscription;
import rx.subscriptions.Subscriptions;
-import android.annotation.TargetApi;
import android.content.Intent;
import android.content.res.Resources;
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcEvent;
-import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.view.ActionMode;
@@ -78,6 +73,7 @@ public abstract class AbstractActivity extends ActionBarActivity implements IAbs
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
initializeCommonFields();
+ AndroidBeam.disable(this);
}
@Override
@@ -206,44 +202,6 @@ public abstract class AbstractActivity extends ActionBarActivity implements IAbs
}
}
- // Do not support older devices than Android 4.0
- // Although there even are 2.3 devices (Nexus S)
- // these are so few that we don't want to deal with the older (non Android Beam) API
-
- public interface ActivitySharingInterface {
- /** Return an URL that represent the current activity for sharing or null for no sharing. */
- public String getAndroidBeamUri();
- }
-
- protected void initializeAndroidBeam(final ActivitySharingInterface sharingInterface) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- initializeICSAndroidBeam(sharingInterface);
- }
- }
-
- @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
- protected void initializeICSAndroidBeam(final ActivitySharingInterface sharingInterface) {
- final NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this);
- if (nfcAdapter == null) {
- return;
- }
- nfcAdapter.setNdefPushMessageCallback(new NfcAdapter.CreateNdefMessageCallback() {
- @Override
- public NdefMessage createNdefMessage(final NfcEvent event) {
- final String uri = sharingInterface.getAndroidBeamUri();
- if (uri == null) {
- return null;
- }
- final NdefRecord[] records = {
- NdefRecord.createUri(uri),
- NdefRecord.createApplicationRecord(CgeoApplication.getInstance().getPackageName())
- };
- return new NdefMessage(records);
- }
- }, this);
-
- }
-
protected void setCacheTitleBar(@Nullable final String geocode, @Nullable final String name, @Nullable final CacheType type) {
if (StringUtils.isNotBlank(name)) {
setTitle(StringUtils.isNotBlank(geocode) ? name + " (" + geocode + ")" : name);
diff --git a/main/src/cgeo/geocaching/activity/AbstractListActivity.java b/main/src/cgeo/geocaching/activity/AbstractListActivity.java
index d7482c3..86ca98f 100644
--- a/main/src/cgeo/geocaching/activity/AbstractListActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractListActivity.java
@@ -1,6 +1,7 @@
package cgeo.geocaching.activity;
import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.network.AndroidBeam;
import android.content.res.Resources;
import android.os.Bundle;
@@ -48,6 +49,7 @@ public abstract class AbstractListActivity extends ActionBarListActivity impleme
initializeCommonFields();
initUpAction();
+ AndroidBeam.disable(this);
}
protected void initUpAction() {
diff --git a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
index 64186a0..11a5436 100644
--- a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
@@ -68,14 +68,12 @@ public abstract class AbstractViewPagerActivity<Page extends Enum<Page>> extends
/**
* Returns a validated view.
*
- * @return
*/
public View getDispatchedView(final ViewGroup parentView);
/**
* Returns a (maybe cached) view.
*
- * @return
*/
public View getView(final ViewGroup parentView);
diff --git a/main/src/cgeo/geocaching/activity/ActivityMixin.java b/main/src/cgeo/geocaching/activity/ActivityMixin.java
index 14a2fbf..5b3be70 100644
--- a/main/src/cgeo/geocaching/activity/ActivityMixin.java
+++ b/main/src/cgeo/geocaching/activity/ActivityMixin.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.activity;
+import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.MainActivity;
import cgeo.geocaching.R;
import cgeo.geocaching.settings.Settings;
@@ -133,8 +135,6 @@ public final class ActivityMixin {
/**
* insert text into the EditText at the current cursor position
*
- * @param editText
- * @param insertText
* @param moveCursor
* place the cursor after the inserted text
*/
@@ -157,22 +157,18 @@ public final class ActivityMixin {
editText.setSelection(newCursor);
}
- /**
- * This is the exact code from Google to implement Up navigation, with one exception: activity.isTaskRoot() was
- * added as {@link NavUtils#shouldUpRecreateTask(Activity, Intent)} seems not to handle the case, that this activity
- * was created from an intent by another app, and our own app is not yet running. The bug seems to be fixed in
- * Android 4.4.something, however.
- *
- * @param activity
- * @return
- */
public static boolean navigateUp(@NonNull final Activity activity) {
- // see http://developer.android.com/training/implementing-navigation/ancestral.html
- final Intent upIntent = NavUtils.getParentActivityIntent(activity);
- if (upIntent == null) {
+ // first check if there is a parent declared in the manifest
+ Intent upIntent = NavUtils.getParentActivityIntent(activity);
+ // if there is no parent, and if this was not a new task, then just go back to simulate going to a parent
+ if (upIntent == null && !activity.isTaskRoot()) {
activity.finish();
return true;
}
+ // use the main activity, if there was no back stack and no manifest based parent
+ if (upIntent == null) {
+ upIntent = new Intent(CgeoApplication.getInstance(), MainActivity.class);
+ }
if (NavUtils.shouldUpRecreateTask(activity, upIntent) || activity.isTaskRoot()) {
// This activity is NOT part of this app's task, so create a new task
// when navigating up, with a synthesized back stack.
@@ -190,7 +186,7 @@ public final class ActivityMixin {
}
public static void presentShowcase(final IAbstractActivity activity) {
- if (VERSION.SDK_INT < 11) {
+ if (VERSION.SDK_INT < 14) {
return;
}
final ShowcaseViewBuilder builder = activity.getShowcase();
diff --git a/main/src/cgeo/geocaching/activity/ShowcaseViewBuilder.java b/main/src/cgeo/geocaching/activity/ShowcaseViewBuilder.java
index 14f9281..86f5302 100644
--- a/main/src/cgeo/geocaching/activity/ShowcaseViewBuilder.java
+++ b/main/src/cgeo/geocaching/activity/ShowcaseViewBuilder.java
@@ -29,7 +29,6 @@ public class ShowcaseViewBuilder extends Builder {
/**
* Use the hash of the title for the single shot remembering
*
- * @param title
*/
private void setSingleshot(final CharSequence title) {
super.singleShot(title.hashCode());
diff --git a/main/src/cgeo/geocaching/apps/AbstractApp.java b/main/src/cgeo/geocaching/apps/AbstractApp.java
index 494e245..3bc7f71 100644
--- a/main/src/cgeo/geocaching/apps/AbstractApp.java
+++ b/main/src/cgeo/geocaching/apps/AbstractApp.java
@@ -5,28 +5,31 @@ import cgeo.geocaching.Geocache;
import cgeo.geocaching.utils.ProcessUtils;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import android.content.Intent;
public abstract class AbstractApp implements App {
- private final String packageName;
- private final String intent;
+ @Nullable private final String packageName;
+ @Nullable private final String intent;
+ @NonNull
private final String name;
/**
* a unique id, defined in res/values/ids.xml
*/
private final int id;
- protected AbstractApp(final String name, final int id, final String intent,
- final String packageName) {
+ protected AbstractApp(@NonNull final String name, final int id, @Nullable final String intent,
+ @Nullable final String packageName) {
this.name = name;
this.id = id;
this.intent = intent;
this.packageName = packageName;
}
- protected AbstractApp(final String name, final int id, final String intent) {
+ protected AbstractApp(@NonNull final String name, final int id, @Nullable final String intent) {
this(name, id, intent, null);
}
@@ -35,9 +38,14 @@ public abstract class AbstractApp implements App {
if (StringUtils.isNotEmpty(packageName) && ProcessUtils.isLaunchable(packageName)) {
return true;
}
+ if (intent == null) {
+ return false;
+ }
+ assert intent != null; // eclipse issue
return ProcessUtils.isIntentAvailable(intent);
}
+ @Nullable
protected Intent getLaunchIntent() {
return ProcessUtils.getLaunchIntent(packageName);
}
@@ -48,6 +56,7 @@ public abstract class AbstractApp implements App {
}
@Override
+ @NonNull
public String getName() {
return name;
}
@@ -57,12 +66,12 @@ public abstract class AbstractApp implements App {
return id;
}
- protected static String getString(int ressourceId) {
+ protected static String getString(final int ressourceId) {
return CgeoApplication.getInstance().getString(ressourceId);
}
@Override
- public boolean isEnabled(Geocache cache) {
+ public boolean isEnabled(final Geocache cache) {
return cache != null;
}
}
diff --git a/main/src/cgeo/geocaching/apps/AbstractAppFactory.java b/main/src/cgeo/geocaching/apps/AbstractAppFactory.java
deleted file mode 100644
index 945f7d6..0000000
--- a/main/src/cgeo/geocaching/apps/AbstractAppFactory.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package cgeo.geocaching.apps;
-
-import android.view.MenuItem;
-
-public abstract class AbstractAppFactory {
-
- protected static App getAppFromMenuItem(MenuItem item, final App[] availableApps) {
- final int id = item.getItemId();
- for (App app : availableApps) {
- if (app.getId() == id) {
- return app;
- }
- }
- return null;
- }
-}
diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java
index baf36a4..dfd148d 100644
--- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java
+++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java
@@ -8,6 +8,7 @@ import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.utils.SynchronizedDateFormat;
+import menion.android.locus.LocusDataStorageProvider;
import menion.android.locus.addon.publiclib.DisplayData;
import menion.android.locus.addon.publiclib.LocusUtils;
import menion.android.locus.addon.publiclib.geoData.Point;
@@ -15,6 +16,9 @@ import menion.android.locus.addon.publiclib.geoData.PointGeocachingData;
import menion.android.locus.addon.publiclib.geoData.PointGeocachingDataWaypoint;
import menion.android.locus.addon.publiclib.geoData.PointsData;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
import android.app.Activity;
import android.location.Location;
@@ -31,7 +35,7 @@ import java.util.Locale;
public abstract class AbstractLocusApp extends AbstractApp {
private static final SynchronizedDateFormat ISO8601DATE = new SynchronizedDateFormat("yyyy-MM-dd'T'", Locale.US);
- protected AbstractLocusApp(final String text, int id, final String intent) {
+ protected AbstractLocusApp(@NonNull final String text, final int id, @NonNull final String intent) {
super(text, id, intent);
}
@@ -47,7 +51,6 @@ public abstract class AbstractLocusApp extends AbstractApp {
* which caches/waypoints to show
* @param withCacheWaypoints
* Whether to give waypoints of caches to Locus or not
- * @param activity
*/
protected static boolean showInLocus(final List<?> objectsToShow, final boolean withCacheWaypoints, final boolean export,
final Activity activity) {
@@ -57,7 +60,7 @@ public abstract class AbstractLocusApp extends AbstractApp {
final boolean withCacheDetails = objectsToShow.size() < 200;
final PointsData pd = new PointsData("c:geo");
- for (Object o : objectsToShow) {
+ for (final Object o : objectsToShow) {
Point p = null;
// get icon and Point
if (o instanceof Geocache) {
@@ -90,7 +93,6 @@ public abstract class AbstractLocusApp extends AbstractApp {
/**
* This method constructs a <code>Point</code> for displaying in Locus
*
- * @param cache
* @param withWaypoints
* whether to give waypoints to Locus or not
* @param withCacheDetails
@@ -98,7 +100,8 @@ public abstract class AbstractLocusApp extends AbstractApp {
* should be false for all if more then 200 Caches are transferred
* @return null, when the <code>Point</code> could not be constructed
*/
- private static Point getCachePoint(Geocache cache, boolean withWaypoints, boolean withCacheDetails) {
+ @Nullable
+ private static Point getCachePoint(final Geocache cache, final boolean withWaypoints, final boolean withCacheDetails) {
if (cache == null || cache.getCoords() == null) {
return null;
}
@@ -141,19 +144,24 @@ public abstract class AbstractLocusApp extends AbstractApp {
if (withWaypoints && cache.hasWaypoints()) {
pg.waypoints = new ArrayList<>();
- for (Waypoint waypoint : cache.getWaypoints()) {
- if (waypoint == null || waypoint.getCoords() == null) {
+ for (final Waypoint waypoint : cache.getWaypoints()) {
+ if (waypoint == null) {
continue;
}
- PointGeocachingDataWaypoint wp = new PointGeocachingDataWaypoint();
- wp.code = waypoint.getGeocode();
+
+ final PointGeocachingDataWaypoint wp = new PointGeocachingDataWaypoint();
+ wp.code = waypoint.getLookup();
wp.name = waypoint.getName();
- String locusWpId = toLocusWaypoint(waypoint.getWaypointType());
+ wp.description = waypoint.getNote();
+ final String locusWpId = toLocusWaypoint(waypoint.getWaypointType());
if (locusWpId != null) {
wp.type = locusWpId;
}
- wp.lat = waypoint.getCoords().getLatitude();
- wp.lon = waypoint.getCoords().getLongitude();
+
+ if (waypoint.getCoords() != null) {
+ wp.lat = waypoint.getCoords().getLatitude();
+ wp.lon = waypoint.getCoords().getLongitude();
+ }
pg.waypoints.add(wp);
}
}
@@ -174,10 +182,10 @@ public abstract class AbstractLocusApp extends AbstractApp {
/**
* This method constructs a <code>Point</code> for displaying in Locus
*
- * @param waypoint
* @return null, when the <code>Point</code> could not be constructed
*/
- private static Point getWaypointPoint(Waypoint waypoint) {
+ @Nullable
+ private static Point getWaypointPoint(final Waypoint waypoint) {
if (waypoint == null || waypoint.getCoords() == null) {
return null;
}
@@ -248,6 +256,7 @@ public abstract class AbstractLocusApp extends AbstractApp {
}
}
+ @Nullable
private static String toLocusWaypoint(final WaypointType wt) {
switch (wt) {
case FINAL:
@@ -268,5 +277,4 @@ public abstract class AbstractLocusApp extends AbstractApp {
return null;
}
}
-
}
diff --git a/main/src/cgeo/geocaching/apps/App.java b/main/src/cgeo/geocaching/apps/App.java
index 7e70581..1383809 100644
--- a/main/src/cgeo/geocaching/apps/App.java
+++ b/main/src/cgeo/geocaching/apps/App.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.apps;
import cgeo.geocaching.Geocache;
+import org.eclipse.jdt.annotation.NonNull;
+
public interface App {
public boolean isInstalled();
@@ -10,6 +12,7 @@ public interface App {
*/
public boolean isUsableAsDefaultNavigationApp();
+ @NonNull
public String getName();
/**
@@ -20,8 +23,6 @@ public interface App {
/**
* Whether or not the app can be used with the given cache (may depend on properties of the cache).
*
- * @param cache
- * @return
*/
boolean isEnabled(final Geocache cache);
}
diff --git a/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java b/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java
index c4f2723..4e542b8 100644
--- a/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/AbstractGeneralApp.java
@@ -4,17 +4,19 @@ import cgeo.geocaching.Geocache;
import cgeo.geocaching.apps.AbstractApp;
import cgeo.geocaching.apps.cache.navi.CacheNavigationApp;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.app.Activity;
import android.content.Intent;
abstract class AbstractGeneralApp extends AbstractApp implements CacheNavigationApp {
- protected AbstractGeneralApp(final String name, final int id, final String packageName) {
+ protected AbstractGeneralApp(@NonNull final String name, final int id, @NonNull final String packageName) {
super(name, id, null, packageName);
}
@Override
- public void navigate(Activity activity, Geocache cache) {
+ public void navigate(final Activity activity, final Geocache cache) {
final Intent intent = getLaunchIntent();
if (intent != null) {
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java
index 5e7a5cc..0bf2c1c 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java
@@ -7,6 +7,8 @@ import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.apps.AbstractApp;
import cgeo.geocaching.location.Geopoint;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.app.Activity;
import android.content.Intent;
@@ -15,20 +17,20 @@ import android.content.Intent;
*/
abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp, GeopointNavigationApp {
- protected AbstractPointNavigationApp(final String name, final int id, final String intent) {
+ protected AbstractPointNavigationApp(@NonNull final String name, final int id, final String intent) {
super(name, id, intent);
}
- protected AbstractPointNavigationApp(final String name, final int id, final String intent, final String packageName) {
+ protected AbstractPointNavigationApp(@NonNull final String name, final int id, final String intent, final String packageName) {
super(name, id, intent, packageName);
}
@Override
- public void navigate(Activity activity, Geocache cache) {
+ public void navigate(final Activity activity, final Geocache cache) {
navigateWithNullCheck(activity, cache.getCoords());
}
- private void navigateWithNullCheck(Activity activity, final Geopoint coords) {
+ private void navigateWithNullCheck(final Activity activity, final Geopoint coords) {
if (coords != null) {
navigate(activity, coords);
} else {
@@ -37,17 +39,17 @@ abstract class AbstractPointNavigationApp extends AbstractApp implements CacheNa
}
@Override
- public void navigate(Activity activity, Waypoint waypoint) {
+ public void navigate(final Activity activity, final Waypoint waypoint) {
navigateWithNullCheck(activity, waypoint.getCoords());
}
@Override
- public boolean isEnabled(Geocache cache) {
+ public boolean isEnabled(final Geocache cache) {
return cache.getCoords() != null;
}
@Override
- public boolean isEnabled(Waypoint waypoint) {
+ public boolean isEnabled(final Waypoint waypoint) {
return waypoint.getCoords() != null;
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
index a2a5803..700c8aa 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
@@ -11,11 +11,12 @@ import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.apps.AbstractApp;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
import android.app.Activity;
abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigationApp, WaypointNavigationApp {
- protected AbstractStaticMapsApp(final String name, final int id) {
+ protected AbstractStaticMapsApp(@NonNull final String name, final int id) {
super(name, id, null);
}
@@ -29,11 +30,11 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat
return false;
}
- protected static boolean hasStaticMap(Waypoint waypoint) {
+ protected static boolean hasStaticMap(final Waypoint waypoint) {
if (waypoint==null) {
return false;
}
- String geocode = waypoint.getGeocode();
+ final String geocode = waypoint.getGeocode();
if (StringUtils.isNotEmpty(geocode) && DataStore.isOffline(geocode, null)) {
return StaticMapsProvider.hasStaticMapForWaypoint(geocode, waypoint);
}
@@ -49,7 +50,7 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat
}
final String geocode = StringUtils.upperCase(logable.getGeocode());
- StaticMapsActivity_.IntentBuilder_ builder = StaticMapsActivity_.intent(activity).geocode(geocode).download(download);
+ final StaticMapsActivity_.IntentBuilder_ builder = StaticMapsActivity_.intent(activity).geocode(geocode).download(download);
if (waypoint != null) {
builder.waypointId(waypoint.getId());
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index d542541..32eba7e 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -5,7 +5,6 @@ import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.Waypoint;
import cgeo.geocaching.activity.ActivityMixin;
-import cgeo.geocaching.apps.AbstractAppFactory;
import cgeo.geocaching.apps.App;
import cgeo.geocaching.apps.cache.WhereYouGoApp;
import cgeo.geocaching.apps.cache.navi.GoogleNavigationApp.GoogleNavigationBikeApp;
@@ -25,7 +24,7 @@ import android.widget.ArrayAdapter;
import java.util.ArrayList;
import java.util.List;
-public final class NavigationAppFactory extends AbstractAppFactory {
+public final class NavigationAppFactory {
private NavigationAppFactory() {
// utility class
@@ -117,10 +116,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* Delegates to {@link #showNavigationMenu(Activity, cgeo.geocaching.Geocache, cgeo.geocaching.Waypoint, Geopoint, boolean, boolean)} with
* <code>showInternalMap = true</code> and <code>showDefaultNavigation = false</code>
*
- * @param activity
- * @param cache
- * @param waypoint
- * @param destination
*/
public static void showNavigationMenu(final Activity activity,
final Geocache cache, final Waypoint waypoint, final Geopoint destination) {
@@ -131,7 +126,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* Specialized way to handle selection of navigation tool.<br />
* A dialog is created for tool selection and the selected tool is started afterwards.
*
- * @param activity
* @param cache
* may be <code>null</code>
* @param waypoint
@@ -196,7 +190,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/**
* Returns all installed navigation apps.
*
- * @return
*/
static List<NavigationAppsEnum> getInstalledNavigationApps() {
final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<>();
@@ -224,7 +217,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/**
* Returns all installed navigation apps for default navigation.
*
- * @return
*/
public static List<NavigationAppsEnum> getInstalledDefaultNavigationApps() {
final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<>();
@@ -240,10 +232,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
* Handles menu selections for menu entries created with
* {@link #showNavigationMenu(Activity, Geocache, Waypoint, Geopoint)}.
*
- * @param item
- * @param activity
- * @param cache
- * @return
*/
public static boolean onMenuItemSelected(final MenuItem item, final Activity activity, final Geocache cache) {
final App menuItem = getAppFromMenuItem(item);
@@ -286,10 +274,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/**
* Starts the default navigation tool if correctly set and installed or the compass app as default fallback.
*
- * @param defaultNavigation
*
- * @param activity
- * @param cache
*/
public static void startDefaultNavigationApplication(final int defaultNavigation, final Activity activity, final Geocache cache) {
if (cache == null || cache.getCoords() == null) {
@@ -310,8 +295,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/**
* Starts the default navigation tool if correctly set and installed or the compass app as default fallback.
*
- * @param activity
- * @param waypoint
*/
public static void startDefaultNavigationApplication(final int defaultNavigation, final Activity activity, final Waypoint waypoint) {
if (waypoint == null || waypoint.getCoords() == null) {
@@ -324,8 +307,6 @@ public final class NavigationAppFactory extends AbstractAppFactory {
/**
* Starts the default navigation tool if correctly set and installed or the compass app as default fallback.
*
- * @param activity
- * @param destination
*/
public static void startDefaultNavigationApplication(final int defaultNavigation, final Activity activity, final Geopoint destination) {
if (destination == null) {
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationSelectionActionProvider.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationSelectionActionProvider.java
index 82883a2..43eaee3 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationSelectionActionProvider.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationSelectionActionProvider.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.apps.App;
import cgeo.geocaching.apps.cache.navi.NavigationAppFactory.NavigationAppsEnum;
+import cgeo.geocaching.ui.AbstractMenuActionProvider;
import android.app.Activity;
import android.content.Context;
@@ -12,11 +13,13 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.SubMenu;
-import android.view.View;
import java.util.List;
-public class NavigationSelectionActionProvider extends ActionProvider {
+/**
+ * Action provider listing all available navigation actions as sub menu.
+ */
+public class NavigationSelectionActionProvider extends AbstractMenuActionProvider {
private Geocache geocache;
private final Activity activity;
@@ -26,17 +29,6 @@ public class NavigationSelectionActionProvider extends ActionProvider {
activity = (Activity) context;
}
- @Override
- public boolean hasSubMenu() {
- return true;
- }
-
- @Override
- public View onCreateActionView() {
- // must return null, otherwise the menu will not work
- return null;
- }
-
public void setTarget(final Geocache cache) {
geocache = cache;
}
diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java
index 40c4d92..8beb5e4 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListApp.java
@@ -8,7 +8,7 @@ import android.app.Activity;
import java.util.List;
-interface CacheListApp extends App {
+public interface CacheListApp extends App {
boolean invoke(final List<Geocache> caches,
final Activity activity, final SearchResult search);
diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
deleted file mode 100644
index b6706a0..0000000
--- a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package cgeo.geocaching.apps.cachelist;
-
-import cgeo.geocaching.Geocache;
-import cgeo.geocaching.R;
-import cgeo.geocaching.SearchResult;
-import cgeo.geocaching.activity.ActivityMixin;
-import cgeo.geocaching.apps.AbstractAppFactory;
-import cgeo.geocaching.utils.Log;
-
-import android.app.Activity;
-import android.content.res.Resources;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.SubMenu;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class CacheListAppFactory extends AbstractAppFactory {
-
- private CacheListAppFactory() {
- // utility class
- }
-
- private static class LazyHolder {
- public static final CacheListApp[] apps = {
- new InternalCacheListMap(),
- new LocusShowCacheListApp(),
- new LocusExportCacheListApp(),
- new MapsWithMeCacheListApp()
- };
- }
-
- /**
- * @param menu
- * @param activity
- * @param res
- */
- public static void addMenuItems(final Menu menu, final Activity activity, final Resources res) {
- final List<CacheListApp> activeApps = getActiveApps();
- if (activeApps.isEmpty()) {
- return;
- }
- if (activeApps.size() == 1) {
- final MenuItem subItem = menu.findItem(R.id.menu_cache_list_app);
- subItem.setVisible(true);
- subItem.setTitle(activeApps.get(0).getName());
- } else {
- final MenuItem subItem = menu.findItem(R.id.submenu_cache_list_app);
- subItem.setVisible(true);
- final SubMenu subMenu = subItem.getSubMenu();
- for (final CacheListApp app : activeApps) {
- subMenu.add(0, app.getId(), 0, app.getName());
- }
- }
- }
-
- private static List<CacheListApp> getActiveApps() {
- final List<CacheListApp> activeApps = new ArrayList<>(LazyHolder.apps.length);
- for (final CacheListApp app : LazyHolder.apps) {
- if (app.isInstalled()) {
- activeApps.add(app);
- }
- }
- return activeApps;
- }
-
- public static boolean onMenuItemSelected(final MenuItem item, final List<Geocache> caches, final Activity activity,
- final SearchResult search) {
- CacheListApp app;
- if (item.getItemId() == R.id.menu_cache_list_app) {
- app = getActiveApps().get(0);
- }
- else {
- app = (CacheListApp) getAppFromMenuItem(item, LazyHolder.apps);
- }
- if (app != null) {
- try {
- final boolean result = app.invoke(caches, activity, search);
- ActivityMixin.invalidateOptionsMenu(activity);
- return result;
- } catch (final Exception e) {
- Log.e("CacheListAppFactory.onMenuItemSelected", e);
- }
- }
- return false;
- }
-
-}
diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListApps.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListApps.java
new file mode 100644
index 0000000..e8e81a8
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListApps.java
@@ -0,0 +1,29 @@
+package cgeo.geocaching.apps.cachelist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public enum CacheListApps {
+ INTERNAL(new InternalCacheListMap()),
+ LOCUS_SHOW(new LocusShowCacheListApp()),
+ LOCUS_EXPORT(new LocusExportCacheListApp()),
+ MAPS_ME(new MapsWithMeCacheListApp());
+
+ private final CacheListApp app;
+
+ private CacheListApps(final CacheListApp app) {
+ this.app = app;
+ }
+
+ public static List<CacheListApp> getActiveApps() {
+ final List<CacheListApp> activeApps = new ArrayList<>();
+ for (final CacheListApps appEnum : values()) {
+ if (appEnum.app.isInstalled()) {
+ activeApps.add(appEnum.app);
+ }
+ }
+ return activeApps;
+ }
+
+}
+
diff --git a/main/src/cgeo/geocaching/apps/cachelist/ListNavigationSelectionActionProvider.java b/main/src/cgeo/geocaching/apps/cachelist/ListNavigationSelectionActionProvider.java
new file mode 100644
index 0000000..6a49995
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cachelist/ListNavigationSelectionActionProvider.java
@@ -0,0 +1,60 @@
+package cgeo.geocaching.apps.cachelist;
+
+import cgeo.geocaching.ui.AbstractMenuActionProvider;
+
+import android.content.Context;
+import android.support.v4.view.ActionProvider;
+import android.support.v4.view.MenuItemCompat;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.MenuItem.OnMenuItemClickListener;
+import android.view.SubMenu;
+
+import java.util.List;
+
+public class ListNavigationSelectionActionProvider extends AbstractMenuActionProvider {
+
+ public static interface Callback {
+ void onListNavigationSelected(final CacheListApp app);
+ }
+
+ private Callback callback;
+
+ public ListNavigationSelectionActionProvider(final Context context) {
+ super(context);
+ }
+
+ public void setCallback(final Callback callback) {
+ this.callback = callback;
+ }
+
+ @Override
+ public void onPrepareSubMenu(final SubMenu subMenu) {
+ subMenu.clear();
+ if (callback == null) {
+ return;
+ }
+ final List<CacheListApp> activeApps = CacheListApps.getActiveApps();
+ for (int i = 0; i < activeApps.size(); i++) {
+ final CacheListApp app = activeApps.get(i);
+ subMenu.add(Menu.NONE, i, Menu.NONE, app.getName()).setOnMenuItemClickListener(new OnMenuItemClickListener() {
+
+ @Override
+ public boolean onMenuItemClick(final MenuItem item) {
+ final CacheListApp app = activeApps.get(item.getItemId());
+ callback.onListNavigationSelected(app);
+ return true;
+ }
+ });
+ }
+ }
+
+ public static void initialize(final MenuItem menuItem, final Callback callback) {
+ final ActionProvider actionProvider = MenuItemCompat.getActionProvider(menuItem);
+ if (actionProvider instanceof ListNavigationSelectionActionProvider) {
+ final ListNavigationSelectionActionProvider navigateAction = (ListNavigationSelectionActionProvider) actionProvider;
+ navigateAction.setCallback(callback);
+ }
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/apps/cachelist/MapsWithMeCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/MapsWithMeCacheListApp.java
index c6c7709..ed64d2d 100644
--- a/main/src/cgeo/geocaching/apps/cachelist/MapsWithMeCacheListApp.java
+++ b/main/src/cgeo/geocaching/apps/cachelist/MapsWithMeCacheListApp.java
@@ -45,7 +45,6 @@ public class MapsWithMeCacheListApp extends AbstractApp implements CacheListApp
/**
* get cache code from a PendingIntent after an invocation of MapsWithMe
*
- * @return
*/
@Nullable
public static String getCacheFromMapsWithMe(final Context context, final Intent intent) {
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel11.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel11.java
new file mode 100644
index 0000000..8398eb3
--- /dev/null
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel11.java
@@ -0,0 +1,15 @@
+package cgeo.geocaching.compatibility;
+
+import android.annotation.TargetApi;
+import android.os.Build;
+import android.widget.TextView;
+
+@TargetApi(Build.VERSION_CODES.HONEYCOMB)
+public class AndroidLevel11 implements AndroidLevel11Interface {
+
+ @Override
+ public void setTextIsSelectable(final TextView textView, final boolean selectable) {
+ textView.setTextIsSelectable(selectable);
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java
new file mode 100644
index 0000000..b4111ab
--- /dev/null
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel11Emulation.java
@@ -0,0 +1,12 @@
+package cgeo.geocaching.compatibility;
+
+import android.widget.TextView;
+
+public class AndroidLevel11Emulation implements AndroidLevel11Interface {
+
+ @Override
+ public void setTextIsSelectable(final TextView textView, final boolean selectable) {
+ // do nothing
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java
new file mode 100644
index 0000000..45c06a4
--- /dev/null
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel11Interface.java
@@ -0,0 +1,9 @@
+package cgeo.geocaching.compatibility;
+
+import android.widget.TextView;
+
+public interface AndroidLevel11Interface {
+
+ void setTextIsSelectable(TextView textView, boolean selectable);
+
+}
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel13.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel13.java
index 946d20e..f599611 100644
--- a/main/src/cgeo/geocaching/compatibility/AndroidLevel13.java
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel13.java
@@ -11,11 +11,6 @@ import android.view.WindowManager;
class AndroidLevel13 implements AndroidLevel13Interface {
@Override
- public int getDisplayWidth() {
- return getDisplaySize().x;
- }
-
- @Override
public Point getDisplaySize() {
final Point dimensions = new Point();
((WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE))
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel13Emulation.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel13Emulation.java
index 8e2e7ec..f9fd3bc 100644
--- a/main/src/cgeo/geocaching/compatibility/AndroidLevel13Emulation.java
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel13Emulation.java
@@ -11,11 +11,6 @@ import android.view.WindowManager;
class AndroidLevel13Emulation implements AndroidLevel13Interface {
@Override
- public int getDisplayWidth() {
- return getDisplay().getWidth();
- }
-
- @Override
public Point getDisplaySize() {
final Display display = getDisplay();
return new Point(display.getWidth(), display.getHeight());
diff --git a/main/src/cgeo/geocaching/compatibility/AndroidLevel13Interface.java b/main/src/cgeo/geocaching/compatibility/AndroidLevel13Interface.java
index 6d3f3c3..b78875f 100644
--- a/main/src/cgeo/geocaching/compatibility/AndroidLevel13Interface.java
+++ b/main/src/cgeo/geocaching/compatibility/AndroidLevel13Interface.java
@@ -3,7 +3,6 @@ package cgeo.geocaching.compatibility;
import android.graphics.Point;
interface AndroidLevel13Interface {
- int getDisplayWidth();
Point getDisplaySize();
}
diff --git a/main/src/cgeo/geocaching/compatibility/Compatibility.java b/main/src/cgeo/geocaching/compatibility/Compatibility.java
index 54e2966..56e18bf 100644
--- a/main/src/cgeo/geocaching/compatibility/Compatibility.java
+++ b/main/src/cgeo/geocaching/compatibility/Compatibility.java
@@ -5,15 +5,18 @@ import org.eclipse.jdt.annotation.NonNull;
import android.app.Activity;
import android.graphics.Point;
import android.os.Build;
+import android.widget.TextView;
public final class Compatibility {
private static final int SDK_VERSION = Build.VERSION.SDK_INT;
+ private static final AndroidLevel11Interface LEVEL_11;
private static final AndroidLevel13Interface LEVEL_13;
private static final AndroidLevel19Interface LEVEL_19;
static {
+ LEVEL_11 = SDK_VERSION >= 11 ? new AndroidLevel11() : new AndroidLevel11Emulation();
LEVEL_13 = SDK_VERSION >= 13 ? new AndroidLevel13() : new AndroidLevel13Emulation();
LEVEL_19 = SDK_VERSION >= 19 ? new AndroidLevel19() : new AndroidLevel19Emulation();
}
@@ -22,19 +25,19 @@ public final class Compatibility {
// utility class
}
- public static int getDisplayWidth() {
- return LEVEL_13.getDisplayWidth();
- }
-
public static Point getDisplaySize() {
return LEVEL_13.getDisplaySize();
}
- public static void importGpxFromStorageAccessFramework(final @NonNull Activity activity, int requestCodeImportGpx) {
+ public static void importGpxFromStorageAccessFramework(final @NonNull Activity activity, final int requestCodeImportGpx) {
LEVEL_19.importGpxFromStorageAccessFramework(activity, requestCodeImportGpx);
}
public static boolean isStorageAccessFrameworkAvailable() {
return SDK_VERSION >= 19;
}
+
+ public static void setTextIsSelectable(final TextView textView, final boolean selectable) {
+ LEVEL_11.setTextIsSelectable(textView, selectable);
+ }
}
diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java
index 4984273..0583aa1 100644
--- a/main/src/cgeo/geocaching/connector/AbstractConnector.java
+++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java
@@ -19,6 +19,7 @@ import cgeo.geocaching.location.Geopoint;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import rx.functions.Action1;
@@ -129,7 +130,8 @@ public abstract class AbstractConnector implements IConnector {
}
@Override
- public String getGeocodeFromUrl(final String url) {
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
final String urlPrefix = getCacheUrlPrefix();
if (StringUtils.isEmpty(urlPrefix) || StringUtils.startsWith(url, urlPrefix)) {
@NonNull final String geocode = url.substring(urlPrefix.length());
@@ -144,7 +146,7 @@ public abstract class AbstractConnector implements IConnector {
abstract protected String getCacheUrlPrefix();
@Override
- @NonNull
+ @Nullable
public String getLongCacheUrl(final @NonNull Geocache cache) {
return getCacheUrl(cache);
}
@@ -201,7 +203,7 @@ public abstract class AbstractConnector implements IConnector {
}
@Override
- public String getWaypointGpxId(final String prefix, final String geocode) {
+ public String getWaypointGpxId(final String prefix, @NonNull final String geocode) {
// Default: just return the prefix
return prefix;
}
diff --git a/main/src/cgeo/geocaching/connector/ConnectorFactory.java b/main/src/cgeo/geocaching/connector/ConnectorFactory.java
index b78b009..918911a 100644
--- a/main/src/cgeo/geocaching/connector/ConnectorFactory.java
+++ b/main/src/cgeo/geocaching/connector/ConnectorFactory.java
@@ -15,9 +15,11 @@ import cgeo.geocaching.connector.gc.GCConnector;
import cgeo.geocaching.connector.gc.MapTokens;
import cgeo.geocaching.connector.oc.OCApiConnector.ApiSupport;
import cgeo.geocaching.connector.oc.OCApiLiveConnector;
+import cgeo.geocaching.connector.oc.OCCZConnector;
import cgeo.geocaching.connector.oc.OCConnector;
import cgeo.geocaching.connector.ox.OXConnector;
import cgeo.geocaching.connector.trackable.GeokretyConnector;
+import cgeo.geocaching.connector.trackable.SwaggieConnector;
import cgeo.geocaching.connector.trackable.TrackableConnector;
import cgeo.geocaching.connector.trackable.TravelBugConnector;
import cgeo.geocaching.connector.trackable.UnknownTrackableConnector;
@@ -43,7 +45,7 @@ public final class ConnectorFactory {
new OCApiLiveConnector("opencaching.de", "www.opencaching.de", "OC", "CC BY-NC-ND, alle Logeinträge © jeweiliger Autor",
R.string.oc_de_okapi_consumer_key, R.string.oc_de_okapi_consumer_secret,
R.string.pref_connectorOCActive, R.string.pref_ocde_tokenpublic, R.string.pref_ocde_tokensecret, ApiSupport.current),
- new OCConnector("OpenCaching.CZ", "www.opencaching.cz", "OZ"),
+ new OCCZConnector(),
new OCApiLiveConnector("opencaching.org.uk", "www.opencaching.org.uk", "OK", "CC BY-NC-SA 2.5",
R.string.oc_uk_okapi_consumer_key, R.string.oc_uk_okapi_consumer_secret,
R.string.pref_connectorOCUKActive, R.string.pref_ocuk_tokenpublic, R.string.pref_ocuk_tokensecret, ApiSupport.oldapi),
@@ -74,8 +76,9 @@ public final class ConnectorFactory {
@NonNull
private static final Collection<TrackableConnector> TRACKABLE_CONNECTORS = Collections.unmodifiableCollection(Arrays.asList(new TrackableConnector[] {
- new GeokretyConnector(), // GK must be first, as it overlaps with the secret codes of travel bugs
- TravelBugConnector.getInstance(),
+ new GeokretyConnector(),
+ new SwaggieConnector(),
+ TravelBugConnector.getInstance(), // travel bugs last, as their secret codes overlap with other connectors
UNKNOWN_TRACKABLE_CONNECTOR // must be last
}));
@@ -212,9 +215,12 @@ public final class ConnectorFactory {
}
@Nullable
- public static String getGeocodeFromURL(final String url) {
+ public static String getGeocodeFromURL(@Nullable final String url) {
+ if (url == null) {
+ return null;
+ }
for (final IConnector connector : CONNECTORS) {
- final String geocode = connector.getGeocodeFromUrl(url);
+ @Nullable final String geocode = connector.getGeocodeFromUrl(url);
if (StringUtils.isNotBlank(geocode)) {
return geocode;
}
@@ -230,7 +236,6 @@ public final class ConnectorFactory {
/**
* Get the geocode of a trackable from a URL.
*
- * @param url
* @return {@code null} if the URL cannot be decoded
*/
@Nullable
diff --git a/main/src/cgeo/geocaching/connector/IConnector.java b/main/src/cgeo/geocaching/connector/IConnector.java
index 0863723..74b1028 100644
--- a/main/src/cgeo/geocaching/connector/IConnector.java
+++ b/main/src/cgeo/geocaching/connector/IConnector.java
@@ -6,6 +6,7 @@ import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.location.Geopoint;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import java.util.Collection;
import java.util.List;
@@ -14,7 +15,6 @@ public interface IConnector {
/**
* get name for display (currently only used in links)
*
- * @return
*/
@NonNull
public String getName();
@@ -31,32 +31,26 @@ public interface IConnector {
/**
* Get the browser URL for the given cache.
*
- * @param cache
- * @return
*/
- @NonNull
+ @Nullable
public String getCacheUrl(final @NonNull Geocache cache);
/**
* get long browser URL for the given cache
*
- * @param cache
- * @return
*/
- @NonNull
+ @Nullable
public String getLongCacheUrl(final @NonNull Geocache cache);
/**
* enable/disable watchlist controls in cache details
*
- * @return
*/
public boolean supportsWatchList();
/**
* Add the cache to the watchlist
*
- * @param cache
* @return True - success/False - failure
*/
public boolean addToWatchlist(@NonNull Geocache cache);
@@ -64,7 +58,6 @@ public interface IConnector {
/**
* Remove the cache from the watchlist
*
- * @param cache
* @return True - success/False - failure
*/
public boolean removeFromWatchlist(@NonNull Geocache cache);
@@ -72,28 +65,24 @@ public interface IConnector {
/**
* enable/disable favorite points controls in cache details
*
- * @return
*/
public boolean supportsFavoritePoints(@NonNull final Geocache cache);
/**
* enable/disable logging controls in cache details
*
- * @return
*/
public boolean supportsLogging();
/**
* enable/disable attaching image to log
*
- * @return
*/
public boolean supportsLogImages();
/**
* Get an ILoggingManager to guide the logging process.
*
- * @return
*/
@NonNull
public ILoggingManager getLoggingManager(@NonNull final LogCacheActivity activity, @NonNull final Geocache cache);
@@ -101,7 +90,6 @@ public interface IConnector {
/**
* Get host name of the connector server for dynamic loading of data.
*
- * @return
*/
@NonNull
public String getHost();
@@ -109,8 +97,6 @@ public interface IConnector {
/**
* Get cache data license text. This is displayed somewhere near the cache details.
*
- * @param cache
- * @return
*/
@NonNull
public String getLicenseText(final @NonNull Geocache cache);
@@ -118,8 +104,6 @@ public interface IConnector {
/**
* return true if this is a ZIP file containing a GPX file
*
- * @param fileName
- * @return
*/
public boolean isZippedGPXFile(@NonNull final String fileName);
@@ -128,17 +112,15 @@ public interface IConnector {
*
* @param cacheHasReliableLatLon
* flag of the cache
- * @return
*/
public boolean isReliableLatLon(boolean cacheHasReliableLatLon);
/**
* extract a geocode from the given URL, if this connector can handle that URL somehow
*
- * @param url
- * @return
*/
- public String getGeocodeFromUrl(final String url);
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url);
/**
* enable/disable uploading personal note
@@ -150,7 +132,6 @@ public interface IConnector {
/**
* Uploading personal note to website
*
- * @param cache
* @return success
*/
public boolean uploadPersonalNote(@NonNull Geocache cache);
@@ -165,7 +146,6 @@ public interface IConnector {
/**
* Resetting of modified coordinates on website to details
*
- * @param cache
* @return success
*/
public boolean deleteModifiedCoordinates(@NonNull Geocache cache);
@@ -173,8 +153,6 @@ public interface IConnector {
/**
* Uploading modified coordinates to website
*
- * @param cache
- * @param wpt
* @return success
*/
public boolean uploadModifiedCoordinates(@NonNull Geocache cache, @NonNull Geopoint wpt);
@@ -183,7 +161,6 @@ public interface IConnector {
* Return {@code true} if this connector is active for online interaction (download details, do searches, ...). If
* this is {@code false}, the connector will still be used for already stored offline caches.
*
- * @return
*/
public boolean isActive();
@@ -200,8 +177,6 @@ public interface IConnector {
* Check if the cache information is complete enough to be
* able to log online.
*
- * @param geocache
- * @return
*/
public boolean canLog(@NonNull Geocache geocache);
@@ -218,8 +193,6 @@ public interface IConnector {
* Get the list of <b>potentially</b> possible log types for a cache. Those may still be filtered further during the
* actual logging activity.
*
- * @param geocache
- * @return
*/
@NonNull
public List<LogType> getPossibleLogTypes(@NonNull Geocache geocache);
@@ -228,16 +201,12 @@ public interface IConnector {
* Get the GPX id for a waypoint when exporting. For some connectors there is an inherent name logic,
* for others its just the 'prefix'.
*
- * @param prefix
- * @return
*/
- public String getWaypointGpxId(String prefix, String geocode);
+ public String getWaypointGpxId(String prefix, @NonNull String geocode);
/**
* Get the 'prefix' (key) for a waypoint from the 'name' in the GPX file
*
- * @param name
- * @return
*/
@NonNull
public String getWaypointPrefix(String name);
@@ -245,14 +214,12 @@ public interface IConnector {
/**
* Get the maximum value for Terrain
*
- * @return
*/
public int getMaxTerrain();
/**
* Get a user readable collection of all online features of this connector.
*
- * @return
*/
@NonNull
public Collection<String> getCapabilities();
diff --git a/main/src/cgeo/geocaching/connector/ILoggingManager.java b/main/src/cgeo/geocaching/connector/ILoggingManager.java
index 40a5377..2b0a067 100644
--- a/main/src/cgeo/geocaching/connector/ILoggingManager.java
+++ b/main/src/cgeo/geocaching/connector/ILoggingManager.java
@@ -16,13 +16,8 @@ public interface ILoggingManager {
/**
* Post a log for a cache online
*
- * @param logType
- * @param date
- * @param log
* @param logPassword
* optional, maybe null
- * @param trackableLogs
- * @return
*/
@NonNull
LogResult postLog(@NonNull LogType logType,
diff --git a/main/src/cgeo/geocaching/connector/UnknownConnector.java b/main/src/cgeo/geocaching/connector/UnknownConnector.java
index fcf1152..cabf03e 100644
--- a/main/src/cgeo/geocaching/connector/UnknownConnector.java
+++ b/main/src/cgeo/geocaching/connector/UnknownConnector.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.Geocache;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
class UnknownConnector extends AbstractConnector {
@@ -14,9 +15,9 @@ class UnknownConnector extends AbstractConnector {
}
@Override
- @NonNull
+ @Nullable
public String getCacheUrl(@NonNull final Geocache cache) {
- return StringUtils.EMPTY;
+ return null;
}
@Override
@@ -42,7 +43,8 @@ class UnknownConnector extends AbstractConnector {
}
@Override
- public String getGeocodeFromUrl(final String url) {
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
return null;
}
diff --git a/main/src/cgeo/geocaching/connector/WaymarkingConnector.java b/main/src/cgeo/geocaching/connector/WaymarkingConnector.java
index 5a6f362..3361341 100644
--- a/main/src/cgeo/geocaching/connector/WaymarkingConnector.java
+++ b/main/src/cgeo/geocaching/connector/WaymarkingConnector.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.Geocache;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
class WaymarkingConnector extends AbstractConnector {
@@ -41,4 +42,20 @@ class WaymarkingConnector extends AbstractConnector {
public boolean canHandle(@NonNull final String geocode) {
return StringUtils.startsWith(geocode, "WM");
}
+
+ @Override
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
+ // coord.info URLs
+ String code = StringUtils.substringAfterLast(url, "coord.info/");
+ if (code != null && canHandle(code)) {
+ return code;
+ }
+ // waymarking URLs http://www.waymarking.com/waymarks/WMNCDT_American_Legion_Flagpole_1983_University_of_Oregon
+ code = StringUtils.substringBetween(url, "waymarks/", "_");
+ if (code != null && canHandle(code)) {
+ return code;
+ }
+ return null;
+ }
}
diff --git a/main/src/cgeo/geocaching/connector/capability/ILogin.java b/main/src/cgeo/geocaching/connector/capability/ILogin.java
index 003ccf4..437eec8 100644
--- a/main/src/cgeo/geocaching/connector/capability/ILogin.java
+++ b/main/src/cgeo/geocaching/connector/capability/ILogin.java
@@ -27,14 +27,12 @@ public interface ILogin extends IConnector {
/**
* Returns the status of the last {@link #login(Handler, Context)} request.
*
- * @return
*/
boolean isLoggedIn();
/**
* User-centered string describing the current login/connection status
*
- * @return
*/
String getLoginStatusString();
@@ -42,7 +40,6 @@ public interface ILogin extends IConnector {
* Name the user has in this connector or empty string if not applicable.
* It might be necessary to execute {@link #login(Handler, Context)} before this information is valid.
*
- * @return
*/
String getUserName();
@@ -51,7 +48,6 @@ public interface ILogin extends IConnector {
* Normally retrieved/updated with {@link #login(Handler, Context)}.
* Might be stale as changes on the connectors site are generally not notified.
*
- * @return
*/
int getCachesFound();
diff --git a/main/src/cgeo/geocaching/connector/capability/IgnoreCapability.java b/main/src/cgeo/geocaching/connector/capability/IgnoreCapability.java
new file mode 100644
index 0000000..5eca3f2
--- /dev/null
+++ b/main/src/cgeo/geocaching/connector/capability/IgnoreCapability.java
@@ -0,0 +1,14 @@
+package cgeo.geocaching.connector.capability;
+
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.connector.IConnector;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+/**
+ * Connector capability to ignore caches.
+ */
+public interface IgnoreCapability extends IConnector {
+ public boolean canIgnoreCache(final @NonNull Geocache cache);
+ public void ignoreCache(final @NonNull Geocache cache);
+}
diff --git a/main/src/cgeo/geocaching/connector/ec/ECConnector.java b/main/src/cgeo/geocaching/connector/ec/ECConnector.java
index 15c2dc2..68dbee7 100644
--- a/main/src/cgeo/geocaching/connector/ec/ECConnector.java
+++ b/main/src/cgeo/geocaching/connector/ec/ECConnector.java
@@ -234,4 +234,14 @@ public class ECConnector extends AbstractConnector implements ISearchByGeocode,
return R.string.pref_ecpassword;
}
+ @Override
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
+ final String geocode = "EC" + StringUtils.substringAfter(url, "extremcaching.com/index.php/output-2/");
+ if (canHandle(geocode)) {
+ return geocode;
+ }
+ return super.getGeocodeFromUrl(url);
+ }
+
}
diff --git a/main/src/cgeo/geocaching/connector/ec/ECLogin.java b/main/src/cgeo/geocaching/connector/ec/ECLogin.java
index 3ae8298..94b450b 100644
--- a/main/src/cgeo/geocaching/connector/ec/ECLogin.java
+++ b/main/src/cgeo/geocaching/connector/ec/ECLogin.java
@@ -88,7 +88,6 @@ public class ECLogin extends AbstractLogin {
/**
* Check if the user has been logged in when he retrieved the data.
*
- * @param data
* @return <code>true</code> if user is logged in, <code>false</code> otherwise
*/
private boolean getLoginStatus(@Nullable final String data) {
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
index e43b9b5..2349392 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
@@ -19,6 +19,7 @@ import cgeo.geocaching.connector.capability.ISearchByGeocode;
import cgeo.geocaching.connector.capability.ISearchByKeyword;
import cgeo.geocaching.connector.capability.ISearchByOwner;
import cgeo.geocaching.connector.capability.ISearchByViewPort;
+import cgeo.geocaching.connector.capability.IgnoreCapability;
import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.loaders.RecaptchaReceiver;
import cgeo.geocaching.location.Geopoint;
@@ -47,7 +48,7 @@ import java.io.File;
import java.util.List;
import java.util.regex.Pattern;
-public class GCConnector extends AbstractConnector implements ISearchByGeocode, ISearchByCenter, ISearchByViewPort, ISearchByKeyword, ILogin, ICredentials, ISearchByOwner, ISearchByFinder, FieldNotesCapability {
+public class GCConnector extends AbstractConnector implements ISearchByGeocode, ISearchByCenter, ISearchByViewPort, ISearchByKeyword, ILogin, ICredentials, ISearchByOwner, ISearchByFinder, FieldNotesCapability, IgnoreCapability {
@NonNull
private static final String CACHE_URL_SHORT = "http://coord.info/";
@@ -305,7 +306,8 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
}
@Override
- public String getGeocodeFromUrl(final String url) {
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
// coord.info URLs
String code = StringUtils.substringAfterLast(url, "coord.info/");
if (code != null && canHandle(code)) {
@@ -375,7 +377,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
}
@Override
- public String getWaypointGpxId(final String prefix, final String geocode) {
+ public String getWaypointGpxId(final String prefix, @NonNull final String geocode) {
String gpxId = prefix;
if (StringUtils.isNotBlank(geocode) && geocode.length() > 2) {
gpxId += geocode.substring(2);
@@ -480,4 +482,14 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
return true;
}
+ @Override
+ public boolean canIgnoreCache(@NonNull final Geocache cache) {
+ return StringUtils.isNotEmpty(cache.getType().wptTypeId);
+ }
+
+ @Override
+ public void ignoreCache(@NonNull final Geocache cache) {
+ GCParser.ignoreCache(cache);
+ }
+
}
diff --git a/main/src/cgeo/geocaching/connector/gc/GCLogin.java b/main/src/cgeo/geocaching/connector/gc/GCLogin.java
index 035176b..71c31c1 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCLogin.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCLogin.java
@@ -166,7 +166,6 @@ public class GCLogin extends AbstractLogin {
/**
* Check if the user has been logged in when he retrieved the data.
*
- * @param page
* @return <code>true</code> if user is logged in, <code>false</code> otherwise
*/
boolean getLoginStatus(@Nullable final String page) {
@@ -412,8 +411,6 @@ public class GCLogin extends AbstractLogin {
/**
* POST HTTP request. Do the request a second time if the user is not logged in
*
- * @param uri
- * @return
*/
String postRequestLogged(final String uri, final Parameters params) {
final String data = Network.getResponseData(Network.postRequest(uri, params));
@@ -433,9 +430,6 @@ public class GCLogin extends AbstractLogin {
/**
* GET HTTP request. Do the request a second time if the user is not logged in
*
- * @param uri
- * @param params
- * @return
*/
@Nullable
String getRequestLogged(@NonNull final String uri, @Nullable final Parameters params) {
@@ -459,8 +453,6 @@ public class GCLogin extends AbstractLogin {
* Unfortunately the cache details page contains user generated whitespace in the personal note, therefore we cannot
* remove the white space from cache details pages.
*
- * @param uri
- * @return
*/
private static boolean canRemoveWhitespace(final String uri) {
return !StringUtils.contains(uri, "cache_details");
diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java
index 1571faa..243d84c 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCMap.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java
@@ -11,8 +11,8 @@ import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.location.GeopointFormatter.Format;
import cgeo.geocaching.location.Units;
import cgeo.geocaching.location.Viewport;
-import cgeo.geocaching.maps.LiveMapStrategy.Strategy;
-import cgeo.geocaching.maps.LiveMapStrategy.StrategyFlag;
+import cgeo.geocaching.maps.LivemapStrategy;
+import cgeo.geocaching.maps.LivemapStrategy.Flag;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.sensors.Sensors;
import cgeo.geocaching.settings.Settings;
@@ -110,7 +110,7 @@ public class GCMap {
* Retrieved data.
* @return SearchResult. Never null.
*/
- public static SearchResult parseMapJSON(final String data, final Tile tile, final Bitmap bitmap, final Strategy strategy) {
+ public static SearchResult parseMapJSON(final String data, final Tile tile, final Bitmap bitmap, final LivemapStrategy strategy) {
final SearchResult searchResult = new SearchResult();
try {
@@ -185,7 +185,7 @@ public class GCMap {
cache.setGeocode(id);
cache.setName(nameCache.get(id));
cache.setCoords(tile.getCoord(xy), tile.getZoomLevel());
- if (strategy.flags.contains(StrategyFlag.PARSE_TILES) && bitmap != null) {
+ if (strategy.flags.contains(LivemapStrategy.Flag.PARSE_TILES) && bitmap != null) {
for (final UTFGridPosition singlePos : singlePositions.get(id)) {
if (IconDecoder.parseMapPNG(cache, bitmap, singlePos, tile.getZoomLevel())) {
break; // cache parsed
@@ -226,14 +226,13 @@ public class GCMap {
* Area to search
* @param tokens
* Live map tokens
- * @return
*/
@NonNull
public static SearchResult searchByViewport(final Viewport viewport, final MapTokens tokens) {
final int speed = (int) Sensors.getInstance().currentGeo().getSpeed() * 60 * 60 / 1000; // in km/h
- Strategy strategy = Settings.getLiveMapStrategy();
- if (strategy == Strategy.AUTO) {
- strategy = speed >= 30 ? Strategy.FAST : Strategy.DETAILED;
+ LivemapStrategy strategy = Settings.getLiveMapStrategy();
+ if (strategy == LivemapStrategy.AUTO) {
+ strategy = speed >= 30 ? LivemapStrategy.FAST : LivemapStrategy.DETAILED;
}
final SearchResult result = searchByViewport(viewport, tokens, strategy);
@@ -257,10 +256,9 @@ public class GCMap {
* Live map tokens
* @param strategy
* Strategy for data retrieval and parsing, @see Strategy
- * @return
*/
@NonNull
- private static SearchResult searchByViewport(final Viewport viewport, final MapTokens tokens, final Strategy strategy) {
+ private static SearchResult searchByViewport(final Viewport viewport, final MapTokens tokens, final LivemapStrategy strategy) {
Log.d("GCMap.searchByViewport" + viewport.toString());
final SearchResult searchResult = new SearchResult();
@@ -269,7 +267,7 @@ public class GCMap {
searchResult.setUrl(viewport.getCenter().format(Format.LAT_LON_DECMINUTE));
}
- if (strategy.flags.contains(StrategyFlag.LOAD_TILES)) {
+ if (strategy.flags.contains(LivemapStrategy.Flag.LOAD_TILES)) {
final Set<Tile> tiles = Tile.getTilesForViewport(viewport);
if (Settings.isDebug()) {
@@ -339,7 +337,7 @@ public class GCMap {
}
}
- if (strategy.flags.contains(StrategyFlag.SEARCH_NEARBY) && Settings.isGCPremiumMember()) {
+ if (strategy.flags.contains(Flag.SEARCH_NEARBY) && Settings.isGCPremiumMember()) {
final Geopoint center = viewport.getCenter();
if ((lastSearchViewport == null) || !lastSearchViewport.contains(center)) {
//FIXME We don't have a RecaptchaReceiver!?
@@ -360,7 +358,6 @@ public class GCMap {
*
* @param typeToDisplay
* - cache type to omit from exclusion list so it gets displayed
- * @return
*
* cache types for live map filter:
* 2 = traditional, 9 = ape, 5 = letterbox
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index d5ea8c4..d0a90bb 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -57,7 +57,6 @@ import rx.functions.Action1;
import rx.functions.Func0;
import rx.functions.Func2;
import rx.schedulers.Schedulers;
-import rx.util.async.Async;
import android.net.Uri;
import android.text.Html;
@@ -65,6 +64,7 @@ import android.text.Html;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.text.Collator;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
@@ -304,12 +304,13 @@ public abstract class GCParser {
if (!cids.isEmpty() && (Settings.isGCPremiumMember() || showCaptcha) && ((recaptchaReceiver == null || StringUtils.isBlank(recaptchaReceiver.getChallenge())) || StringUtils.isNotBlank(recaptchaText))) {
Log.i("Trying to get .loc for " + cids.size() + " caches");
- final Observable<Set<Geocache>> storedCaches = Async.start(new Func0<Set<Geocache>>() {
+ final Observable<Set<Geocache>> storedCaches = Observable.defer(new Func0<Observable<Set<Geocache>>>() {
@Override
- public Set<Geocache> call() {
- return DataStore.loadCaches(Geocache.getGeocodes(caches), LoadFlags.LOAD_CACHE_OR_DB);
+ public Observable<Set<Geocache>> call() {
+ return Observable.just(DataStore.loadCaches(Geocache.getGeocodes(caches), LoadFlags.LOAD_CACHE_OR_DB));
}
- }, Schedulers.io());
+ }).subscribeOn(Schedulers.io()).cache();
+ storedCaches.subscribe(); // Force asynchronous start of database loading
try {
// get coordinates for parsed caches
@@ -987,22 +988,22 @@ public abstract class GCParser {
* Observable that fetches a list of pocket queries. Returns a single element (which may be an empty list).
* Executes on the network scheduler.
*/
- public static final Observable<List<PocketQueryList>> searchPocketQueryListObservable = Async.fromCallable(new Func0<List<PocketQueryList>>() {
+ public static final Observable<List<PocketQueryList>> searchPocketQueryListObservable = Observable.defer(new Func0<Observable<List<PocketQueryList>>>() {
@Override
- public List<PocketQueryList> call() {
+ public Observable<List<PocketQueryList>> call() {
final Parameters params = new Parameters();
final String page = GCLogin.getInstance().getRequestLogged("http://www.geocaching.com/pocket/default.aspx", params);
if (StringUtils.isBlank(page)) {
Log.e("GCParser.searchPocketQueryList: No data from server");
- return Collections.emptyList();
+ return Observable.just(Collections.<PocketQueryList>emptyList());
}
final String subPage = StringUtils.substringAfter(page, "class=\"PocketQueryListTable");
if (StringUtils.isEmpty(subPage)) {
Log.e("GCParser.searchPocketQueryList: class \"PocketQueryListTable\" not found on page");
- return Collections.emptyList();
+ return Observable.just(Collections.<PocketQueryList>emptyList());
}
final List<PocketQueryList> list = new ArrayList<>();
@@ -1024,17 +1025,18 @@ public abstract class GCParser {
}
// just in case, lets sort the resulting list
+ final Collator collator = TextUtils.getCollator();
Collections.sort(list, new Comparator<PocketQueryList>() {
@Override
public int compare(final PocketQueryList left, final PocketQueryList right) {
- return String.CASE_INSENSITIVE_ORDER.compare(left.getName(), right.getName());
+ return collator.compare(left.getName(), right.getName());
}
});
- return list;
+ return Observable.just(list);
}
- }, RxUtils.networkScheduler);
+ }).subscribeOn(RxUtils.networkScheduler);
public static ImmutablePair<StatusCode, String> postLog(final String geocode, final String cacheid, final String[] viewstates,
final LogType logType, final int year, final int month, final int day,
@@ -1985,4 +1987,25 @@ public abstract class GCParser {
return false;
}
+ public static boolean ignoreCache(@NonNull final Geocache cache) {
+ final String uri = "http://www.geocaching.com/bookmarks/ignore.aspx?guid=" + cache.getGuid() + "&WptTypeID=" + cache.getType().wptTypeId;
+ final String page = GCLogin.getInstance().postRequestLogged(uri, null);
+
+ if (StringUtils.isBlank(page)) {
+ Log.e("GCParser.ignoreCache: No data from server");
+ return false;
+ }
+
+ final String[] viewstates = GCLogin.getViewstates(page);
+
+ final Parameters params = new Parameters(
+ "__EVENTTARGET", "",
+ "__EVENTARGUMENT", "",
+ "ctl00$ContentBody$btnYes", "Yes. Ignore it.");
+
+ GCLogin.putViewstates(params, viewstates);
+ final String response = Network.getResponseData(Network.postRequest(uri, params));
+
+ return StringUtils.contains(response, "<p class=\"Success\">");
+ }
}
diff --git a/main/src/cgeo/geocaching/connector/gc/Tile.java b/main/src/cgeo/geocaching/connector/gc/Tile.java
index 93b61f9..dd6371b 100644
--- a/main/src/cgeo/geocaching/connector/gc/Tile.java
+++ b/main/src/cgeo/geocaching/connector/gc/Tile.java
@@ -15,7 +15,6 @@ import org.eclipse.jdt.annotation.NonNull;
import rx.Observable;
import rx.functions.Func0;
-import rx.util.async.Async;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@@ -144,7 +143,6 @@ public class Tile {
* First point
* @param right
* Second point
- * @return
*/
static int calcZoomLon(final Geopoint left, final Geopoint right, final int numberOfTiles) {
@@ -177,7 +175,6 @@ public class Tile {
* First point
* @param top
* Second point
- * @return
*/
static int calcZoomLat(final Geopoint bottom, final Geopoint top, final int numberOfTiles) {
@@ -208,8 +205,6 @@ public class Tile {
* Calculates the inverted hyperbolic sine
* (after Bronstein, Semendjajew: Taschenbuch der Mathematik)
*
- * @param x
- * @return
*/
private static double asinh(final double x) {
return Math.log(x + Math.sqrt(x * x + 1.0));
@@ -241,12 +236,12 @@ public class Tile {
static Observable<String> requestMapInfo(final String url, final Parameters params, final String referer) {
final HttpResponse response = Network.getRequest(url, params, new Parameters("Referer", referer));
- return Async.start(new Func0<String>() {
+ return Observable.defer(new Func0<Observable<String>>() {
@Override
- public String call() {
- return Network.getResponseData(response);
+ public Observable<String> call() {
+ return Observable.just(Network.getResponseData(response));
}
- }, RxUtils.networkScheduler);
+ }).subscribeOn(RxUtils.networkScheduler);
}
/** Request .png image for a tile. Return as soon as the request has been made, before the answer has been
@@ -256,17 +251,17 @@ public class Tile {
*/
static Observable<Bitmap> requestMapTile(final Parameters params) {
final HttpResponse response = Network.getRequest(GCConstants.URL_MAP_TILE, params, new Parameters("Referer", GCConstants.URL_LIVE_MAP));
- return Async.start(new Func0<Bitmap>() {
+ return Observable.defer(new Func0<Observable<Bitmap>>() {
@Override
- public Bitmap call() {
+ public Observable<Bitmap> call() {
try {
- return response != null ? BitmapFactory.decodeStream(response.getEntity().getContent()) : null;
+ return Observable.just(response != null ? BitmapFactory.decodeStream(response.getEntity().getContent()) : null);
} catch (final IOException e) {
Log.e("Tile.requestMapTile() ", e);
- return null;
+ return Observable.just(null);
}
}
- }, RxUtils.computationScheduler);
+ }).subscribeOn(RxUtils.computationScheduler);
}
public boolean containsPoint(final @NonNull ICoordinates point) {
@@ -281,8 +276,6 @@ public class Tile {
* Calculate needed tiles for the given viewport to cover it with
* max 2x2 tiles
*
- * @param viewport
- * @return
*/
protected static Set<Tile> getTilesForViewport(final Viewport viewport) {
return getTilesForViewport(viewport, 2, Tile.ZOOMLEVEL_MIN);
@@ -293,10 +286,6 @@ public class Tile {
* You can define the minimum number of tiles on the longer axis
* and/or the minimum zoom level.
*
- * @param viewport
- * @param tilesOnAxis
- * @param minZoom
- * @return
*/
protected static Set<Tile> getTilesForViewport(final Viewport viewport, final int tilesOnAxis, final int minZoom) {
final Set<Tile> tiles = new HashSet<>();
diff --git a/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java b/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java
index 9de7e1e..f5cd208 100644
--- a/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java
+++ b/main/src/cgeo/geocaching/connector/gc/UTFGridPosition.java
@@ -36,7 +36,6 @@ final class UTFGridPosition {
/**
* @param key
* Key in the format (xx, xx)
- * @return
*/
static UTFGridPosition fromString(final String key) {
final MatcherWrapper matcher = new MatcherWrapper(UTFGridPosition.PATTERN_JSON_KEY, key);
diff --git a/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java b/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java
index 71adcbd..c9e01a2 100644
--- a/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java
+++ b/main/src/cgeo/geocaching/connector/gc/UncertainProperty.java
@@ -4,7 +4,6 @@ package cgeo.geocaching.connector.gc;
/**
* Property with certainty. When merging properties, the one with higher certainty wins.
*
- * @param <T>
*/
public class UncertainProperty<T> {
diff --git a/main/src/cgeo/geocaching/connector/oc/IOCAuthParams.java b/main/src/cgeo/geocaching/connector/oc/IOCAuthParams.java
index acf7b48..5e5151a 100644
--- a/main/src/cgeo/geocaching/connector/oc/IOCAuthParams.java
+++ b/main/src/cgeo/geocaching/connector/oc/IOCAuthParams.java
@@ -7,7 +7,6 @@ public interface IOCAuthParams {
/**
* The site name: 'www.opencaching...'
*
- * @return
*/
@NonNull
String getSite();
@@ -15,56 +14,48 @@ public interface IOCAuthParams {
/**
* ResId of the Consumer key
*
- * @return
*/
int getCKResId();
/**
* ResId of the Consumer secret
*
- * @return
*/
int getCSResId();
/**
* ResId of the Authorization title
*
- * @return
*/
int getAuthTitleResId();
/**
* Preference key of the public token
*
- * @return
*/
int getTokenPublicPrefKey();
/**
* Preference key of the secret token
*
- * @return
*/
int getTokenSecretPrefKey();
/**
* Preference key of the temporary public token (OAuth)
*
- * @return
*/
int getTempTokenPublicPrefKey();
/**
* Preference key of the temporary secret token (OAuth)
*
- * @return
*/
int getTempTokenSecretPrefKey();
/**
* The URI to use as a callback (OAuth)
*
- * @return
*/
@NonNull
String getCallbackUri();
diff --git a/main/src/cgeo/geocaching/connector/oc/OCCZConnector.java b/main/src/cgeo/geocaching/connector/oc/OCCZConnector.java
new file mode 100644
index 0000000..ee4330a
--- /dev/null
+++ b/main/src/cgeo/geocaching/connector/oc/OCCZConnector.java
@@ -0,0 +1,34 @@
+package cgeo.geocaching.connector.oc;
+
+import cgeo.geocaching.utils.Log;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+public class OCCZConnector extends OCConnector {
+
+ private static final String GEOCODE_PREFIX = "OZ";
+
+ public OCCZConnector() {
+ super("OpenCaching.CZ", "www.opencaching.cz", GEOCODE_PREFIX);
+ }
+
+ @Override
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
+ if (!StringUtils.containsIgnoreCase(url, "opencaching.cz")) {
+ return null;
+ }
+ final String id = StringUtils.substringAfter(url, "cacheid=");
+ try {
+ final String geocode = GEOCODE_PREFIX + StringUtils.leftPad(Integer.toHexString(Integer.parseInt(id)), 4, '0');
+ if (canHandle(geocode)) {
+ return geocode;
+ }
+ } catch (final NumberFormatException e) {
+ Log.e("Unexpected URL for opencaching.cz " + url);
+ }
+ return super.getGeocodeFromUrl(url);
+ }
+}
diff --git a/main/src/cgeo/geocaching/connector/oc/OCConnector.java b/main/src/cgeo/geocaching/connector/oc/OCConnector.java
index 8ac457b..6d7b23a 100644
--- a/main/src/cgeo/geocaching/connector/oc/OCConnector.java
+++ b/main/src/cgeo/geocaching/connector/oc/OCConnector.java
@@ -5,7 +5,9 @@ import cgeo.geocaching.R;
import cgeo.geocaching.connector.AbstractConnector;
import cgeo.geocaching.enumerations.LogType;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import java.util.Arrays;
import java.util.List;
@@ -83,4 +85,24 @@ public class OCConnector extends AbstractConnector {
return STANDARD_LOG_TYPES;
}
+
+ @Override
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
+ // different opencaching installations have different supported URLs
+
+ // host.tld/geocode
+ final String shortHost = StringUtils.remove(getHost(), "www.");
+ String geocode = StringUtils.substringAfter(url, shortHost + "/");
+ if (canHandle(geocode)) {
+ return geocode;
+ }
+
+ // host.tld/viewcache.php?wp=geocode
+ geocode = StringUtils.substringAfter(url, shortHost + "/viewcache.php?wp=");
+ if (canHandle(geocode)) {
+ return geocode;
+ }
+ return super.getGeocodeFromUrl(url);
+ }
}
diff --git a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
index 275a103..e7d4e6f 100644
--- a/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
+++ b/main/src/cgeo/geocaching/connector/oc/OkapiClient.java
@@ -30,6 +30,7 @@ import cgeo.geocaching.network.OAuth;
import cgeo.geocaching.network.OAuthTokens;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.settings.Settings;
+import cgeo.geocaching.utils.HtmlUtils;
import cgeo.geocaching.utils.JsonUtils;
import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.SynchronizedDateFormat;
@@ -62,8 +63,16 @@ import java.util.Map;
import java.util.TimeZone;
import java.util.regex.Pattern;
+/**
+ * Client for the OpenCaching API (Okapi).
+ *
+ * @see <a href="http://www.opencaching.de/okapi/introduction.html">Okapi overview</a>
+ *
+ */
final class OkapiClient {
+ private static final String PARAMETER_LOGCOUNT_VALUE = "all";
+ private static final String PARAMETER_LOGCOUNT_KEY = "lpc";
private static final char SEPARATOR = '|';
private static final String SEPARATOR_STRING = Character.toString(SEPARATOR);
private static final SynchronizedDateFormat LOG_DATE_FORMAT = new SynchronizedDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ", TimeZone.getTimeZone("UTC"), Locale.US);
@@ -149,6 +158,7 @@ final class OkapiClient {
params.add("fields", getFullFields(ocapiConn));
params.add("attribution_append", "none");
+ params.add(PARAMETER_LOGCOUNT_KEY, PARAMETER_LOGCOUNT_VALUE);
final JSONResult result = request(ocapiConn, OkapiService.SERVICE_CACHE, params);
@@ -458,7 +468,7 @@ final class OkapiClient {
parseUser(logResponse.get(LOG_USER)),
parseDate(logResponse.get(LOG_DATE).asText()).getTime(),
parseLogType(logResponse.get(LOG_TYPE).asText()),
- logResponse.get(LOG_COMMENT).asText().trim());
+ HtmlUtils.removeExtraParagraph(logResponse.get(LOG_COMMENT).asText().trim()));
result.add(log);
} catch (final NullPointerException e) {
Log.e("OkapiClient.parseLogs", e);
diff --git a/main/src/cgeo/geocaching/connector/ox/OXConnector.java b/main/src/cgeo/geocaching/connector/ox/OXConnector.java
index 41035d1..d1db301 100644
--- a/main/src/cgeo/geocaching/connector/ox/OXConnector.java
+++ b/main/src/cgeo/geocaching/connector/ox/OXConnector.java
@@ -14,6 +14,7 @@ import cgeo.geocaching.location.Viewport;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.CancellableHandler;
+import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
@@ -109,4 +110,14 @@ public class OXConnector extends AbstractConnector implements ISearchByCenter, I
}
return new SearchResult(caches);
}
+
+ @Override
+ @Nullable
+ public String getGeocodeFromUrl(@NonNull final String url) {
+ final String geocode = StringUtils.substringAfter(url, "http://www.opencaching.com/de/#!geocache/");
+ if (canHandle(geocode)) {
+ return geocode;
+ }
+ return super.getGeocodeFromUrl(url);
+ }
}
diff --git a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java
index 7896826..25f66f4 100644
--- a/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java
+++ b/main/src/cgeo/geocaching/connector/ox/OXGPXParser.java
@@ -29,7 +29,6 @@ public class OXGPXParser extends GPX10Parser {
* The short description of OX caches contains "title by owner, type(T/D/Awesomeness)". That is a lot of
* duplication. Additionally a space between type and (T/D/Awesomeness) is introduced.
*
- * @param cache
*/
private static void removeTitleFromShortDescription(final @NonNull Geocache cache) {
cache.setShortDescription(StringUtils.replace(StringUtils.trim(StringUtils.substringAfterLast(cache.getShortDescription(), ",")), "(", " ("));
diff --git a/main/src/cgeo/geocaching/connector/trackable/GeokretyConnector.java b/main/src/cgeo/geocaching/connector/trackable/GeokretyConnector.java
index b6792f0..6f9b21a 100644
--- a/main/src/cgeo/geocaching/connector/trackable/GeokretyConnector.java
+++ b/main/src/cgeo/geocaching/connector/trackable/GeokretyConnector.java
@@ -26,6 +26,7 @@ public class GeokretyConnector extends AbstractTrackableConnector {
}
@Override
+ @Nullable
public Trackable searchTrackable(final String geocode, final String guid, final String id) {
final String page = Network.getResponseData(Network.getRequest("http://geokrety.org/export2.php?gkid=" + getId(geocode)));
if (page == null) {
@@ -48,7 +49,12 @@ public class GeokretyConnector extends AbstractTrackableConnector {
public @Nullable
String getTrackableCodeFromUrl(@NonNull final String url) {
// http://geokrety.org/konkret.php?id=38545
- final String id = StringUtils.substringAfterLast(url, "konkret.php?id=");
+ String id = StringUtils.substringAfterLast(url, "konkret.php?id=");
+ if (StringUtils.isNumeric(id)) {
+ return geocode(Integer.parseInt(id));
+ }
+ // http://geokretymap.org/38545
+ id = StringUtils.substringAfterLast(url, "geokretymap.org/");
if (StringUtils.isNumeric(id)) {
return geocode(Integer.parseInt(id));
}
@@ -58,8 +64,6 @@ public class GeokretyConnector extends AbstractTrackableConnector {
/**
* Get geocode from geokrety id
*
- * @param id
- * @return
*/
public static String geocode(final int id) {
return String.format("GK%04X", id);
diff --git a/main/src/cgeo/geocaching/connector/trackable/SwaggieConnector.java b/main/src/cgeo/geocaching/connector/trackable/SwaggieConnector.java
new file mode 100644
index 0000000..dcd618c
--- /dev/null
+++ b/main/src/cgeo/geocaching/connector/trackable/SwaggieConnector.java
@@ -0,0 +1,51 @@
+package cgeo.geocaching.connector.trackable;
+
+import cgeo.geocaching.Trackable;
+import cgeo.geocaching.network.Network;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+import java.util.regex.Pattern;
+
+public final class SwaggieConnector extends AbstractTrackableConnector {
+
+ private static final Pattern PATTERN_SW_CODE = Pattern.compile("SW[0-9]{4}");
+
+ @Override
+ public boolean canHandleTrackable(final String geocode) {
+ return geocode != null && PATTERN_SW_CODE.matcher(geocode).matches();
+ }
+
+ @Override
+ @NonNull
+ public String getUrl(@NonNull final Trackable trackable) {
+ return getUrl(trackable.getGeocode());
+ }
+
+ @Override
+ @Nullable
+ public Trackable searchTrackable(final String geocode, final String guid, final String id) {
+ final String page = Network.getResponseData(Network.getRequest(getUrl(geocode)));
+ if (page == null) {
+ return null;
+ }
+ return SwaggieParser.parse(page);
+ }
+
+ @Override
+ @Nullable
+ public String getTrackableCodeFromUrl(@NonNull final String url) {
+ final String geocode = StringUtils.upperCase(StringUtils.substringAfterLast(url, "swaggie/"));
+ if (canHandleTrackable(geocode)) {
+ return geocode;
+ }
+ return null;
+ }
+
+ private static String getUrl(final String geocode) {
+ return "http://geocaching.com.au/swaggie/" + geocode;
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/connector/trackable/SwaggieParser.java b/main/src/cgeo/geocaching/connector/trackable/SwaggieParser.java
new file mode 100644
index 0000000..1883056
--- /dev/null
+++ b/main/src/cgeo/geocaching/connector/trackable/SwaggieParser.java
@@ -0,0 +1,55 @@
+package cgeo.geocaching.connector.trackable;
+
+import cgeo.geocaching.Trackable;
+import cgeo.geocaching.utils.TextUtils;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+import java.util.regex.Pattern;
+
+final class SwaggieParser {
+
+ private SwaggieParser() {
+ // utility class
+ }
+
+ private static final Pattern PATTERN_NAME = Pattern.compile(Pattern.quote("<h1><a") + ".*?>(.*?)<");
+ private static final Pattern PATTERN_GEOCODE = Pattern.compile(Pattern.quote("'/swaggie/") + "(.*?)'");
+ private static final Pattern PATTERN_DESCRIPTION = Pattern.compile(Pattern.quote("'swaggie_description'>") + "(.*?)</div");
+ private static final Pattern PATTERN_OWNER = Pattern.compile(">([^<]*?)</a> released");
+
+ @Nullable
+ public static Trackable parse(@NonNull final String page) {
+ final Trackable trackable = new Trackable();
+ final String name = TextUtils.getMatch(page, PATTERN_NAME, null);
+ if (StringUtils.isEmpty(name)) {
+ return null;
+ }
+ trackable.setName(name);
+
+ final String geocode = TextUtils.getMatch(page, PATTERN_GEOCODE, null);
+ if (StringUtils.isEmpty(geocode)) {
+ return null;
+ }
+ trackable.setGeocode(geocode);
+
+ final String description = StringUtils.trim(TextUtils.getMatch(page, PATTERN_DESCRIPTION, StringUtils.EMPTY));
+ if (StringUtils.isEmpty(description)) {
+ return null;
+ }
+ trackable.setDetails(description);
+
+ final String owner = StringUtils.trim(TextUtils.getMatch(page, PATTERN_OWNER, StringUtils.EMPTY));
+ if (StringUtils.isEmpty(owner)) {
+ return null;
+ }
+ trackable.setOwner(owner);
+
+ trackable.setType("Swaggie");
+
+ return trackable;
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/connector/trackable/TrackableConnector.java b/main/src/cgeo/geocaching/connector/trackable/TrackableConnector.java
index 01c1897..1281683 100644
--- a/main/src/cgeo/geocaching/connector/trackable/TrackableConnector.java
+++ b/main/src/cgeo/geocaching/connector/trackable/TrackableConnector.java
@@ -21,6 +21,7 @@ public interface TrackableConnector {
public boolean isLoggable();
+ @Nullable
public Trackable searchTrackable(String geocode, String guid, String id);
@Nullable
diff --git a/main/src/cgeo/geocaching/connector/trackable/TravelBugConnector.java b/main/src/cgeo/geocaching/connector/trackable/TravelBugConnector.java
index 5d825a3..665ebea 100644
--- a/main/src/cgeo/geocaching/connector/trackable/TravelBugConnector.java
+++ b/main/src/cgeo/geocaching/connector/trackable/TravelBugConnector.java
@@ -36,6 +36,7 @@ public class TravelBugConnector extends AbstractTrackableConnector {
}
@Override
+ @Nullable
public Trackable searchTrackable(final String geocode, final String guid, final String id) {
return GCParser.searchTrackable(geocode, guid, id);
}
diff --git a/main/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnector.java b/main/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnector.java
index 7e7e1b6..5fc7bf1 100644
--- a/main/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnector.java
+++ b/main/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnector.java
@@ -3,6 +3,7 @@ package cgeo.geocaching.connector.trackable;
import cgeo.geocaching.Trackable;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
public class UnknownTrackableConnector extends AbstractTrackableConnector {
@@ -18,6 +19,7 @@ public class UnknownTrackableConnector extends AbstractTrackableConnector {
}
@Override
+ @Nullable
public Trackable searchTrackable(final String geocode, final String guid, final String id) {
return null;
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
index 585b890..770b63b 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
@@ -130,19 +130,22 @@ public enum CacheAttribute {
// THIS LIST IS GENERATED: don't change anything here but read
// project/attributes/readme.txt
+ @NonNull
private static final String INTERNAL_YES = "_yes";
+ @NonNull
private static final String INTERNAL_NO = "_no";
public static final int NO_ID = -1;
public final int gcid;
public final int ocacode;
+ @NonNull
public final String rawName;
public final int drawableId;
public final int stringIdYes;
public final int stringIdNo;
- CacheAttribute(final int gcid, final int ocacode, final String rawName,
+ CacheAttribute(final int gcid, final int ocacode, @NonNull final String rawName,
final int drawableId, final int stringIdYes, final int stringIdNo) {
this.gcid = gcid;
this.ocacode = ocacode;
@@ -159,12 +162,15 @@ public enum CacheAttribute {
* true: for positive text, false: for negative text
* @return the localized text
*/
+ @NonNull
public String getL10n(final boolean enabled) {
return CgeoApplication.getInstance().getResources().getString(
enabled ? stringIdYes : stringIdNo);
}
+ @NonNull
private final static Map<String, CacheAttribute> FIND_BY_GCRAWNAME = new HashMap<>();
+ @NonNull
private final static SparseArray<CacheAttribute> FIND_BY_OCACODE = new SparseArray<>();
static {
for (final CacheAttribute attr : values()) {
@@ -176,7 +182,7 @@ public enum CacheAttribute {
}
@Nullable
- public static CacheAttribute getByRawName(final String rawName) {
+ public static CacheAttribute getByRawName(@Nullable final String rawName) {
return rawName != null ? FIND_BY_GCRAWNAME.get(rawName) : null;
}
@@ -186,14 +192,14 @@ public enum CacheAttribute {
}
@NonNull
- public static String trimAttributeName(final String attributeName) {
+ public static String trimAttributeName(@Nullable final String attributeName) {
if (null == attributeName) {
return "";
}
return attributeName.replace(INTERNAL_YES, "").replace(INTERNAL_NO, "").trim();
}
- public static boolean isEnabled(final String attributeName) {
+ public static boolean isEnabled(@Nullable final String attributeName) {
return !StringUtils.endsWithIgnoreCase(attributeName, INTERNAL_NO);
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheListType.java b/main/src/cgeo/geocaching/enumerations/CacheListType.java
index 1fce282..297e1be 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheListType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheListType.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.enumerations;
import cgeo.geocaching.loaders.AbstractSearchLoader.CacheListLoaderType;
+import org.eclipse.jdt.annotation.NonNull;
+
public enum CacheListType {
OFFLINE(true, CacheListLoaderType.OFFLINE),
POCKET(false, CacheListLoaderType.POCKET),
@@ -19,9 +21,9 @@ public enum CacheListType {
*/
public final boolean canSwitch;
- public final CacheListLoaderType loaderType;
+ @NonNull public final CacheListLoaderType loaderType;
- CacheListType(final boolean canSwitch, final CacheListLoaderType loaderType) {
+ CacheListType(final boolean canSwitch, @NonNull final CacheListLoaderType loaderType) {
this.canSwitch = canSwitch;
this.loaderType = loaderType;
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheSize.java b/main/src/cgeo/geocaching/enumerations/CacheSize.java
index 54e12e0..10c8c9f 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheSize.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheSize.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import java.util.HashMap;
import java.util.Locale;
@@ -24,6 +25,7 @@ public enum CacheSize {
OTHER("Other", 8, R.string.cache_size_other, "other"),
UNKNOWN("Unknown", -1, R.string.cache_size_unknown, ""); // CacheSize not init. yet
+ @NonNull
public final String id;
public final int comparable;
private final int stringId;
@@ -32,13 +34,14 @@ public enum CacheSize {
*/
private final String ocSize2;
- CacheSize(final String id, final int comparable, final int stringId, final String ocSize2) {
+ CacheSize(@NonNull final String id, final int comparable, final int stringId, final String ocSize2) {
this.id = id;
this.comparable = comparable;
this.stringId = stringId;
this.ocSize2 = ocSize2;
}
+ @NonNull
final private static Map<String, CacheSize> FIND_BY_ID = new HashMap<>();
static {
for (final CacheSize cs : values()) {
@@ -50,7 +53,7 @@ public enum CacheSize {
}
@NonNull
- public static CacheSize getById(final String id) {
+ public static CacheSize getById(@Nullable final String id) {
if (id == null) {
return UNKNOWN;
}
@@ -87,6 +90,7 @@ public enum CacheSize {
return UNKNOWN;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
diff --git a/main/src/cgeo/geocaching/enumerations/CacheType.java b/main/src/cgeo/geocaching/enumerations/CacheType.java
index e66c742..a6c32d9 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheType.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheType.java
@@ -15,26 +15,26 @@ import java.util.Map;
*/
public enum CacheType {
- TRADITIONAL("traditional", "Traditional Cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional),
- MULTI("multi", "Multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi),
- MYSTERY("mystery", "Unknown Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery),
- LETTERBOX("letterbox", "Letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox),
- EVENT("event", "Event Cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event),
- MEGA_EVENT("mega", "Mega-Event Cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega),
- GIGA_EVENT("giga", "Giga-Event Cache", "51420629-5739-4945-8bdd-ccfd434c0ead", R.string.giga, R.drawable.type_giga),
- EARTH("earth", "Earthcache", "c66f5cf3-9523-4549-b8dd-759cd2f18db8", R.string.earth, R.drawable.type_earth),
- CITO("cito", "Cache in Trash out Event", "57150806-bc1a-42d6-9cf0-538d171a2d22", R.string.cito, R.drawable.type_cito),
- WEBCAM("webcam", "Webcam Cache", "31d2ae3c-c358-4b5f-8dcd-2185bf472d3d", R.string.webcam, R.drawable.type_webcam),
- VIRTUAL("virtual", "Virtual Cache", "294d4360-ac86-4c83-84dd-8113ef678d7e", R.string.virtual, R.drawable.type_virtual),
- WHERIGO("wherigo", "Wherigo Cache", "0544fa55-772d-4e5c-96a9-36a51ebcf5c9", R.string.wherigo, R.drawable.type_wherigo),
- LOSTANDFOUND("lostfound", "Lost and Found Event Cache", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound, R.drawable.type_event), // icon missing
- PROJECT_APE("ape", "Project Ape Cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape, R.drawable.type_ape),
- GCHQ("gchq", "Groundspeak HQ", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq, R.drawable.type_hq),
- GPS_EXHIBIT("gps", "GPS Adventures Exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps, R.drawable.type_event), // icon missing
- BLOCK_PARTY("block", "Groundspeak Block Party", "bc2f3df2-1aab-4601-b2ff-b5091f6c02e3", R.string.block, R.drawable.type_event), // icon missing
- UNKNOWN("unknown", "unknown", "", R.string.unknown, R.drawable.type_unknown),
+ TRADITIONAL("traditional", "Traditional Cache", "32bc9333-5e52-4957-b0f6-5a2c8fc7b257", R.string.traditional, R.drawable.type_traditional, "2"),
+ MULTI("multi", "Multi-cache", "a5f6d0ad-d2f2-4011-8c14-940a9ebf3c74", R.string.multi, R.drawable.type_multi, "3"),
+ MYSTERY("mystery", "Unknown Cache", "40861821-1835-4e11-b666-8d41064d03fe", R.string.mystery, R.drawable.type_mystery, "8"),
+ LETTERBOX("letterbox", "Letterbox hybrid", "4bdd8fb2-d7bc-453f-a9c5-968563b15d24", R.string.letterbox, R.drawable.type_letterbox, "5"),
+ EVENT("event", "Event Cache", "69eb8534-b718-4b35-ae3c-a856a55b0874", R.string.event, R.drawable.type_event, "6"),
+ MEGA_EVENT("mega", "Mega-Event Cache", "69eb8535-b718-4b35-ae3c-a856a55b0874", R.string.mega, R.drawable.type_mega, "453"),
+ GIGA_EVENT("giga", "Giga-Event Cache", "51420629-5739-4945-8bdd-ccfd434c0ead", R.string.giga, R.drawable.type_giga, "7005"),
+ EARTH("earth", "Earthcache", "c66f5cf3-9523-4549-b8dd-759cd2f18db8", R.string.earth, R.drawable.type_earth, "137"),
+ CITO("cito", "Cache in Trash out Event", "57150806-bc1a-42d6-9cf0-538d171a2d22", R.string.cito, R.drawable.type_cito, "13"),
+ WEBCAM("webcam", "Webcam Cache", "31d2ae3c-c358-4b5f-8dcd-2185bf472d3d", R.string.webcam, R.drawable.type_webcam, "11"),
+ VIRTUAL("virtual", "Virtual Cache", "294d4360-ac86-4c83-84dd-8113ef678d7e", R.string.virtual, R.drawable.type_virtual, "4"),
+ WHERIGO("wherigo", "Wherigo Cache", "0544fa55-772d-4e5c-96a9-36a51ebcf5c9", R.string.wherigo, R.drawable.type_wherigo, "1858"),
+ LOSTANDFOUND("lostfound", "Lost and Found Event Cache", "3ea6533d-bb52-42fe-b2d2-79a3424d4728", R.string.lostfound, R.drawable.type_event, "3653"), // icon missing
+ PROJECT_APE("ape", "Project Ape Cache", "2555690d-b2bc-4b55-b5ac-0cb704c0b768", R.string.ape, R.drawable.type_ape, "2"),
+ GCHQ("gchq", "Groundspeak HQ", "416f2494-dc17-4b6a-9bab-1a29dd292d8c", R.string.gchq, R.drawable.type_hq, "3773"),
+ GPS_EXHIBIT("gps", "GPS Adventures Exhibit", "72e69af2-7986-4990-afd9-bc16cbbb4ce3", R.string.gps, R.drawable.type_event, "1304"), // icon missing
+ BLOCK_PARTY("block", "Groundspeak Block Party", "bc2f3df2-1aab-4601-b2ff-b5091f6c02e3", R.string.block, R.drawable.type_event, "4738"), // icon missing
+ UNKNOWN("unknown", "unknown", "", R.string.unknown, R.drawable.type_unknown, ""),
/** No real cache type -> filter */
- ALL("all", "display all caches", "9a79e6ce-3344-409c-bbe9-496530baf758", R.string.all_types, R.drawable.type_unknown);
+ ALL("all", "display all caches", "9a79e6ce-3344-409c-bbe9-496530baf758", R.string.all_types, R.drawable.type_unknown, "");
/**
* id field is used when for storing caches in the database.
@@ -48,17 +48,22 @@ public enum CacheType {
public final String guid;
private final int stringId;
public final int markerId;
+ @NonNull public final String wptTypeId;
- CacheType(final String id, final String pattern, final String guid, final int stringId, final int markerId) {
+ CacheType(final String id, final String pattern, final String guid, final int stringId, final int markerId, @NonNull final String wptTypeId) {
this.id = id;
this.pattern = pattern;
this.guid = guid;
this.stringId = stringId;
this.markerId = markerId;
+ this.wptTypeId = wptTypeId;
}
+ @NonNull
private final static Map<String, CacheType> FIND_BY_ID = new HashMap<>();
+ @NonNull
private final static Map<String, CacheType> FIND_BY_PATTERN = new HashMap<>();
+ @NonNull
private final static Map<String, CacheType> FIND_BY_GUID = new HashMap<>();
static {
@@ -102,6 +107,7 @@ public enum CacheType {
return result;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
@@ -118,7 +124,6 @@ public enum CacheType {
/**
* Whether this type contains the given cache.
*
- * @param cache
* @return true if this is the ALL type or if this type equals the type of the cache.
*/
public boolean contains(final Geocache cache) {
diff --git a/main/src/cgeo/geocaching/enumerations/LoadFlags.java b/main/src/cgeo/geocaching/enumerations/LoadFlags.java
index 69d8df2..0f08690 100644
--- a/main/src/cgeo/geocaching/enumerations/LoadFlags.java
+++ b/main/src/cgeo/geocaching/enumerations/LoadFlags.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.enumerations;
+import org.eclipse.jdt.annotation.NonNull;
+
import java.util.EnumSet;
/**
@@ -33,6 +35,7 @@ public interface LoadFlags {
DB // include saving to CacheCache
}
+ @NonNull
public final static EnumSet<SaveFlag> SAVE_ALL = EnumSet.allOf(SaveFlag.class);
public enum RemoveFlag {
@@ -41,6 +44,7 @@ public interface LoadFlags {
OWN_WAYPOINTS_ONLY_FOR_TESTING // only to be used in unit testing (as we never delete own waypoints)
}
+ @NonNull
public final static EnumSet<RemoveFlag> REMOVE_ALL = EnumSet.of(RemoveFlag.CACHE, RemoveFlag.DB);
} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/enumerations/LogType.java b/main/src/cgeo/geocaching/enumerations/LogType.java
index a27ec1a..bf0d66c 100644
--- a/main/src/cgeo/geocaching/enumerations/LogType.java
+++ b/main/src/cgeo/geocaching/enumerations/LogType.java
@@ -4,6 +4,7 @@ import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import java.util.HashMap;
import java.util.Locale;
@@ -47,13 +48,16 @@ public enum LogType {
UNKNOWN(0, "unknown", "", "", R.string.err_unknown, R.drawable.mark_red); // LogType not init. yet
public final int id;
+ @Nullable
public final String iconName;
+ @NonNull
public final String type;
+ @NonNull
public final String oc_type;
private final int stringId;
public final int markerId;
- LogType(final int id, final String iconName, final String type, final String oc_type, final int stringId, final int markerId) {
+ LogType(final int id, @Nullable final String iconName, @NonNull final String type, @NonNull final String oc_type, final int stringId, final int markerId) {
this.id = id;
this.iconName = iconName;
this.type = type;
@@ -110,6 +114,7 @@ public enum LogType {
return result;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
diff --git a/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java b/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java
index fefeb62..05ce6fd 100644
--- a/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java
+++ b/main/src/cgeo/geocaching/enumerations/LogTypeTrackable.java
@@ -18,6 +18,7 @@ public enum LogTypeTrackable {
this.resourceId = resourceId;
}
+ @NonNull
public String getLabel() {
return CgeoApplication.getInstance().getString(resourceId);
}
diff --git a/main/src/cgeo/geocaching/enumerations/StatusCode.java b/main/src/cgeo/geocaching/enumerations/StatusCode.java
index 9030e2b..37d027f 100644
--- a/main/src/cgeo/geocaching/enumerations/StatusCode.java
+++ b/main/src/cgeo/geocaching/enumerations/StatusCode.java
@@ -2,6 +2,8 @@ package cgeo.geocaching.enumerations;
import cgeo.geocaching.R;
+import org.eclipse.jdt.annotation.NonNull;
+
import android.content.res.Resources;
public enum StatusCode {
@@ -35,6 +37,7 @@ public enum StatusCode {
return error_string;
}
+ @NonNull
public String getErrorString(final Resources res) {
return res.getString(error_string);
}
diff --git a/main/src/cgeo/geocaching/enumerations/WaypointType.java b/main/src/cgeo/geocaching/enumerations/WaypointType.java
index 732a665..d2281ef 100644
--- a/main/src/cgeo/geocaching/enumerations/WaypointType.java
+++ b/main/src/cgeo/geocaching/enumerations/WaypointType.java
@@ -49,6 +49,7 @@ public enum WaypointType {
}
}
}
+ @NonNull
public static final Set<WaypointType> ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL = Collections.unmodifiableSet(ALL_TYPES_EXCEPT_OWN_AND_ORIGINAL_TMP);
/**
@@ -67,6 +68,7 @@ public enum WaypointType {
return waypointType;
}
+ @NonNull
public final String getL10n() {
return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
}
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index b3201f8..af564da 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -117,8 +117,7 @@ public class GpxExport extends AbstractExport {
private File getExportFile() {
final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
- final Date now = new Date();
- return FileUtils.getUniqueNamedFile(Settings.getGpxExportDir() + File.separatorChar + "export_" + fileNameDateFormat.format(now) + ".gpx");
+ return FileUtils.getUniqueNamedFile(new File(Settings.getGpxExportDir(), "export_" + fileNameDateFormat.format(new Date()) + ".gpx"));
}
@Override
diff --git a/main/src/cgeo/geocaching/export/GpxSerializer.java b/main/src/cgeo/geocaching/export/GpxSerializer.java
index fe53f37..8139c76 100644
--- a/main/src/cgeo/geocaching/export/GpxSerializer.java
+++ b/main/src/cgeo/geocaching/export/GpxSerializer.java
@@ -55,7 +55,7 @@ public final class GpxSerializer {
}
- public void writeGPX(List<String> allGeocodesIn, Writer writer, final ProgressListener progressListener) throws IOException {
+ public void writeGPX(final List<String> allGeocodesIn, final Writer writer, final ProgressListener progressListener) throws IOException {
// create a copy of the geocode list, as we need to modify it, but it might be immutable
final ArrayList<String> allGeocodes = new ArrayList<>(allGeocodesIn);
@@ -88,7 +88,7 @@ public final class GpxSerializer {
gpx.endDocument();
}
- private void exportBatch(final XmlSerializer gpx, Collection<String> geocodesOfBatch) throws IOException {
+ private void exportBatch(final XmlSerializer gpx, final Collection<String> geocodesOfBatch) throws IOException {
final Set<Geocache> caches = DataStore.loadCaches(geocodesOfBatch, LoadFlags.LOAD_ALL_DB_ONLY);
for (final Geocache cache : caches) {
if (cache == null) {
@@ -174,11 +174,10 @@ public final class GpxSerializer {
}
/**
- * @param boolFlag
* @return XML schema compliant boolean representation of the boolean flag. This must be either true, false, 0 or 1,
* but no other value (also not upper case True/False).
*/
- private static String gpxBoolean(boolean boolFlag) {
+ private static String gpxBoolean(final boolean boolFlag) {
return boolFlag ? "true" : "false";
}
@@ -255,7 +254,7 @@ public final class GpxSerializer {
}
private void writeLogs(final Geocache cache) throws IOException {
- List<LogEntry> logs = cache.getLogs();
+ final List<LogEntry> logs = cache.getLogs();
if (logs.isEmpty()) {
return;
}
@@ -291,7 +290,7 @@ public final class GpxSerializer {
}
private void writeTravelBugs(final Geocache cache) throws IOException {
- List<Trackable> inventory = cache.getInventory();
+ final List<Trackable> inventory = cache.getInventory();
if (CollectionUtils.isEmpty(inventory)) {
return;
}
@@ -338,7 +337,7 @@ public final class GpxSerializer {
return getLocationPart(cache, 0);
}
- private static String getLocationPart(final Geocache cache, int partIndex) {
+ private static String getLocationPart(final Geocache cache, final int partIndex) {
final String location = cache.getLocation();
if (StringUtils.contains(location, ", ")) {
final String[] parts = StringUtils.split(location, ',');
@@ -350,7 +349,7 @@ public final class GpxSerializer {
}
public static String getCountry(final Geocache cache) {
- String country = getLocationPart(cache, 1);
+ final String country = getLocationPart(cache, 1);
if (StringUtils.isNotEmpty(country)) {
return country;
}
diff --git a/main/src/cgeo/geocaching/files/AbstractFileListActivity.java b/main/src/cgeo/geocaching/files/AbstractFileListActivity.java
index 427fd48..3ec9849 100644
--- a/main/src/cgeo/geocaching/files/AbstractFileListActivity.java
+++ b/main/src/cgeo/geocaching/files/AbstractFileListActivity.java
@@ -201,7 +201,6 @@ public abstract class AbstractFileListActivity<T extends ArrayAdapter<File>> ext
* Check if a filename belongs to the AbstractFileListActivity. This implementation checks for file extensions.
* Subclasses may override this method to filter out specific files.
*
- * @param filename
* @return <code>true</code> if the filename belongs to the list
*/
protected boolean filenameBelongsToList(@NonNull final String filename) {
diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java
index e7523f3..5699ebe 100644
--- a/main/src/cgeo/geocaching/files/GPXImporter.java
+++ b/main/src/cgeo/geocaching/files/GPXImporter.java
@@ -95,8 +95,6 @@ public class GPXImporter {
*
* @param uri
* URI of the file to import
- * @param mimeType
- * @param pathName
*/
public void importGPX(final Uri uri, final @Nullable String mimeType, final @Nullable String pathName) {
final ContentResolver contentResolver = fromActivity.getContentResolver();
diff --git a/main/src/cgeo/geocaching/files/GPXParser.java b/main/src/cgeo/geocaching/files/GPXParser.java
index 4f8979b..e4bb7e1 100644
--- a/main/src/cgeo/geocaching/files/GPXParser.java
+++ b/main/src/cgeo/geocaching/files/GPXParser.java
@@ -840,7 +840,6 @@ public abstract class GPXParser extends FileParser {
/**
* Add listeners for GSAK extensions
*
- * @param cacheParent
*/
private void registerGsakExtensions(final Element cacheParent) {
for (final String gsakNamespace : GSAK_NS) {
@@ -901,7 +900,6 @@ public abstract class GPXParser extends FileParser {
/**
* Add listeners for c:geo extensions
*
- * @param cacheParent
*/
private void registerCgeoExtensions(final Element cacheParent) {
final Element cgeoVisited = cacheParent.getChild(CGEO_NS, "visited");
@@ -940,8 +938,6 @@ public abstract class GPXParser extends FileParser {
* GPX 1.0 and 1.1 use different XML elements to put the cache into, therefore needs to be overwritten in the
* version specific subclasses
*
- * @param waypoint
- * @return
*/
protected abstract Element getCacheParent(Element waypoint);
diff --git a/main/src/cgeo/geocaching/files/LocalStorage.java b/main/src/cgeo/geocaching/files/LocalStorage.java
index 7fce27d..cfeac9a 100644
--- a/main/src/cgeo/geocaching/files/LocalStorage.java
+++ b/main/src/cgeo/geocaching/files/LocalStorage.java
@@ -364,24 +364,6 @@ public final class LocalStorage {
return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
}
- public static boolean deleteDirectory(@NonNull final File dir) {
- final File[] files = dir.listFiles();
-
- // Although we are called on an existing directory, it might have been removed concurrently
- // in the meantime, for example by the user or by another cleanup task.
- if (files != null) {
- for (final File file : files) {
- if (file.isDirectory()) {
- deleteDirectory(file);
- } else {
- FileUtils.delete(file);
- }
- }
- }
-
- return FileUtils.delete(dir);
- }
-
/**
* Deletes all files from directory geocode with the given prefix.
*
diff --git a/main/src/cgeo/geocaching/filter/AbstractFilter.java b/main/src/cgeo/geocaching/filter/AbstractFilter.java
index 248c9c2..4d521c5 100644
--- a/main/src/cgeo/geocaching/filter/AbstractFilter.java
+++ b/main/src/cgeo/geocaching/filter/AbstractFilter.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.filter;
+import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import org.eclipse.jdt.annotation.NonNull;
@@ -8,12 +9,18 @@ import java.util.ArrayList;
import java.util.List;
abstract class AbstractFilter implements IFilter {
+ @NonNull
private final String name;
- protected AbstractFilter(final String name) {
+ protected AbstractFilter(final int nameResourceId) {
+ this(CgeoApplication.getInstance().getString(nameResourceId));
+ }
+
+ protected AbstractFilter(@NonNull final String name) {
this.name = name;
}
+
@Override
public void filter(@NonNull final List<Geocache> list) {
final List<Geocache> itemsToRemove = new ArrayList<>();
@@ -26,6 +33,7 @@ abstract class AbstractFilter implements IFilter {
}
@Override
+ @NonNull
public String getName() {
return name;
}
@@ -39,4 +47,9 @@ abstract class AbstractFilter implements IFilter {
public String toString() {
return getName();
}
+
+ @Override
+ public int getImageId() {
+ return 0;
+ }
}
diff --git a/main/src/cgeo/geocaching/filter/AttributeFilter.java b/main/src/cgeo/geocaching/filter/AttributeFilter.java
index 2fc6eb2..6ed4a8f 100644
--- a/main/src/cgeo/geocaching/filter/AttributeFilter.java
+++ b/main/src/cgeo/geocaching/filter/AttributeFilter.java
@@ -15,7 +15,7 @@ class AttributeFilter extends AbstractFilter {
private final String attribute;
- public AttributeFilter(final String name, final String attribute) {
+ public AttributeFilter(@NonNull final String name, final String attribute) {
super(name);
this.attribute = attribute;
}
diff --git a/main/src/cgeo/geocaching/filter/DistanceFilter.java b/main/src/cgeo/geocaching/filter/DistanceFilter.java
index f1ba7f8..b352f5d 100644
--- a/main/src/cgeo/geocaching/filter/DistanceFilter.java
+++ b/main/src/cgeo/geocaching/filter/DistanceFilter.java
@@ -17,7 +17,7 @@ class DistanceFilter extends AbstractFilter {
private final int minDistance;
private final int maxDistance;
- public DistanceFilter(final String name, final int minDistance, final int maxDistance) {
+ public DistanceFilter(@NonNull final String name, final int minDistance, final int maxDistance) {
super(name);
this.minDistance = minDistance;
this.maxDistance = maxDistance;
diff --git a/main/src/cgeo/geocaching/filter/FilterActivity.java b/main/src/cgeo/geocaching/filter/FilterActivity.java
new file mode 100644
index 0000000..13a2263
--- /dev/null
+++ b/main/src/cgeo/geocaching/filter/FilterActivity.java
@@ -0,0 +1,154 @@
+package cgeo.geocaching.filter;
+
+import butterknife.ButterKnife;
+import butterknife.InjectView;
+
+import cgeo.geocaching.R;
+import cgeo.geocaching.activity.AbstractActionBarActivity;
+import cgeo.geocaching.filter.FilterRegistry.FactoryEntry;
+import cgeo.geocaching.utils.Log;
+
+import org.androidannotations.annotations.EActivity;
+import org.androidannotations.annotations.OptionsItem;
+import org.androidannotations.annotations.OptionsMenu;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ExpandableListView;
+import android.widget.ExpandableListView.OnChildClickListener;
+import android.widget.LinearLayout;
+import android.widget.SimpleExpandableListAdapter;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Show a filter selection using an {@code ExpandableListView}.
+ */
+@OptionsMenu(R.menu.filter_options)
+@EActivity
+public class FilterActivity extends AbstractActionBarActivity {
+
+ public static final String EXTRA_FILTER_RESULT = null;
+ public static final int REQUEST_SELECT_FILTER = 1234;
+
+ private static final String KEY_FILTER_NAME = "filterName";
+ private static final String KEY_FILTER_GROUP_NAME = "filterGroupName";
+
+ @InjectView(R.id.filterList) protected ExpandableListView filterList;
+ @InjectView(R.id.filters) protected LinearLayout filtersContainer;
+
+ @Override
+ public void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState, R.layout.filter_activity);
+ ButterKnife.inject(this);
+
+ createListAdapter();
+ }
+
+ private void createListAdapter() {
+ final SimpleExpandableListAdapter adapter =
+ new SimpleExpandableListAdapter(
+ this,
+ // top level entries in the next 4 lines
+ createFilterTopLevelGroups(),
+ android.R.layout.simple_expandable_list_item_1,
+ new String[] { KEY_FILTER_GROUP_NAME },
+ new int[] { android.R.id.text1 },
+
+ // child level entries in the next 4 lines
+ createFilterChildren(),
+ android.R.layout.simple_expandable_list_item_2,
+ new String[] { KEY_FILTER_NAME, "CHILD_NAME" },
+ new int[] { android.R.id.text1 }
+ );
+ filterList.setAdapter(adapter);
+ filterList.setOnChildClickListener(new OnChildClickListener() {
+
+ @Override
+ public boolean onChildClick(final ExpandableListView parent, final View v, final int groupPosition, final int childPosition, final long id) {
+ setFilterResult(groupPosition, childPosition);
+ return true;
+ }
+
+ });
+ }
+
+ public static @Nullable IFilter getFilterFromPosition(final int groupPosition, final int childPosition) {
+ if (groupPosition < 0 || childPosition < 0) {
+ return null;
+ }
+ final FactoryEntry factoryEntry = FilterRegistry.getInstance().getFactories().get(groupPosition);
+ return createFilterFactory(factoryEntry.getFactory()).getFilters().get(childPosition);
+ }
+
+ /**
+ * Creates the group list with the mapped properties.
+ */
+ private static List<Map<String, String>> createFilterTopLevelGroups() {
+ final ArrayList<Map<String, String>> groups = new ArrayList<>();
+ for (final FactoryEntry factoryEntry : FilterRegistry.getInstance().getFactories()) {
+ final Map<String, String> map = new HashMap<>();
+ map.put(KEY_FILTER_GROUP_NAME, factoryEntry.getName());
+ groups.add(map);
+ }
+ return groups;
+ }
+
+ private static List<List<Map<String, String>>> createFilterChildren() {
+ final List<List<Map<String, String>>> listOfChildGroups = new ArrayList<>();
+
+ for (final FactoryEntry factoryEntry : FilterRegistry.getInstance().getFactories()) {
+ final IFilterFactory factory = createFilterFactory(factoryEntry.getFactory());
+ final List<? extends IFilter> filters = factory.getFilters();
+
+ final List<Map<String, String>> childGroups = new ArrayList<>(filters.size());
+
+ for (final IFilter filter : filters) {
+ final HashMap<String, String> hashMap = new HashMap<>(1);
+ hashMap.put(KEY_FILTER_NAME, filter.getName());
+ hashMap.put("CHILD_NAME", filter.getName());
+ childGroups.add(hashMap);
+ }
+ listOfChildGroups.add(childGroups);
+ }
+ return listOfChildGroups;
+ }
+
+ private static IFilterFactory createFilterFactory(final Class<? extends IFilterFactory> class1) {
+ try {
+ return class1.newInstance();
+ } catch (final InstantiationException e) {
+ Log.e("createFilterFactory", e);
+ } catch (final IllegalAccessException e) {
+ Log.e("createFilterFactory", e);
+ }
+ return null;
+ }
+
+ /**
+ * After calling this method, the calling activity must implement onActivityResult, and check the
+ * {@link #EXTRA_FILTER_RESULT}.
+ */
+ public static void selectFilter(@NonNull final Activity context) {
+ context.startActivityForResult(new Intent(context, FilterActivity_.class), REQUEST_SELECT_FILTER);
+ }
+
+ @OptionsItem(R.id.menu_reset_filter)
+ void resetFilter() {
+ setFilterResult(-1, -1);
+ }
+
+ private void setFilterResult(final int groupPosition, final int childPosition) {
+ final Intent resultIntent = new Intent();
+ resultIntent.putExtra(EXTRA_FILTER_RESULT, new int[] { groupPosition, childPosition });
+ setResult(Activity.RESULT_OK, resultIntent);
+ finish();
+ }
+}
diff --git a/main/src/cgeo/geocaching/filter/FilterRegistry.java b/main/src/cgeo/geocaching/filter/FilterRegistry.java
new file mode 100644
index 0000000..d6d9db9
--- /dev/null
+++ b/main/src/cgeo/geocaching/filter/FilterRegistry.java
@@ -0,0 +1,86 @@
+package cgeo.geocaching.filter;
+
+import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.R;
+import cgeo.geocaching.filter.SizeFilter.Factory;
+
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+
+import android.content.res.Resources;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * singleton registry of all available filter components
+ *
+ */
+public class FilterRegistry {
+ private final List<FactoryEntry> registry = new ArrayList<>();
+ private static Resources res;
+
+ static class FactoryEntry {
+ private final String name;
+ private final @NonNull Class<? extends IFilterFactory> filterFactory;
+
+ public FactoryEntry(final String name, final @NonNull Class<? extends IFilterFactory> filterFactory) {
+ this.name = name;
+ this.filterFactory = filterFactory;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Class<? extends IFilterFactory> getFactory() {
+ return filterFactory;
+ }
+ }
+
+ private static class SingletonHolder {
+ private static final FilterRegistry INSTANCE = new FilterRegistry();
+ }
+
+ public static FilterRegistry getInstance() {
+ return SingletonHolder.INSTANCE;
+ }
+
+ private FilterRegistry() {
+ res = CgeoApplication.getInstance().getResources();
+ register(R.string.caches_filter_type, TypeFilter.Factory.class);
+ register(R.string.caches_filter_size, SizeFilter.Factory.class);
+ register(R.string.cache_terrain, TerrainFilter.Factory.class);
+ register(R.string.cache_difficulty, DifficultyFilter.Factory.class);
+ register(R.string.cache_attributes, AttributeFilter.Factory.class);
+ register(R.string.cache_status, StateFilterFactory.class);
+ register(R.string.caches_filter_origin, OriginFilter.Factory.class);
+ register(R.string.caches_filter_distance, DistanceFilter.Factory.class);
+ register(R.string.caches_filter_popularity, PopularityFilter.Factory.class);
+ register(R.string.caches_filter_popularity_ratio, PopularityRatioFilter.Factory.class);
+ register(R.string.caches_filter_personal_data, PersonalDataFilterFactory.class);
+ }
+
+ private void register(final int resourceId, final @NonNull Class<? extends IFilterFactory> factoryClass) {
+ registry.add(new FactoryEntry(res.getString(resourceId), factoryClass));
+ }
+
+ public String getFactoryName(final Class<Factory> factoryClass) {
+ for (final FactoryEntry entry : registry) {
+ if (entry.filterFactory == factoryClass) {
+ return entry.name;
+ }
+ }
+ return StringUtils.EMPTY;
+ }
+
+ public List<FactoryEntry> getFactories() {
+ return Collections.unmodifiableList(registry);
+ }
+}
diff --git a/main/src/cgeo/geocaching/filter/FilterUserInterface.java b/main/src/cgeo/geocaching/filter/FilterUserInterface.java
deleted file mode 100644
index 2d7dafc..0000000
--- a/main/src/cgeo/geocaching/filter/FilterUserInterface.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package cgeo.geocaching.filter;
-
-import cgeo.geocaching.CgeoApplication;
-import cgeo.geocaching.R;
-import cgeo.geocaching.enumerations.CacheType;
-import cgeo.geocaching.settings.Settings;
-import cgeo.geocaching.utils.Log;
-import cgeo.geocaching.utils.TextUtils;
-
-import rx.functions.Action1;
-
-import android.app.Activity;
-import android.app.AlertDialog;
-import android.content.DialogInterface;
-import android.content.res.Resources;
-import android.widget.ArrayAdapter;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-public final class FilterUserInterface {
-
- private static class FactoryEntry {
- private final String name;
- private final Class<? extends IFilterFactory> filterFactory;
-
- public FactoryEntry(final String name, final Class<? extends IFilterFactory> filterFactory) {
- this.name = name;
- this.filterFactory = filterFactory;
- }
-
- @Override
- public String toString() {
- return name;
- }
- }
-
- private final Activity activity;
- private final ArrayList<FactoryEntry> registry;
- private final Resources res;
-
- public FilterUserInterface(final Activity activity) {
- this.activity = activity;
- this.res = CgeoApplication.getInstance().getResources();
-
- registry = new ArrayList<>();
- if (Settings.getCacheType() == CacheType.ALL) {
- register(R.string.caches_filter_type, TypeFilter.Factory.class);
- }
- register(R.string.caches_filter_size, SizeFilter.Factory.class);
- register(R.string.cache_terrain, TerrainFilter.Factory.class);
- register(R.string.cache_difficulty, DifficultyFilter.Factory.class);
- register(R.string.cache_attributes, AttributeFilter.Factory.class);
- register(R.string.cache_status, StateFilter.Factory.class);
- register(R.string.caches_filter_track, TrackablesFilter.class);
- register(R.string.caches_filter_origin, OriginFilter.Factory.class);
- register(R.string.caches_filter_distance, DistanceFilter.Factory.class);
- register(R.string.caches_filter_popularity, PopularityFilter.Factory.class);
- register(R.string.caches_filter_popularity_ratio, PopularityRatioFilter.Factory.class);
- register(R.string.caches_filter_personal_data, PersonalDataFilterFactory.class);
- register(R.string.caches_filter_rating, RatingFilter.class);
-
- // sort by localized names
- final Collator collator = TextUtils.getCollator();
- Collections.sort(registry, new Comparator<FactoryEntry>() {
-
- @Override
- public int compare(final FactoryEntry lhs, final FactoryEntry rhs) {
- return collator.compare(lhs.name, rhs.name);
- }
- });
-
- // reset shall be last
- register(R.string.caches_filter_clear, null);
- }
-
- private void register(final int resourceId, final Class<? extends IFilterFactory> factoryClass) {
- registry.add(new FactoryEntry(res.getString(resourceId), factoryClass));
- }
-
- public void selectFilter(final Action1<IFilter> runAfterwards) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setTitle(R.string.caches_filter_title);
-
- final ArrayAdapter<FactoryEntry> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, registry);
-
- builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(final DialogInterface dialog, final int itemIndex) {
- final FactoryEntry entry = adapter.getItem(itemIndex);
- // reset?
- if (entry.filterFactory == null) {
- runAfterwards.call(null);
- }
- else {
- try {
- final IFilterFactory factoryInstance = entry.filterFactory.newInstance();
- selectFromFactory(factoryInstance, entry.name, runAfterwards);
- } catch (final Exception e) {
- Log.e("selectFilter", e);
- }
- }
- }
- });
-
- builder.create().show();
- }
-
- private void selectFromFactory(final IFilterFactory factory, final String menuTitle, final Action1<IFilter> runAfterwards) {
- final List<IFilter> filters = Collections.unmodifiableList(factory.getFilters());
- if (filters.size() == 1) {
- runAfterwards.call(filters.get(0));
- return;
- }
-
- final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
- builder.setTitle(menuTitle);
-
- final ArrayAdapter<IFilter> adapter = new ArrayAdapter<>(activity, android.R.layout.select_dialog_item, filters);
- builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(final DialogInterface dialog, final int item) {
- runAfterwards.call(filters.get(item));
- }
- });
-
- builder.create().show();
- }
-
-}
diff --git a/main/src/cgeo/geocaching/filter/IFilter.java b/main/src/cgeo/geocaching/filter/IFilter.java
index de39e5a..f590f79 100644
--- a/main/src/cgeo/geocaching/filter/IFilter.java
+++ b/main/src/cgeo/geocaching/filter/IFilter.java
@@ -8,13 +8,15 @@ import java.util.List;
public interface IFilter {
+ @NonNull
String getName();
/**
- * @param cache
- * @return true if the filter accepts the cache, false otherwise
+ * @return {@code true} if the filter accepts the cache, false otherwise
*/
boolean accepts(@NonNull final Geocache cache);
void filter(@NonNull final List<Geocache> list);
+
+ int getImageId();
} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/filter/ModifiedFilter.java b/main/src/cgeo/geocaching/filter/ModifiedFilter.java
index c224cb4..9b5c856 100644
--- a/main/src/cgeo/geocaching/filter/ModifiedFilter.java
+++ b/main/src/cgeo/geocaching/filter/ModifiedFilter.java
@@ -1,6 +1,5 @@
package cgeo.geocaching.filter;
-import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
@@ -12,7 +11,7 @@ import java.util.List;
class ModifiedFilter extends AbstractFilter implements IFilterFactory {
public ModifiedFilter() {
- super(CgeoApplication.getInstance().getString(R.string.caches_filter_modified));
+ super(R.string.caches_filter_modified);
}
@Override
diff --git a/main/src/cgeo/geocaching/filter/OfflineLogFilter.java b/main/src/cgeo/geocaching/filter/OfflineLogFilter.java
new file mode 100644
index 0000000..0ed9618
--- /dev/null
+++ b/main/src/cgeo/geocaching/filter/OfflineLogFilter.java
@@ -0,0 +1,19 @@
+package cgeo.geocaching.filter;
+
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.R;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+public class OfflineLogFilter extends AbstractFilter {
+
+ protected OfflineLogFilter() {
+ super(R.string.caches_filter_offline_log);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isLogOffline();
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/filter/OriginFilter.java b/main/src/cgeo/geocaching/filter/OriginFilter.java
index 4fb3301..d51b02c 100644
--- a/main/src/cgeo/geocaching/filter/OriginFilter.java
+++ b/main/src/cgeo/geocaching/filter/OriginFilter.java
@@ -15,7 +15,7 @@ public class OriginFilter extends AbstractFilter {
private final IConnector connector;
- public OriginFilter(final IConnector connector) {
+ public OriginFilter(@NonNull final IConnector connector) {
super(connector.getName());
this.connector = connector;
}
diff --git a/main/src/cgeo/geocaching/filter/OwnRatingFilter.java b/main/src/cgeo/geocaching/filter/OwnRatingFilter.java
index 0c468a9..1b86bab 100644
--- a/main/src/cgeo/geocaching/filter/OwnRatingFilter.java
+++ b/main/src/cgeo/geocaching/filter/OwnRatingFilter.java
@@ -1,6 +1,5 @@
package cgeo.geocaching.filter;
-import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.gcvote.GCVote;
@@ -18,7 +17,7 @@ import java.util.List;
public class OwnRatingFilter extends AbstractFilter implements IFilterFactory {
protected OwnRatingFilter() {
- super(CgeoApplication.getInstance().getString(R.string.caches_filter_own_rating));
+ super(R.string.caches_filter_own_rating);
}
@Override
diff --git a/main/src/cgeo/geocaching/filter/PersonalDataFilterFactory.java b/main/src/cgeo/geocaching/filter/PersonalDataFilterFactory.java
index 6c6186b..e9780da 100644
--- a/main/src/cgeo/geocaching/filter/PersonalDataFilterFactory.java
+++ b/main/src/cgeo/geocaching/filter/PersonalDataFilterFactory.java
@@ -10,7 +10,7 @@ public class PersonalDataFilterFactory implements IFilterFactory {
@Override
@NonNull
public List<? extends IFilter> getFilters() {
- return Arrays.asList(new OwnRatingFilter(), new PersonalNoteFilter(), new ModifiedFilter());
+ return Arrays.asList(new OwnRatingFilter(), new PersonalNoteFilter(), new ModifiedFilter(), new OfflineLogFilter());
}
}
diff --git a/main/src/cgeo/geocaching/filter/PersonalNoteFilter.java b/main/src/cgeo/geocaching/filter/PersonalNoteFilter.java
index 978ad6b..11c623e 100644
--- a/main/src/cgeo/geocaching/filter/PersonalNoteFilter.java
+++ b/main/src/cgeo/geocaching/filter/PersonalNoteFilter.java
@@ -1,6 +1,5 @@
package cgeo.geocaching.filter;
-import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
@@ -16,7 +15,7 @@ import java.util.List;
public class PersonalNoteFilter extends AbstractFilter implements IFilterFactory {
protected PersonalNoteFilter() {
- super(CgeoApplication.getInstance().getString(R.string.caches_filter_personal_note));
+ super(R.string.caches_filter_personal_note);
}
@Override
diff --git a/main/src/cgeo/geocaching/filter/PopularityFilter.java b/main/src/cgeo/geocaching/filter/PopularityFilter.java
index bb564e8..eabc533 100644
--- a/main/src/cgeo/geocaching/filter/PopularityFilter.java
+++ b/main/src/cgeo/geocaching/filter/PopularityFilter.java
@@ -13,7 +13,7 @@ class PopularityFilter extends AbstractFilter {
private final int minFavorites;
private final int maxFavorites;
- public PopularityFilter(final String name, final int minFavorites, final int maxFavorites) {
+ public PopularityFilter(@NonNull final String name, final int minFavorites, final int maxFavorites) {
super(name);
this.minFavorites = minFavorites;
this.maxFavorites = maxFavorites;
diff --git a/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java b/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java
index 53904f1..0548345 100644
--- a/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java
+++ b/main/src/cgeo/geocaching/filter/PopularityRatioFilter.java
@@ -18,7 +18,7 @@ class PopularityRatioFilter extends AbstractFilter {
private final int minRatio;
private final int maxRatio;
- public PopularityRatioFilter(final String name, final int minRatio, final int maxRatio) {
+ public PopularityRatioFilter(@NonNull final String name, final int minRatio, final int maxRatio) {
super(name);
this.minRatio = minRatio;
this.maxRatio = maxRatio;
diff --git a/main/src/cgeo/geocaching/filter/RatingFilter.java b/main/src/cgeo/geocaching/filter/RatingFilter.java
index 3edfcb6..16ce16c 100644
--- a/main/src/cgeo/geocaching/filter/RatingFilter.java
+++ b/main/src/cgeo/geocaching/filter/RatingFilter.java
@@ -1,24 +1,20 @@
package cgeo.geocaching.filter;
-import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.gcvote.GCVote;
import org.eclipse.jdt.annotation.NonNull;
-import java.util.Collections;
-import java.util.List;
-
/**
* Filter {@link Geocache}s if they have a locally stored {@link GCVote} rating. This filter will not do any network
* request to find potentially missing local votes.
*
*/
-public class RatingFilter extends AbstractFilter implements IFilterFactory {
+public class RatingFilter extends AbstractFilter {
protected RatingFilter() {
- super(CgeoApplication.getInstance().getString(R.string.caches_filter_rating));
+ super(R.string.caches_filter_rating);
}
@Override
@@ -26,10 +22,4 @@ public class RatingFilter extends AbstractFilter implements IFilterFactory {
return cache.getRating() > 0;
}
- @Override
- @NonNull
- public List<RatingFilter> getFilters() {
- return Collections.singletonList(this);
- }
-
}
diff --git a/main/src/cgeo/geocaching/filter/SizeFilter.java b/main/src/cgeo/geocaching/filter/SizeFilter.java
index 4c7c122..a19d95b 100644
--- a/main/src/cgeo/geocaching/filter/SizeFilter.java
+++ b/main/src/cgeo/geocaching/filter/SizeFilter.java
@@ -11,7 +11,7 @@ import java.util.List;
class SizeFilter extends AbstractFilter {
private final CacheSize cacheSize;
- public SizeFilter(final CacheSize cacheSize) {
+ public SizeFilter(@NonNull final CacheSize cacheSize) {
super(cacheSize.id);
this.cacheSize = cacheSize;
}
@@ -22,6 +22,7 @@ class SizeFilter extends AbstractFilter {
}
@Override
+ @NonNull
public String getName() {
return cacheSize.getL10n();
}
@@ -40,6 +41,6 @@ class SizeFilter extends AbstractFilter {
}
return filters;
}
-
}
+
}
diff --git a/main/src/cgeo/geocaching/filter/StateFilter.java b/main/src/cgeo/geocaching/filter/StateFilter.java
deleted file mode 100644
index f574045..0000000
--- a/main/src/cgeo/geocaching/filter/StateFilter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package cgeo.geocaching.filter;
-
-import cgeo.geocaching.CgeoApplication;
-import cgeo.geocaching.Geocache;
-import cgeo.geocaching.R;
-
-import org.eclipse.jdt.annotation.NonNull;
-
-import android.content.res.Resources;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-abstract class StateFilter extends AbstractFilter {
-
- static final Resources res = CgeoApplication.getInstance().getResources();
-
- protected StateFilter(final String name) {
- super(name);
- }
-
- static class StateFoundFilter extends StateFilter {
-
- public StateFoundFilter() {
- super(res.getString(R.string.cache_status_found));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return cache.isFound();
- }
-
- }
-
- static class StateNotFoundFilter extends StateFilter {
-
- public StateNotFoundFilter() {
- super(res.getString(R.string.cache_not_status_found));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return !cache.isFound();
- }
-
- }
-
- static class StateArchivedFilter extends StateFilter {
- public StateArchivedFilter() {
- super(res.getString(R.string.cache_status_archived));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return cache.isArchived();
- }
- }
-
- static class StateDisabledFilter extends StateFilter {
- public StateDisabledFilter() {
- super(res.getString(R.string.cache_status_disabled));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return cache.isDisabled();
- }
- }
-
- static class StatePremiumFilter extends StateFilter {
- public StatePremiumFilter() {
- super(res.getString(R.string.cache_status_premium));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return cache.isPremiumMembersOnly();
- }
- }
-
- static class StateNonPremiumFilter extends StateFilter {
- public StateNonPremiumFilter() {
- super(res.getString(R.string.cache_status_not_premium));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return !cache.isPremiumMembersOnly();
- }
- }
-
- private static class StateOfflineLogFilter extends StateFilter {
- public StateOfflineLogFilter() {
- super(res.getString(R.string.cache_status_offline_log));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return cache.isLogOffline();
- }
- }
-
- static class StateStoredFilter extends StateFilter {
- public StateStoredFilter() {
- super(res.getString(R.string.cache_status_stored));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return cache.isOffline();
- }
- }
-
- static class StateNotStoredFilter extends StateFilter {
- public StateNotStoredFilter() {
- super(res.getString(R.string.cache_status_not_stored));
- }
-
- @Override
- public boolean accepts(@NonNull final Geocache cache) {
- return !cache.isOffline();
- }
- }
-
- public static class Factory implements IFilterFactory {
-
- @Override
- @NonNull
- public List<StateFilter> getFilters() {
- final List<StateFilter> filters = new ArrayList<>(6);
- filters.add(new StateFoundFilter());
- filters.add(new StateNotFoundFilter());
- filters.add(new StateArchivedFilter());
- filters.add(new StateDisabledFilter());
- filters.add(new StatePremiumFilter());
- filters.add(new StateNonPremiumFilter());
- filters.add(new StateOfflineLogFilter());
- filters.add(new StateStoredFilter());
- filters.add(new StateNotStoredFilter());
-
- Collections.sort(filters, new Comparator<StateFilter>() {
-
- @Override
- public int compare(final StateFilter filter1, final StateFilter filter2) {
- return String.CASE_INSENSITIVE_ORDER.compare(filter1.getName(), filter2.getName());
- }
- });
-
- return filters;
- }
-
- }
-
-}
diff --git a/main/src/cgeo/geocaching/filter/StateFilterFactory.java b/main/src/cgeo/geocaching/filter/StateFilterFactory.java
new file mode 100644
index 0000000..42de764
--- /dev/null
+++ b/main/src/cgeo/geocaching/filter/StateFilterFactory.java
@@ -0,0 +1,145 @@
+package cgeo.geocaching.filter;
+
+import cgeo.geocaching.Geocache;
+import cgeo.geocaching.R;
+
+import org.eclipse.jdt.annotation.NonNull;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+class StateFilterFactory implements IFilterFactory {
+
+ @Override
+ @NonNull
+ public List<? extends IFilter> getFilters() {
+ final List<AbstractFilter> filters = new ArrayList<>(6);
+ filters.add(new StateFoundFilter());
+ filters.add(new StateNotFoundFilter());
+ filters.add(new StateArchivedFilter());
+ filters.add(new StateDisabledFilter());
+ filters.add(new StatePremiumFilter());
+ filters.add(new StateNonPremiumFilter());
+ filters.add(new StateOfflineLogFilter());
+ filters.add(new StateStoredFilter());
+ filters.add(new StateNotStoredFilter());
+ filters.add(new RatingFilter());
+ filters.add(new TrackablesFilter());
+
+ Collections.sort(filters, new Comparator<AbstractFilter>() {
+
+ @Override
+ public int compare(final AbstractFilter filter1, final AbstractFilter filter2) {
+ return String.CASE_INSENSITIVE_ORDER.compare(filter1.getName(), filter2.getName());
+ }
+ });
+
+ return filters;
+ }
+
+ static class StateFoundFilter extends AbstractFilter {
+
+ public StateFoundFilter() {
+ super(R.string.cache_status_found);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isFound();
+ }
+
+ }
+
+ static class StateNotFoundFilter extends AbstractFilter {
+
+ public StateNotFoundFilter() {
+ super(R.string.cache_not_status_found);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return !cache.isFound();
+ }
+
+ }
+
+ static class StateArchivedFilter extends AbstractFilter {
+ public StateArchivedFilter() {
+ super(R.string.cache_status_archived);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isArchived();
+ }
+ }
+
+ static class StateDisabledFilter extends AbstractFilter {
+ public StateDisabledFilter() {
+ super(R.string.cache_status_disabled);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isDisabled();
+ }
+ }
+
+ static class StatePremiumFilter extends AbstractFilter {
+ public StatePremiumFilter() {
+ super(R.string.cache_status_premium);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isPremiumMembersOnly();
+ }
+ }
+
+ static class StateNonPremiumFilter extends AbstractFilter {
+ public StateNonPremiumFilter() {
+ super(R.string.cache_status_not_premium);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return !cache.isPremiumMembersOnly();
+ }
+ }
+
+ private static class StateOfflineLogFilter extends AbstractFilter {
+ public StateOfflineLogFilter() {
+ super(R.string.cache_status_offline_log);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isLogOffline();
+ }
+ }
+
+ static class StateStoredFilter extends AbstractFilter {
+ public StateStoredFilter() {
+ super(R.string.cache_status_stored);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return cache.isOffline();
+ }
+ }
+
+ static class StateNotStoredFilter extends AbstractFilter {
+ public StateNotStoredFilter() {
+ super(R.string.cache_status_not_stored);
+ }
+
+ @Override
+ public boolean accepts(@NonNull final Geocache cache) {
+ return !cache.isOffline();
+ }
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/filter/TrackablesFilter.java b/main/src/cgeo/geocaching/filter/TrackablesFilter.java
index 7ad06a1..debe11f 100644
--- a/main/src/cgeo/geocaching/filter/TrackablesFilter.java
+++ b/main/src/cgeo/geocaching/filter/TrackablesFilter.java
@@ -1,17 +1,13 @@
package cgeo.geocaching.filter;
-import cgeo.geocaching.CgeoApplication;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import org.eclipse.jdt.annotation.NonNull;
-import java.util.Collections;
-import java.util.List;
-
-class TrackablesFilter extends AbstractFilter implements IFilterFactory {
+class TrackablesFilter extends AbstractFilter {
public TrackablesFilter() {
- super(CgeoApplication.getInstance().getString(R.string.caches_filter_track));
+ super(R.string.caches_filter_track);
}
@Override
@@ -19,10 +15,4 @@ class TrackablesFilter extends AbstractFilter implements IFilterFactory {
return cache.hasTrackables();
}
- @Override
- @NonNull
- public List<TrackablesFilter> getFilters() {
- return Collections.singletonList(this);
- }
-
}
diff --git a/main/src/cgeo/geocaching/filter/TypeFilter.java b/main/src/cgeo/geocaching/filter/TypeFilter.java
index 412cbc2..b8c879f 100644
--- a/main/src/cgeo/geocaching/filter/TypeFilter.java
+++ b/main/src/cgeo/geocaching/filter/TypeFilter.java
@@ -11,7 +11,7 @@ import java.util.List;
class TypeFilter extends AbstractFilter {
private final CacheType cacheType;
- public TypeFilter(final CacheType cacheType) {
+ public TypeFilter(@NonNull final CacheType cacheType) {
super(cacheType.id);
this.cacheType = cacheType;
}
@@ -22,6 +22,7 @@ class TypeFilter extends AbstractFilter {
}
@Override
+ @NonNull
public String getName() {
return cacheType.getL10n();
}
@@ -42,4 +43,9 @@ class TypeFilter extends AbstractFilter {
}
}
+
+ @Override
+ public int getImageId() {
+ return cacheType.markerId;
+ }
}
diff --git a/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java b/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java
index e5717ab..0738274 100644
--- a/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java
+++ b/main/src/cgeo/geocaching/gcvote/GCVoteDialog.java
@@ -87,9 +87,8 @@ public class GCVoteDialog {
cache.setMyVote(rating);
DataStore.saveChangedCache(cache);
return true;
- } else {
- Log.w("GCVoteDialog.vote: could not send vote");
}
+ Log.w("GCVoteDialog.vote: could not send vote");
}
} catch (final RuntimeException e) {
Log.e("GCVoteDialog.vote: could not send vote", e);
diff --git a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
index 04d720e..b9fbc76 100644
--- a/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
+++ b/main/src/cgeo/geocaching/loaders/OfflineGeocacheListLoader.java
@@ -26,7 +26,6 @@ public class OfflineGeocacheListLoader extends AbstractSearchLoader {
}
/**
- * @param listId
* @return the bundle needed for querying the LoaderManager for the offline list with the given id
*/
public static Bundle getBundleForList(final int listId) {
diff --git a/main/src/cgeo/geocaching/location/Geopoint.java b/main/src/cgeo/geocaching/location/Geopoint.java
index ad693ca..a746a1e 100644
--- a/main/src/cgeo/geocaching/location/Geopoint.java
+++ b/main/src/cgeo/geocaching/location/Geopoint.java
@@ -97,12 +97,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Create new Geopoint from individual textual components.
*
- * @param latDir
- * @param latDeg
- * @param latDegFrac
- * @param lonDir
- * @param lonDeg
- * @param lonDegFrac
*/
public Geopoint(final String latDir, final String latDeg, final String latDegFrac,
final String lonDir, final String lonDeg, final String lonDegFrac) {
@@ -113,14 +107,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Create new Geopoint from individual textual components.
*
- * @param latDir
- * @param latDeg
- * @param latMin
- * @param latMinFrac
- * @param lonDir
- * @param lonDeg
- * @param lonMin
- * @param lonMinFrac
*/
public Geopoint(final String latDir, final String latDeg, final String latMin, final String latMinFrac,
final String lonDir, final String lonDeg, final String lonMin, final String lonMinFrac) {
@@ -131,16 +117,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Create new Geopoint from individual textual components.
*
- * @param latDir
- * @param latDeg
- * @param latMin
- * @param latSec
- * @param latSecFrac
- * @param lonDir
- * @param lonDeg
- * @param lonMin
- * @param lonSec
- * @param lonSecFrac
*/
public Geopoint(final String latDir, final String latDeg, final String latMin, final String latSec, final String latSecFrac,
final String lonDir, final String lonDeg, final String lonMin, final String lonSec, final String lonSecFrac) {
@@ -202,8 +178,8 @@ public final class Geopoint implements ICoordinates, Parcelable {
* @return An array of floats: the distance in meters, then the bearing in degrees
*/
private float[] pathTo(final Geopoint target) {
- float[] results = new float[2];
- android.location.Location.distanceBetween(latitude, longitude, target.latitude, target.longitude, results);
+ final float[] results = new float[2];
+ Location.distanceBetween(latitude, longitude, target.latitude, target.longitude, results);
return results;
}
@@ -283,7 +259,7 @@ public final class Geopoint implements ICoordinates, Parcelable {
* @see GeopointFormatter
* @return formatted coordinates
*/
- public String format(GeopointFormatter.Format format) {
+ public String format(final GeopointFormatter.Format format) {
return GeopointFormatter.format(format, this);
}
@@ -301,7 +277,7 @@ public final class Geopoint implements ICoordinates, Parcelable {
abstract public static class GeopointException extends NumberFormatException {
private static final long serialVersionUID = 1L;
- protected GeopointException(String msg) {
+ protected GeopointException(final String msg) {
super(msg);
}
}
@@ -347,7 +323,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get latitude character (N or S).
*
- * @return
*/
public char getLatDir() {
return latitude >= 0 ? 'N' : 'S';
@@ -356,7 +331,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get longitude character (E or W).
*
- * @return
*/
public char getLonDir() {
return longitude >= 0 ? 'E' : 'W';
@@ -365,7 +339,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the integral non-negative latitude degrees.
*
- * @return
*/
public int getLatDeg() {
return getDeg(latitude);
@@ -374,7 +347,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the integral non-negative longitude degrees.
*
- * @return
*/
public int getLonDeg() {
return getDeg(longitude);
@@ -387,7 +359,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the fractional part of the latitude degrees scaled up by 10^5.
*
- * @return
*/
public int getLatDegFrac() {
return getDegFrac(latitude);
@@ -396,7 +367,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the fractional part of the longitude degrees scaled up by 10^5.
*
- * @return
*/
public int getLonDegFrac() {
return getDegFrac(longitude);
@@ -409,7 +379,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the integral latitude minutes.
*
- * @return
*/
public int getLatMin() {
return getMin(latitude);
@@ -418,7 +387,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the integral longitude minutes.
*
- * @return
*/
public int getLonMin() {
return getMin(longitude);
@@ -431,7 +399,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the fractional part of the latitude minutes scaled up by 1000.
*
- * @return
*/
public int getLatMinFrac() {
return getMinFrac(latitude);
@@ -440,7 +407,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the fractional part of the longitude minutes scaled up by 1000.
*
- * @return
*/
public int getLonMinFrac() {
return getMinFrac(longitude);
@@ -453,7 +419,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the latitude minutes.
*
- * @return
*/
public double getLatMinRaw() {
return getMinRaw(latitude);
@@ -462,7 +427,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the longitude minutes.
*
- * @return
*/
public double getLonMinRaw() {
return getMinRaw(longitude);
@@ -475,7 +439,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the integral part of the latitude seconds.
*
- * @return
*/
public int getLatSec() {
return getSec(latitude);
@@ -484,7 +447,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the integral part of the longitude seconds.
*
- * @return
*/
public int getLonSec() {
return getSec(longitude);
@@ -497,7 +459,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the fractional part of the latitude seconds scaled up by 1000.
*
- * @return
*/
public int getLatSecFrac() {
@@ -507,7 +468,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the fractional part of the longitude seconds scaled up by 1000.
*
- * @return
*/
public int getLonSecFrac() {
@@ -521,7 +481,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the latitude seconds.
*
- * @return
*/
public double getLatSecRaw() {
return getSecRaw(latitude);
@@ -530,7 +489,6 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Get the longitude seconds.
*
- * @return
*/
public double getLonSecRaw() {
return getSecRaw(longitude);
@@ -555,19 +513,19 @@ public final class Geopoint implements ICoordinates, Parcelable {
/**
* Gets distance in meters (workaround for 4.2.1 JIT bug).
*/
- public static double getDistance(double lat1, double lon1, double lat2, double lon2) {
+ public static double getDistance(final double lat1, final double lon1, final double lat2, final double lon2) {
// for haversine use R = 6372.8 km instead of 6371 km
- double earthRadius = 6372.8;
- double dLat = toRadians(lat2 - lat1);
- double dLon = toRadians(lon2 - lon1);
- double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
+ final double earthRadius = 6372.8;
+ final double dLat = toRadians(lat2 - lat1);
+ final double dLon = toRadians(lon2 - lon1);
+ final double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(toRadians(lat1)) * Math.cos(toRadians(lat2)) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
// simplify haversine
return (2 * earthRadius * 1000 * Math.asin(Math.sqrt(a)));
}
- private static double toRadians(double angdeg) {
+ private static double toRadians(final double angdeg) {
return angdeg * DEG_TO_RAD;
}
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 457b06c..c808ffd 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -4,6 +4,7 @@ import butterknife.ButterKnife;
import cgeo.geocaching.CacheListActivity;
import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.CompassActivity;
import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.Intents;
@@ -22,7 +23,6 @@ import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.location.Viewport;
-import cgeo.geocaching.maps.LiveMapStrategy.Strategy;
import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapActivityImpl;
@@ -32,6 +32,7 @@ import cgeo.geocaching.maps.interfaces.MapProvider;
import cgeo.geocaching.maps.interfaces.MapSource;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
import cgeo.geocaching.maps.interfaces.OnMapDragListener;
+import cgeo.geocaching.network.AndroidBeam;
import cgeo.geocaching.sensors.GeoData;
import cgeo.geocaching.sensors.GeoDirHandler;
import cgeo.geocaching.sensors.Sensors;
@@ -39,6 +40,7 @@ import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.ui.dialog.LiveMapInfoDialogBuilder;
import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.CancellableHandler;
+import cgeo.geocaching.utils.Formatter;
import cgeo.geocaching.utils.LeastRecentlyUsedSet;
import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.MapUtils;
@@ -46,6 +48,7 @@ import cgeo.geocaching.utils.MapUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import rx.Subscription;
import rx.functions.Action0;
@@ -217,29 +220,9 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
switch (what) {
case UPDATE_TITLE:
- // set title
- final StringBuilder title = new StringBuilder();
+ map.setTitle();
+ map.setSubtitle();
- if (map.mapMode == MapMode.LIVE && map.isLiveEnabled) {
- title.append(map.res.getString(R.string.map_live));
- } else {
- title.append(map.mapTitle);
- }
-
- map.countVisibleCaches();
- if (!map.caches.isEmpty() && !map.mapTitle.contains("[")) {
- title.append(" [").append(map.cachesCnt);
- if (map.cachesCnt != map.caches.size() && Settings.isDebug()) {
- title.append('/').append(map.caches.size());
- }
- title.append(']');
- }
-
- if (Settings.isDebug() && map.lastSearchResult != null && StringUtils.isNotBlank(map.lastSearchResult.getUrl())) {
- title.append('[').append(map.lastSearchResult.getUrl()).append(']');
- }
-
- map.setTitle(title.toString());
break;
case INVALIDATE_MAP:
map.mapView.repaintRequired(null);
@@ -254,7 +237,8 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
final private Handler displayHandler = new DisplayHandler(this);
- private void setTitle(final String title) {
+ private void setTitle() {
+ final String title = calculateTitle();
/* Compatibility for the old Action Bar, only used by the maps activity at the moment */
final TextView titleview = ButterKnife.findById(activity, R.id.actionbar_title);
if (titleview != null) {
@@ -266,10 +250,84 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
}
}
+ private String calculateTitle() {
+ if (isLiveEnabled) {
+ return res.getString(R.string.map_live);
+ }
+ if (mapMode == MapMode.SINGLE) {
+ final Geocache cache = getSingleModeCache();
+ if (cache != null) {
+ return cache.getName();
+ }
+ }
+ return StringUtils.defaultIfEmpty(mapTitle, res.getString(R.string.map_map));
+ }
+
+ @Nullable
+ private Geocache getSingleModeCache() {
+ // use a copy of the caches list to avoid concurrent modification
+ for (final Geocache geocache : new ArrayList<>(caches)) {
+ if (geocache.getGeocode().equals(geocodeIntent)) {
+ return geocache;
+ }
+ }
+ return null;
+ }
+
+ private void setSubtitle() {
+ final String subtitle = calculateSubtitle();
+ if (StringUtils.isEmpty(subtitle)) {
+ return;
+ }
+
+ /* Compatibility for the old Action Bar, only used by the maps activity at the moment */
+ final TextView titleView = ButterKnife.findById(activity, R.id.actionbar_title);
+ if (titleView != null) {
+ titleView.setText(titleView.getText().toString() + ' ' + subtitle);
+ }
+ if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)) {
+ setSubtitleIceCreamSandwich(subtitle);
+ }
+ }
+
+ private String calculateSubtitle() {
+ // count caches in the sub title
+ countVisibleCaches();
+ final StringBuilder subtitle = new StringBuilder();
+ if (!isLiveEnabled && mapMode == MapMode.SINGLE) {
+ final Geocache cache = getSingleModeCache();
+ if (cache != null) {
+ return Formatter.formatMapSubtitle(cache);
+ }
+ }
+ if (!caches.isEmpty()) {
+ final int totalCount = caches.size();
+
+ if (cachesCnt != totalCount && Settings.isDebug()) {
+ subtitle.append(cachesCnt).append('/').append(res.getQuantityString(R.plurals.cache_counts, totalCount, totalCount));
+ }
+ else {
+ subtitle.append(res.getQuantityString(R.plurals.cache_counts, cachesCnt, cachesCnt));
+ }
+ }
+
+ if (Settings.isDebug() && lastSearchResult != null && StringUtils.isNotBlank(lastSearchResult.getUrl())) {
+ subtitle.append(" [").append(lastSearchResult.getUrl()).append(']');
+ }
+
+ return subtitle.toString();
+ }
+
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setTitleIceCreamSandwich(final String title) {
activity.getActionBar().setTitle(title);
}
+
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ private void setSubtitleIceCreamSandwich(final String subtitle) {
+ activity.getActionBar().setSubtitle(subtitle);
+ }
+
/** Updates the progress. */
private static final class ShowProgressHandler extends Handler {
private int counter = 0;
@@ -396,7 +454,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
coordsIntent = extras.getParcelable(Intents.EXTRA_COORDS);
waypointTypeIntent = WaypointType.findById(extras.getString(Intents.EXTRA_WPTTYPE));
mapStateIntent = extras.getIntArray(Intents.EXTRA_MAPSTATE);
- mapTitle = extras.getString(Intents.EXTRA_MAP_TITLE);
+ mapTitle = extras.getString(Intents.EXTRA_TITLE);
}
else {
mapMode = MapMode.LIVE;
@@ -435,7 +493,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
activity.getActionBar().setDisplayHomeAsUpEnabled(true);
}
activity.setContentView(mapProvider.getMapLayoutId());
- setTitle(res.getString(R.string.map_map));
+ setTitle();
// initialize map
mapView = (MapViewImpl) activity.findViewById(mapProvider.getMapViewId());
@@ -449,18 +507,21 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
mapView.clearOverlays();
overlayCaches = mapView.createAddMapOverlay(mapView.getContext(), getResources().getDrawable(R.drawable.marker));
- overlayPositionAndScale = mapView.createAddPositionAndScaleOverlay();
+
+
+ overlayPositionAndScale = mapView.createAddPositionAndScaleOverlay(coordsIntent, geocodeIntent);
if (trailHistory != null) {
overlayPositionAndScale.setHistory(trailHistory);
}
+
mapView.repaintRequired(null);
setZoom(Settings.getMapZoom(mapMode));
mapView.getMapController().setCenter(Settings.getMapCenter());
if (null == mapStateIntent) {
- followMyLocation &= mapMode == MapMode.LIVE;
+ followMyLocation = followMyLocation && (mapMode == MapMode.LIVE);
} else {
followMyLocation = 1 == mapStateIntent[3];
if ((overlayCaches.getCircles() ? 1 : 0) != mapStateIntent[4]) {
@@ -493,6 +554,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
if (!CgeoApplication.getInstance().isLiveMapHintShownInThisSession() && Settings.getLiveMapHintShowCount() <= 3) {
LiveMapInfoDialogBuilder.create(activity).show();
}
+ AndroidBeam.disable(activity);
}
private void initMyLocationSwitchButton(final CheckBox locSwitch) {
@@ -508,7 +570,6 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
/**
* Set the zoom of the map. The zoom is restricted to a certain minimum in case of live map.
*
- * @param zoom
*/
private void setZoom(final int zoom) {
mapView.getMapController().setZoom(isLiveEnabled ? Math.max(zoom, MIN_LIVEMAP_ZOOM) : zoom);
@@ -663,7 +724,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
item = menu.findItem(R.id.menu_theme_mode); // show theme selection
item.setVisible(mapView.hasMapThemes());
- menu.findItem(R.id.menu_as_list).setVisible(!isLoading());
+ menu.findItem(R.id.menu_as_list).setVisible(!isLoading() && caches.size() > 1);
menu.findItem(R.id.submenu_strategy).setVisible(isLiveEnabled);
@@ -680,6 +741,8 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
default: // DETAILED
menu.findItem(R.id.menu_strategy_detailed).setChecked(true);
}
+ menu.findItem(R.id.menu_hint).setVisible(mapMode == MapMode.SINGLE);
+ menu.findItem(R.id.menu_compass).setVisible(mapMode == MapMode.SINGLE);
} catch (final RuntimeException e) {
Log.e("CGeoMap.onPrepareOptionsMenu", e);
}
@@ -708,6 +771,10 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
lastSearchResult = null;
searchIntent = null;
ActivityMixin.invalidateOptionsMenu(activity);
+ if (mapMode != MapMode.SINGLE) {
+ mapTitle = StringUtils.EMPTY;
+ }
+ updateMapTitle();
return true;
case R.id.menu_store_caches:
if (!isLoading()) {
@@ -765,24 +832,30 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
}
case R.id.menu_strategy_fastest: {
item.setChecked(true);
- Settings.setLiveMapStrategy(Strategy.FASTEST);
+ Settings.setLiveMapStrategy(LivemapStrategy.FASTEST);
return true;
}
case R.id.menu_strategy_fast: {
item.setChecked(true);
- Settings.setLiveMapStrategy(Strategy.FAST);
+ Settings.setLiveMapStrategy(LivemapStrategy.FAST);
return true;
}
case R.id.menu_strategy_auto: {
item.setChecked(true);
- Settings.setLiveMapStrategy(Strategy.AUTO);
+ Settings.setLiveMapStrategy(LivemapStrategy.AUTO);
return true;
}
case R.id.menu_strategy_detailed: {
item.setChecked(true);
- Settings.setLiveMapStrategy(Strategy.DETAILED);
+ Settings.setLiveMapStrategy(LivemapStrategy.DETAILED);
return true;
}
+ case R.id.menu_hint:
+ menuShowHint();
+ return true;
+ case R.id.menu_compass:
+ menuCompass();
+ return true;
default:
final MapSource mapSource = MapProviderFactory.getMapSource(id);
if (mapSource != null) {
@@ -794,6 +867,20 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
return false;
}
+ private void menuCompass() {
+ final Geocache cache = getSingleModeCache();
+ if (cache != null) {
+ CompassActivity.startActivityCache(this.getActivity(), cache);
+ }
+ }
+
+ private void menuShowHint() {
+ final Geocache cache = getSingleModeCache();
+ if (cache != null) {
+ cache.showHintToast(getActivity());
+ }
+ }
+
private void selectMapTheme() {
final File[] themeFiles = Settings.getMapThemeFiles();
@@ -901,7 +988,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
mapIntent.putExtra(Intents.EXTRA_COORDS, coordsIntent);
}
mapIntent.putExtra(Intents.EXTRA_WPTTYPE, waypointTypeIntent != null ? waypointTypeIntent.id : null);
- mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, mapTitle);
+ mapIntent.putExtra(Intents.EXTRA_TITLE, mapTitle);
mapIntent.putExtra(Intents.EXTRA_MAP_MODE, mapMode);
mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, isLiveEnabled);
@@ -994,12 +1081,13 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
final boolean needsRepaintForHeading = needsRepaintForHeading();
if (needsRepaintForDistanceOrAccuracy) {
- if (map.followMyLocation) {
+ if (CGeoMap.followMyLocation) {
map.centerMap(new Geopoint(currentLocation));
}
}
if (needsRepaintForDistanceOrAccuracy || needsRepaintForHeading) {
+
map.overlayPositionAndScale.setCoordinates(currentLocation);
map.overlayPositionAndScale.setHeading(currentHeading);
map.mapView.repaintRequired(map.overlayPositionAndScale);
@@ -1092,7 +1180,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
// update title on any change
if (moved || !viewportNow.equals(previousViewport)) {
- map.displayHandler.sendEmptyMessage(UPDATE_TITLE);
+ map.updateMapTitle();
}
previousZoom = zoomNow;
@@ -1116,7 +1204,6 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
/**
* get if map is loading something
*
- * @return
*/
public boolean isLoading() {
return !loadTimer.isUnsubscribed() &&
@@ -1319,7 +1406,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
}
displayHandler.sendEmptyMessage(INVALIDATE_MAP);
- displayHandler.sendEmptyMessage(UPDATE_TITLE);
+ updateMapTitle();
} finally {
showProgressHandler.sendEmptyMessage(HIDE_PROGRESS);
}
@@ -1332,11 +1419,15 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
final CachesOverlayItemImpl item = getWaypointItem(waypoint);
overlayCaches.updateItems(item);
displayHandler.sendEmptyMessage(INVALIDATE_MAP);
- displayHandler.sendEmptyMessage(UPDATE_TITLE);
+ updateMapTitle();
cachesCnt = 1;
}
+ private void updateMapTitle() {
+ displayHandler.sendEmptyMessage(UPDATE_TITLE);
+ }
+
private static abstract class DoRunnable implements Runnable {
private final WeakReference<CGeoMap> mapRef;
@@ -1619,7 +1710,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
mapIntent.putExtra(Intents.EXTRA_MAP_MODE, MapMode.LIST);
mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, false);
if (StringUtils.isNotBlank(title)) {
- mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, title);
+ mapIntent.putExtra(Intents.EXTRA_TITLE, title);
}
fromActivity.startActivity(mapIntent);
}
@@ -1639,7 +1730,7 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
mapIntent.putExtra(Intents.EXTRA_WPTTYPE, type.id);
}
if (StringUtils.isNotBlank(title)) {
- mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, title);
+ mapIntent.putExtra(Intents.EXTRA_TITLE, title);
}
fromActivity.startActivity(mapIntent);
}
@@ -1649,7 +1740,6 @@ public class CGeoMap extends AbstractMap implements ViewFactory {
mapIntent.putExtra(Intents.EXTRA_MAP_MODE, MapMode.SINGLE);
mapIntent.putExtra(Intents.EXTRA_LIVE_ENABLED, false);
mapIntent.putExtra(Intents.EXTRA_GEOCODE, geocode);
- mapIntent.putExtra(Intents.EXTRA_MAP_TITLE, geocode);
fromActivity.startActivity(mapIntent);
}
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index c4c4465..048217e 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -158,8 +158,6 @@ public class CachesOverlay extends AbstractItemizedOverlay {
* reality and therefore the minor changes due to the projection will not make any visible difference at the zoom
* levels which are used to see the circles.
*
- * @param projection
- * @return
*/
private int calculateDrawingRadius(MapProjectionImpl projection) {
float[] distanceArray = new float[1];
diff --git a/main/src/cgeo/geocaching/maps/DirectionDrawer.java b/main/src/cgeo/geocaching/maps/DirectionDrawer.java
new file mode 100644
index 0000000..c746221
--- /dev/null
+++ b/main/src/cgeo/geocaching/maps/DirectionDrawer.java
@@ -0,0 +1,60 @@
+package cgeo.geocaching.maps;
+
+import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.location.Geopoint;
+import cgeo.geocaching.maps.interfaces.MapItemFactory;
+import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
+import cgeo.geocaching.settings.Settings;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Point;
+import android.location.Location;
+import android.util.DisplayMetrics;
+import android.view.WindowManager;
+
+public class DirectionDrawer {
+ private Geopoint currentCoords;
+ private final Geopoint destinationCoords;
+ private final MapItemFactory mapItemFactory;
+ private final float width;
+
+ private Paint line = null;
+
+ public DirectionDrawer(final Geopoint coords) {
+ this.destinationCoords = coords;
+ this.mapItemFactory = Settings.getMapProvider().getMapItemFactory();
+
+ final DisplayMetrics metrics = new DisplayMetrics();
+ final WindowManager windowManager = (WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE);
+ windowManager.getDefaultDisplay().getMetrics(metrics);
+
+ width = 4f * metrics.density;
+
+ }
+
+ public void setCoordinates(final Location coordinatesIn) {
+ currentCoords = new Geopoint(coordinatesIn);
+ }
+
+ void drawDirection(final Canvas canvas, final MapProjectionImpl projection) {
+ if (currentCoords == null) {
+ return;
+ }
+
+ if (line == null) {
+ line = new Paint();
+ line.setAntiAlias(true);
+ line.setStrokeWidth(width);
+ line.setColor(0x80EB391E);
+ }
+
+ final Point pos = new Point();
+ final Point dest = new Point();
+ projection.toPixels(mapItemFactory.getGeoPointBase(currentCoords), pos);
+ projection.toPixels(mapItemFactory.getGeoPointBase(destinationCoords), dest);
+
+ canvas.drawLine(pos.x, pos.y, dest.x, dest.y, line);
+ }
+}
diff --git a/main/src/cgeo/geocaching/maps/DistanceDrawer.java b/main/src/cgeo/geocaching/maps/DistanceDrawer.java
new file mode 100644
index 0000000..f2d11bb
--- /dev/null
+++ b/main/src/cgeo/geocaching/maps/DistanceDrawer.java
@@ -0,0 +1,131 @@
+package cgeo.geocaching.maps;
+
+import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.location.Geopoint;
+import cgeo.geocaching.location.Units;
+import cgeo.geocaching.maps.interfaces.MapViewImpl;
+
+import android.content.Context;
+import android.graphics.BlurMaskFilter;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.Rect;
+import android.graphics.RectF;
+import android.graphics.Typeface;
+import android.location.Location;
+import android.util.DisplayMetrics;
+import android.view.WindowManager;
+
+public class DistanceDrawer {
+ private Geopoint currentCoords;
+ private final Geopoint destinationCoords;
+
+ private Paint paintBox = null;
+ private Paint paintBoxShadow = null;
+ private Paint paintText = null;
+ private BlurMaskFilter blurBoxShadow = null;
+
+ private final boolean needsInvertedColors;
+ private float pixelDensity = 0;
+ private final float boxWidth, boxHeight, boxCornerRadius, boxShadowSize, boxPadding;
+ private final float textHeight, maxTextWidth;
+ private final float boxX, boxY;
+
+ private String distanceText = null;
+
+ public DistanceDrawer(final MapViewImpl mapView, final Geopoint destinationCoords) {
+ this.destinationCoords = destinationCoords;
+
+ final DisplayMetrics metrics = new DisplayMetrics();
+ final WindowManager windowManager = (WindowManager) CgeoApplication.getInstance().getSystemService(Context.WINDOW_SERVICE);
+ windowManager.getDefaultDisplay().getMetrics(metrics);
+
+ pixelDensity = metrics.density;
+
+ boxPadding = 2;
+ boxWidth = 100 * pixelDensity + 3 * boxPadding;
+ boxHeight = 30 * pixelDensity + 2 * boxPadding;
+ boxCornerRadius = 5 * pixelDensity;
+ boxShadowSize = 1 * pixelDensity;
+ textHeight = 20 * pixelDensity;
+
+ needsInvertedColors = mapView.needsInvertedColors();
+ boxX = metrics.widthPixels - boxWidth;
+ boxY = 0;
+
+ maxTextWidth = boxWidth - 3 * boxPadding;
+ }
+
+ public void setCoordinates(final Location coordinatesIn) {
+ currentCoords = new Geopoint(coordinatesIn);
+
+ final float distance = currentCoords.distanceTo(destinationCoords);
+ distanceText = Units.getDistanceFromKilometers(distance);
+ }
+
+ void drawDistance(final Canvas canvas) {
+ if (currentCoords == null) {
+ return;
+ }
+
+ if (blurBoxShadow == null) {
+ blurBoxShadow = new BlurMaskFilter(3, BlurMaskFilter.Blur.NORMAL);
+
+ paintBoxShadow = new Paint();
+ paintBoxShadow.setAntiAlias(true);
+ paintBoxShadow.setMaskFilter(blurBoxShadow);
+
+ paintBox = new Paint();
+ paintBox.setAntiAlias(true);
+
+ paintText = new Paint();
+ paintText.setAntiAlias(true);
+ paintText.setTextAlign(Paint.Align.LEFT);
+ paintText.setTypeface(Typeface.DEFAULT_BOLD);
+
+ final int TRANSPARENCY = 0x80000000;
+ if (needsInvertedColors) {
+ paintBoxShadow.setColor(0x000000 | TRANSPARENCY);
+ paintBox.setColor(0xFFFFFF | TRANSPARENCY);
+ paintText.setColor(0xFF000000);
+ } else {
+ paintBoxShadow.setColor(0xFFFFFF | TRANSPARENCY);
+ paintBox.setColor(0x000000 | TRANSPARENCY);
+ paintText.setColor(0xFFFFFFFF);
+ }
+ }
+
+ /* Calculate text size */
+ final Rect textBounds = new Rect();
+ paintText.setTextSize(textHeight);
+ paintText.getTextBounds(distanceText, 0, distanceText.length(), textBounds);
+ while (textBounds.height() > maxTextWidth) {
+ paintText.setTextSize(paintText.getTextSize() - 1);
+ paintText.getTextBounds(distanceText, 0, distanceText.length(), textBounds);
+ }
+
+ final float textX = (boxWidth - 3 * boxPadding - textBounds.width()) / 2 + boxX + 2 * boxPadding;
+ final float textY = (boxHeight + textBounds.height()) / 2 + boxY;
+
+ /* Paint background box */
+ canvas.drawRoundRect(
+ new RectF(
+ boxX - boxShadowSize, boxY - boxShadowSize - boxCornerRadius,
+ boxX + boxWidth + boxShadowSize + boxCornerRadius, boxY + boxHeight + boxShadowSize
+ ),
+ boxCornerRadius, boxCornerRadius,
+ paintBoxShadow
+ );
+ canvas.drawRoundRect(
+ new RectF(
+ boxX, boxY - boxCornerRadius,
+ boxX + boxWidth + boxCornerRadius, boxY + boxHeight
+ ),
+ boxCornerRadius, boxCornerRadius,
+ paintBox
+ );
+
+ /* Paint distance */
+ canvas.drawText(distanceText, textX, textY, paintText);
+ }
+}
diff --git a/main/src/cgeo/geocaching/maps/LiveMapStrategy.java b/main/src/cgeo/geocaching/maps/LiveMapStrategy.java
deleted file mode 100644
index 16d5e8b..0000000
--- a/main/src/cgeo/geocaching/maps/LiveMapStrategy.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package cgeo.geocaching.maps;
-
-import cgeo.geocaching.CgeoApplication;
-import cgeo.geocaching.R;
-
-import java.util.EnumSet;
-
-/**
- * Defines the strategy for the Live Map
- */
-public interface LiveMapStrategy {
-
- public enum StrategyFlag {
- LOAD_TILES, // 2x2 tiles filling the complete viewport
- PARSE_TILES, // parse PNG images
- SEARCH_NEARBY // searchByCoords()
- }
-
- public enum Strategy {
- FASTEST(1, EnumSet.of(StrategyFlag.LOAD_TILES), R.string.map_strategy_fastest),
- FAST(2, EnumSet.of(StrategyFlag.LOAD_TILES, StrategyFlag.PARSE_TILES), R.string.map_strategy_fast),
- AUTO(3, EnumSet.noneOf(StrategyFlag.class), R.string.map_strategy_auto),
- DETAILED(4, EnumSet.allOf(StrategyFlag.class), R.string.map_strategy_detailed);
-
- public final int id;
- public final EnumSet<StrategyFlag> flags;
- private final int stringId;
-
- Strategy(int id, EnumSet<StrategyFlag> flags, int stringId) {
- this.id = id;
- this.flags = flags;
- this.stringId = stringId;
- }
-
- public static Strategy getById(final int id) {
- for (Strategy strategy : Strategy.values()) {
- if (strategy.id == id) {
- return strategy;
- }
- }
- return AUTO;
- }
-
- public final String getL10n() {
- return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
- }
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/LivemapStrategy.java b/main/src/cgeo/geocaching/maps/LivemapStrategy.java
new file mode 100644
index 0000000..c135fc8
--- /dev/null
+++ b/main/src/cgeo/geocaching/maps/LivemapStrategy.java
@@ -0,0 +1,45 @@
+package cgeo.geocaching.maps;
+
+import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.R;
+
+import java.util.EnumSet;
+
+/**
+ * Defines the strategy for the Live Map
+ */
+public enum LivemapStrategy {
+ FASTEST(1, EnumSet.of(Flag.LOAD_TILES), R.string.map_strategy_fastest),
+ FAST(2, EnumSet.of(Flag.LOAD_TILES, Flag.PARSE_TILES), R.string.map_strategy_fast),
+ AUTO(3, EnumSet.noneOf(Flag.class), R.string.map_strategy_auto),
+ DETAILED(4, EnumSet.allOf(Flag.class), R.string.map_strategy_detailed);
+
+ public final int id;
+ public final EnumSet<Flag> flags;
+ private final int stringId;
+
+ public enum Flag {
+ LOAD_TILES, // 2x2 tiles filling the complete viewport
+ PARSE_TILES, // parse PNG images
+ SEARCH_NEARBY // searchByCoords()
+ }
+
+ LivemapStrategy(final int id, final EnumSet<Flag> flags, final int stringId) {
+ this.id = id;
+ this.flags = flags;
+ this.stringId = stringId;
+ }
+
+ public static LivemapStrategy getById(final int id) {
+ for (final LivemapStrategy strategy : LivemapStrategy.values()) {
+ if (strategy.id == id) {
+ return strategy;
+ }
+ }
+ return AUTO;
+ }
+
+ public final String getL10n() {
+ return CgeoApplication.getInstance().getBaseContext().getResources().getString(stringId);
+ }
+}
diff --git a/main/src/cgeo/geocaching/maps/PositionAndScaleOverlay.java b/main/src/cgeo/geocaching/maps/PositionAndScaleOverlay.java
index 63fcd73..9a6e4b9 100644
--- a/main/src/cgeo/geocaching/maps/PositionAndScaleOverlay.java
+++ b/main/src/cgeo/geocaching/maps/PositionAndScaleOverlay.java
@@ -1,5 +1,8 @@
package cgeo.geocaching.maps;
+import cgeo.geocaching.DataStore;
+import cgeo.geocaching.location.Geopoint;
+import cgeo.geocaching.location.Viewport;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
@@ -16,22 +19,40 @@ public class PositionAndScaleOverlay implements GeneralOverlay {
PositionDrawer positionDrawer = null;
ScaleDrawer scaleDrawer = null;
+ DirectionDrawer directionDrawer = null;
+ DistanceDrawer distanceDrawer = null;
- public PositionAndScaleOverlay(OverlayImpl ovlImpl) {
+ public PositionAndScaleOverlay(final OverlayImpl ovlImpl, final MapViewImpl mapView, final Geopoint coords, final String geocode) {
this.ovlImpl = ovlImpl;
positionDrawer = new PositionDrawer();
scaleDrawer = new ScaleDrawer();
+
+ if (coords != null) {
+ directionDrawer = new DirectionDrawer(coords);
+ distanceDrawer = new DistanceDrawer(mapView, coords);
+ } else if (geocode != null) {
+ final Viewport bounds = DataStore.getBounds(geocode);
+ if (bounds != null) {
+ directionDrawer = new DirectionDrawer(bounds.center);
+ distanceDrawer = new DistanceDrawer(mapView, bounds.center);
+ }
+ }
}
- public void setCoordinates(Location coordinatesIn) {
+ public void setCoordinates(final Location coordinatesIn) {
positionDrawer.setCoordinates(coordinatesIn);
+ if (directionDrawer != null) {
+ directionDrawer.setCoordinates(coordinatesIn);
+ distanceDrawer.setCoordinates(coordinatesIn);
+ }
+
}
public Location getCoordinates() {
return positionDrawer.getCoordinates();
}
- public void setHeading(float bearingNow) {
+ public void setHeading(final float bearingNow) {
positionDrawer.setHeading(bearingNow);
}
@@ -40,21 +61,27 @@ public class PositionAndScaleOverlay implements GeneralOverlay {
}
@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, getOverlayImpl().getMapViewImpl());
}
@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(), mapView);
}
- private void drawInternal(Canvas canvas, MapProjectionImpl projection, MapViewImpl mapView) {
+ private void drawInternal(final Canvas canvas, final MapProjectionImpl projection, final MapViewImpl mapView) {
+ if (directionDrawer != null) {
+ directionDrawer.drawDirection(canvas, projection);
+ }
positionDrawer.drawPosition(canvas, projection);
scaleDrawer.drawScale(canvas, mapView);
+ if (distanceDrawer != null) {
+ distanceDrawer.drawDistance(canvas);
+ }
}
@Override
@@ -66,7 +93,7 @@ public class PositionAndScaleOverlay implements GeneralOverlay {
return positionDrawer.getHistory();
}
- public void setHistory(ArrayList<Location> history) {
+ public void setHistory(final ArrayList<Location> history) {
positionDrawer.setHistory(history);
}
}
diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapView.java
index d474e1d..f3b7e9e 100644
--- a/main/src/cgeo/geocaching/maps/google/v1/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleMapView.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.maps.google.v1;
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
+import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.location.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.PositionAndScaleOverlay;
@@ -36,22 +37,22 @@ public class GoogleMapView extends MapView implements MapViewImpl {
private OnMapDragListener onDragListener;
private final GoogleMapController mapController = new GoogleMapController(getController());
- public GoogleMapView(Context context, AttributeSet attrs) {
+ public GoogleMapView(final Context context, final AttributeSet attrs) {
super(context, attrs);
initialize(context);
}
- public GoogleMapView(Context context, AttributeSet attrs, int defStyle) {
+ public GoogleMapView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
initialize(context);
}
- public GoogleMapView(Context context, String apiKey) {
+ public GoogleMapView(final Context context, final String apiKey) {
super(context, apiKey);
initialize(context);
}
- private void initialize(Context context) {
+ private void initialize(final Context context) {
if (isInEditMode()) {
return;
}
@@ -66,16 +67,16 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
super.draw(canvas);
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("GoogleMapView.draw", e);
}
}
@Override
- public void displayZoomControls(boolean takeFocus) {
+ public void displayZoomControls(final boolean takeFocus) {
try {
// Push zoom controls to the right
- FrameLayout.LayoutParams zoomParams = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
+ final FrameLayout.LayoutParams zoomParams = new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
zoomParams.gravity = Gravity.RIGHT;
// The call to retrieve the zoom buttons controller is undocumented and works so far on all devices
// supported by Google Play, but fails at least on one Jolla.
@@ -83,9 +84,9 @@ public class GoogleMapView extends MapView implements MapViewImpl {
controller.getZoomControls().setLayoutParams(zoomParams);
super.displayZoomControls(takeFocus);
- } catch (NoSuchMethodException ignored) {
+ } catch (final NoSuchMethodException ignored) {
Log.w("GoogleMapView.displayZoomControls: unable to explicitly place the zoom buttons");
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("GoogleMapView.displayZoomControls", e);
}
}
@@ -98,7 +99,7 @@ public class GoogleMapView extends MapView implements MapViewImpl {
@Override
@NonNull
public GeoPointImpl getMapViewCenter() {
- GeoPoint point = getMapCenter();
+ final GeoPoint point = getMapCenter();
return new GoogleGeoPoint(point.getLatitudeE6(), point.getLongitudeE6());
}
@@ -118,17 +119,17 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public CachesOverlay createAddMapOverlay(Context context, Drawable drawable) {
+ public CachesOverlay createAddMapOverlay(final Context context, final Drawable drawable) {
- GoogleCacheOverlay ovl = new GoogleCacheOverlay(context, drawable);
+ final GoogleCacheOverlay ovl = new GoogleCacheOverlay(context, drawable);
getOverlays().add(ovl);
return ovl.getBase();
}
@Override
- public PositionAndScaleOverlay createAddPositionAndScaleOverlay() {
+ public PositionAndScaleOverlay createAddPositionAndScaleOverlay(final Geopoint coords, final String geocode) {
- GoogleOverlay ovl = new GoogleOverlay();
+ final GoogleOverlay ovl = new GoogleOverlay(this, coords, geocode);
getOverlays().add(ovl);
return (PositionAndScaleOverlay) ovl.getBase();
}
@@ -144,21 +145,21 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public void repaintRequired(GeneralOverlay overlay) {
+ public void repaintRequired(final GeneralOverlay overlay) {
invalidate();
}
@Override
- public void setOnDragListener(OnMapDragListener onDragListener) {
+ public void setOnDragListener(final OnMapDragListener onDragListener) {
this.onDragListener = onDragListener;
}
@Override
- public boolean onTouchEvent(MotionEvent ev) {
+ public boolean onTouchEvent(final MotionEvent ev) {
try {
gestureDetector.onTouchEvent(ev);
return super.onTouchEvent(ev);
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("GoogleMapView.onTouchEvent", e);
}
return false;
@@ -166,7 +167,7 @@ public class GoogleMapView extends MapView implements MapViewImpl {
private class GestureListener extends SimpleOnGestureListener {
@Override
- public boolean onDoubleTap(MotionEvent e) {
+ public boolean onDoubleTap(final MotionEvent e) {
getController().zoomInFixing((int) e.getX(), (int) e.getY());
if (onDragListener != null) {
onDragListener.onDrag();
@@ -175,8 +176,8 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public boolean onScroll(MotionEvent e1, MotionEvent e2,
- float distanceX, float distanceY) {
+ public boolean onScroll(final MotionEvent e1, final MotionEvent e2,
+ final float distanceX, final float distanceY) {
if (onDragListener != null) {
onDragListener.onDrag();
}
diff --git a/main/src/cgeo/geocaching/maps/google/v1/GoogleOverlay.java b/main/src/cgeo/geocaching/maps/google/v1/GoogleOverlay.java
index 40a5539..415de1f 100644
--- a/main/src/cgeo/geocaching/maps/google/v1/GoogleOverlay.java
+++ b/main/src/cgeo/geocaching/maps/google/v1/GoogleOverlay.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.google.v1;
+import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.maps.PositionAndScaleOverlay;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
@@ -16,14 +17,14 @@ import java.util.concurrent.locks.ReentrantLock;
public class GoogleOverlay extends Overlay implements OverlayImpl {
private PositionAndScaleOverlay overlayBase = null;
- private Lock lock = new ReentrantLock();
+ private final Lock lock = new ReentrantLock();
- public GoogleOverlay() {
- overlayBase = new PositionAndScaleOverlay(this);
+ public GoogleOverlay(final MapViewImpl mapView, final Geopoint coords, final String geocode) {
+ overlayBase = new PositionAndScaleOverlay(this, mapView, coords, geocode);
}
@Override
- public void draw(Canvas canvas, MapView mapView, boolean shadow) {
+ public void draw(final Canvas canvas, final MapView mapView, final boolean shadow) {
super.draw(canvas, mapView, shadow);
if (overlayBase != null) {
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapActivityImpl.java b/main/src/cgeo/geocaching/maps/interfaces/MapActivityImpl.java
index 3596d5f..1e69b44 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapActivityImpl.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapActivityImpl.java
@@ -33,5 +33,8 @@ public interface MapActivityImpl {
boolean superOnOptionsItemSelected(MenuItem item);
+ /**
+ * called from the pseudo actionbar layout
+ */
public abstract void navigateUp(View view);
}
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
index 0560ad4..1876dfc 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.interfaces;
+import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.location.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.PositionAndScaleOverlay;
@@ -46,7 +47,7 @@ public interface MapViewImpl {
CachesOverlay createAddMapOverlay(Context context, Drawable drawable);
- PositionAndScaleOverlay createAddPositionAndScaleOverlay();
+ PositionAndScaleOverlay createAddPositionAndScaleOverlay(final Geopoint coords, final String geocode);
void setMapSource();
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
index 01b10ec..76d645c 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
@@ -7,8 +7,6 @@ import cgeo.geocaching.maps.MapProviderFactory;
import cgeo.geocaching.maps.interfaces.MapItemFactory;
import cgeo.geocaching.maps.interfaces.MapProvider;
import cgeo.geocaching.maps.interfaces.MapSource;
-import cgeo.geocaching.maps.mapsforge.v024.MapsforgeMapActivity024;
-import cgeo.geocaching.maps.mapsforge.v024.MapsforgeMapItemFactory024;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.utils.Log;
@@ -30,7 +28,6 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
public static final String MAPSFORGE_CYCLEMAP_ID = "MAPSFORGE_CYCLEMAP";
public static final String MAPSFORGE_MAPNIK_ID = "MAPSFORGE_MAPNIK";
- private boolean oldMap = false;
private MapItemFactory mapItemFactory = new MapsforgeMapItemFactory();
private MapsforgeMapProvider() {
@@ -56,13 +53,13 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
return Collections.emptyList();
}
- File directory = new File(directoryPath);
+ final File directory = new File(directoryPath);
if (directory.isDirectory()) {
try {
- ArrayList<String> mapFileList = new ArrayList<>();
+ final ArrayList<String> mapFileList = new ArrayList<>();
final File[] files = directory.listFiles();
if (ArrayUtils.isNotEmpty(files)) {
- for (File file : files) {
+ for (final File file : files) {
if (file.getName().endsWith(".map")) {
if (MapsforgeMapProvider.isValidMapFile(file.getAbsolutePath())) {
mapFileList.add(file.getAbsolutePath());
@@ -72,69 +69,44 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
Collections.sort(mapFileList, String.CASE_INSENSITIVE_ORDER);
}
return mapFileList;
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("MapsforgeMapProvider.getOfflineMaps: ", e);
}
}
return Collections.emptyList();
}
- public static boolean isValidMapFile(String mapFileIn) {
+ public static boolean isValidMapFile(final String mapFileIn) {
if (StringUtils.isEmpty(mapFileIn)) {
return false;
}
- MapDatabase mapDB = new MapDatabase();
- FileOpenResult result = mapDB.openFile(new File(mapFileIn));
+ final MapDatabase mapDB = new MapDatabase();
+ final FileOpenResult result = mapDB.openFile(new File(mapFileIn));
mapDB.closeFile();
- boolean isValid = result.isSuccess();
-
- if (!isValid) {
- isValid = isMapfile024(mapFileIn);
- }
-
- return isValid;
- }
-
- private static boolean isMapfile024(String mapFileIn) {
- return mapFileIn != null && org.mapsforge.android.mapsold.MapDatabase.isValidMapFile(mapFileIn);
+ return result.isSuccess();
}
@Override
public boolean isSameActivity(final MapSource source1, final MapSource source2) {
- return source1 == source2 ||
- !isMapfile024(Settings.getMapFile()) ||
- (!(source1 instanceof OfflineMapSource) && !(source2 instanceof OfflineMapSource));
+ return source1.getNumericalId() == source2.getNumericalId() || (!(source1 instanceof OfflineMapSource) && !(source2 instanceof OfflineMapSource));
}
@Override
public Class<? extends Activity> getMapClass() {
- final MapSource source = Settings.getMapSource();
- if (source instanceof OfflineMapSource && isMapfile024(Settings.getMapFile())) {
- oldMap = true;
- mapItemFactory = new MapsforgeMapItemFactory024();
- return MapsforgeMapActivity024.class;
- }
- oldMap = false;
mapItemFactory = new MapsforgeMapItemFactory();
return MapsforgeMapActivity.class;
}
@Override
public int getMapViewId() {
- if (oldMap) {
- return R.id.mfmap_old;
- }
return R.id.mfmap;
}
@Override
public int getMapLayoutId() {
- if (oldMap) {
- return R.layout.map_mapsforge_old;
- }
return R.layout.map_mapsforge;
}
@@ -152,7 +124,7 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
private final String fileName;
- public OfflineMapSource(final String fileName, MapProvider mapProvider, final String name, final MapGeneratorInternal generator) {
+ public OfflineMapSource(final String fileName, final MapProvider mapProvider, final String name, final MapGeneratorInternal generator) {
super(fileName, mapProvider, name, generator);
this.fileName = fileName;
}
@@ -171,7 +143,7 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
MapProviderFactory.deleteOfflineMapSources();
final Resources resources = CgeoApplication.getInstance().getResources();
final List<String> offlineMaps = getOfflineMaps();
- for (String mapFile : offlineMaps) {
+ for (final String mapFile : offlineMaps) {
final String mapName = StringUtils.capitalize(StringUtils.substringBeforeLast(new File(mapFile).getName(), "."));
registerMapSource(new OfflineMapSource(mapFile, this, mapName + " (" + resources.getString(R.string.map_source_osm_offline) + ")", MapGeneratorInternal.DATABASE_RENDERER));
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index 73d87b0..71bf583 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -1,6 +1,7 @@
package cgeo.geocaching.maps.mapsforge;
import cgeo.geocaching.R;
+import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.location.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.PositionAndScaleOverlay;
@@ -40,12 +41,12 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
private OnMapDragListener onDragListener;
private final MapsforgeMapController mapController = new MapsforgeMapController(getController(), getMapGenerator().getZoomLevelMax());
- public MapsforgeMapView(Context context, AttributeSet attrs) {
+ public MapsforgeMapView(final Context context, final AttributeSet attrs) {
super(context, attrs);
initialize(context);
}
- private void initialize(Context context) {
+ private void initialize(final Context context) {
if (isInEditMode()) {
return;
}
@@ -56,7 +57,7 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
- public void draw(@NonNull Canvas canvas) {
+ public void draw(@NonNull final Canvas canvas) {
try {
// Google Maps and OSM Maps use different zoom levels for the same view.
// Here we don't want the Google Maps compatible zoom level, but the actual one.
@@ -65,13 +66,13 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
super.draw(canvas);
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("MapsforgeMapView.draw", e);
}
}
@Override
- public void displayZoomControls(boolean takeFocus) {
+ public void displayZoomControls(final boolean takeFocus) {
// nothing to do here
}
@@ -83,7 +84,7 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
@Override
@NonNull
public GeoPointImpl getMapViewCenter() {
- GeoPoint point = getMapPosition().getMapCenter();
+ final GeoPoint point = getMapPosition().getMapCenter();
return new MapsforgeGeoPoint(point.latitudeE6, point.longitudeE6);
}
@@ -103,16 +104,16 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
- public CachesOverlay createAddMapOverlay(Context context, Drawable drawable) {
+ public CachesOverlay createAddMapOverlay(final Context context, final Drawable drawable) {
- MapsforgeCacheOverlay ovl = new MapsforgeCacheOverlay(context, drawable);
+ final MapsforgeCacheOverlay ovl = new MapsforgeCacheOverlay(context, drawable);
getOverlays().add(ovl);
return ovl.getBase();
}
@Override
- public PositionAndScaleOverlay createAddPositionAndScaleOverlay() {
- MapsforgeOverlay ovl = new MapsforgeOverlay();
+ public PositionAndScaleOverlay createAddPositionAndScaleOverlay(final Geopoint coords, final String geocode) {
+ final MapsforgeOverlay ovl = new MapsforgeOverlay(this, coords, geocode);
getOverlays().add(ovl);
return (PositionAndScaleOverlay) ovl.getBase();
}
@@ -122,12 +123,12 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
int span = 0;
- Projection projection = getProjection();
+ final Projection projection = getProjection();
if (projection != null && getHeight() > 0) {
- GeoPoint low = projection.fromPixels(0, 0);
- GeoPoint high = projection.fromPixels(0, getHeight());
+ final GeoPoint low = projection.fromPixels(0, 0);
+ final GeoPoint high = projection.fromPixels(0, getHeight());
if (low != null && high != null) {
span = Math.abs(high.latitudeE6 - low.latitudeE6);
@@ -142,11 +143,11 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
int span = 0;
- Projection projection = getProjection();
+ final Projection projection = getProjection();
if (projection != null && getWidth() > 0) {
- GeoPoint low = projection.fromPixels(0, 0);
- GeoPoint high = projection.fromPixels(getWidth(), 0);
+ final GeoPoint low = projection.fromPixels(0, 0);
+ final GeoPoint high = projection.fromPixels(getWidth(), 0);
if (low != null && high != null) {
span = Math.abs(high.longitudeE6 - low.longitudeE6);
@@ -191,7 +192,7 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
newMapType = ((MapsforgeMapSource) mapSource).getGenerator();
}
- MapGenerator mapGenerator = MapGeneratorFactory.createMapGenerator(newMapType);
+ final MapGenerator mapGenerator = MapGeneratorFactory.createMapGenerator(newMapType);
// When swapping map sources, make sure we aren't exceeding max zoom. See bug #1535
final int maxZoom = mapGenerator.getZoomLevelMax();
@@ -230,11 +231,11 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
@Override
public void setMapTheme() {
- String customRenderTheme = Settings.getCustomRenderThemeFilePath();
+ final String customRenderTheme = Settings.getCustomRenderThemeFilePath();
if (StringUtils.isNotEmpty(customRenderTheme)) {
try {
setRenderTheme(new File(customRenderTheme));
- } catch (FileNotFoundException ignored) {
+ } catch (final FileNotFoundException ignored) {
Toast.makeText(
getContext(),
getContext().getResources().getString(R.string.warn_rendertheme_missing),
@@ -247,38 +248,38 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
- public void repaintRequired(GeneralOverlay overlay) {
+ public void repaintRequired(final GeneralOverlay overlay) {
if (null == overlay) {
invalidate();
} else {
try {
- Overlay ovl = (Overlay) overlay.getOverlayImpl();
+ final Overlay ovl = (Overlay) overlay.getOverlayImpl();
if (ovl != null) {
ovl.requestRedraw();
}
- } catch (Exception e) {
+ } catch (final Exception e) {
Log.e("MapsforgeMapView.repaintRequired", e);
}
}
}
@Override
- public void setOnDragListener(OnMapDragListener onDragListener) {
+ public void setOnDragListener(final OnMapDragListener onDragListener) {
this.onDragListener = onDragListener;
}
@Override
- public boolean onTouchEvent(MotionEvent ev) {
+ public boolean onTouchEvent(final MotionEvent ev) {
gestureDetector.onTouchEvent(ev);
return super.onTouchEvent(ev);
}
private class GestureListener extends SimpleOnGestureListener {
@Override
- public boolean onDoubleTap(MotionEvent e) {
+ public boolean onDoubleTap(final MotionEvent e) {
if (onDragListener != null) {
onDragListener.onDrag();
}
@@ -286,8 +287,8 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
- public boolean onScroll(MotionEvent e1, MotionEvent e2,
- float distanceX, float distanceY) {
+ public boolean onScroll(final MotionEvent e1, final MotionEvent e2,
+ final float distanceX, final float distanceY) {
if (onDragListener != null) {
onDragListener.onDrag();
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java
index 3df4ab0..3926eb6 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.mapsforge;
+import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.maps.PositionAndScaleOverlay;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
@@ -17,15 +18,15 @@ import java.util.concurrent.locks.ReentrantLock;
public class MapsforgeOverlay extends Overlay implements OverlayImpl {
private PositionAndScaleOverlay overlayBase = null;
- private Lock lock = new ReentrantLock();
+ private final Lock lock = new ReentrantLock();
- public MapsforgeOverlay() {
- overlayBase = new PositionAndScaleOverlay(this);
+ public MapsforgeOverlay(final MapViewImpl mapView, final Geopoint coords, final String geocode) {
+ overlayBase = new PositionAndScaleOverlay(this, mapView, coords, geocode);
}
@Override
- protected void drawOverlayBitmap(Canvas canvas, Point drawPosition,
- Projection projection, byte drawZoomLevel) {
+ protected void drawOverlayBitmap(final Canvas canvas, final Point drawPosition,
+ final Projection projection, final byte drawZoomLevel) {
if (overlayBase != null) {
overlayBase.drawOverlayBitmap(canvas, drawPosition, new MapsforgeMapProjection(projection), drawZoomLevel);
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java
deleted file mode 100644
index a8111ed..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.maps.CachesOverlay;
-import cgeo.geocaching.maps.interfaces.ItemizedOverlayImpl;
-import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-
-import org.mapsforge.android.mapsold.ItemizedOverlay;
-import org.mapsforge.android.mapsold.Projection;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Point;
-import android.graphics.drawable.Drawable;
-
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class MapsforgeCacheOverlay extends ItemizedOverlay<MapsforgeCacheOverlayItem> implements ItemizedOverlayImpl {
-
- private CachesOverlay base;
- private Lock lock = new ReentrantLock();
-
- public MapsforgeCacheOverlay(Context contextIn, Drawable markerIn) {
- super(boundCenterBottom(markerIn));
- base = new CachesOverlay(this, contextIn);
- }
-
- @Override
- public CachesOverlay getBase() {
- return base;
- }
-
- @Override
- protected MapsforgeCacheOverlayItem createItem(int i) {
- if (base == null) {
- return null;
- }
-
- return (MapsforgeCacheOverlayItem) base.createItem(i);
- }
-
- @Override
- public int size() {
- if (base == null) {
- return 0;
- }
-
- return base.size();
- }
-
- @Override
- protected boolean onTap(int arg0) {
- if (base == null) {
- return false;
- }
-
- return base.onTap(arg0);
- }
-
- @Override
- protected void drawOverlayBitmap(Canvas canvas, Point drawPosition,
- Projection projection, byte drawZoomLevel) {
- base.drawOverlayBitmap(canvas, drawPosition, new MapsforgeMapProjection(projection), drawZoomLevel);
- }
-
- @Override
- public void superPopulate() {
- populate();
- }
-
- @Override
- public Drawable superBoundCenterBottom(Drawable marker) {
- return ItemizedOverlay.boundCenterBottom(marker);
- }
-
- @Override
- public void superSetLastFocusedItemIndex(int i) {
- // nothing to do
- }
-
- @Override
- public boolean superOnTap(int index) {
- return super.onTap(index);
- }
-
- @Override
- public void superDraw(Canvas canvas, MapViewImpl mapView, boolean shadow) {
- // nothing to do here...
- }
-
- @Override
- public void superDrawOverlayBitmap(Canvas canvas, Point drawPosition,
- MapProjectionImpl projection, byte drawZoomLevel) {
- super.drawOverlayBitmap(canvas, drawPosition, (Projection) projection.getImpl(), drawZoomLevel);
- }
-
- @Override
- public void lock() {
- lock.lock();
- }
-
- @Override
- public void unlock() {
- lock.unlock();
- }
-
- @Override
- public MapViewImpl getMapViewImpl() {
- return (MapViewImpl) internalMapView;
- }
-
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlayItem.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlayItem.java
deleted file mode 100644
index 4e4a358..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlayItem.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.IWaypoint;
-import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
-
-import org.mapsforge.android.mapsold.GeoPoint;
-import org.mapsforge.android.mapsold.OverlayItem;
-
-import android.graphics.drawable.Drawable;
-
-public class MapsforgeCacheOverlayItem extends OverlayItem implements CachesOverlayItemImpl {
- final private IWaypoint coord;
- final private boolean applyDistanceRule;
-
- public MapsforgeCacheOverlayItem(IWaypoint coordinate, boolean applyDistanceRule) {
- super(new GeoPoint(coordinate.getCoords().getLatitudeE6(), coordinate.getCoords().getLongitudeE6()), coordinate.getName(), "");
-
- this.coord = coordinate;
- this.applyDistanceRule = applyDistanceRule;
- }
-
- @Override
- public IWaypoint getCoord() {
- return coord;
- }
-
- @Override
- public Drawable getMarker(int index) {
- return getMarker();
- }
-
- @Override
- public boolean applyDistanceRule() {
- return applyDistanceRule;
- }
-
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeGeoPoint.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeGeoPoint.java
deleted file mode 100644
index 72aceb0..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeGeoPoint.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.location.Geopoint;
-import cgeo.geocaching.maps.interfaces.GeoPointImpl;
-
-import org.mapsforge.android.mapsold.GeoPoint;
-
-public class MapsforgeGeoPoint extends GeoPoint implements GeoPointImpl {
-
- public MapsforgeGeoPoint(int latitudeE6, int longitudeE6) {
- super(latitudeE6, longitudeE6);
- }
-
- @Override
- public Geopoint getCoords() {
- return new Geopoint(getLatitudeE6() / 1e6, getLongitudeE6() / 1e6);
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java
deleted file mode 100644
index daeb2b8..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.activity.ActivityMixin;
-import cgeo.geocaching.activity.FilteredActivity;
-import cgeo.geocaching.maps.AbstractMap;
-import cgeo.geocaching.maps.CGeoMap;
-import cgeo.geocaching.maps.interfaces.MapActivityImpl;
-
-import org.mapsforge.android.mapsold.MapActivity;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-
-public class MapsforgeMapActivity024 extends MapActivity implements MapActivityImpl, FilteredActivity {
-
- private AbstractMap mapBase;
-
- public MapsforgeMapActivity024() {
- mapBase = new CGeoMap(this);
- }
-
- @Override
- public Activity getActivity() {
- return this;
- }
-
- @Override
- protected void onCreate(Bundle icicle) {
- mapBase.onCreate(icicle);
- }
-
- @Override
- protected void onSaveInstanceState(final Bundle outState) {
- mapBase.onSaveInstanceState(outState);
- }
-
- @Override
- protected void onDestroy() {
- mapBase.onDestroy();
- }
-
- @Override
- protected void onPause() {
- mapBase.onPause();
- }
-
- @Override
- protected void onResume() {
- mapBase.onResume();
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- return mapBase.onCreateOptionsMenu(menu);
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- return mapBase.onOptionsItemSelected(item);
- }
-
- @Override
- public boolean onPrepareOptionsMenu(Menu menu) {
- return mapBase.onPrepareOptionsMenu(menu);
- }
-
- @Override
- protected void onStop() {
- mapBase.onStop();
- }
-
- @Override
- public void superOnCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- }
-
- @Override
- public boolean superOnCreateOptionsMenu(Menu menu) {
- return super.onCreateOptionsMenu(menu);
- }
-
- @Override
- public void superOnDestroy() {
- super.onDestroy();
- }
-
- @Override
- public boolean superOnOptionsItemSelected(MenuItem item) {
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- public void superOnResume() {
- super.onResume();
- }
-
- @Override
- public void superOnStop() {
- super.onStop();
- }
-
- @Override
- public void superOnPause() {
- super.onPause();
- }
-
- @Override
- public boolean superOnPrepareOptionsMenu(Menu menu) {
- return super.onPrepareOptionsMenu(menu);
- }
-
- @Override
- public void navigateUp(View view) {
- ActivityMixin.navigateUp(this);
- }
-
- @Override
- public void showFilterMenu(View view) {
- // do nothing, the filter bar only shows the global filter
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapController.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapController.java
deleted file mode 100644
index db33d56..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapController.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.maps.interfaces.GeoPointImpl;
-import cgeo.geocaching.maps.interfaces.MapControllerImpl;
-
-import org.mapsforge.android.mapsold.GeoPoint;
-import org.mapsforge.android.mapsold.MapController;
-
-public class MapsforgeMapController implements MapControllerImpl {
-
- private MapController mapController;
- private int maxZoomLevel;
-
- public MapsforgeMapController(MapController mapControllerIn, int maxZoomLevelIn) {
- mapController = mapControllerIn;
- maxZoomLevel = maxZoomLevelIn;
- }
-
- @Override
- public void animateTo(GeoPointImpl geoPoint) {
- mapController.setCenter(castToGeoPointImpl(geoPoint));
- }
-
- private static GeoPoint castToGeoPointImpl(GeoPointImpl geoPoint) {
- assert geoPoint instanceof GeoPoint;
- return (GeoPoint) geoPoint;
- }
-
- @Override
- public void setCenter(GeoPointImpl geoPoint) {
- mapController.setCenter(castToGeoPointImpl(geoPoint));
- }
-
- /**
- * Set the map zoom level to mapzoom-1 or maxZoomLevel, whichever is least
- * mapzoom-1 is used to be compatible with Google Maps zoom levels
- */
- @Override
- public void setZoom(int mapzoom) {
- // Google Maps and OSM Maps use different zoom levels for the same view.
- // All OSM Maps zoom levels are offset by 1 so they match Google Maps.
- mapController.setZoom(Math.min(mapzoom - 1, maxZoomLevel));
- }
-
- @Override
- public void zoomToSpan(int latSpanE6, int lonSpanE6) {
-
- if (latSpanE6 != 0 && lonSpanE6 != 0) {
- // calculate zoomlevel
- int distDegree = Math.max(latSpanE6, lonSpanE6);
- int zoomLevel = (int) Math.floor(Math.log(360.0 * 1e6 / distDegree) / Math.log(2));
- mapController.setZoom(zoomLevel + 1);
- }
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java
deleted file mode 100644
index 23d94d9..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.IWaypoint;
-import cgeo.geocaching.location.Geopoint;
-import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
-import cgeo.geocaching.maps.interfaces.GeoPointImpl;
-import cgeo.geocaching.maps.interfaces.MapItemFactory;
-
-public class MapsforgeMapItemFactory024 implements MapItemFactory {
-
- @Override
- public GeoPointImpl getGeoPointBase(final Geopoint coords) {
- return new MapsforgeGeoPoint(coords.getLatitudeE6(), coords.getLongitudeE6());
- }
-
- @Override
- public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, boolean applyDistanceRule) {
- return new MapsforgeCacheOverlayItem(coordinate, applyDistanceRule);
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapProjection.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapProjection.java
deleted file mode 100644
index 9d36b7d..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapProjection.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.maps.interfaces.GeoPointImpl;
-import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
-
-import org.mapsforge.android.mapsold.GeoPoint;
-import org.mapsforge.android.mapsold.Projection;
-
-import android.graphics.Point;
-
-public class MapsforgeMapProjection implements MapProjectionImpl {
-
- private Projection projection;
-
- public MapsforgeMapProjection(Projection projectionIn) {
- projection = projectionIn;
- }
-
- @Override
- public void toPixels(GeoPointImpl leftGeo, Point left) {
- projection.toPixels((GeoPoint) leftGeo, left);
- }
-
- @Override
- public Object getImpl() {
- return projection;
- }
-
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
deleted file mode 100644
index 42c55fe..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
+++ /dev/null
@@ -1,254 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.R;
-import cgeo.geocaching.location.Viewport;
-import cgeo.geocaching.maps.CachesOverlay;
-import cgeo.geocaching.maps.PositionAndScaleOverlay;
-import cgeo.geocaching.maps.interfaces.GeneralOverlay;
-import cgeo.geocaching.maps.interfaces.GeoPointImpl;
-import cgeo.geocaching.maps.interfaces.MapControllerImpl;
-import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-import cgeo.geocaching.maps.interfaces.OnMapDragListener;
-import cgeo.geocaching.settings.Settings;
-import cgeo.geocaching.utils.Log;
-
-import org.eclipse.jdt.annotation.NonNull;
-import org.mapsforge.android.mapsold.GeoPoint;
-import org.mapsforge.android.mapsold.MapDatabase;
-import org.mapsforge.android.mapsold.MapView;
-import org.mapsforge.android.mapsold.MapViewMode;
-import org.mapsforge.android.mapsold.Overlay;
-import org.mapsforge.android.mapsold.Projection;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.drawable.Drawable;
-import android.util.AttributeSet;
-import android.view.GestureDetector;
-import android.view.GestureDetector.SimpleOnGestureListener;
-import android.view.MotionEvent;
-import android.widget.Toast;
-public class MapsforgeMapView024 extends MapView implements MapViewImpl {
- private GestureDetector gestureDetector;
- private OnMapDragListener onDragListener;
- private final MapsforgeMapController mapController = new MapsforgeMapController(getController(), getMaxZoomLevel());
-
- public MapsforgeMapView024(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialize(context);
- }
-
- private void initialize(Context context) {
- if (isInEditMode()) {
- return;
- }
- gestureDetector = new GestureDetector(context, new GestureListener());
- }
-
- @Override
- public void draw(@NonNull Canvas canvas) {
- try {
- // Google Maps and OSM Maps use different zoom levels for the same view.
- // Here we don't want the Google Maps compatible zoom level, but the actual one.
- if (getActualMapZoomLevel() > 22) { // to avoid too close zoom level (mostly on Samsung Galaxy S series)
- getController().setZoom(22);
- }
-
- super.draw(canvas);
- } catch (Exception e) {
- Log.e("MapsforgeMapView024.draw", e);
- }
- }
-
- @Override
- public void displayZoomControls(boolean takeFocus) {
- // nothing to do here
- }
-
- @Override
- public MapControllerImpl getMapController() {
- return mapController;
- }
-
- @Override
- @NonNull
- public GeoPointImpl getMapViewCenter() {
- GeoPoint point = getMapCenter();
- return new MapsforgeGeoPoint(point.getLatitudeE6(), point.getLongitudeE6());
- }
-
- @Override
- public Viewport getViewport() {
- return new Viewport(getMapViewCenter(), getLatitudeSpan() / 1e6, getLongitudeSpan() / 1e6);
- }
-
- @Override
- public void clearOverlays() {
- getOverlays().clear();
- }
-
- @Override
- public MapProjectionImpl getMapProjection() {
- return new MapsforgeMapProjection(getProjection());
- }
-
- @Override
- public CachesOverlay createAddMapOverlay(Context context, Drawable drawable) {
-
- MapsforgeCacheOverlay ovl = new MapsforgeCacheOverlay(context, drawable);
- getOverlays().add(ovl);
- return ovl.getBase();
- }
-
- @Override
- public PositionAndScaleOverlay createAddPositionAndScaleOverlay() {
- MapsforgeOverlay ovl = new MapsforgeOverlay();
- getOverlays().add(ovl);
- return (PositionAndScaleOverlay) ovl.getBase();
- }
-
- @Override
- public int getLatitudeSpan() {
-
- int span = 0;
-
- Projection projection = getProjection();
-
- if (projection != null && getHeight() > 0) {
-
- GeoPoint low = projection.fromPixels(0, 0);
- GeoPoint high = projection.fromPixels(0, getHeight());
-
- if (low != null && high != null) {
- span = Math.abs(high.getLatitudeE6() - low.getLatitudeE6());
- }
- }
-
- return span;
- }
-
- @Override
- public int getLongitudeSpan() {
-
- int span = 0;
-
- Projection projection = getProjection();
-
- if (projection != null && getWidth() > 0) {
- GeoPoint low = projection.fromPixels(0, 0);
- GeoPoint high = projection.fromPixels(getWidth(), 0);
-
- if (low != null && high != null) {
- span = Math.abs(high.getLongitudeE6() - low.getLongitudeE6());
- }
- }
-
- return span;
- }
-
- @Override
- public void preLoad() {
- // Nothing to do here
- }
-
- /**
- * Get the map zoom level which is compatible with Google Maps.
- *
- * @return the current map zoom level +1
- */
- @Override
- public int getMapZoomLevel() {
- // Google Maps and OSM Maps use different zoom levels for the same view.
- // All OSM Maps zoom levels are offset by 1 so they match Google Maps.
- return getZoomLevel() + 1;
- }
-
- /**
- * Get the actual map zoom level
- *
- * @return the current map zoom level with no adjustments
- */
- private int getActualMapZoomLevel() {
- return getZoomLevel();
- }
-
- @Override
- public void setMapSource() {
- setMapViewMode(MapViewMode.CANVAS_RENDERER);
- setMapFile(Settings.getMapFile());
- if (!MapDatabase.isValidMapFile(Settings.getMapFile())) {
- Log.e("MapsforgeMapView024: Invalid map file");
- }
- Toast.makeText(
- getContext(),
- getContext().getResources().getString(R.string.warn_deprecated_mapfile),
- Toast.LENGTH_LONG)
- .show();
- }
-
- @Override
- public void repaintRequired(GeneralOverlay overlay) {
-
- if (null == overlay) {
- invalidate();
- } else {
- try {
- Overlay ovl = (Overlay) overlay.getOverlayImpl();
-
- if (ovl != null) {
- ovl.requestRedraw();
- }
-
- } catch (Exception e) {
- Log.e("MapsforgeMapView024.repaintRequired", e);
- }
- }
- }
-
- @Override
- public void setOnDragListener(OnMapDragListener onDragListener) {
- this.onDragListener = onDragListener;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent ev) {
- gestureDetector.onTouchEvent(ev);
- return super.onTouchEvent(ev);
- }
-
- private class GestureListener extends SimpleOnGestureListener {
- @Override
- public boolean onDoubleTap(MotionEvent e) {
- if (onDragListener != null) {
- onDragListener.onDrag();
- }
- return true;
- }
-
- @Override
- public boolean onScroll(MotionEvent e1, MotionEvent e2,
- float distanceX, float distanceY) {
- if (onDragListener != null) {
- onDragListener.onDrag();
- }
- return super.onScroll(e1, e2, distanceX, distanceY);
- }
- }
-
- @Override
- public boolean needsInvertedColors() {
- return false;
- }
-
- @Override
- public boolean hasMapThemes() {
- // not supported
- return false;
- }
-
- @Override
- public void setMapTheme() {
- // not supported
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOverlay.java
deleted file mode 100644
index bfb3548..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOverlay.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.maps.PositionAndScaleOverlay;
-import cgeo.geocaching.maps.interfaces.GeneralOverlay;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-import cgeo.geocaching.maps.interfaces.OverlayImpl;
-
-import org.mapsforge.android.mapsold.Overlay;
-import org.mapsforge.android.mapsold.Projection;
-
-import android.graphics.Canvas;
-import android.graphics.Point;
-
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class MapsforgeOverlay extends Overlay implements OverlayImpl {
-
- private PositionAndScaleOverlay overlayBase = null;
- private Lock lock = new ReentrantLock();
-
- public MapsforgeOverlay() {
- overlayBase = new PositionAndScaleOverlay(this);
- }
-
- @Override
- protected void drawOverlayBitmap(Canvas canvas, Point drawPosition,
- Projection projection, byte drawZoomLevel) {
-
- if (overlayBase != null) {
- overlayBase.drawOverlayBitmap(canvas, drawPosition, new MapsforgeMapProjection(projection), drawZoomLevel);
- }
- }
-
- public GeneralOverlay getBase() {
- return overlayBase;
- }
-
- @Override
- public void lock() {
- lock.lock();
- }
-
- @Override
- public void unlock() {
- lock.unlock();
- }
-
- @Override
- public MapViewImpl getMapViewImpl() {
- return (MapViewImpl) internalMapView;
- }
-
-}
diff --git a/main/src/cgeo/geocaching/network/AndroidBeam.java b/main/src/cgeo/geocaching/network/AndroidBeam.java
new file mode 100644
index 0000000..68b8f94
--- /dev/null
+++ b/main/src/cgeo/geocaching/network/AndroidBeam.java
@@ -0,0 +1,93 @@
+package cgeo.geocaching.network;
+
+import cgeo.geocaching.CgeoApplication;
+
+import org.apache.commons.io.Charsets;
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.Nullable;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.nfc.NdefMessage;
+import android.nfc.NdefRecord;
+import android.nfc.NfcAdapter;
+import android.nfc.NfcAdapter.CreateNdefMessageCallback;
+import android.nfc.NfcEvent;
+import android.os.Build;
+
+/**
+ * utility class managing all NFC related tasks
+ */
+public class AndroidBeam {
+
+ private AndroidBeam() {
+ // utility class
+ }
+
+ /**
+ * returns the URI transmitted via Android Beam, or the URI contained in the data of the intent
+ */
+ @Nullable
+ public static Uri getUri(final Intent intent) {
+ if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) {
+ final NdefMessage msg = (NdefMessage) intent.getExtras().getParcelableArray(NfcAdapter.EXTRA_NDEF_MESSAGES)[0];
+ return Uri.parse("http://" + new String(msg.getRecords()[0].getPayload(), Charsets.UTF_8));
+ }
+ return intent.getData();
+ }
+
+ // Do not support older devices than Android 4.0
+ // Although there even are 2.3 devices (Nexus S)
+ // these are so few that we don't want to deal with the older (non Android Beam) API
+
+ public interface ActivitySharingInterface {
+ /** Return an URL that represent the current activity for sharing or null for no sharing. */
+ @Nullable
+ public String getAndroidBeamUri();
+ }
+
+ public static void enable(final Activity activity, final ActivitySharingInterface sharingInterface) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ initializeICSAndroidBeam(activity, createMessageCallback(sharingInterface));
+ }
+ }
+
+ public static void disable(final Activity activity) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
+ initializeICSAndroidBeam(activity, null);
+ }
+ }
+
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ private static void initializeICSAndroidBeam(final Activity activity, final CreateNdefMessageCallback messageCallback) {
+ final NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(activity);
+ if (nfcAdapter == null) {
+ return;
+ }
+ nfcAdapter.setNdefPushMessageCallback(messageCallback, activity);
+
+ }
+
+ @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
+ private static CreateNdefMessageCallback createMessageCallback(final ActivitySharingInterface sharingInterface) {
+ return new NfcAdapter.CreateNdefMessageCallback() {
+ @Override
+ public NdefMessage createNdefMessage(final NfcEvent event) {
+ String uri = sharingInterface.getAndroidBeamUri();
+ if (uri == null) {
+ return null;
+ }
+ // normalize our modified URLs for beaming
+ uri = StringUtils.replace(uri, "geocaching.com//", "geocaching.com/");
+ final NdefRecord[] records = {
+ NdefRecord.createUri(uri),
+ NdefRecord.createApplicationRecord(CgeoApplication.getInstance().getPackageName())
+ };
+ return new NdefMessage(records);
+ }
+ };
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/playservices/LocationProvider.java b/main/src/cgeo/geocaching/playservices/LocationProvider.java
index 9d193b5..027ae29 100644
--- a/main/src/cgeo/geocaching/playservices/LocationProvider.java
+++ b/main/src/cgeo/geocaching/playservices/LocationProvider.java
@@ -102,12 +102,12 @@ public class LocationProvider implements GoogleApiClient.ConnectionCallbacks, Go
// no less precise than 20 meters.
final Observable<GeoData> untilPreciseEnoughObservable =
lowPowerObservable.mergeWith(highPowerObservable.delaySubscription(6, TimeUnit.SECONDS))
- .lift(RxUtils.operatorTakeUntil(new Func1<GeoData, Boolean>() {
+ .takeUntil(new Func1<GeoData, Boolean>() {
@Override
public Boolean call(final GeoData geoData) {
return geoData.getAccuracy() <= 20;
}
- }));
+ });
// After sending the last known location, try to get a precise location then use the low-power mode. If no
// location information is given for 25 seconds (if the network location is turned off for example), get
diff --git a/main/src/cgeo/geocaching/sensors/RotationProvider.java b/main/src/cgeo/geocaching/sensors/RotationProvider.java
index 02dbc8c..c63e39f 100644
--- a/main/src/cgeo/geocaching/sensors/RotationProvider.java
+++ b/main/src/cgeo/geocaching/sensors/RotationProvider.java
@@ -43,6 +43,7 @@ public class RotationProvider extends LooperCallbacks<Float> implements SensorEv
return ((SensorManager) context.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR) != null;
}
+ @TargetApi(19)
public static boolean hasGeomagneticRotationSensor(final Context context) {
return ((SensorManager) context.getSystemService(Context.SENSOR_SERVICE)).getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR) != null;
}
diff --git a/main/src/cgeo/geocaching/settings/AbstractAttributeBasedPrefence.java b/main/src/cgeo/geocaching/settings/AbstractAttributeBasedPrefence.java
index 1930c17..4a78037 100644
--- a/main/src/cgeo/geocaching/settings/AbstractAttributeBasedPrefence.java
+++ b/main/src/cgeo/geocaching/settings/AbstractAttributeBasedPrefence.java
@@ -42,7 +42,6 @@ public abstract class AbstractAttributeBasedPrefence extends Preference {
/**
* Evaluate the attributes which where requested in {@link AbstractAttributeBasedPrefence#getAttributeNames()}.
*
- * @param values
*/
protected abstract void processAttributeValues(TypedArray values);
diff --git a/main/src/cgeo/geocaching/settings/AbstractCheckCredentialsPreference.java b/main/src/cgeo/geocaching/settings/AbstractCheckCredentialsPreference.java
index ed09757..6130c4c 100644
--- a/main/src/cgeo/geocaching/settings/AbstractCheckCredentialsPreference.java
+++ b/main/src/cgeo/geocaching/settings/AbstractCheckCredentialsPreference.java
@@ -14,7 +14,6 @@ import rx.Observable;
import rx.android.app.AppObservable;
import rx.functions.Action1;
import rx.functions.Func0;
-import rx.util.async.Async;
import android.app.ProgressDialog;
import android.content.Context;
@@ -74,10 +73,10 @@ public abstract class AbstractCheckCredentialsPreference extends AbstractClickab
loginDialog.setCancelable(false);
Cookies.clearCookies();
- AppObservable.bindActivity(settingsActivity, Async.start(new Func0<ImmutablePair<StatusCode, Observable<Drawable>>>() {
+ AppObservable.bindActivity(settingsActivity, Observable.defer(new Func0<Observable<ImmutablePair<StatusCode, Observable<Drawable>>>>() {
@Override
- public ImmutablePair<StatusCode, Observable<Drawable>> call() {
- return login();
+ public Observable<ImmutablePair<StatusCode, Observable<Drawable>>> call() {
+ return Observable.just(login());
}
})).subscribeOn(RxUtils.networkScheduler).subscribe(new Action1<ImmutablePair<StatusCode, Observable<Drawable>>>() {
@Override
diff --git a/main/src/cgeo/geocaching/settings/InfoPreference.java b/main/src/cgeo/geocaching/settings/InfoPreference.java
index 8040a62..b1c7fed 100644
--- a/main/src/cgeo/geocaching/settings/InfoPreference.java
+++ b/main/src/cgeo/geocaching/settings/InfoPreference.java
@@ -91,8 +91,6 @@ public class InfoPreference extends AbstractAttributeBasedPrefence {
/**
* Add an info icon at the left hand side of the preference.
*
- * @param parent
- * @return
*/
private View addInfoIcon(ViewGroup parent) {
View preferenceView = super.onCreateView(parent);
diff --git a/main/src/cgeo/geocaching/settings/Settings.java b/main/src/cgeo/geocaching/settings/Settings.java
index 0b54fe1..3d47f8b 100644
--- a/main/src/cgeo/geocaching/settings/Settings.java
+++ b/main/src/cgeo/geocaching/settings/Settings.java
@@ -11,8 +11,8 @@ import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.maps.CGeoMap.MapMode;
-import cgeo.geocaching.maps.LiveMapStrategy.Strategy;
import cgeo.geocaching.maps.MapProviderFactory;
+import cgeo.geocaching.maps.LivemapStrategy;
import cgeo.geocaching.maps.google.v1.GoogleMapProvider;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapProvider;
@@ -188,7 +188,7 @@ public class Settings {
e.putInt(getKey(R.string.pref_lastdetailspage), prefsV0.getInt(getKey(R.string.pref_lastdetailspage), 1));
e.putInt(getKey(R.string.pref_defaultNavigationTool), prefsV0.getInt(getKey(R.string.pref_defaultNavigationTool), NavigationAppsEnum.COMPASS.id));
e.putInt(getKey(R.string.pref_defaultNavigationTool2), prefsV0.getInt(getKey(R.string.pref_defaultNavigationTool2), NavigationAppsEnum.INTERNAL_MAP.id));
- e.putInt(getKey(R.string.pref_livemapstrategy), prefsV0.getInt(getKey(R.string.pref_livemapstrategy), Strategy.AUTO.id));
+ e.putInt(getKey(R.string.pref_livemapstrategy), prefsV0.getInt(getKey(R.string.pref_livemapstrategy), LivemapStrategy.AUTO.id));
e.putBoolean(getKey(R.string.pref_debug), prefsV0.getBoolean(getKey(R.string.pref_debug), false));
e.putInt(getKey(R.string.pref_livemaphintshowcount), prefsV0.getInt(getKey(R.string.pref_livemaphintshowcount), 0));
@@ -906,11 +906,11 @@ public class Settings {
String.valueOf(NavigationAppsEnum.INTERNAL_MAP.id)));
}
- public static Strategy getLiveMapStrategy() {
- return Strategy.getById(getInt(R.string.pref_livemapstrategy, Strategy.AUTO.id));
+ public static LivemapStrategy getLiveMapStrategy() {
+ return LivemapStrategy.getById(getInt(R.string.pref_livemapstrategy, LivemapStrategy.AUTO.id));
}
- public static void setLiveMapStrategy(final Strategy strategy) {
+ public static void setLiveMapStrategy(final LivemapStrategy strategy) {
putInt(R.string.pref_livemapstrategy, strategy.id);
}
diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java
index 99de30f..6e3ba0e 100644
--- a/main/src/cgeo/geocaching/settings/SettingsActivity.java
+++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java
@@ -12,6 +12,7 @@ import cgeo.geocaching.connector.gc.GCConnector;
import cgeo.geocaching.files.SimpleDirChooser;
import cgeo.geocaching.maps.MapProviderFactory;
import cgeo.geocaching.maps.interfaces.MapSource;
+import cgeo.geocaching.network.AndroidBeam;
import cgeo.geocaching.sensors.Sensors;
import cgeo.geocaching.utils.DatabaseBackupUtils;
import cgeo.geocaching.utils.DebugUtils;
@@ -100,6 +101,7 @@ public class SettingsActivity extends PreferenceActivity {
final Intent intent = getIntent();
openInitialScreen(intent.getIntExtra(INTENT_OPEN_SCREEN, 0));
+ AndroidBeam.disable(this);
}
private void openInitialScreen(final int initialScreen) {
@@ -327,13 +329,14 @@ public class SettingsActivity extends PreferenceActivity {
backup.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(final Preference preference) {
- return DatabaseBackupUtils.createBackup(SettingsActivity.this, new Runnable() {
+ DatabaseBackupUtils.createBackup(SettingsActivity.this, new Runnable() {
@Override
public void run() {
VALUE_CHANGE_LISTENER.onPreferenceChange(SettingsActivity.this.getPreference(R.string.pref_fakekey_preference_backup_info), "");
}
});
+ return true;
}
});
diff --git a/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java b/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
index a0c5a9f..d7c46e1 100644
--- a/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
+++ b/main/src/cgeo/geocaching/sorting/AbstractCacheComparator.java
@@ -35,9 +35,11 @@ abstract class AbstractCacheComparator implements CacheComparator {
* Check necessary preconditions (like missing fields) before running the comparison itself.
* Caches not filling the conditions will be placed last, sorted by Geocode.
*
- * The default returns <code>true</code> and can be overridden if needed in child classes.
- *
+ * The default implementation returns <code>true</code> and can be overridden if needed in sub classes.
+ *
* @param cache
+ * the cache to be sorted
+ *
* @return <code>true</code> if the cache holds the necessary data to be compared meaningfully
*/
@SuppressWarnings("static-method")
@@ -51,8 +53,6 @@ abstract class AbstractCacheComparator implements CacheComparator {
* A cache is smaller than another cache if it is desirable to show it first when presented to the user.
* For example, a highly rated cache must be considered smaller than a poorly rated one.
*
- * @param cache1
- * @param cache2
* @return an integer < 0 if cache1 is less than cache2, 0 if they are equal, and > 0 if cache1 is greater than
* cache2.
*/
diff --git a/main/src/cgeo/geocaching/sorting/DateComparator.java b/main/src/cgeo/geocaching/sorting/DateComparator.java
index af50213..347eb44 100644
--- a/main/src/cgeo/geocaching/sorting/DateComparator.java
+++ b/main/src/cgeo/geocaching/sorting/DateComparator.java
@@ -17,13 +17,8 @@ class DateComparator extends AbstractCacheComparator {
final Date date2 = cache2.getHiddenDate();
if (date1 != null && date2 != null) {
final int dateDifference = date1.compareTo(date2);
- // for equal dates, sort by distance
if (dateDifference == 0) {
- final ArrayList<Geocache> list = new ArrayList<>();
- list.add(cache1);
- list.add(cache2);
- final DistanceComparator distanceComparator = new DistanceComparator(Sensors.getInstance().currentGeo().getCoords(), list);
- return distanceComparator.compare(cache1, cache2);
+ return sortSameDate(cache1, cache2);
}
return dateDifference;
}
@@ -35,4 +30,13 @@ class DateComparator extends AbstractCacheComparator {
}
return 0;
}
+
+ @SuppressWarnings("static-method")
+ protected int sortSameDate(final Geocache cache1, final Geocache cache2) {
+ final ArrayList<Geocache> list = new ArrayList<>();
+ list.add(cache1);
+ list.add(cache2);
+ final DistanceComparator distanceComparator = new DistanceComparator(Sensors.getInstance().currentGeo().getCoords(), list);
+ return distanceComparator.compare(cache1, cache2);
+ }
}
diff --git a/main/src/cgeo/geocaching/sorting/EventDateComparator.java b/main/src/cgeo/geocaching/sorting/EventDateComparator.java
index 197946a..efeeb5d 100644
--- a/main/src/cgeo/geocaching/sorting/EventDateComparator.java
+++ b/main/src/cgeo/geocaching/sorting/EventDateComparator.java
@@ -1,5 +1,7 @@
package cgeo.geocaching.sorting;
+import cgeo.geocaching.Geocache;
+
/**
* Compares caches by date. Used only for event caches.
*/
@@ -7,4 +9,16 @@ public class EventDateComparator extends DateComparator {
final static public EventDateComparator singleton = new EventDateComparator();
+ @Override
+ protected int sortSameDate(final Geocache left, final Geocache right) {
+ return compare(left.guessEventTimeMinutes(), right.guessEventTimeMinutes());
+ }
+
+ /**
+ * copy of {@link Integer#compare(int, int)}, as that is not available on lower API levels
+ *
+ */
+ private static int compare(final int left, final int right) {
+ return left < right ? -1 : (left == right ? 0 : 1);
+ }
}
diff --git a/main/src/cgeo/geocaching/sorting/NameComparator.java b/main/src/cgeo/geocaching/sorting/NameComparator.java
index 376c8b9..ab7bbcb 100644
--- a/main/src/cgeo/geocaching/sorting/NameComparator.java
+++ b/main/src/cgeo/geocaching/sorting/NameComparator.java
@@ -1,15 +1,20 @@
package cgeo.geocaching.sorting;
import cgeo.geocaching.Geocache;
+import cgeo.geocaching.utils.TextUtils;
import org.apache.commons.lang3.StringUtils;
+import java.text.Collator;
+
/**
* sorts caches by name
*
*/
class NameComparator extends AbstractCacheComparator {
+ private final Collator collator = TextUtils.getCollator();
+
@Override
protected boolean canCompare(final Geocache cache) {
return StringUtils.isNotBlank(cache.getName());
@@ -17,6 +22,6 @@ class NameComparator extends AbstractCacheComparator {
@Override
protected int compareCaches(final Geocache cache1, final Geocache cache2) {
- return cache1.getNameForSorting().compareToIgnoreCase(cache2.getNameForSorting());
+ return collator.compare(cache1.getNameForSorting(), cache2.getNameForSorting());
}
}
diff --git a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java
index 306c686..60e8b2d 100644
--- a/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/AbstractCachingPageViewCreator.java
@@ -14,7 +14,6 @@ import android.view.ViewGroup;
/**
* View creator which destroys the created view on every {@link #notifyDataSetChanged()}.
*
- * @param <ViewClass>
*/
public abstract class AbstractCachingPageViewCreator<ViewClass extends View> implements PageViewCreator {
diff --git a/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java b/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java
new file mode 100644
index 0000000..075bfe6
--- /dev/null
+++ b/main/src/cgeo/geocaching/ui/AbstractImageAdapter.java
@@ -0,0 +1,66 @@
+package cgeo.geocaching.ui;
+
+import cgeo.geocaching.R;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.GridView;
+import android.widget.ImageView;
+
+import java.util.List;
+
+public abstract class AbstractImageAdapter extends BaseAdapter {
+ private final Context context;
+ // references to our images
+ private final List<Integer> imageIds;
+ private final int imageWidth;
+
+ public AbstractImageAdapter(final Context context, final GridView gridView, final List<Integer> imageIds) {
+ this.context = context;
+ this.imageIds = imageIds;
+
+ final Drawable drawable = context.getResources().getDrawable(imageIds.get(0));
+ imageWidth = drawable.getIntrinsicWidth();
+
+ // fix the column width, now that we know the images
+ gridView.setColumnWidth(getImageWidth());
+ }
+
+ @Override
+ public int getCount() {
+ return imageIds.size();
+ }
+
+ @Override
+ public Object getItem(final int position) {
+ return null;
+ }
+
+ @Override
+ public long getItemId(final int position) {
+ return 0;
+ }
+
+ // 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;
+ if (convertView == null) { // if it's not recycled, initialize some attributes
+ imageView = (ImageView) LayoutInflater.from(context).inflate(R.layout.grid_image, null);
+ } else {
+ imageView = (ImageView) convertView;
+ }
+
+ imageView.setImageResource(imageIds.get(position));
+ return imageView;
+ }
+
+ int getImageWidth() {
+ return imageWidth;
+ }
+
+} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/ui/AbstractMenuActionProvider.java b/main/src/cgeo/geocaching/ui/AbstractMenuActionProvider.java
new file mode 100644
index 0000000..fbea675
--- /dev/null
+++ b/main/src/cgeo/geocaching/ui/AbstractMenuActionProvider.java
@@ -0,0 +1,24 @@
+package cgeo.geocaching.ui;
+
+import android.content.Context;
+import android.support.v4.view.ActionProvider;
+import android.view.View;
+
+public abstract class AbstractMenuActionProvider extends ActionProvider {
+
+ public AbstractMenuActionProvider(final Context context) {
+ super(context);
+ }
+
+ @Override
+ public boolean hasSubMenu() {
+ return true;
+ }
+
+ @Override
+ public View onCreateActionView() {
+ // must return null, otherwise the menu will not work
+ return null;
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
index ebbe23f..d9daa1d 100644
--- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
@@ -18,7 +18,7 @@ import cgeo.geocaching.sorting.EventDateComparator;
import cgeo.geocaching.sorting.InverseComparator;
import cgeo.geocaching.sorting.VisitComparator;
import cgeo.geocaching.utils.AngleUtils;
-import cgeo.geocaching.utils.DateUtils;
+import cgeo.geocaching.utils.CalendarUtils;
import cgeo.geocaching.utils.Formatter;
import cgeo.geocaching.utils.Log;
@@ -112,7 +112,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
@InjectView(R.id.distance) protected DistanceView distance;
@InjectView(R.id.favorite) protected TextView favorite;
@InjectView(R.id.info) protected TextView info;
- @InjectView(R.id.inventory) protected ImageView inventory;
+ @InjectView(R.id.inventory) protected TextView inventory;
@InjectView(R.id.direction) protected CompassMiniView direction;
@InjectView(R.id.dirimg) protected ImageView dirImg;
public Geocache cache = null;
@@ -160,7 +160,6 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
/**
* change the sort order
*
- * @param comparator
*/
public void setComparator(final CacheComparator comparator) {
cacheComparator = comparator;
@@ -415,7 +414,7 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
}
Spannable spannable = null;
- if (cache.isDisabled() || cache.isArchived() || DateUtils.isPastEvent(cache)) { // strike
+ if (cache.isDisabled() || cache.isArchived() || CalendarUtils.isPastEvent(cache)) { // strike
spannable = Spannable.Factory.getInstance().newSpannable(cache.getName());
spannable.setSpan(new StrikethroughSpan(), 0, spannable.toString().length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
@@ -434,7 +433,9 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
}
holder.text.setCompoundDrawablesWithIntrinsicBounds(getCacheIcon(cache), null, null, null);
- if (cache.getInventoryItems() > 0) {
+ final int inventorySize = cache.getInventoryItems();
+ if (inventorySize > 0) {
+ holder.inventory.setText(Integer.toString(inventorySize));
holder.inventory.setVisibility(View.VISIBLE);
} else {
holder.inventory.setVisibility(View.GONE);
diff --git a/main/src/cgeo/geocaching/ui/CompassMiniView.java b/main/src/cgeo/geocaching/ui/CompassMiniView.java
index a811fa0..d50d806 100644
--- a/main/src/cgeo/geocaching/ui/CompassMiniView.java
+++ b/main/src/cgeo/geocaching/ui/CompassMiniView.java
@@ -50,18 +50,19 @@ final public class CompassMiniView extends View {
private static final float MINIMUM_ROTATION_DEGREES_FOR_REPAINT = 5;
private float azimuthRelative;
- public CompassMiniView(Context context) {
+ public CompassMiniView(final Context context) {
super(context);
}
- public CompassMiniView(Context context, AttributeSet attrs) {
+ public CompassMiniView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
@Override
public void onAttachedToWindow() {
if (instances++ == 0) {
- compassArrow = BitmapFactory.decodeResource(getResources(), Settings.isLightSkin() ? R.drawable.compass_arrow_mini_black : R.drawable.compass_arrow_mini_white);
+ final int drawable = isInEditMode() || !Settings.isLightSkin() ? R.drawable.compass_arrow_mini_white : R.drawable.compass_arrow_mini_black;
+ compassArrow = BitmapFactory.decodeResource(getResources(), drawable);
compassArrowWidth = compassArrow.getWidth();
compassArrowHeight = compassArrow.getWidth();
}
@@ -79,12 +80,12 @@ final public class CompassMiniView extends View {
targetCoords = point;
}
- public void updateAzimuth(float azimuth) {
+ public void updateAzimuth(final float azimuth) {
this.azimuth = azimuth;
updateDirection();
}
- public void updateHeading(float heading) {
+ public void updateHeading(final float heading) {
this.heading = heading;
updateDirection();
}
@@ -106,7 +107,7 @@ final public class CompassMiniView extends View {
azimuthRelative = AngleUtils.normalize(azimuth - heading);
// avoid updates on very small changes, which are not visible to the user
- float change = Math.abs(azimuthRelative - lastDrawnAzimuth);
+ final float change = Math.abs(azimuthRelative - lastDrawnAzimuth);
if (change < MINIMUM_ROTATION_DEGREES_FOR_REPAINT) {
return;
}
@@ -119,7 +120,7 @@ final public class CompassMiniView extends View {
}
@Override
- protected void onDraw(Canvas canvas) {
+ protected void onDraw(final Canvas canvas) {
super.onDraw(canvas);
lastDrawnAzimuth = azimuthRelative;
@@ -137,11 +138,11 @@ final public class CompassMiniView extends View {
}
@Override
- protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
setMeasuredDimension(measureWidth(widthMeasureSpec), measureHeight(heightMeasureSpec));
}
- private int measureWidth(int measureSpec) {
+ private int measureWidth(final int measureSpec) {
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
@@ -158,7 +159,7 @@ final public class CompassMiniView extends View {
return result;
}
- private int measureHeight(int measureSpec) {
+ private int measureHeight(final int measureSpec) {
final int specMode = MeasureSpec.getMode(measureSpec);
final int specSize = MeasureSpec.getSize(measureSpec);
diff --git a/main/src/cgeo/geocaching/ui/NavigationActionProvider.java b/main/src/cgeo/geocaching/ui/NavigationActionProvider.java
index 5840e27..ed4455d 100644
--- a/main/src/cgeo/geocaching/ui/NavigationActionProvider.java
+++ b/main/src/cgeo/geocaching/ui/NavigationActionProvider.java
@@ -9,6 +9,10 @@ import android.support.v4.view.ActionProvider;
import android.view.LayoutInflater;
import android.view.View;
+/**
+ * Action provider showing the compass icon, and reacting to normal click (primary navigation) and long click (secondary
+ * navigation).
+ */
public class NavigationActionProvider extends ActionProvider {
private final Context context;
diff --git a/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java b/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java
index d51e697..aa75db7 100644
--- a/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java
+++ b/main/src/cgeo/geocaching/ui/WeakReferenceHandler.java
@@ -11,7 +11,6 @@ import java.lang.ref.WeakReference;
*
* Create static private subclasses of this handler class in your activity.
*
- * @param <ActivityType>
*/
public abstract class WeakReferenceHandler<ActivityType extends Activity> extends Handler {
diff --git a/main/src/cgeo/geocaching/ui/dialog/Dialogs.java b/main/src/cgeo/geocaching/ui/dialog/Dialogs.java
index 47ce6e1..3729677 100644
--- a/main/src/cgeo/geocaching/ui/dialog/Dialogs.java
+++ b/main/src/cgeo/geocaching/ui/dialog/Dialogs.java
@@ -408,7 +408,6 @@ public final class Dialogs {
/**
* Move the cursor to the end of the input field.
*
- * @param input
*/
public static void moveCursorToEnd(final EditText input) {
input.setSelection(input.getText().length(), input.getText().length());
diff --git a/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java
index 7e49c97..076c412 100644
--- a/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/logs/CacheLogsViewCreator.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.ui.logs;
import cgeo.geocaching.CacheDetailActivity;
import cgeo.geocaching.CgeoApplication;
+import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.R;
@@ -24,28 +25,33 @@ import java.util.Map.Entry;
public class CacheLogsViewCreator extends LogsViewCreator {
private final boolean allLogs;
private final Resources res = CgeoApplication.getInstance().getResources();
+ private final CacheDetailActivity cacheDetailActivity;
- public CacheLogsViewCreator(CacheDetailActivity cacheDetailActivity, boolean allLogs) {
+ public CacheLogsViewCreator(final CacheDetailActivity cacheDetailActivity, final boolean allLogs) {
super(cacheDetailActivity);
+ this.cacheDetailActivity = cacheDetailActivity;
this.allLogs = allLogs;
}
- /**
- * May return null!
- *
- * @return
- */
private Geocache getCache() {
- if (this.activity instanceof CacheDetailActivity) {
- CacheDetailActivity details = (CacheDetailActivity) this.activity;
- return details.getCache();
- }
- return null;
+ return cacheDetailActivity.getCache();
}
@Override
protected List<LogEntry> getLogs() {
- return allLogs ? getCache().getLogs() : getCache().getFriendsLogs();
+ final Geocache cache = getCache();
+ final List<LogEntry> logs = allLogs ? cache.getLogs() : cache.getFriendsLogs();
+ return addOwnOfflineLog(cache, logs);
+ }
+
+ private List<LogEntry> addOwnOfflineLog(final Geocache cache, final List<LogEntry> logsIn) {
+ final LogEntry log = DataStore.loadLogOffline(cache.getGeocode());
+ final ArrayList<LogEntry> logs = new ArrayList<>(logsIn);
+ if (log != null) {
+ log.author = res.getString(R.string.log_your_saved_log);
+ logs.add(0, log);
+ }
+ return logs;
}
@Override
@@ -56,7 +62,7 @@ public class CacheLogsViewCreator extends LogsViewCreator {
final List<Entry<LogType, Integer>> sortedLogCounts = new ArrayList<>(logCounts.size());
for (final Entry<LogType, Integer> entry : logCounts.entrySet()) {
// it may happen that the label is unknown -> then avoid any output for this type
- if (entry.getKey() != LogType.PUBLISH_LISTING && entry.getKey().getL10n() != null && entry.getValue() != 0) {
+ if (entry.getKey() != LogType.PUBLISH_LISTING && entry.getValue() != 0) {
sortedLogCounts.add(entry);
}
}
@@ -66,7 +72,7 @@ public class CacheLogsViewCreator extends LogsViewCreator {
Collections.sort(sortedLogCounts, new Comparator<Entry<LogType, Integer>>() {
@Override
- public int compare(Entry<LogType, Integer> logCountItem1, Entry<LogType, Integer> logCountItem2) {
+ public int compare(final Entry<LogType, Integer> logCountItem1, final Entry<LogType, Integer> logCountItem2) {
return logCountItem1.getKey().compareTo(logCountItem2.getKey());
}
});
@@ -84,7 +90,7 @@ public class CacheLogsViewCreator extends LogsViewCreator {
}
@Override
- protected void fillCountOrLocation(LogViewHolder holder, final LogEntry log) {
+ protected void fillCountOrLocation(final LogViewHolder holder, final LogEntry log) {
// finds count
if (log.found == -1) {
holder.countOrLocation.setVisibility(View.GONE);
@@ -95,6 +101,21 @@ public class CacheLogsViewCreator extends LogsViewCreator {
}
@Override
+ protected void fillViewHolder(final View convertView, final LogViewHolder holder, final LogEntry log) {
+ super.fillViewHolder(convertView, holder, log);
+ if (isOfflineLog(log)) {
+ holder.author.setOnClickListener(new EditOfflineLogListener(getCache(), cacheDetailActivity));
+ holder.text.setOnClickListener(new EditOfflineLogListener(getCache(), cacheDetailActivity));
+ holder.marker.setVisibility(View.VISIBLE);
+ holder.marker.setImageResource(R.drawable.mark_orange);
+ }
+ }
+
+ private boolean isOfflineLog(final LogEntry log) {
+ return log.author.equals(activity.getString(R.string.log_your_saved_log));
+ }
+
+ @Override
protected boolean isValid() {
return getCache() != null;
}
diff --git a/main/src/cgeo/geocaching/ui/logs/EditOfflineLogListener.java b/main/src/cgeo/geocaching/ui/logs/EditOfflineLogListener.java
new file mode 100644
index 0000000..2e0f154
--- /dev/null
+++ b/main/src/cgeo/geocaching/ui/logs/EditOfflineLogListener.java
@@ -0,0 +1,25 @@
+package cgeo.geocaching.ui.logs;
+
+import cgeo.geocaching.CacheDetailActivity;
+import cgeo.geocaching.Geocache;
+
+import android.view.View;
+import android.view.View.OnClickListener;
+
+class EditOfflineLogListener implements OnClickListener {
+
+ private final Geocache cache;
+ private final CacheDetailActivity activity;
+
+ public EditOfflineLogListener(final Geocache cache, final CacheDetailActivity activity) {
+ this.cache = cache;
+ this.activity = activity;
+ }
+
+ @Override
+ public void onClick(final View v) {
+ activity.setNeedsRefresh();
+ cache.logVisit(activity);
+ }
+
+}
diff --git a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
index 3aaeec1..a6fd5aa 100644
--- a/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/logs/LogsViewCreator.java
@@ -68,7 +68,7 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre
return view;
}
- protected void fillViewHolder(final View convertView, final LogViewHolder holder, final LogEntry log) {
+ protected void fillViewHolder(@SuppressWarnings("unused") final View convertView, final LogViewHolder holder, final LogEntry log) {
if (log.date > 0) {
holder.date.setText(Formatter.formatShortDateVerbally(log.date));
holder.date.setVisibility(View.VISIBLE);
@@ -116,12 +116,10 @@ public abstract class LogsViewCreator extends AbstractCachingListViewPageViewCre
holder.marker.setVisibility(View.GONE);
}
- if (null == convertView) {
- holder.author.setOnClickListener(createUserActionsListener());
- holder.text.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance());
- holder.text.setOnClickListener(new DecryptTextClickListener(holder.text));
- activity.registerForContextMenu(holder.text);
- }
+ holder.author.setOnClickListener(createUserActionsListener());
+ holder.text.setMovementMethod(AnchorAwareLinkMovementMethod.getInstance());
+ holder.text.setOnClickListener(new DecryptTextClickListener(holder.text));
+ activity.registerForContextMenu(holder.text);
}
abstract protected UserActionsClickListener createUserActionsListener();
diff --git a/main/src/cgeo/geocaching/ui/logs/TrackableLogsViewCreator.java b/main/src/cgeo/geocaching/ui/logs/TrackableLogsViewCreator.java
index 24c8871..c120286 100644
--- a/main/src/cgeo/geocaching/ui/logs/TrackableLogsViewCreator.java
+++ b/main/src/cgeo/geocaching/ui/logs/TrackableLogsViewCreator.java
@@ -19,7 +19,6 @@ public class TrackableLogsViewCreator extends LogsViewCreator {
private final TrackableActivity trackableActivity;
/**
- * @param trackableActivity
*/
public TrackableLogsViewCreator(final TrackableActivity trackableActivity) {
super(trackableActivity);
diff --git a/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java b/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java
index 3d2b2b1..c2edd24 100644
--- a/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java
+++ b/main/src/cgeo/geocaching/utils/AsyncTaskWithProgress.java
@@ -14,8 +14,6 @@ import android.os.AsyncTask;
* automatically derived from the number of {@code Params} given to the task in {@link #execute(Object...)}.
* </p>
*
- * @param <Params>
- * @param <Result>
*/
public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Params, Integer, Result> {
@@ -28,9 +26,6 @@ public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Pa
/**
* Creates an AsyncTask with progress dialog.
*
- * @param activity
- * @param progressTitle
- * @param progressMessage
*/
public AsyncTaskWithProgress(final Activity activity, final String progressTitle, final String progressMessage) {
this(activity, progressTitle, progressMessage, false);
@@ -39,8 +34,6 @@ public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Pa
/**
* Creates an AsyncTask with progress dialog.
*
- * @param activity
- * @param progressTitle
*/
public AsyncTaskWithProgress(final Activity activity, final String progressTitle) {
this(activity, progressTitle, null);
@@ -49,9 +42,6 @@ public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Pa
/**
* Creates an AsyncTask with progress dialog.
*
- * @param activity
- * @param progressTitle
- * @param progressMessage
*/
public AsyncTaskWithProgress(final Activity activity, final String progressTitle, final String progressMessage, final boolean indeterminate) {
this.activity = activity;
@@ -63,8 +53,6 @@ public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Pa
/**
* Creates an AsyncTask with progress dialog.
*
- * @param activity
- * @param progressTitle
*/
public AsyncTaskWithProgress(final Activity activity, final String progressTitle, final boolean indeterminate) {
this(activity, progressTitle, null, indeterminate);
@@ -102,6 +90,8 @@ public abstract class AsyncTaskWithProgress<Params, Result> extends AsyncTask<Pa
* This method should typically be overridden by sub classes instead of {@link #onPostExecute(Object)}.
*
* @param result
+ * The result of the operation computed by {@link #doInBackground(Object...)}.
+ *
*/
protected void onPostExecuteInternal(final Result result) {
// empty by default
diff --git a/main/src/cgeo/geocaching/utils/DateUtils.java b/main/src/cgeo/geocaching/utils/CalendarUtils.java
index 9aa4222..ed3b18c 100644
--- a/main/src/cgeo/geocaching/utils/DateUtils.java
+++ b/main/src/cgeo/geocaching/utils/CalendarUtils.java
@@ -5,13 +5,13 @@ import cgeo.geocaching.Geocache;
import java.util.Calendar;
import java.util.Date;
-public final class DateUtils {
+public final class CalendarUtils {
- private DateUtils() {
+ private CalendarUtils() {
// utility class
}
- public static int daysSince(long date) {
+ public static int daysSince(final long date) {
final Calendar logDate = Calendar.getInstance();
logDate.setTimeInMillis(date);
logDate.set(Calendar.SECOND, 0);
@@ -24,12 +24,27 @@ public final class DateUtils {
return (int) Math.round((today.getTimeInMillis() - logDate.getTimeInMillis()) / 86400000d);
}
+ public static int daysSince(final Calendar date) {
+ return daysSince(date.getTimeInMillis());
+ }
+
public static boolean isPastEvent(final Geocache cache) {
if (!cache.isEventCache()) {
return false;
}
final Date hiddenDate = cache.getHiddenDate();
- return hiddenDate != null && DateUtils.daysSince(hiddenDate.getTime()) > 0;
+ return hiddenDate != null && CalendarUtils.daysSince(hiddenDate.getTime()) > 0;
+ }
+
+ /**
+ * Return whether the given date is *more* than 1 day away. We allow 1 day to be "present time" to compensate for
+ * potential timezone issues.
+ *
+ * @param date
+ * the date
+ */
+ public static boolean isFuture(final Calendar date) {
+ return daysSince(date) < -1;
}
}
diff --git a/main/src/cgeo/geocaching/utils/CheckerUtils.java b/main/src/cgeo/geocaching/utils/CheckerUtils.java
new file mode 100644
index 0000000..39ef078
--- /dev/null
+++ b/main/src/cgeo/geocaching/utils/CheckerUtils.java
@@ -0,0 +1,35 @@
+package cgeo.geocaching.utils;
+
+import cgeo.geocaching.Geocache;
+
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+
+import android.util.Patterns;
+
+import java.util.regex.Matcher;
+
+public final class CheckerUtils {
+ private static final String[] CHECKERS = new String[] { "geocheck.org", "geochecker.com", "certitudes.org" };
+
+ private CheckerUtils() {
+ // utility class
+ }
+
+ @Nullable
+ public static String getCheckerUrl(@NonNull final Geocache cache) {
+ final String description = cache.getDescription();
+ final Matcher matcher = Patterns.WEB_URL.matcher(description);
+ while (matcher.find()) {
+ final String url = matcher.group();
+ for (final String checker : CHECKERS) {
+ if (StringUtils.containsIgnoreCase(url, checker)) {
+ return StringEscapeUtils.unescapeHtml4(url);
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java b/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java
index ab27264..a65a9fb 100644
--- a/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java
+++ b/main/src/cgeo/geocaching/utils/DatabaseBackupUtils.java
@@ -6,6 +6,8 @@ import cgeo.geocaching.R;
import cgeo.geocaching.ui.dialog.Dialogs;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
import rx.functions.Action0;
import rx.functions.Action1;
@@ -14,6 +16,8 @@ import rx.schedulers.Schedulers;
import android.app.Activity;
import android.app.ProgressDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.content.res.Resources;
import java.io.File;
@@ -26,7 +30,8 @@ public class DatabaseBackupUtils {
}
/**
- * restore the database in a new thread, showing a progress window
+ * After confirming to overwrite the existing caches on the devices, restore the database in a new thread, showing a
+ * progress window
*
* @param activity
* calling activity
@@ -35,6 +40,23 @@ public class DatabaseBackupUtils {
if (!hasBackup()) {
return;
}
+ final int caches = DataStore.getAllCachesCount();
+ if (caches == 0) {
+ restoreDatabaseInternal(activity);
+ }
+ else {
+ Dialogs.confirm(activity, R.string.init_backup_restore, activity.getString(R.string.restore_confirm_overwrite, activity.getResources().getQuantityString(R.plurals.cache_counts, caches, caches)), new OnClickListener() {
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ restoreDatabaseInternal(activity);
+ }
+ });
+
+ }
+ }
+
+ private static void restoreDatabaseInternal(final Activity activity) {
final Resources res = activity.getResources();
final ProgressDialog dialog = ProgressDialog.show(activity, res.getString(R.string.init_backup_restore), res.getString(R.string.init_restore_running), true, false);
final AtomicBoolean restoreSuccessful = new AtomicBoolean(false);
@@ -57,14 +79,32 @@ public class DatabaseBackupUtils {
});
}
- public static boolean createBackup(final Activity activity, final Runnable runAfterwards) {
+ /**
+ * Create a backup after confirming to overwrite the existing backup.
+ *
+ */
+ public static void createBackup(final Activity activity, final Runnable runAfterwards) {
// avoid overwriting an existing backup with an empty database
// (can happen directly after reinstalling the app)
if (DataStore.getAllCachesCount() == 0) {
Dialogs.message(activity, R.string.init_backup, R.string.init_backup_unnecessary);
- return false;
+ return;
+ }
+ if (hasBackup()) {
+ Dialogs.confirm(activity, R.string.init_backup, activity.getString(R.string.backup_confirm_overwrite, getBackupDateTime()), new OnClickListener() {
+
+ @Override
+ public void onClick(final DialogInterface dialog, final int which) {
+ createBackupInternal(activity, runAfterwards);
+ }
+ });
}
+ else {
+ createBackupInternal(activity, runAfterwards);
+ }
+ }
+ private static void createBackupInternal(final Activity activity, final Runnable runAfterwards) {
final ProgressDialog dialog = ProgressDialog.show(activity,
activity.getString(R.string.init_backup),
activity.getString(R.string.init_backup_running), true, false);
@@ -88,9 +128,9 @@ public class DatabaseBackupUtils {
}
}
});
- return true;
}
+ @Nullable
public static File getRestoreFile() {
final File fileSourceFile = DataStore.getBackupFileInternal();
return fileSourceFile.exists() && fileSourceFile.length() > 0 ? fileSourceFile : null;
@@ -100,6 +140,7 @@ public class DatabaseBackupUtils {
return getRestoreFile() != null;
}
+ @NonNull
public static String getBackupDateTime() {
final File restoreFile = getRestoreFile();
if (restoreFile == null) {
diff --git a/main/src/cgeo/geocaching/utils/DebugUtils.java b/main/src/cgeo/geocaching/utils/DebugUtils.java
index 07aac64..1f95e7c 100644
--- a/main/src/cgeo/geocaching/utils/DebugUtils.java
+++ b/main/src/cgeo/geocaching/utils/DebugUtils.java
@@ -22,15 +22,14 @@ public class DebugUtils {
public static void createMemoryDump(final @NonNull Context context) {
try {
- final Date now = new Date();
final SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyy-MM-dd_hh-mm", Locale.US);
- File file = FileUtils.getUniqueNamedFile(Environment.getExternalStorageDirectory().getPath()
- + File.separatorChar + "cgeo_dump_" + fileNameDateFormat.format(now) + ".hprof");
+ final File file = FileUtils.getUniqueNamedFile(new File(Environment.getExternalStorageDirectory(),
+ "cgeo_dump_" + fileNameDateFormat.format(new Date()) + ".hprof"));
android.os.Debug.dumpHprofData(file.getPath());
Toast.makeText(context, context.getString(R.string.init_memory_dumped, file.getAbsolutePath()),
Toast.LENGTH_LONG).show();
ShareUtils.share(context, file, R.string.init_memory_dump);
- } catch (IOException e) {
+ } catch (final IOException e) {
Log.e("createMemoryDump", e);
}
}
diff --git a/main/src/cgeo/geocaching/utils/FileUtils.java b/main/src/cgeo/geocaching/utils/FileUtils.java
index c123469..778b9c7 100644
--- a/main/src/cgeo/geocaching/utils/FileUtils.java
+++ b/main/src/cgeo/geocaching/utils/FileUtils.java
@@ -4,6 +4,7 @@ import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.CharEncoding;
import org.apache.commons.lang3.StringUtils;
+import org.eclipse.jdt.annotation.NonNull;
import android.os.Handler;
import android.os.Message;
@@ -75,6 +76,24 @@ public final class FileUtils {
}
}
+ public static boolean deleteDirectory(@NonNull final File dir) {
+ final File[] files = dir.listFiles();
+
+ // Although we are called on an existing directory, it might have been removed concurrently
+ // in the meantime, for example by the user or by another cleanup task.
+ if (files != null) {
+ for (final File file : files) {
+ if (file.isDirectory()) {
+ deleteDirectory(file);
+ } else {
+ delete(file);
+ }
+ }
+ }
+
+ return delete(dir);
+ }
+
public static abstract class FileSelector {
public abstract boolean isSelected(File file);
@@ -92,18 +111,20 @@ public final class FileUtils {
* </ul>
* which does not yet exist.
*/
- public static File getUniqueNamedFile(final String baseNameAndPath) {
- final String extension = StringUtils.substringAfterLast(baseNameAndPath, ".");
- final String pathName = StringUtils.substringBeforeLast(baseNameAndPath, ".");
- int number = 1;
- while (new File(getNumberedFileName(pathName, extension, number)).exists()) {
- number++;
+ public static File getUniqueNamedFile(final File file) {
+ if (!file.exists()) {
+ return file;
}
- return new File(getNumberedFileName(pathName, extension, number));
- }
-
- private static String getNumberedFileName(final String pathName, final String extension, final int number) {
- return pathName + (number > 1 ? "_" + Integer.toString(number) : "") + "." + extension;
+ final String baseNameAndPath = file.getPath();
+ final String prefix = StringUtils.substringBeforeLast(baseNameAndPath, ".") + "_";
+ final String extension = "." + StringUtils.substringAfterLast(baseNameAndPath, ".");
+ for (int i = 1; i < Integer.MAX_VALUE; i++) {
+ final File numbered = new File(prefix + i + extension);
+ if (!numbered.exists()) {
+ return numbered;
+ }
+ }
+ throw new IllegalStateException("Unable to generate a non-existing file name");
}
/**
diff --git a/main/src/cgeo/geocaching/utils/Formatter.java b/main/src/cgeo/geocaching/utils/Formatter.java
index c764c5a..2127d59 100644
--- a/main/src/cgeo/geocaching/utils/Formatter.java
+++ b/main/src/cgeo/geocaching/utils/Formatter.java
@@ -17,6 +17,7 @@ import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Locale;
public abstract class Formatter {
@@ -76,6 +77,10 @@ public abstract class Formatter {
return dateFormat.format(date);
}
+ private static String formatShortDateIncludingWeekday(final long time) {
+ return DateUtils.formatDateTime(CgeoApplication.getInstance().getBaseContext(), time, DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_ABBREV_WEEKDAY) + ", " + formatShortDate(time);
+ }
+
/**
* Generate a numeric date string according to system-wide settings (locale, date format)
* such as "10/20/2010". Today and yesterday will be presented as strings "today" and "yesterday".
@@ -85,7 +90,7 @@ public abstract class Formatter {
* @return the formatted string
*/
public static String formatShortDateVerbally(final long date) {
- final int diff = cgeo.geocaching.utils.DateUtils.daysSince(date);
+ final int diff = CalendarUtils.daysSince(date);
switch (diff) {
case 0:
return CgeoApplication.getInstance().getString(R.string.log_today);
@@ -145,10 +150,10 @@ public abstract class Formatter {
private static void addShortInfos(final Geocache cache, final ArrayList<String> infos) {
if (cache.hasDifficulty()) {
- infos.add("D " + String.format("%.1f", cache.getDifficulty()));
+ infos.add("D " + formatDT(cache.getDifficulty()));
}
if (cache.hasTerrain()) {
- infos.add("T " + String.format("%.1f", cache.getTerrain()));
+ infos.add("T " + formatDT(cache.getTerrain()));
}
// don't show "not chosen" for events and virtuals, that should be the normal case
@@ -157,11 +162,15 @@ public abstract class Formatter {
} else if (cache.isEventCache()) {
final Date hiddenDate = cache.getHiddenDate();
if (hiddenDate != null) {
- infos.add(Formatter.formatShortDate(hiddenDate.getTime()));
+ infos.add(Formatter.formatShortDateIncludingWeekday(hiddenDate.getTime()));
}
}
}
+ private static String formatDT(final float value) {
+ return String.format(Locale.getDefault(), "%.1f", value);
+ }
+
public static String formatCacheInfoHistory(final Geocache cache) {
final ArrayList<String> infos = new ArrayList<>(3);
infos.add(StringUtils.upperCase(cache.getGeocode()));
@@ -190,7 +199,7 @@ public abstract class Formatter {
}
public static String formatDaysAgo(final long date) {
- final int days = cgeo.geocaching.utils.DateUtils.daysSince(date);
+ final int days = CalendarUtils.daysSince(date);
switch (days) {
case 0:
return CgeoApplication.getInstance().getString(R.string.log_today);
@@ -204,7 +213,6 @@ public abstract class Formatter {
/**
* Formatting of the hidden date of a cache
*
- * @param cache
* @return {@code null} or hidden date of the cache (or event date of the cache) in human readable format
*/
public static String formatHiddenDate(final Geocache cache) {
@@ -223,4 +231,8 @@ public abstract class Formatter {
return dateString;
}
+ public static String formatMapSubtitle(final Geocache cache) {
+ return "D " + formatDT(cache.getDifficulty()) + SEPARATOR + "T " + formatDT(cache.getTerrain()) + SEPARATOR + cache.getGeocode();
+ }
+
}
diff --git a/main/src/cgeo/geocaching/utils/HtmlUtils.java b/main/src/cgeo/geocaching/utils/HtmlUtils.java
index e90b70d..ab6e8fe 100644
--- a/main/src/cgeo/geocaching/utils/HtmlUtils.java
+++ b/main/src/cgeo/geocaching/utils/HtmlUtils.java
@@ -21,8 +21,6 @@ public final class HtmlUtils {
* Extract the text from a HTML based string. This is similar to what HTML.fromHtml(...) does, but this method also
* removes the embedded images instead of replacing them by a small rectangular representation character.
*
- * @param html
- * @return
*/
public static String extractText(final CharSequence html) {
if (StringUtils.isBlank(html)) {
@@ -61,7 +59,8 @@ public final class HtmlUtils {
return Html.fromHtml(result).toString().trim();
}
- public static String removeExtraParagraph(final String html) {
+ public static String removeExtraParagraph(final String htmlIn) {
+ final String html = StringUtils.trim(htmlIn);
if (StringUtils.startsWith(html, "<p>") && StringUtils.endsWith(html, "</p>")) {
final String paragraph = StringUtils.substring(html, "<p>".length(), html.length() - "</p>".length()).trim();
if (extractText(paragraph).equals(paragraph)) {
diff --git a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedMap.java b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedMap.java
index 6122532..f89c040 100644
--- a/main/src/cgeo/geocaching/utils/LeastRecentlyUsedMap.java
+++ b/main/src/cgeo/geocaching/utils/LeastRecentlyUsedMap.java
@@ -117,7 +117,6 @@ public abstract class LeastRecentlyUsedMap<K, V> extends LinkedHashMap<K, V> {
* Interface for handlers that wish to get notified when items are
* removed from the LRUMap
*
- * @param <V>
*/
public interface RemoveHandler<V> {
diff --git a/main/src/cgeo/geocaching/utils/Log.java b/main/src/cgeo/geocaching/utils/Log.java
index 2f51e42..861faaa 100644
--- a/main/src/cgeo/geocaching/utils/Log.java
+++ b/main/src/cgeo/geocaching/utils/Log.java
@@ -37,7 +37,6 @@ public final class Log {
/**
* Save a copy of the debug flag from the settings for performance reasons.
*
- * @param isDebug
*/
public static void setDebug(final boolean isDebug) {
Log.isDebug = isDebug;
diff --git a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java
index ff4013c..1db3d5b 100644
--- a/main/src/cgeo/geocaching/utils/LogTemplateProvider.java
+++ b/main/src/cgeo/geocaching/utils/LogTemplateProvider.java
@@ -215,7 +215,7 @@ public final class LogTemplateProvider {
}
final Geocache cache = context.getCache();
if (cache != null) {
- return cache.getUrl();
+ return StringUtils.defaultString(cache.getUrl());
}
return StringUtils.EMPTY;
}
diff --git a/main/src/cgeo/geocaching/utils/MatcherWrapper.java b/main/src/cgeo/geocaching/utils/MatcherWrapper.java
index e116269..733a18e 100644
--- a/main/src/cgeo/geocaching/utils/MatcherWrapper.java
+++ b/main/src/cgeo/geocaching/utils/MatcherWrapper.java
@@ -45,8 +45,6 @@ public class MatcherWrapper {
* <p>
* Do not change this method, even if Findbugs and other tools will report a violation for that line!
*
- * @param input
- * @return
*/
@SuppressFBWarnings("DM_STRING_CTOR")
private static String newString(final String input) {
diff --git a/main/src/cgeo/geocaching/utils/ProcessUtils.java b/main/src/cgeo/geocaching/utils/ProcessUtils.java
index ce05483..6a57cbf 100644
--- a/main/src/cgeo/geocaching/utils/ProcessUtils.java
+++ b/main/src/cgeo/geocaching/utils/ProcessUtils.java
@@ -3,7 +3,10 @@ package cgeo.geocaching.utils;
import cgeo.geocaching.CgeoApplication;
import org.apache.commons.collections4.CollectionUtils;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
@@ -21,10 +24,8 @@ public final class ProcessUtils {
/**
* Preferred method to detect the availability of an external app
*
- * @param packageName
- * @return
*/
- public static boolean isLaunchable(final String packageName) {
+ public static boolean isLaunchable(@Nullable final String packageName) {
return getLaunchIntent(packageName) != null;
}
@@ -33,17 +34,15 @@ public final class ProcessUtils {
* This function is relatively costly, so if you know that the package in question has
* a launch intent, use isLaunchable() instead.
*
- * @param packageName
- * @return
*/
- public static boolean isInstalled(final String packageName) {
+ public static boolean isInstalled(@NonNull final String packageName) {
return isLaunchable(packageName) || hasPackageInstalled(packageName);
}
/**
* This will find installed applications even without launch intent (e.g. the streetview plugin).
*/
- private static boolean hasPackageInstalled(final String packageName) {
+ private static boolean hasPackageInstalled(@NonNull final String packageName) {
final List<PackageInfo> packs = CgeoApplication.getInstance().getPackageManager().getInstalledPackages(0);
for (final PackageInfo packageInfo : packs) {
if (packageName.equals(packageInfo.packageName)) {
@@ -56,7 +55,8 @@ public final class ProcessUtils {
/**
* This will find applications, which can be launched.
*/
- public static Intent getLaunchIntent(final String packageName) {
+ @Nullable
+ public static Intent getLaunchIntent(@Nullable final String packageName) {
if (packageName == null) {
return null;
}
@@ -70,7 +70,7 @@ public final class ProcessUtils {
}
}
- public static boolean isIntentAvailable(final String intent) {
+ public static boolean isIntentAvailable(@NonNull final String intent) {
return isIntentAvailable(intent, null);
}
@@ -79,16 +79,16 @@ public final class ProcessUtils {
* method queries the package manager for installed packages that can
* respond to an intent with the specified action. If no suitable package is
* found, this method returns false.
- *
+ *
* @param action
* The Intent action to check for availability.
* @param uri
* The Intent URI to check for availability.
- *
+ *
* @return True if an Intent with the specified action can be sent and
* responded to, false otherwise.
*/
- public static boolean isIntentAvailable(final String action, final Uri uri) {
+ public static boolean isIntentAvailable(@NonNull final String action, @Nullable final Uri uri) {
final PackageManager packageManager = CgeoApplication.getInstance().getPackageManager();
final Intent intent;
if (uri == null) {
@@ -103,4 +103,18 @@ public final class ProcessUtils {
return CollectionUtils.isNotEmpty(list) || CollectionUtils.isNotEmpty(servicesList);
}
+ @SuppressWarnings("deprecation")
+ public static void openMarket(final Activity activity, @NonNull final String packageName) {
+ try {
+ final String url = "market://details?id=" + packageName;
+ final Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
+ activity.startActivity(marketIntent);
+
+ } catch (final RuntimeException ignored) {
+ // market not available, fall back to browser
+ activity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://play.google.com/store/apps/details?id=" + packageName)));
+ }
+ }
+
}
diff --git a/main/src/cgeo/geocaching/utils/RxUtils.java b/main/src/cgeo/geocaching/utils/RxUtils.java
index 280575b..08cc3e7 100644
--- a/main/src/cgeo/geocaching/utils/RxUtils.java
+++ b/main/src/cgeo/geocaching/utils/RxUtils.java
@@ -2,7 +2,6 @@ package cgeo.geocaching.utils;
import rx.Observable;
import rx.Observable.OnSubscribe;
-import rx.Observable.Operator;
import rx.Scheduler;
import rx.Scheduler.Worker;
import rx.Subscriber;
@@ -17,7 +16,6 @@ import rx.observers.Subscribers;
import rx.schedulers.Schedulers;
import rx.subjects.PublishSubject;
import rx.subscriptions.Subscriptions;
-import rx.util.async.Async;
import android.os.Handler;
import android.os.HandlerThread;
@@ -115,49 +113,6 @@ public class RxUtils {
abstract protected void onStop();
}
- public static <T> Operator<T, T> operatorTakeUntil(final Func1<? super T, Boolean> predicate) {
- return new Operator<T, T>() {
- @Override
- public Subscriber<? super T> call(final Subscriber<? super T> subscriber) {
- return new Subscriber<T>(subscriber) {
- private boolean done = false;
-
- @Override
- public void onCompleted() {
- if (!done) {
- subscriber.onCompleted();
- }
- }
-
- @Override
- public void onError(final Throwable throwable) {
- if (!done) {
- subscriber.onError(throwable);
- }
- }
-
- @Override
- public void onNext(final T value) {
- subscriber.onNext(value);
- boolean shouldEnd = false;
- try {
- shouldEnd = predicate.call(value);
- } catch (final Throwable e) {
- done = true;
- subscriber.onError(e);
- unsubscribe();
- }
- if (shouldEnd) {
- done = true;
- subscriber.onCompleted();
- unsubscribe();
- }
- }
- };
- }
- };
- }
-
public static<T> Observable<T> rememberLast(final Observable<T> observable, final T initialValue) {
final AtomicReference<T> lastValue = new AtomicReference<>(initialValue);
return observable.doOnNext(new Action1<T>() {
@@ -175,20 +130,26 @@ public class RxUtils {
}
public static <T> void andThenOnUi(final Scheduler scheduler, final Func0<T> background, final Action1<T> foreground) {
- Async.fromCallable(background, scheduler).observeOn(AndroidSchedulers.mainThread()).subscribe(foreground);
+ scheduler.createWorker().schedule(new Action0() {
+ @Override
+ public void call() {
+ final T value = background.call();
+ AndroidSchedulers.mainThread().createWorker().schedule(new Action0() {
+ @Override
+ public void call() {
+ foreground.call(value);
+ }
+ });
+ }
+ });
}
public static void andThenOnUi(final Scheduler scheduler, final Action0 background, final Action0 foreground) {
- andThenOnUi(scheduler, new Func0<Void>() {
+ scheduler.createWorker().schedule(new Action0() {
@Override
- public Void call() {
+ public void call() {
background.call();
- return null;
- }
- }, new Action1<Void>() {
- @Override
- public void call(final Void ignored) {
- foreground.call();
+ AndroidSchedulers.mainThread().createWorker().schedule(foreground);
}
});
}
diff --git a/main/src/cgeo/geocaching/utils/TextUtils.java b/main/src/cgeo/geocaching/utils/TextUtils.java
index 9fc960c..1f14f8d 100644
--- a/main/src/cgeo/geocaching/utils/TextUtils.java
+++ b/main/src/cgeo/geocaching/utils/TextUtils.java
@@ -106,8 +106,6 @@ public final class TextUtils {
/**
* Searches for the pattern pattern in the data.
*
- * @param data
- * @param pattern
* @return true if data contains the pattern pattern
*/
public static boolean matches(final String data, final Pattern pattern) {
@@ -164,8 +162,6 @@ public final class TextUtils {
* Remove all control characters (which are not valid in XML or HTML), as those should not appear in cache texts
* anyway
*
- * @param input
- * @return
*/
public static String removeControlCharacters(final String input) {
final Matcher remover = PATTERN_REMOVE_NONPRINTABLE.matcher(input);
diff --git a/main/src/cgeo/geocaching/utils/XmlUtils.java b/main/src/cgeo/geocaching/utils/XmlUtils.java
index c36fb53..004fd1b 100644
--- a/main/src/cgeo/geocaching/utils/XmlUtils.java
+++ b/main/src/cgeo/geocaching/utils/XmlUtils.java
@@ -17,7 +17,6 @@ public final class XmlUtils {
* @param prefix an XML prefix, see {@link XmlSerializer#startTag(String, String)}
* @param tag an XML tag
* @param text some text to insert, or <tt>null</tt> to omit completely this tag
- * @throws IOException
*/
public static void simpleText(final XmlSerializer serializer, final String prefix, final String tag, final String text) throws IOException {
if (text != null) {
@@ -34,7 +33,6 @@ public final class XmlUtils {
* @param prefix an XML prefix, see {@link XmlSerializer#startTag(String, String)} shared by all tags
* @param tagAndText an XML tag, the corresponding text, another XML tag, the corresponding text. <tt>null</tt> texts
* will be omitted along with their respective tag.
- * @throws IOException
*/
public static void multipleTexts(final XmlSerializer serializer, final String prefix, final String... tagAndText) throws IOException {
for (int i = 0; i < tagAndText.length; i += 2) {
diff --git a/main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java b/main/thirdparty/menion/android/locus/LocusDataStorageProvider.java
index 03954f5..b575cb5 100644
--- a/main/src/cgeo/geocaching/apps/LocusDataStorageProvider.java
+++ b/main/thirdparty/menion/android/locus/LocusDataStorageProvider.java
@@ -1,4 +1,4 @@
-package cgeo.geocaching.apps;
+package menion.android.locus;
import menion.android.locus.addon.publiclib.geoData.PointsData;
import menion.android.locus.addon.publiclib.utils.DataCursor;
diff --git a/mapswithme-api/build.gradle b/mapswithme-api/build.gradle
index 86d5c77..94cd14f 100644
--- a/mapswithme-api/build.gradle
+++ b/mapswithme-api/build.gradle
@@ -1,34 +1,19 @@
apply plugin: 'android-library'
-dependencies {
- compile fileTree(dir: 'libs', include: '*.jar')
-}
-
android {
- compileSdkVersion 19
- buildToolsVersion "21.1.2"
- sourceSets {
- main {
- manifest.srcFile 'AndroidManifest.xml'
- java.srcDirs = ['src']
- resources.srcDirs = ['src']
- aidl.srcDirs = ['src']
- renderscript.srcDirs = ['src']
- res.srcDirs = ['res']
- assets.srcDirs = ['assets']
- }
+ // Define these properties in the gradle.properties file in the root project folder
+ compileSdkVersion propTargetSdkVersion.toInteger()
+ buildToolsVersion propBuildToolsVersion
- // Move the tests to tests/java, tests/res, etc...
- instrumentTest.setRoot('tests')
+ defaultConfig {
+ minSdkVersion propMinSdkVersion.toInteger()
+ targetSdkVersion propTargetSdkVersion.toInteger()
+ }
- // Move the build types to build-types/<type>
- // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
- // This moves them out of them default location under src/<type>/... which would
- // conflict with src/ being used by the main source set.
- // Adding new build types or product flavors should be accompanied
- // by a similar customization.
- debug.setRoot('build-types/debug')
- release.setRoot('build-types/release')
- }
+ sourceSets.main {
+ manifest.srcFile 'AndroidManifest.xml'
+ java.srcDirs = ['src']
+ res.srcDirs = ['res']
+ }
}
diff --git a/mapswithme-api/project.properties b/mapswithme-api/project.properties
index 91d2b02..93c8c3c 100644
--- a/mapswithme-api/project.properties
+++ b/mapswithme-api/project.properties
@@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
-target=android-19
+target=android-21
android.library=true
diff --git a/mapswithme-api/res/layout/dlg_install_mwm.xml b/mapswithme-api/res/layout/dlg_install_mwm.xml
index 0d174a8..1858369 100644
--- a/mapswithme-api/res/layout/dlg_install_mwm.xml
+++ b/mapswithme-api/res/layout/dlg_install_mwm.xml
@@ -54,16 +54,6 @@
android:background="@drawable/btn_green_selector"
android:text="@string/down_pro" />
- <Button
- android:id="@+id/btn_lite"
- style="@style/promoButton"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:background="@drawable/btn_gray_selector"
- android:padding="6dp"
- android:text="@string/down_lite" />
-
</LinearLayout>
</ScrollView> \ No newline at end of file
diff --git a/mapswithme-api/res/values/strings.xml b/mapswithme-api/res/values/strings.xml
index 1955847..d9e3f27 100644
--- a/mapswithme-api/res/values/strings.xml
+++ b/mapswithme-api/res/values/strings.xml
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="mwm_should_be_installed">Offline maps are required to proceed. We have partnered with MapsWithMe to provide you with offline maps of the entire world.\nTo continue please download the app:</string>
- <string name="down_lite">Download MapsWithMe Lite (free)</string>
- <string name="down_pro">Download MapsWithMe Pro</string>
-
- <string name="url_pro">http://mapswith.me/get</string>
- <string name="url_lite">http://mapswith.me/app</string>
+ <string name="mwm_should_be_installed">Offline maps are required to proceed. We have partnered with MAPS.ME to provide you with offline maps of the entire world.\nTo continue please download the app:</string>
+ <string name="down_pro">Download MAPS.ME</string>
+ <string name="url_pro">http://maps.me/get</string>
</resources> \ No newline at end of file
diff --git a/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java b/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java
index 5670a5f..480bbe1 100644
--- a/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java
+++ b/mapswithme-api/src/com/mapswithme/maps/api/DownloadMapsWithMeDialog.java
@@ -41,7 +41,6 @@ public class DownloadMapsWithMeDialog extends Dialog implements android.view.Vie
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.dlg_install_mwm);
- findViewById(R.id.btn_lite).setOnClickListener(this);
findViewById(R.id.btn_pro).setOnClickListener(this);
setOwnerActivity(activity);
@@ -59,7 +58,7 @@ public class DownloadMapsWithMeDialog extends Dialog implements android.view.Vie
@Override
public void onClick(View v)
{
- String url = getContext().getString(v.getId() == R.id.btn_lite ? R.string.url_lite : R.string.url_pro);
+ String url = getContext().getString(R.string.url_pro);
onDownloadButtonClicked(url);
}
}
diff --git a/play-services-base/project.properties b/play-services-base/project.properties
index ad36a32..664c438 100644
--- a/play-services-base/project.properties
+++ b/play-services-base/project.properties
@@ -11,5 +11,5 @@
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard.txt
# Project target.
-target=Google Inc.:Google APIs:19
+target=Google Inc.:Google APIs:21
android.library=true
diff --git a/play-services-location/project.properties b/play-services-location/project.properties
index 8a32119..51a7632 100644
--- a/play-services-location/project.properties
+++ b/play-services-location/project.properties
@@ -11,6 +11,6 @@
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard.txt
# Project target.
-target=Google Inc.:Google APIs:19
+target=Google Inc.:Google APIs:21
android.library=true
android.library.reference.1=../play-services-base
diff --git a/tests/.settings/org.eclipse.jdt.core.prefs b/tests/.settings/org.eclipse.jdt.core.prefs
index 0c3bd0c..af15cda 100644
--- a/tests/.settings/org.eclipse.jdt.core.prefs
+++ b/tests/.settings/org.eclipse.jdt.core.prefs
@@ -51,7 +51,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
diff --git a/tests/.settings/org.eclipse.jdt.ui.prefs b/tests/.settings/org.eclipse.jdt.ui.prefs
index 1fda530..06e562c 100644
--- a/tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/tests/.settings/org.eclipse.jdt.ui.prefs
@@ -8,7 +8,7 @@ org.eclipse.jdt.ui.ondemandthreshold=99
org.eclipse.jdt.ui.staticondemandthreshold=99
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=false
+sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
@@ -20,16 +20,16 @@ sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
-sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.convert_to_enhanced_for_loop=true
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=true
sp_cleanup.insert_inferred_type_arguments=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.make_variable_declarations_final=true
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=true
@@ -37,16 +37,16 @@ sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=false
sp_cleanup.remove_trailing_whitespaces=true
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=false
-sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
@@ -55,7 +55,7 @@ sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
-sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks=true
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=false
sp_cleanup.use_parentheses_in_expressions=false
diff --git a/tests/res/layout/cgeo_tests_activity.xml b/tests/res/layout/cgeo_tests_activity.xml
index 43225ac..d035210 100644
--- a/tests/res/layout/cgeo_tests_activity.xml
+++ b/tests/res/layout/cgeo_tests_activity.xml
@@ -13,6 +13,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical"
android:gravity="center_vertical"
@@ -27,6 +28,7 @@
android:layout_height="fill_parent"
android:layout_above="@+id/buttonRun"
android:layout_alignParentLeft="true"
+ android:layout_alignParentStart="true"
android:layout_below="@+id/headline" >
<TextView
@@ -43,6 +45,7 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="false"
+ android:layout_alignParentStart="false"
android:onClick="runTests"
android:text="@string/run_tests" />
diff --git a/tests/src/cgeo/CGeoTestCase.java b/tests/src/cgeo/CGeoTestCase.java
index 7fc1e8d..2dbac3d 100644
--- a/tests/src/cgeo/CGeoTestCase.java
+++ b/tests/src/cgeo/CGeoTestCase.java
@@ -29,14 +29,12 @@ public abstract class CGeoTestCase extends ApplicationTestCase<CgeoApplication>
}
/** Remove cache from DB and cache to ensure that the cache is not loaded from the database */
- protected static void deleteCacheFromDB(String geocode) {
+ protected static void deleteCacheFromDB(final String geocode) {
DataStore.removeCache(geocode, LoadFlags.REMOVE_ALL);
}
/**
* remove cache from database and file system
- *
- * @param geocode
*/
protected static void removeCacheCompletely(final String geocode) {
final EnumSet<RemoveFlag> flags = EnumSet.copyOf(LoadFlags.REMOVE_ALL);
@@ -71,10 +69,8 @@ public abstract class CGeoTestCase extends ApplicationTestCase<CgeoApplication>
/**
* can be called after recordMapStoreFlags,
* to set the flags for map storing as necessary
- * @param storeCacheMap
- * @param storeWpMaps
*/
- protected void setMapStoreFlags(boolean storeCacheMap, boolean storeWpMaps) {
+ protected void setMapStoreFlags(final boolean storeCacheMap, final boolean storeWpMaps) {
if (!oldMapStoreFlagsRecorded) {
throw new IllegalStateException("Previous MapStoreFlags havn't been recorded! Setting not allowed");
}
diff --git a/tests/src/cgeo/geocaching/CgeoApplicationTest.java b/tests/src/cgeo/geocaching/CgeoApplicationTest.java
index ebe317d..6763d7b 100644
--- a/tests/src/cgeo/geocaching/CgeoApplicationTest.java
+++ b/tests/src/cgeo/geocaching/CgeoApplicationTest.java
@@ -16,7 +16,7 @@ import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.loaders.RecaptchaReceiver;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.location.Viewport;
-import cgeo.geocaching.maps.LiveMapStrategy.Strategy;
+import cgeo.geocaching.maps.LivemapStrategy;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.settings.TestSettings;
import cgeo.geocaching.test.RegExPerformanceTest;
@@ -95,7 +95,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
// no assumption possible: assertThat(tb.getSpottedName()).isEqualTo("Nice place for a break cache");
// we can't check specifics in the log entries since they change, but we can verify data was parsed
- for (LogEntry log : tb.getLogs()) {
+ for (final LogEntry log : tb.getLogs()) {
assertThat(log.date).isGreaterThan(0);
assertThat(log.author).isNotEmpty();
if (log.type == LogType.PLACED_IT || log.type == LogType.RETRIEVED_IT) {
@@ -136,7 +136,6 @@ public class CgeoApplicationTest extends CGeoTestCase {
/**
* Set the login data to the cgeo login, run the given Runnable, and restore the login.
*
- * @param runnable
*/
private static void withMockedLoginDo(final Runnable runnable) {
final ImmutablePair<String, String> login = Settings.getGcCredentials();
@@ -212,9 +211,8 @@ public class CgeoApplicationTest extends CGeoTestCase {
/**
* mock the "exclude disabled caches" and "exclude my caches" options for the execution of the runnable
*
- * @param runnable
*/
- private static void withMockedFilters(Runnable runnable) {
+ private static void withMockedFilters(final Runnable runnable) {
// backup user settings
final boolean excludeMine = Settings.isExcludeMyCaches();
final boolean excludeDisabled = Settings.isExcludeDisabledCaches();
@@ -293,7 +291,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
@Override
public void run() {
// backup user settings
- final Strategy strategy = Settings.getLiveMapStrategy();
+ final LivemapStrategy strategy = Settings.getLiveMapStrategy();
final CacheType cacheType = Settings.getCacheType();
try {
@@ -308,7 +306,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
final Viewport viewport = new Viewport(mockedCache, 0.003, 0.003);
// check coords for DETAILED
- Settings.setLiveMapStrategy(Strategy.DETAILED);
+ Settings.setLiveMapStrategy(LivemapStrategy.DETAILED);
SearchResult search = ConnectorFactory.searchByViewport(viewport, tokens);
assertThat(search).isNotNull();
assertThat(search.getGeocodes().contains(mockedCache.getGeocode())).isTrue();
@@ -320,7 +318,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
assertThat(parsedCache.isReliableLatLon()).isEqualTo(Settings.isGCPremiumMember());
// check update after switch strategy to FAST
- Settings.setLiveMapStrategy(Strategy.FAST);
+ Settings.setLiveMapStrategy(LivemapStrategy.FAST);
Tile.cache.removeFromTileCache(mockedCache);
search = ConnectorFactory.searchByViewport(viewport, tokens);
@@ -351,8 +349,8 @@ public class CgeoApplicationTest extends CGeoTestCase {
@Override
public void run() {
- final Strategy strategy = Settings.getLiveMapStrategy();
- final Strategy testStrategy = Strategy.FAST; // FASTEST, FAST or DETAILED for tests
+ final LivemapStrategy strategy = Settings.getLiveMapStrategy();
+ final LivemapStrategy testStrategy = LivemapStrategy.FAST; // FASTEST, FAST or DETAILED for tests
Settings.setLiveMapStrategy(testStrategy);
final CacheType cacheType = Settings.getCacheType();
@@ -377,7 +375,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
Log.d("cgeoApplicationTest.testSearchByViewportNotLoggedIn: Coords actual = " + cacheFromViewport.getCoords());
assertThat(cache.getCoords().distanceTo(cacheFromViewport.getCoords()) <= 1e-3).isFalse();
// depending on the chosen strategy the coords can be reliable or not
- assertThat(cacheFromViewport.isReliableLatLon()).isEqualTo(testStrategy == Strategy.DETAILED);
+ assertThat(cacheFromViewport.isReliableLatLon()).isEqualTo(testStrategy == LivemapStrategy.DETAILED);
// premium cache
cache = new GC2JVEH();
@@ -402,7 +400,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
* Test cache parsing. Esp. useful after a GC.com update
*/
public static void testSearchByGeocodeBasis() {
- for (MockedCache mockedCache : RegExPerformanceTest.MOCKED_CACHES) {
+ for (final MockedCache mockedCache : RegExPerformanceTest.MOCKED_CACHES) {
final String oldUser = mockedCache.getMockedDataUser();
try {
mockedCache.setMockedDataUser(Settings.getUsername());
@@ -426,7 +424,7 @@ public class CgeoApplicationTest extends CGeoTestCase {
}
/** Remove cache from DB and cache to ensure that the cache is not loaded from the database */
- private static void deleteCacheFromDBAndLogout(String geocode) {
+ private static void deleteCacheFromDBAndLogout(final String geocode) {
deleteCacheFromDB(geocode);
GCLogin.getInstance().logout();
diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java
index 37b6883..26c677d 100644
--- a/tests/src/cgeo/geocaching/GeocacheTest.java
+++ b/tests/src/cgeo/geocaching/GeocacheTest.java
@@ -295,6 +295,7 @@ public class GeocacheTest extends CGeoTestCase {
assertTime("<u><em>Uhrzeit:</em></u> 17-20 " + timeHours + "</span></strong>", 17, 00);
assertTime("von 11 bis 13 " + timeHours, 11, 00);
assertTime("from 11 to 13 " + timeHours, 11, 00);
+ assertTime("von 19.15 " + timeHours + " bis ca.20.30 " + timeHours + " statt", 19, 15);
}
public static void testGuessEventTimeShortDescription() {
@@ -302,7 +303,7 @@ public class GeocacheTest extends CGeoTestCase {
cache.setType(CacheType.EVENT);
cache.setDescription(StringUtils.EMPTY);
cache.setShortDescription("text 14:20 text");
- assertThat(cache.guessEventTimeMinutes()).isEqualTo(String.valueOf(14 * 60 + 20));
+ assertThat(cache.guessEventTimeMinutes()).isEqualTo(14 * 60 + 20);
}
private static void assertTime(final String description, final int hours, final int minutes) {
@@ -310,14 +311,14 @@ public class GeocacheTest extends CGeoTestCase {
cache.setDescription(description);
cache.setType(CacheType.EVENT);
final int minutesAfterMidnight = hours * 60 + minutes;
- assertThat(cache.guessEventTimeMinutes()).isEqualTo(String.valueOf(minutesAfterMidnight));
+ assertThat(cache.guessEventTimeMinutes()).isEqualTo(minutesAfterMidnight);
}
private static void assertNoTime(final String description) {
final Geocache cache = new Geocache();
cache.setDescription(description);
cache.setType(CacheType.EVENT);
- assertThat(cache.guessEventTimeMinutes()).isNull();
+ assertThat(cache.guessEventTimeMinutes()).isEqualTo(-1);
}
public static void testGetPossibleLogTypes() throws Exception {
diff --git a/tests/src/cgeo/geocaching/StaticMapsProviderTest.java b/tests/src/cgeo/geocaching/StaticMapsProviderTest.java
index b107912..02b1d02 100644
--- a/tests/src/cgeo/geocaching/StaticMapsProviderTest.java
+++ b/tests/src/cgeo/geocaching/StaticMapsProviderTest.java
@@ -7,6 +7,7 @@ import cgeo.geocaching.files.LocalStorage;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.settings.TestSettings;
+import cgeo.geocaching.utils.FileUtils;
import cgeo.geocaching.utils.RxUtils;
import junit.framework.TestCase;
@@ -78,7 +79,7 @@ public class StaticMapsProviderTest extends TestCase {
private static void deleteCacheDirectory(String geocode) {
File cacheDir = LocalStorage.getStorageDir(geocode);
- LocalStorage.deleteDirectory(cacheDir);
+ FileUtils.deleteDirectory(cacheDir);
}
}
diff --git a/tests/src/cgeo/geocaching/connector/WaymarkingConnectorTest.java b/tests/src/cgeo/geocaching/connector/WaymarkingConnectorTest.java
new file mode 100644
index 0000000..c4eacc5
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/WaymarkingConnectorTest.java
@@ -0,0 +1,21 @@
+package cgeo.geocaching.connector;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import junit.framework.TestCase;
+
+public class WaymarkingConnectorTest extends TestCase {
+
+ public static void testGetGeocodeFromUrl() {
+ assertThat(ConnectorFactory.getGeocodeFromURL("http://coord.info/WM1234")).isEqualTo("WM1234");
+ assertThat(ConnectorFactory.getGeocodeFromURL("http://www.waymarking.com/waymarks/WMNCDT_American_Legion_Flagpole_1983_University_of_Oregon")).isEqualTo("WMNCDT");
+
+ final IConnector wmConnector = ConnectorFactory.getConnector("WM1234");
+ assertThat(wmConnector).isNotNull();
+
+ assertThat(wmConnector.getGeocodeFromUrl("http://coord.info/WM1234")).isEqualTo("WM1234");
+ assertThat(wmConnector.getGeocodeFromUrl("http://www.waymarking.com/waymarks/WMNCDT_American_Legion_Flagpole_1983_University_of_Oregon")).isEqualTo("WMNCDT");
+
+ assertThat(wmConnector.getGeocodeFromUrl("http://coord.info/GC12ABC")).isNull();
+ assertThat(wmConnector.getGeocodeFromUrl("http://coord.info/TB1234")).isNull();
+ }
+}
diff --git a/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java b/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java
index aa6a185..f4073a9 100644
--- a/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java
+++ b/tests/src/cgeo/geocaching/connector/ec/ECConnectorTest.java
@@ -32,4 +32,8 @@ public class ECConnectorTest extends TestCase {
return geocache;
}
+ public static void testGetGeocodeFromUrl() throws Exception {
+ assertThat(ECConnector.getInstance().getGeocodeFromUrl("http://extremcaching.com/index.php/output-2/738")).isEqualTo("EC738");
+ }
+
}
diff --git a/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java b/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java
index 24f65fd..30a9af9 100644
--- a/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java
+++ b/tests/src/cgeo/geocaching/connector/gc/GCConnectorTest.java
@@ -82,7 +82,7 @@ public class GCConnectorTest extends AbstractResourceInstrumentationTestCase {
assertTileAt(7536, 4915, new Tile(new Geopoint("S 33° 50.326 E 151° 12.426"), 13));
}
- private static void assertTileAt(int x, int y, final Tile tile) {
+ private static void assertTileAt(final int x, final int y, final Tile tile) {
assertThat(tile.getX()).isEqualTo(x);
assertThat(tile.getY()).isEqualTo(y);
}
@@ -96,5 +96,6 @@ public class GCConnectorTest extends AbstractResourceInstrumentationTestCase {
assertThat(GCConnector.getInstance().getGeocodeFromUrl("http://coord.info/TB1234")).isNull();
assertThat(GCConnector.getInstance().getGeocodeFromUrl("http://www.coord.info/TB1234")).isNull();
+ assertThat(GCConnector.getInstance().getGeocodeFromUrl("http://www.coord.info/WM1234")).isNull();
}
}
diff --git a/tests/src/cgeo/geocaching/connector/oc/OCCZConnectorTest.java b/tests/src/cgeo/geocaching/connector/oc/OCCZConnectorTest.java
new file mode 100644
index 0000000..52fc5c8
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/oc/OCCZConnectorTest.java
@@ -0,0 +1,14 @@
+package cgeo.geocaching.connector.oc;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import junit.framework.TestCase;
+
+public class OCCZConnectorTest extends TestCase {
+
+ public static void testGetGeocodeFromUrl() throws Exception {
+ final OCCZConnector connector = new OCCZConnector();
+ assertThat(connector.getGeocodeFromUrl("http://opencaching.cz/viewcache.php?cacheid=610")).isEqualTo("OZ0262");
+ assertThat(connector.getGeocodeFromUrl("http://www.opencaching.de/viewcache.php?cacheid=151223")).isNull();
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java b/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java
index 0aad3aa..697b8d8 100644
--- a/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java
+++ b/tests/src/cgeo/geocaching/connector/oc/OCConnectorTest.java
@@ -24,4 +24,15 @@ public class OCConnectorTest extends TestCase {
return ocConnector;
}
+ public static void testGetGeocodeFromUrlDe() throws Exception {
+ final IConnector connector = ConnectorFactory.getConnector("OC0028");
+ assertThat(connector.getGeocodeFromUrl("http://opencaching.de/OC0028")).isEqualTo("OC0028");
+ assertThat(connector.getGeocodeFromUrl("http://www.opencaching.de/OC0028")).isEqualTo("OC0028");
+ }
+
+ public static void testGetGeocodeFromUrlUs() throws Exception {
+ final IConnector connector = ConnectorFactory.getConnector("OU07A0");
+ assertThat(connector.getGeocodeFromUrl("http://www.opencaching.us/viewcache.php?wp=OU07A0")).isEqualTo("OU07A0");
+ }
+
}
diff --git a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
index aa66ac9..22b2dbe 100644
--- a/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
+++ b/tests/src/cgeo/geocaching/connector/oc/OkapiClientTest.java
@@ -30,7 +30,7 @@ public class OkapiClientTest extends CGeoTestCase {
public static void testOCSearchMustWorkWithoutOAuthAccessTokens() {
final String geoCode = "OC1234";
- Geocache cache = OkapiClient.getCache(geoCode);
+ final Geocache cache = OkapiClient.getCache(geoCode);
assertThat(cache).overridingErrorMessage("You must have a valid OKAPI key installed for running this test (but you do not need to set credentials in the app).").isNotNull();
assertThat(cache.getName()).isEqualTo("Wupper-Schein");
}
@@ -55,9 +55,16 @@ public class OkapiClientTest extends CGeoTestCase {
final String geoCode = "OC6465";
removeCacheCompletely(geoCode);
- Geocache cache = OkapiClient.getCache(geoCode);
+ final Geocache cache = OkapiClient.getCache(geoCode);
assertThat(cache).as("Cache from OKAPI").isNotNull();
assertThat(cache.getLogCounts().get(LogType.WILL_ATTEND)).isGreaterThan(0);
}
+ public static void testGetAllLogs() {
+ final String geoCode = "OC10CB8";
+ final Geocache cache = OkapiClient.getCache(geoCode);
+ final int defaultLogCount = 10;
+ assertThat(cache.getLogs().size()).isGreaterThan(defaultLogCount);
+ }
+
}
diff --git a/tests/src/cgeo/geocaching/connector/ox/OXConnectorTest.java b/tests/src/cgeo/geocaching/connector/ox/OXConnectorTest.java
index 5433387..11f2d66 100644
--- a/tests/src/cgeo/geocaching/connector/ox/OXConnectorTest.java
+++ b/tests/src/cgeo/geocaching/connector/ox/OXConnectorTest.java
@@ -14,4 +14,10 @@ public class OXConnectorTest extends TestCase {
assertThat(oxConnector.canHandle("OX_")).isFalse();
}
+ public static void testGetGeocodeFromUrl() {
+ final OXConnector connector = new OXConnector();
+ assertThat(connector.getGeocodeFromUrl("http://www.opencaching.com/de/#!geocache/OX1R421")).isEqualTo("OX1R421");
+ assertThat(connector.getGeocodeFromUrl("http://www.opencaching.com/#!geocache/OX1R421")).isEqualTo("OX1R421");
+ }
+
}
diff --git a/tests/src/cgeo/geocaching/connector/trackable/SwaggieConnectorTest.java b/tests/src/cgeo/geocaching/connector/trackable/SwaggieConnectorTest.java
new file mode 100644
index 0000000..54c3319
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/trackable/SwaggieConnectorTest.java
@@ -0,0 +1,29 @@
+package cgeo.geocaching.connector.trackable;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import cgeo.geocaching.Trackable;
+
+import junit.framework.TestCase;
+
+public class SwaggieConnectorTest extends TestCase {
+
+ public static void testCanHandleTrackable() {
+ assertThat(new SwaggieConnector().canHandleTrackable("SW0001")).isTrue();
+ assertThat(new SwaggieConnector().canHandleTrackable("SWABCD")).isFalse();
+ assertThat(new SwaggieConnector().canHandleTrackable("GK82A2")).isFalse();
+ assertThat(new SwaggieConnector().canHandleTrackable("TB1234")).isFalse();
+ assertThat(new SwaggieConnector().canHandleTrackable("UNKNOWN")).isFalse();
+ }
+
+ public static void testGetTrackableCodeFromUrl() throws Exception {
+ assertThat(new SwaggieConnector().getTrackableCodeFromUrl("http://geocaching.com.au/swaggie/sw0017")).isEqualTo("SW0017");
+ }
+
+ public static void testGetUrl() throws Exception {
+ final Trackable trackable = new Trackable();
+ trackable.setGeocode("SW0017");
+ assertThat(new SwaggieConnector().getUrl(trackable)).isEqualTo("http://geocaching.com.au/swaggie/SW0017");
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java b/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java
new file mode 100644
index 0000000..2661fb3
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/trackable/SwaggieParserTest.java
@@ -0,0 +1,34 @@
+package cgeo.geocaching.connector.trackable;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import cgeo.geocaching.Trackable;
+import cgeo.geocaching.connector.ConnectorFactory;
+import cgeo.geocaching.network.Network;
+
+import junit.framework.TestCase;
+
+public class SwaggieParserTest extends TestCase {
+
+ public static void testParse() {
+ final Trackable trackableIn = new Trackable();
+ trackableIn.setGeocode("SW0017");
+
+ final String trackableUrl = ConnectorFactory.getTrackableConnector(trackableIn.getGeocode()).getUrl(trackableIn);
+ assertThat(trackableUrl).isNotNull();
+
+ final String page = Network.getResponseData(Network.getRequest(trackableUrl));
+ assertThat(page).isNotNull();
+
+ assert page != null;
+ final Trackable trackable = SwaggieParser.parse(page);
+ assertThat(trackable).isNotNull();
+ assert trackable != null;
+
+ assertThat(trackable.getName()).isEqualTo("Law and Order 1");
+ assertThat(trackable.getGeocode()).isEqualTo("SW0017");
+ assertThat(trackable.getDetails()).isEqualTo("A mini CD that may or may not contain a DivX .AVI of the Law and Order: CSI episode that features geocaching as part of the storyline.");
+ assertThat(trackable.getType()).isEqualTo("Swaggie");
+ assertThat(trackable.getOwner()).isEqualTo("Bear_Left");
+ }
+}
diff --git a/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java b/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java
index 8d80822..7123e87 100644
--- a/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java
+++ b/tests/src/cgeo/geocaching/connector/trackable/TravelBugConnectorTest.java
@@ -26,14 +26,16 @@ public class TravelBugConnectorTest extends TestCase {
}
public static void testOnlineSearchBySecretCode() {
- Trackable trackable = getConnector().searchTrackable("GST9HV", null, null);
+ final Trackable trackable = getConnector().searchTrackable("GST9HV", null, null);
assertThat(trackable).isNotNull();
+ assert trackable != null;
assertThat(trackable.getName()).isEqualTo("Deutschland");
}
public static void testOnlineSearchByPublicCode() {
- Trackable trackable = getConnector().searchTrackable("TB4JD36", null, null);
+ final Trackable trackable = getConnector().searchTrackable("TB4JD36", null, null);
assertThat(trackable).isNotNull();
+ assert trackable != null;
assertThat(trackable.getName()).isEqualTo("Mein Kilometerzähler");
}
diff --git a/tests/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnectorTest.java b/tests/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnectorTest.java
new file mode 100644
index 0000000..ded0a1a
--- /dev/null
+++ b/tests/src/cgeo/geocaching/connector/trackable/UnknownTrackableConnectorTest.java
@@ -0,0 +1,44 @@
+package cgeo.geocaching.connector.trackable;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import cgeo.geocaching.Trackable;
+
+import junit.framework.TestCase;
+
+public class UnknownTrackableConnectorTest extends TestCase {
+
+ private static UnknownTrackableConnector getConnector() {
+ return new UnknownTrackableConnector();
+ }
+
+ public static void testCanHandleTrackable() throws Exception {
+ assertThat(getConnector().canHandleTrackable("TB1234")).isFalse();
+ }
+
+ public static void testGetUrl() throws Exception {
+ try {
+ getConnector().getUrl(new Trackable());
+ fail("IllegalStateException expected");
+ } catch (final IllegalStateException e) {
+ // empty
+ }
+ }
+
+ public static void testSearchTrackable() throws Exception {
+ assertThat(getConnector().searchTrackable("TB1234", null, null)).isNull();
+ }
+
+ public static void testIsLoggable() throws Exception {
+ assertThat(getConnector().isLoggable()).isFalse();
+ }
+
+ public static void testGetTrackableCodeFromUrl() throws Exception {
+ assertThat(getConnector().getTrackableCodeFromUrl("http://www.sometrackable.com/1234")).isNull();
+ }
+
+ public static void testGetUserActions() throws Exception {
+ assertThat(getConnector().getUserActions()).isEmpty();
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/export/ExportTest.java b/tests/src/cgeo/geocaching/export/ExportTest.java
index bec676f..21c45a0 100644
--- a/tests/src/cgeo/geocaching/export/ExportTest.java
+++ b/tests/src/cgeo/geocaching/export/ExportTest.java
@@ -25,7 +25,7 @@ public class ExportTest extends CGeoTestCase {
final Geocache cache = new Geocache();
cache.setGeocode("GCX1234");
final LogEntry log = new LogEntry(1353244820000L, LogType.FOUND_IT, "Hidden in a tree");
- FieldNotes fieldNotes = new FieldNotes();
+ final FieldNotes fieldNotes = new FieldNotes();
fieldNotes.add(cache, log);
assertEquals("Non matching export " + fieldNotes.getContent(), "GCX1234,2012-11-18T13:20:20Z,Found it,\"Hidden in a tree\"\n", fieldNotes.getContent());
}
@@ -55,8 +55,8 @@ public class ExportTest extends CGeoTestCase {
cache.setDetailed(true);
DataStore.saveCache(cache, LoadFlags.SAVE_ALL);
- List<Geocache> exportList = Collections.singletonList(cache);
- GpxExportTester gpxExport = new GpxExportTester();
+ final List<Geocache> exportList = Collections.singletonList(cache);
+ final GpxExportTester gpxExport = new GpxExportTester();
File result = null;
try {
result = gpxExport.testExportSync(exportList);
@@ -67,17 +67,22 @@ public class ExportTest extends CGeoTestCase {
assertThat(result).isNotNull();
// make sure we actually exported waypoints
- String gpx = org.apache.commons.io.FileUtils.readFileToString(result);
+ final String gpx = org.apache.commons.io.FileUtils.readFileToString(result);
assertThat(gpx).contains("<wpt");
assertThat(gpx).contains(cache.getGeocode());
+ if (cache.getUrl() != null) {
+ assertThat(gpx).contains("<url>");
+ } else {
+ assertThat(gpx).doesNotContain("<url>");
+ }
FileUtils.deleteIgnoringFailure(result);
}
private static class GpxExportTester extends GpxExport {
- public File testExportSync(List<Geocache> caches) throws InterruptedException, ExecutionException {
- final ArrayList<String> geocodes = new ArrayList<String>(caches.size());
+ public File testExportSync(final List<Geocache> caches) throws InterruptedException, ExecutionException {
+ final ArrayList<String> geocodes = new ArrayList<>(caches.size());
for (final Geocache cache : caches) {
geocodes.add(cache.getGeocode());
}
diff --git a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
index c43ad38..b20b066 100644
--- a/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
+++ b/tests/src/cgeo/geocaching/export/GpxSerializerTest.java
@@ -38,13 +38,13 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
final AtomicReference<Integer> importedCount = new AtomicReference<Integer>(0);
final StringWriter writer = new StringWriter();
- Geocache cache = loadCacheFromResource(R.raw.gc1bkp3_gpx101);
+ final Geocache cache = loadCacheFromResource(R.raw.gc1bkp3_gpx101);
assertThat(cache).isNotNull();
new GpxSerializer().writeGPX(Collections.singletonList("GC1BKP3"), writer, new GpxSerializer.ProgressListener() {
@Override
- public void publishProgress(int countExported) {
+ public void publishProgress(final int countExported) {
importedCount.set(countExported);
}
});
@@ -54,8 +54,6 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
/**
* This test verifies that a loop of import, export, import leads to the same cache information.
*
- * @throws IOException
- * @throws ParserException
*/
public void testStableExportImportExport() throws IOException, ParserException {
final String geocode = "GC1BKP3";
@@ -70,7 +68,7 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
final GPX10Parser parser = new GPX10Parser(StoredList.TEMPORARY_LIST.id);
final InputStream stream = new ByteArrayInputStream(gpxFirst.getBytes(CharEncoding.UTF_8));
- Collection<Geocache> caches = parser.parse(stream, null);
+ final Collection<Geocache> caches = parser.parse(stream, null);
assertThat(caches).isNotNull();
assertThat(caches).hasSize(1);
@@ -78,43 +76,43 @@ public class GpxSerializerTest extends AbstractResourceInstrumentationTestCase {
assertThat(replaceLogIds(gpxSecond)).isEqualTo(replaceLogIds(gpxFirst));
}
- private static String replaceLogIds(String gpx) {
+ private static String replaceLogIds(final String gpx) {
return gpx.replaceAll("log id=\"\\d*\"", "");
}
- private static String getGPXFromCache(String geocode) throws IOException {
+ private static String getGPXFromCache(final String geocode) throws IOException {
final StringWriter writer = new StringWriter();
new GpxSerializer().writeGPX(Collections.singletonList(geocode), writer, null);
return writer.toString();
}
public static void testStateFromStateCountry() throws Exception {
- Geocache cache = withLocation("state, country");
+ final Geocache cache = withLocation("state, country");
assertThat(GpxSerializer.getState(cache)).isEqualTo("state");
}
public static void testCountryFromStateCountry() throws Exception {
- Geocache cache = withLocation("state, country");
+ final Geocache cache = withLocation("state, country");
assertThat(GpxSerializer.getCountry(cache)).isEqualTo("country");
}
public static void testCountryFromCountryOnly() throws Exception {
- Geocache cache = withLocation("somewhere");
+ final Geocache cache = withLocation("somewhere");
assertThat(GpxSerializer.getCountry(cache)).isEqualTo("somewhere");
}
public static void testStateFromCountryOnly() throws Exception {
- Geocache cache = withLocation("somewhere");
+ final Geocache cache = withLocation("somewhere");
assertThat(GpxSerializer.getState(cache)).isEmpty();
}
public static void testCountryFromExternalCommaString() throws Exception {
- Geocache cache = withLocation("first,second"); // this was not created by c:geo, therefore don't split it
+ final Geocache cache = withLocation("first,second"); // this was not created by c:geo, therefore don't split it
assertThat(GpxSerializer.getState(cache)).isEmpty();
}
private static Geocache withLocation(final String location) {
- Geocache cache = new Geocache();
+ final Geocache cache = new Geocache();
cache.setLocation(location);
return cache;
}
diff --git a/tests/src/cgeo/geocaching/files/GPXImporterTest.java b/tests/src/cgeo/geocaching/files/GPXImporterTest.java
index 9426fe8..86fa90d 100644
--- a/tests/src/cgeo/geocaching/files/GPXImporterTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXImporterTest.java
@@ -153,11 +153,11 @@ public class GPXImporterTest extends AbstractResourceInstrumentationTestCase {
assertThat(cache.getName()).isEqualTo("First Aid Station #1");
}
- private void assertImportStepMessages(int... importSteps) {
- assertThat(importStepHandler.messages).hasSize(importSteps.length);
- for (int i = 0; i < importSteps.length; i++) {
+ private void assertImportStepMessages(final int... importSteps) {
+ for (int i = 0; i < Math.min(importSteps.length, importStepHandler.messages.size()); i++) {
assertThat(importStepHandler.messages.get(i).what).isEqualTo(importSteps[i]);
}
+ assertThat(importStepHandler.messages).hasSize(importSteps.length);
}
public void testImportLoc() throws IOException {
diff --git a/tests/src/cgeo/geocaching/files/GPXParserTest.java b/tests/src/cgeo/geocaching/files/GPXParserTest.java
index 2cc1f34..7c40b2a 100644
--- a/tests/src/cgeo/geocaching/files/GPXParserTest.java
+++ b/tests/src/cgeo/geocaching/files/GPXParserTest.java
@@ -6,6 +6,8 @@ import cgeo.geocaching.DataStore;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.LogEntry;
import cgeo.geocaching.Waypoint;
+import cgeo.geocaching.connector.ConnectorFactory;
+import cgeo.geocaching.connector.IConnector;
import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.LoadFlags;
@@ -14,7 +16,7 @@ import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.test.AbstractResourceInstrumentationTestCase;
import cgeo.geocaching.test.R;
-import cgeo.geocaching.utils.DateUtils;
+import cgeo.geocaching.utils.CalendarUtils;
import cgeo.geocaching.utils.SynchronizedDateFormat;
import java.io.IOException;
@@ -177,7 +179,7 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
assertThat(log.log).isEqualTo("Sehr schöne Runde und wir haben wieder etwas Neues über Hockenheim gelernt. Super Tarnung.\nTFTC, Geoteufel");
assertThat(log.isOwn()).isFalse();
assertThat(log.getDisplayText()).isEqualTo(log.log);
- assertThat(DateUtils.daysSince(log.date) > 700).isTrue();
+ assertThat(CalendarUtils.daysSince(log.date) > 700).isTrue();
// following info is not contained in pocket query gpx file
assertThat(cache.getAttributes()).isEmpty();
@@ -411,6 +413,9 @@ public class GPXParserTest extends AbstractResourceInstrumentationTestCase {
assertThat(lab.getName()).isEqualTo("01_Munich Olympic Walk Of Stars_Updated-Project MUNICH2014 - Mia san Giga! Olympiapark");
assertThat(lab.getShortDescription()).isEqualTo("01_Munich Olympic Walk Of Stars_Updated (Giga! Olympia Park)-Project MUNICH2014 - Mia san Giga! Olympiapark");
assertThat(lab.getDescription()).startsWith("DEU:");
+
+ final IConnector unknownConnector = ConnectorFactory.getConnector("ABC123");
+ assertThat(ConnectorFactory.getConnector(lab)).isSameAs(unknownConnector);
}
}
diff --git a/tests/src/cgeo/geocaching/filter/StateArchivedFilterTest.java b/tests/src/cgeo/geocaching/filter/StateArchivedFilterTest.java
index d474857..3353fe9 100644
--- a/tests/src/cgeo/geocaching/filter/StateArchivedFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StateArchivedFilterTest.java
@@ -4,11 +4,10 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StateArchivedFilter;
public class StateArchivedFilterTest extends CGeoTestCase {
- private StateFilter.StateArchivedFilter archivedFilter;
+ private StateFilterFactory.StateArchivedFilter archivedFilter;
private Geocache archivedCache;
@Override
@@ -16,7 +15,7 @@ public class StateArchivedFilterTest extends CGeoTestCase {
super.setUp();
// members can only be setup here, after application is initialized
- archivedFilter = new StateArchivedFilter();
+ archivedFilter = new StateFilterFactory.StateArchivedFilter();
archivedCache = new Geocache();
archivedCache.setArchived(true);
}
diff --git a/tests/src/cgeo/geocaching/filter/StateDisabledFilterTest.java b/tests/src/cgeo/geocaching/filter/StateDisabledFilterTest.java
index 71a1134..eff3a67 100644
--- a/tests/src/cgeo/geocaching/filter/StateDisabledFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StateDisabledFilterTest.java
@@ -4,18 +4,17 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StateDisabledFilter;
public class StateDisabledFilterTest extends CGeoTestCase {
- private StateFilter.StateDisabledFilter disabledFilter;
+ private StateFilterFactory.StateDisabledFilter disabledFilter;
private Geocache disabledCache;
@Override
protected void setUp() throws Exception {
super.setUp();
- disabledFilter = new StateDisabledFilter();
+ disabledFilter = new StateFilterFactory.StateDisabledFilter();
disabledCache = new Geocache();
disabledCache.setDisabled(true);
}
diff --git a/tests/src/cgeo/geocaching/filter/StateFoundFilterTest.java b/tests/src/cgeo/geocaching/filter/StateFoundFilterTest.java
index e763881..beedd51 100644
--- a/tests/src/cgeo/geocaching/filter/StateFoundFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StateFoundFilterTest.java
@@ -4,18 +4,17 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StateFoundFilter;
public class StateFoundFilterTest extends CGeoTestCase {
- private StateFilter.StateFoundFilter foundFilter;
+ private StateFilterFactory.StateFoundFilter foundFilter;
private Geocache foundCache;
@Override
protected void setUp() throws Exception {
super.setUp();
- foundFilter = new StateFoundFilter();
+ foundFilter = new StateFilterFactory.StateFoundFilter();
foundCache = new Geocache();
foundCache.setFound(true);
}
diff --git a/tests/src/cgeo/geocaching/filter/StateNonPremiumFilterTest.java b/tests/src/cgeo/geocaching/filter/StateNonPremiumFilterTest.java
index c698e8b..87a8909 100644
--- a/tests/src/cgeo/geocaching/filter/StateNonPremiumFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StateNonPremiumFilterTest.java
@@ -4,18 +4,17 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StateNonPremiumFilter;
public class StateNonPremiumFilterTest extends CGeoTestCase {
- private StateFilter.StateNonPremiumFilter nonPremiumFilter;
+ private StateFilterFactory.StateNonPremiumFilter nonPremiumFilter;
private Geocache premiumCache;
@Override
protected void setUp() throws Exception {
super.setUp();
- nonPremiumFilter = new StateNonPremiumFilter();
+ nonPremiumFilter = new StateFilterFactory.StateNonPremiumFilter();
premiumCache = new Geocache();
premiumCache.setPremiumMembersOnly(true);
}
diff --git a/tests/src/cgeo/geocaching/filter/StateNotFoundFilterTest.java b/tests/src/cgeo/geocaching/filter/StateNotFoundFilterTest.java
index 2bf9d94..bb5098c 100644
--- a/tests/src/cgeo/geocaching/filter/StateNotFoundFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StateNotFoundFilterTest.java
@@ -4,18 +4,17 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StateNotFoundFilter;
public class StateNotFoundFilterTest extends CGeoTestCase {
- private StateFilter.StateNotFoundFilter notFoundFilter;
+ private StateFilterFactory.StateNotFoundFilter notFoundFilter;
private Geocache foundCache;
@Override
protected void setUp() throws Exception {
super.setUp();
- notFoundFilter = new StateNotFoundFilter();
+ notFoundFilter = new StateFilterFactory.StateNotFoundFilter();
foundCache = new Geocache();
foundCache.setFound(true);
}
diff --git a/tests/src/cgeo/geocaching/filter/StatePremiumFilterTest.java b/tests/src/cgeo/geocaching/filter/StatePremiumFilterTest.java
index ac8682b..c06a4fe 100644
--- a/tests/src/cgeo/geocaching/filter/StatePremiumFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StatePremiumFilterTest.java
@@ -4,18 +4,17 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StatePremiumFilter;
public class StatePremiumFilterTest extends CGeoTestCase {
- private StateFilter.StatePremiumFilter premiumFilter;
+ private StateFilterFactory.StatePremiumFilter premiumFilter;
private Geocache premiumCache;
@Override
protected void setUp() throws Exception {
super.setUp();
- premiumFilter = new StatePremiumFilter();
+ premiumFilter = new StateFilterFactory.StatePremiumFilter();
premiumCache = new Geocache();
premiumCache.setPremiumMembersOnly(true);
}
diff --git a/tests/src/cgeo/geocaching/filter/StateStoredFilterTest.java b/tests/src/cgeo/geocaching/filter/StateStoredFilterTest.java
index d110921..5d1eecc 100644
--- a/tests/src/cgeo/geocaching/filter/StateStoredFilterTest.java
+++ b/tests/src/cgeo/geocaching/filter/StateStoredFilterTest.java
@@ -4,20 +4,18 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.CGeoTestCase;
import cgeo.geocaching.Geocache;
-import cgeo.geocaching.filter.StateFilter.StateNotStoredFilter;
-import cgeo.geocaching.filter.StateFilter.StateStoredFilter;
public class StateStoredFilterTest extends CGeoTestCase {
- private StateFilter.StateStoredFilter storedFilter;
- private StateFilter.StateNotStoredFilter notStoredFilter;
+ private StateFilterFactory.StateStoredFilter storedFilter;
+ private StateFilterFactory.StateNotStoredFilter notStoredFilter;
private Geocache cache;
@Override
protected void setUp() throws Exception {
super.setUp();
- storedFilter = new StateStoredFilter();
- notStoredFilter = new StateNotStoredFilter();
+ storedFilter = new StateFilterFactory.StateStoredFilter();
+ notStoredFilter = new StateFilterFactory.StateNotStoredFilter();
cache = new Geocache();
}
diff --git a/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java b/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java
index 533135d..6d4fa46 100644
--- a/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java
+++ b/tests/src/cgeo/geocaching/sorting/NameComparatorTest.java
@@ -18,7 +18,7 @@ public class NameComparatorTest extends AndroidTestCase {
}
}
- private NameComparator comp = new NameComparator();
+ private final NameComparator comp = new NameComparator();
public void testLexical() {
assertSorted(new NamedCache("A"), new NamedCache("Z"));
@@ -38,11 +38,10 @@ public class NameComparatorTest extends AndroidTestCase {
/**
* Assert that a given collection of names is already sorted correctly.
*
- * @param names
*/
- private void assertSortedNames(String... names) {
- ArrayList<Geocache> caches = new ArrayList<Geocache>(names.length);
- for (String name : names) {
+ private void assertSortedNames(final String... names) {
+ final ArrayList<Geocache> caches = new ArrayList<Geocache>(names.length);
+ for (final String name : names) {
caches.add(new NamedCache(name));
}
Collections.sort(caches, comp);
diff --git a/tests/src/cgeo/geocaching/test/WhitespaceTest.java b/tests/src/cgeo/geocaching/test/WhitespaceTest.java
index 1ce7cc8..110cdbc 100644
--- a/tests/src/cgeo/geocaching/test/WhitespaceTest.java
+++ b/tests/src/cgeo/geocaching/test/WhitespaceTest.java
@@ -30,8 +30,6 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase {
* The place for the implementation to prove that the new version of replaceWhitespace is faster than
* BaseUtils.replaceWhitespace()
*
- * @param data
- * @return
*/
public static String replaceWhitespaceManually(final String data) {
final int length = data.length();
@@ -39,7 +37,7 @@ public class WhitespaceTest extends AbstractResourceInstrumentationTestCase {
data.getChars(0, length, chars, 0);
int resultSize = 0;
boolean lastWasWhitespace = true;
- for (char c : chars) {
+ for (final char c : chars) {
if (c == ' ' || c == '\n' || c == '\r' || c == '\t') {
if (!lastWasWhitespace) {
chars[resultSize++] = ' ';
diff --git a/tests/src/cgeo/geocaching/utils/DateUtilsTest.java b/tests/src/cgeo/geocaching/utils/CalendarUtilsTest.java
index d0a2b4a..c074903 100644
--- a/tests/src/cgeo/geocaching/utils/DateUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/CalendarUtilsTest.java
@@ -5,17 +5,17 @@ import static org.assertj.core.api.Assertions.assertThat;
import cgeo.geocaching.Geocache;
import cgeo.geocaching.enumerations.CacheType;
-import java.util.Calendar;
-
import junit.framework.TestCase;
-public class DateUtilsTest extends TestCase {
+import java.util.Calendar;
+
+public class CalendarUtilsTest extends TestCase {
public static void testDaysSince() {
final Calendar start = Calendar.getInstance();
for (int hour = 0; hour < 24; hour++) {
start.set(Calendar.HOUR_OF_DAY, hour);
- assertThat(DateUtils.daysSince(start.getTimeInMillis())).isEqualTo(0);
+ assertThat(CalendarUtils.daysSince(start.getTimeInMillis())).isEqualTo(0);
}
}
@@ -32,12 +32,22 @@ public class DateUtilsTest extends TestCase {
assertPastEvent(start, true);
}
- private static void assertPastEvent(final Calendar start, boolean expectedPast) {
+ private static void assertPastEvent(final Calendar start, final boolean expectedPast) {
final Geocache cache = new Geocache();
cache.setType(CacheType.EVENT);
cache.setHidden(start.getTime());
- assertThat(DateUtils.isPastEvent(cache)).isEqualTo(expectedPast);
+ assertThat(CalendarUtils.isPastEvent(cache)).isEqualTo(expectedPast);
}
+ public static void testIsFuture() {
+ final Calendar date = Calendar.getInstance();
+ assertThat(CalendarUtils.isFuture(date)).isFalse();
+
+ date.add(Calendar.DAY_OF_MONTH, 1);
+ assertThat(CalendarUtils.isFuture(date)).isFalse();
+
+ date.add(Calendar.DAY_OF_MONTH, 1);
+ assertThat(CalendarUtils.isFuture(date)).isTrue();
+ }
}
diff --git a/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java b/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java
new file mode 100644
index 0000000..fa7c7e7
--- /dev/null
+++ b/tests/src/cgeo/geocaching/utils/CheckerUtilsTest.java
@@ -0,0 +1,25 @@
+package cgeo.geocaching.utils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import cgeo.geocaching.Geocache;
+
+import junit.framework.TestCase;
+
+public class CheckerUtilsTest extends TestCase {
+
+ public static void testGetCheckerUrl() throws Exception {
+ assertUrl("<p style=\"text-align:center;\"><a href=\"http://geocheck.org/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f\" target=\"_blank\"><img", "http://geocheck.org/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f");
+ assertUrl("<p style=\"text-align:center;\"><a href=\"http://google.com/geo_inputchkcoord.php?gid=618932716cc7e68-c4bb-4f41-8bb1-3e0a3e374a1f\" target=\"_blank\"><img", null);
+ assertUrl("http://www.certitudes.org/certitude?wp=GC5MVX7", "http://www.certitudes.org/certitude?wp=GC5MVX7");
+ assertUrl("http://geochecker.com/index.php?code=e001928e3c2682ec2bae0f24b9d02cfb&action=check&wp=474350573454&name=47656f636865636b6572205465737420666f72204e33382030302e303030205737362030302e303030", "http://geochecker.com/index.php?code=e001928e3c2682ec2bae0f24b9d02cfb&action=check&wp=474350573454&name=47656f636865636b6572205465737420666f72204e33382030302e303030205737362030302e303030");
+ assertUrl("<p>Haarige Aussichten gibt es <a href=\"http://www.geochecker.com/index.php?code=cd52752a8649c5e385a624b5341176f9&amp;action=check&amp;wp=4743314a43384b&amp;name=4b61747a656e&amp;language=German\">hier</a>.</p></span>", "http://www.geochecker.com/index.php?code=cd52752a8649c5e385a624b5341176f9&action=check&wp=4743314a43384b&name=4b61747a656e&language=German");
+ }
+
+ private static void assertUrl(final String description, final String expected) {
+ final Geocache geocache = new Geocache();
+ geocache.setDescription(description);
+ assertThat(CheckerUtils.getCheckerUrl(geocache)).isEqualTo(expected);
+ }
+
+}
diff --git a/tests/src/cgeo/geocaching/utils/FileUtilsTest.java b/tests/src/cgeo/geocaching/utils/FileUtilsTest.java
new file mode 100644
index 0000000..65638e1
--- /dev/null
+++ b/tests/src/cgeo/geocaching/utils/FileUtilsTest.java
@@ -0,0 +1,49 @@
+package cgeo.geocaching.utils;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import cgeo.geocaching.files.LocalStorage;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.IOException;
+
+public class FileUtilsTest extends TestCase {
+
+ final File testDir = LocalStorage.getStorageDir("automated-tests");
+ final File baseFile = new File(testDir, "prefix.ext");
+ final File alternative1 = new File(testDir, "prefix_1.ext");
+ final File alternative2 = new File(testDir, "prefix_2.ext");
+
+ public void testGetUniqueNamedFile() throws IOException {
+ FileUtils.deleteDirectory(testDir);
+ testDir.mkdirs();
+ try {
+ assertThat(FileUtils.getUniqueNamedFile(baseFile)).isEqualTo(baseFile);
+ baseFile.createNewFile();
+ assertThat(FileUtils.getUniqueNamedFile(baseFile)).isEqualTo(alternative1);
+ alternative1.createNewFile();
+ assertThat(FileUtils.getUniqueNamedFile(baseFile)).isEqualTo(alternative2);
+ assertThat(FileUtils.getUniqueNamedFile(baseFile)).isEqualTo(alternative2);
+ } finally {
+ FileUtils.deleteDirectory(testDir);
+ }
+ }
+
+ public static void testFileUrl() {
+ assertThat(FileUtils.isFileUrl("file:///tmp/foo/bar")).isTrue();
+ assertThat(FileUtils.isFileUrl("http://www.google.com")).isFalse();
+ assertThat(FileUtils.fileToUrl(new File("/tmp/foo/bar"))).isEqualTo("file:///tmp/foo/bar");
+ assertThat(FileUtils.urlToFile("file:///tmp/foo/bar").getPath()).isEqualTo("/tmp/foo/bar");
+ }
+
+ public void testCreateRemoveDirectories() {
+ FileUtils.deleteDirectory(testDir);
+ assertThat(testDir.exists()).isFalse();
+ FileUtils.mkdirs(testDir);
+ assertThat(testDir.exists()).isTrue();
+ FileUtils.deleteDirectory(testDir);
+ assertThat(testDir.exists()).isFalse();
+ }
+}
diff --git a/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java b/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java
index 2c6ed18..b442c8a 100644
--- a/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/ProcessUtilsTest.java
@@ -6,7 +6,7 @@ import junit.framework.TestCase;
public class ProcessUtilsTest extends TestCase {
public static void testIsInstalled() {
- assertThat(ProcessUtils.isInstalled("com.android.launcher")).isTrue();
+ assertThat(ProcessUtils.isInstalled("com.android.settings")).isTrue();
}
public static void testIsInstalledNotLaunchable() {
@@ -16,7 +16,7 @@ public class ProcessUtilsTest extends TestCase {
}
public static void testIsLaunchable() {
- assertThat(ProcessUtils.isInstalled("com.android.settings")).isTrue();
+ assertThat(ProcessUtils.isLaunchable("com.android.settings")).isTrue();
}
}
diff --git a/tests/src/cgeo/geocaching/utils/RxUtilsTest.java b/tests/src/cgeo/geocaching/utils/RxUtilsTest.java
index 2487184..cc8589b 100644
--- a/tests/src/cgeo/geocaching/utils/RxUtilsTest.java
+++ b/tests/src/cgeo/geocaching/utils/RxUtilsTest.java
@@ -4,7 +4,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import rx.Observable;
import rx.Subscription;
-import rx.functions.Func1;
import rx.subjects.PublishSubject;
import rx.subjects.ReplaySubject;
@@ -21,16 +20,6 @@ public class RxUtilsTest extends AndroidTestCase {
range.onCompleted();
}
- public static void testTakeUntil() {
- final Observable<Integer> observable = range.lift(RxUtils.operatorTakeUntil(new Func1<Integer, Boolean>() {
- @Override
- public Boolean call(final Integer value) {
- return value > 6;
- }
- }));
- assertThat(observable.toList().toBlocking().single().toArray()).isEqualTo(new int[]{1, 2, 3, 4, 5, 6, 7});
- }
-
public static void testRememberLast() {
final PublishSubject<String> rawObservable = PublishSubject.create();
final Observable<String> observable = RxUtils.rememberLast(rawObservable, "initial");
diff --git a/tests/src/cgeo/junit/CgeoTestRunner.java b/tests/src/cgeo/junit/CgeoTestRunner.java
index 16a5f12..94803cf 100644
--- a/tests/src/cgeo/junit/CgeoTestRunner.java
+++ b/tests/src/cgeo/junit/CgeoTestRunner.java
@@ -11,10 +11,12 @@ import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* Test runner which derives from the newer Google instrumentation test runner used by the Espresso test framework. It
- * adds junit report functionality by cloning the behaviour of the {@link JUnitReportTestRunner}.
+ * adds junit report functionality by cloning the behavior of the {@link JUnitReportTestRunner}.
*
*/
public class CgeoTestRunner extends GoogleInstrumentationTestRunner {
@@ -86,21 +88,32 @@ public class CgeoTestRunner extends GoogleInstrumentationTestRunner {
@Override
public void start() {
- mListener = new JUnitReportListener(getContext(), getTargetContext(), mReportFile, mReportDir, mFilterTraces, mMultiFile);
- try {
- Class<?> c = getClass();
- Field bridgeTestRunner = c.getSuperclass().getDeclaredField("bridgeTestRunner");
- bridgeTestRunner.setAccessible(true);
- Object obj = bridgeTestRunner.get(this);
- Method m = obj.getClass().getDeclaredMethod("getAndroidTestRunner", (Class[]) null);
- AndroidTestRunner androidTestRunner = (AndroidTestRunner) m.invoke(obj);
- androidTestRunner.addTestListener(mListener);
- } catch (NoSuchFieldException | InvocationTargetException | IllegalAccessException | NoSuchMethodException | SecurityException x) {
- Log.e(LOG_TAG, x.toString());
- }
+ makeAndroidTestRunnerAccessible();
super.start();
}
+ private void makeAndroidTestRunnerAccessible() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
+ public Void run() {
+ mListener = new JUnitReportListener(getContext(), getTargetContext(), mReportFile, mReportDir, mFilterTraces, mMultiFile);
+ try {
+ Class<?> c = getClass();
+ Field bridgeTestRunner = c.getSuperclass().getDeclaredField("bridgeTestRunner");
+ bridgeTestRunner.setAccessible(true);
+ Object obj = bridgeTestRunner.get(this);
+ Method m = obj.getClass().getDeclaredMethod("getAndroidTestRunner", (Class[]) null);
+ AndroidTestRunner androidTestRunner = (AndroidTestRunner) m.invoke(obj);
+ androidTestRunner.addTestListener(mListener);
+ } catch (NoSuchFieldException | InvocationTargetException | IllegalAccessException
+ | NoSuchMethodException | SecurityException x) {
+ Log.e(LOG_TAG, x.toString());
+ }
+ return null;
+ }
+ });
+ }
+
@Override
public void finish(int resultCode, Bundle results) {
if (mListener != null) {