Skip to content

Commit

Permalink
remove all static map functions and settings (fix cgeo#7332)
Browse files Browse the repository at this point in the history
  • Loading branch information
moving-bits committed Mar 15, 2019
1 parent 1dbfca6 commit bb77cf7
Show file tree
Hide file tree
Showing 26 changed files with 2 additions and 1,097 deletions.
4 changes: 0 additions & 4 deletions main/AndroidManifest.xml
Expand Up @@ -335,10 +335,6 @@
android:name=".maps.mapsforge.v6.NewMap"
android:label="@string/map_map" >
</activity>
<activity
android:name=".staticmaps.StaticMapsActivity_"
android:label="@string/map_static_title" >
</activity>
<activity
android:name="cgeo.geocaching.log.LogCacheActivity"
android:label="@string/log_new_log" >
Expand Down
22 changes: 0 additions & 22 deletions main/res/layout/staticmaps_activity.xml

This file was deleted.

12 changes: 0 additions & 12 deletions main/res/layout/staticmaps_activity_item.xml

This file was deleted.

12 changes: 0 additions & 12 deletions main/res/menu/static_maps_activity_options.xml

This file was deleted.

4 changes: 0 additions & 4 deletions main/res/values/preference_keys.xml
Expand Up @@ -71,8 +71,6 @@
<string translatable="false" name="pref_sigautoinsert">sigautoinsert</string>
<string translatable="false" name="pref_trackautovisit">trackautovisit</string>
<string translatable="false" name="pref_log_offline">log_offline</string>
<string translatable="false" name="pref_offlinemaps">offlinemaps</string>
<string translatable="false" name="pref_offlinewpmaps">offlinewpmaps</string>
<string translatable="false" name="pref_logimages">logimages</string>
<string translatable="false" name="pref_choose_list">choose_list</string>
<string translatable="false" name="pref_mapsource">mapsource</string>
Expand Down Expand Up @@ -145,8 +143,6 @@
<string translatable="false" name="pref_navigation_menu_radar">navigationRadar</string>
<string translatable="false" name="pref_navigation_menu_internal_map">navigationInternalMap</string>
<string translatable="false" name="pref_navigation_menu_internal_new_map">navigationInternalNewMap</string>
<string translatable="false" name="pref_navigation_menu_static_map">navigationStatic</string>
<string translatable="false" name="pref_navigation_menu_static_map_download">navigationStaticDownload</string>
<string translatable="false" name="pref_navigation_menu_locus">navigationLocus</string>
<string translatable="false" name="pref_navigation_menu_rmaps">navigationRmaps</string>
<string translatable="false" name="pref_navigation_menu_google_maps">navigationGoogleMaps</string>
Expand Down
10 changes: 1 addition & 9 deletions main/res/values/strings.xml
Expand Up @@ -269,7 +269,6 @@
<string name="info_log_report_problem_changed">Available problem reports have changed!</string>
<string name="info_select_logimage_cancelled">Image selection or capture was cancelled.</string>
<string name="info_stored_image">New image saved to:</string>
<string name="info_storing_static_maps">Trying to store static maps</string>
<string name="info_cache_saved">The cache has been stored locally</string>
<string name="warn_calculator_state_save">Be sure to save waypoint if you want to keep the calculator state.</string>
<string name="err_trackable_log_not_anonymous">Logging %1$s from c:geo cannot be done anonymously. Do you want to open the settings to fill in your credentials from %2$s?</string>
Expand Down Expand Up @@ -456,7 +455,7 @@
<string name="settings_title_cachedetails">Cache Details</string>
<string name="settings_summary_cachedetails">Customize the display of cache information.</string>
<string name="settings_title_offlinedata">Offline Data</string>
<string name="settings_summary_offlinedata">Configure static maps and other offline data storage.</string>
<string name="settings_summary_offlinedata">Configure other offline data storage.</string>
<string name="settings_title_logging">Logging</string>
<string name="settings_summary_logging">Configure your signature and set logging options.</string>
<string name="settings_title_map">Map</string>
Expand Down Expand Up @@ -586,10 +585,6 @@
<string name="init_brouterThreshold_description">Maximum distance up to which brouter helper app (if installed) will calculate a route.</string>
<string name="init_disabled">Exclude Disabled</string>
<string name="init_summary_disabled">Exclude disabled caches</string>
<string name="init_offline">Static Maps</string>
<string name="init_summary_offline">Store cache static maps for offline use</string>
<string name="init_offline_wp">Static Maps (WP)</string>
<string name="init_summary_offline_wp">Store waypoints static maps for offline use</string>
<string name="init_save_log_img">Save Images</string>
<string name="init_summary_save_log_img">Save Images from Logs</string>
<string name="init_units">Use Imperial Units</string>
Expand Down Expand Up @@ -897,8 +892,6 @@
<string name="cache_menu_radar">Radar</string>
<string name="cache_menu_map">Map</string>
<string name="cache_menu_mfbeta">Mapsforge Beta</string>
<string name="cache_menu_map_static">Static Maps</string>
<string name="cache_menu_download_map_static">Download Static Maps</string>
<string name="cache_menu_rmaps">Rmaps</string>
<string name="cache_menu_map_ext">Other external apps</string>
<string name="cache_menu_streetview">Street View</string>
Expand Down Expand Up @@ -991,7 +984,6 @@
<string name="gpx_import_loading_caches_with_filename">Loading caches from %1$s</string>
<string name="gpx_import_loading_waypoints">Loading waypoints file</string>
<string name="gpx_import_loading_waypoints_with_filename">Loading waypoints from %1$s</string>
<string name="gpx_import_store_static_maps">Storing static maps</string>
<string name="gpx_import_caches_imported">caches imported</string>
<string name="gpx_import_caches_imported_with_filename">%1$d caches imported from %2$s</string>
<string name="gpx_import_static_maps_skipped">Download of static maps aborted</string>
Expand Down
22 changes: 0 additions & 22 deletions main/res/xml/preferences.xml
Expand Up @@ -610,18 +610,6 @@
android:icon="?attr/settings_sdcard"
android:title="@string/settings_title_offlinedata"
android:summary="@string/settings_summary_offlinedata" >
<CheckBoxPreference
android:defaultValue="true"
android:key="@string/pref_offlinemaps"
android:summary="@string/init_summary_offline"
android:enabled="false"
android:title="@string/init_offline" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_offlinewpmaps"
android:summary="@string/init_summary_offline_wp"
android:enabled="false"
android:title="@string/init_offline_wp" />
<CheckBoxPreference
android:defaultValue="false"
android:key="@string/pref_logimages"
Expand Down Expand Up @@ -684,16 +672,6 @@
android:enabled="false"
android:key="@string/pref_navigation_menu_internal_map"
android:title="@string/cache_menu_map" />
<CheckBoxPreference
android:defaultValue="true"
android:enabled="false"
android:key="@string/pref_navigation_menu_static_map"
android:title="@string/cache_menu_map_static" />
<CheckBoxPreference
android:defaultValue="true"
android:enabled="false"
android:key="@string/pref_navigation_menu_static_map_download"
android:title="@string/cache_menu_download_map_static" />
<CheckBoxPreference
android:defaultValue="true"
android:enabled="false"
Expand Down
47 changes: 0 additions & 47 deletions main/src/cgeo/geocaching/CacheDetailActivity.java
Expand Up @@ -52,7 +52,6 @@
import cgeo.geocaching.sensors.GeoDirHandler;
import cgeo.geocaching.sensors.Sensors;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.staticmaps.StaticMapsProvider;
import cgeo.geocaching.storage.DataStore;
import cgeo.geocaching.ui.AbstractCachingPageViewCreator;
import cgeo.geocaching.ui.AnchorAwareLinkMovementMethod;
Expand All @@ -77,7 +76,6 @@
import cgeo.geocaching.utils.CryptUtils;
import cgeo.geocaching.utils.DisposableHandler;
import cgeo.geocaching.utils.Formatter;
import cgeo.geocaching.utils.ImageUtils;
import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.SimpleDisposableHandler;
import cgeo.geocaching.utils.SimpleHandler;
Expand All @@ -93,10 +91,8 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.net.Uri;
Expand Down Expand Up @@ -137,7 +133,6 @@
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
Expand All @@ -156,9 +151,6 @@

import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.Maybe;
import io.reactivex.MaybeEmitter;
import io.reactivex.MaybeOnSubscribe;
import io.reactivex.Observable;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Consumer;
Expand Down Expand Up @@ -1104,20 +1096,6 @@ public ScrollView getDispatchedView(final ViewGroup parentView) {

view = (ScrollView) getLayoutInflater().inflate(R.layout.cachedetail_details_page, parentView, false);

// Start loading preview map
AndroidRxUtils.bindActivity(CacheDetailActivity.this, previewMap).subscribeOn(AndroidRxUtils.networkScheduler)
.subscribe(new Consumer<BitmapDrawable>() {
@Override
public void accept(final BitmapDrawable image) {
final Bitmap bitmap = image.getBitmap();
if (bitmap != null && bitmap.getWidth() > 10) {
final ImageView imageView = ButterKnife.findById(view, R.id.map_preview);
imageView.setImageDrawable(image);
view.findViewById(R.id.map_preview_box).setVisibility(View.VISIBLE);
}
}
});

detailsList = ButterKnife.findById(view, R.id.details_list);
final CacheDetailsCreator details = new CacheDetailsCreator(CacheDetailActivity.this, detailsList);

Expand Down Expand Up @@ -1531,31 +1509,6 @@ private void updateFavPointBox() {

}

private final Maybe<BitmapDrawable> previewMap = Maybe.create(new MaybeOnSubscribe<BitmapDrawable>() {
@Override
public void subscribe(final MaybeEmitter<BitmapDrawable> emitter) throws Exception {
try {
// persistent preview from storage
Bitmap image = StaticMapsProvider.getPreviewMap(cache);

if (image == null && Settings.isStoreOfflineMaps() && cache.getCoords() != null) {
StaticMapsProvider.storeCachePreviewMap(cache).blockingAwait();
image = StaticMapsProvider.getPreviewMap(cache);
}

if (image != null) {
emitter.onSuccess(ImageUtils.scaleBitmapToFitDisplay(image));
} else {
emitter.onComplete();
}
} catch (final Exception e) {
Log.w("CacheDetailActivity.previewMap", e);
emitter.onError(e);
}
}

});

/**
* Reflect the (contextual) action mode of the action bar.
*/
Expand Down
35 changes: 1 addition & 34 deletions main/src/cgeo/geocaching/CacheListActivity.java
Expand Up @@ -112,10 +112,8 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand All @@ -127,8 +125,6 @@
import io.reactivex.ObservableEmitter;
import io.reactivex.ObservableOnSubscribe;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
import io.reactivex.disposables.Disposables;
import io.reactivex.functions.Action;
import io.reactivex.functions.Function;
import io.reactivex.schedulers.Schedulers;
Expand Down Expand Up @@ -1441,36 +1437,7 @@ private void deleteCaches(@NonNull final Collection<Geocache> caches) {
*/
private void loadDetails(final DisposableHandler handler, final List<Geocache> caches, final Set<Integer> additionalListIds) {
final Observable<Geocache> allCaches;
if (Settings.isStoreOfflineMaps()) {
allCaches = Observable.create(new ObservableOnSubscribe<Geocache>() {
private final Disposable disposable = Disposables.empty();

@Override
public void subscribe(final ObservableEmitter<Geocache> emitter) throws Exception {
emitter.setDisposable(disposable);
final Deque<Geocache> withStaticMaps = new LinkedList<>();
for (final Geocache cache : caches) {
if (disposable.isDisposed()) {
return;
}
if (cache.hasStaticMap()) {
withStaticMaps.push(cache);
} else {
emitter.onNext(cache);
}
}
for (final Geocache cache : withStaticMaps) {
if (disposable.isDisposed()) {
return;
}
emitter.onNext(cache);
}
emitter.onComplete();
}
}).subscribeOn(Schedulers.io());
} else {
allCaches = Observable.fromIterable(caches);
}
allCaches = Observable.fromIterable(caches);
final Observable<Geocache> loaded = allCaches.flatMap(new Function<Geocache, Observable<Geocache>>() {
@Override
public Observable<Geocache> apply(final Geocache cache) {
Expand Down
7 changes: 0 additions & 7 deletions main/src/cgeo/geocaching/EditWaypointActivity.java
Expand Up @@ -17,7 +17,6 @@
import cgeo.geocaching.sensors.GeoData;
import cgeo.geocaching.sensors.GeoDirHandler;
import cgeo.geocaching.settings.Settings;
import cgeo.geocaching.staticmaps.StaticMapsProvider;
import cgeo.geocaching.storage.DataStore;
import cgeo.geocaching.ui.WeakReferenceHandler;
import cgeo.geocaching.ui.dialog.CoordinatesInputDialog;
Expand Down Expand Up @@ -710,12 +709,6 @@ protected void saveWaypointInBackground(final ActivityData currentState, final H
}
final Waypoint oldWaypoint = cache.getWaypointById(waypointId);
if (cache.addOrChangeWaypoint(waypoint, true)) {
if (!StaticMapsProvider.hasAllStaticMapsForWaypoint(geocode, waypoint)) {
StaticMapsProvider.removeWpStaticMaps(oldWaypoint, geocode);
if (Settings.isStoreOfflineWpMaps()) {
StaticMapsProvider.storeWaypointStaticMap(cache, waypoint).subscribe();
}
}
if (waypoint.getCoords() != null && (modifyLocal.isChecked() || modifyBoth.isChecked())) {
if (!cache.hasUserModifiedCoords()) {
final Waypoint origWaypoint = new Waypoint(CgeoApplication.getInstance().getString(R.string.cache_coordinates_original), WaypointType.ORIGINAL, false);
Expand Down
56 changes: 0 additions & 56 deletions main/src/cgeo/geocaching/apps/navi/AbstractStaticMapsApp.java

This file was deleted.

0 comments on commit bb77cf7

Please sign in to comment.