diff --git a/OsmAnd/src/net/osmand/plus/ApplicationMode.java b/OsmAnd/src/net/osmand/plus/ApplicationMode.java index 88cdc51e60..dea67aaaad 100644 --- a/OsmAnd/src/net/osmand/plus/ApplicationMode.java +++ b/OsmAnd/src/net/osmand/plus/ApplicationMode.java @@ -259,7 +259,7 @@ public class ApplicationMode { return ctx.getString(key); } - public String toHumanStringCtx(ClientContext ctx) { + public String toHumanStringCtx(Context ctx) { return ctx.getString(key); } diff --git a/OsmAnd/src/net/osmand/plus/ClientContext.java b/OsmAnd/src/net/osmand/plus/ClientContext.java deleted file mode 100644 index bc9cf60fc8..0000000000 --- a/OsmAnd/src/net/osmand/plus/ClientContext.java +++ /dev/null @@ -1,46 +0,0 @@ -package net.osmand.plus; - -import java.io.File; - -import net.osmand.Location; -import net.osmand.plus.api.SQLiteAPI; -import net.osmand.plus.api.SettingsAPI; -import net.osmand.plus.render.RendererRegistry; -import net.osmand.plus.routing.RoutingHelper; - - -/* - * In Android version ClientContext should be cast to Android.Context for backward compatibility - */ -public interface ClientContext { - - public String getString(int resId, Object... args); - - public File getAppPath(String extend); - - public void showShortToastMessage(int msgId, Object... args); - - public void showToastMessage(int msgId, Object... args); - - public void showToastMessage(String msg); - - public RendererRegistry getRendererRegistry(); - - //public OsmandSettings getSettings(); - - public SettingsAPI getSettingsAPI(); - - public SQLiteAPI getSQLiteAPI(); - - // public RendererAPI getRendererAPI(); - - public void runInUIThread(Runnable run); - - public void runInUIThread(Runnable run, long delay); - - public RoutingHelper getRoutingHelper(); - - public Location getLastKnownLocation(); - - -} diff --git a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java index aa534027db..46437376cb 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java @@ -8,6 +8,7 @@ import net.osmand.data.Amenity; import net.osmand.data.AmenityType; import net.osmand.data.City.CityType; import net.osmand.plus.OsmandSettings.MetricsConstants; +import android.content.Context; public class OsmAndFormatter { private final static float METERS_IN_KILOMETER = 1000f; @@ -116,7 +117,7 @@ public class OsmAndFormatter { } - public static String toPublicString(CityType t, ClientContext ctx) { + public static String toPublicString(CityType t, Context ctx) { switch (t) { case CITY: return ctx.getString(R.string.city_type_city); @@ -134,7 +135,7 @@ public class OsmAndFormatter { return ""; } - public static String toPublicString(AmenityType t, ClientContext ctx) { + public static String toPublicString(AmenityType t, Context ctx) { Class cl = R.string.class; try { Field fld = cl.getField("amenity_type_"+t.getCategoryName()); @@ -147,7 +148,7 @@ public class OsmAndFormatter { } - public static String getPoiSimpleFormat(Amenity amenity, ClientContext ctx, boolean en){ + public static String getPoiSimpleFormat(Amenity amenity, Context ctx, boolean en){ return toPublicString(amenity.getType(), ctx) + " : " + getPoiStringWithoutType(amenity, en); //$NON-NLS-1$ } @@ -167,7 +168,7 @@ public class OsmAndFormatter { return type + " " + n; //$NON-NLS-1$ } - public static String getAmenityDescriptionContent(ClientContext ctx, Amenity amenity, boolean shortDescription) { + public static String getAmenityDescriptionContent(Context ctx, Amenity amenity, boolean shortDescription) { StringBuilder d = new StringBuilder(); for(Entry e : amenity.getAdditionalInfo().entrySet()) { String key = e.getKey(); diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java index 7195e50a53..e26bf35032 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java +++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java @@ -78,7 +78,7 @@ import com.actionbarsherlock.app.SherlockExpandableListActivity; import com.actionbarsherlock.app.SherlockListActivity; -public class OsmandApplication extends Application implements ClientContext { +public class OsmandApplication extends Application { public static final String EXCEPTION_PATH = "exception.log"; //$NON-NLS-1$ private static final org.apache.commons.logging.Log LOG = PlatformUtil.getLog(OsmandApplication.class); @@ -679,38 +679,31 @@ public class OsmandApplication extends Application implements ClientContext { return targetPointsHelper; } - @Override public void showShortToastMessage(int msgId, Object... args) { AccessibleToast.makeText(this, getString(msgId, args), Toast.LENGTH_SHORT).show(); } - @Override public void showToastMessage(int msgId, Object... args) { AccessibleToast.makeText(this, getString(msgId, args), Toast.LENGTH_LONG).show(); } - @Override public void showToastMessage(String msg) { AccessibleToast.makeText(this, msg, Toast.LENGTH_LONG).show(); } - @Override public SettingsAPI getSettingsAPI() { return settingsAPI; } - @Override public SQLiteAPI getSQLiteAPI() { return sqliteAPI; } - @Override public void runInUIThread(Runnable run) { uiHandler.post(run); } - @Override public void runInUIThread(Runnable run, long delay) { uiHandler.postDelayed(run, delay); } @@ -730,7 +723,6 @@ public class OsmandApplication extends Application implements ClientContext { uiHandler.sendMessageDelayed(msg, delay); } - @Override public File getAppPath(String path) { if(path == null) { path = ""; @@ -738,12 +730,6 @@ public class OsmandApplication extends Application implements ClientContext { return new File(getSettings().getExternalStorageDirectory(), IndexConstants.APP_DIR + path); } - @Override - public Location getLastKnownLocation() { - return locationProvider.getLastKnownLocation(); - } - - public void applyTheme(Context c) { int t = R.style.OsmandLightDarkActionBarTheme; if (osmandSettings.OSMAND_THEME.get() == OsmandSettings.OSMAND_DARK_THEME) { diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 80ca3e2084..0af25c800a 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -119,7 +119,7 @@ public class OsmandSettings { profilePreferences = getProfilePreferences(currentMode); } - public ClientContext getContext() { + public OsmandApplication getContext() { return ctx; } @@ -1680,7 +1680,7 @@ public class OsmandSettings { this.key = key; } - public String toHumanString(ClientContext ctx){ + public String toHumanString(Context ctx){ return ctx.getString(key); } @@ -1726,7 +1726,7 @@ public class OsmandSettings { this.ttsString = ttsString; } - public String toHumanString(ClientContext ctx){ + public String toHumanString(Context ctx){ return ctx.getString(key); } diff --git a/OsmAnd/src/net/osmand/plus/PoiFilter.java b/OsmAnd/src/net/osmand/plus/PoiFilter.java index e34d2b4255..5df97e9a91 100644 --- a/OsmAnd/src/net/osmand/plus/PoiFilter.java +++ b/OsmAnd/src/net/osmand/plus/PoiFilter.java @@ -15,6 +15,10 @@ import net.osmand.data.Amenity; import net.osmand.data.AmenityType; import net.osmand.util.MapUtils; +import org.apache.http.client.protocol.ClientContext; + +import android.content.Context; + public class PoiFilter { public final static String STD_PREFIX = "std_"; //$NON-NLS-1$ @@ -327,7 +331,7 @@ public class PoiFilter { this.isStandardFilter = isStandardFilter; } - public ClientContext getApplication() { + public Context getApplication() { return app; } diff --git a/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java b/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java index b7ac0010a9..90fbb7e22f 100644 --- a/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java +++ b/OsmAnd/src/net/osmand/plus/PoiFiltersHelper.java @@ -301,10 +301,10 @@ public class PoiFiltersHelper { private static final String CATEGORIES_COL_SUBCATEGORY = "subcategory"; //$NON-NLS-1$ private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE " + CATEGORIES_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$ CATEGORIES_FILTER_ID + ", " + CATEGORIES_COL_CATEGORY + ", " + CATEGORIES_COL_SUBCATEGORY + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - private ClientContext context; + private OsmandApplication context; private SQLiteConnection conn; - PoiFilterDbHelper(ClientContext context) { + PoiFilterDbHelper(OsmandApplication context) { this.context = context; } diff --git a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java index f8b07c3dc0..5d603235f7 100644 --- a/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java +++ b/OsmAnd/src/net/osmand/plus/SQLiteTileSource.java @@ -18,6 +18,7 @@ import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; +import org.apache.http.client.protocol.ClientContext; import android.database.sqlite.SQLiteDiskIOException; import android.graphics.Bitmap; @@ -42,12 +43,12 @@ public class SQLiteTileSource implements ITileSource { private int expirationTimeMillis = -1; // never static final int tileSize = 256; - private ClientContext ctx; + private OsmandApplication ctx; private boolean onlyReadonlyAvailable = false; - public SQLiteTileSource(ClientContext ctx, File f, List toFindUrl){ + public SQLiteTileSource(OsmandApplication ctx, File f, List toFindUrl){ this.ctx = ctx; this.file = f; if (f != null) { diff --git a/OsmAnd/src/net/osmand/plus/SearchHistoryHelper.java b/OsmAnd/src/net/osmand/plus/SearchHistoryHelper.java index 72b3ce0fcb..1cbdc4c974 100644 --- a/OsmAnd/src/net/osmand/plus/SearchHistoryHelper.java +++ b/OsmAnd/src/net/osmand/plus/SearchHistoryHelper.java @@ -9,14 +9,14 @@ import net.osmand.plus.api.SQLiteAPI.SQLiteCursor; public class SearchHistoryHelper { private static final int HISTORY_LIMIT = 50; - private ClientContext context; + private OsmandApplication context; private List loadedEntries = null; - public SearchHistoryHelper(ClientContext context) { + public SearchHistoryHelper(OsmandApplication context) { this.context = context; } - public static SearchHistoryHelper getInstance(ClientContext context){ + public static SearchHistoryHelper getInstance(OsmandApplication context){ return new SearchHistoryHelper(context); } diff --git a/OsmAnd/src/net/osmand/plus/access/AccessibilityMode.java b/OsmAnd/src/net/osmand/plus/access/AccessibilityMode.java index f71179329f..c6bb62c2c6 100644 --- a/OsmAnd/src/net/osmand/plus/access/AccessibilityMode.java +++ b/OsmAnd/src/net/osmand/plus/access/AccessibilityMode.java @@ -1,7 +1,7 @@ package net.osmand.plus.access; -import net.osmand.plus.ClientContext; import net.osmand.plus.R; +import android.content.Context; public enum AccessibilityMode { @@ -15,7 +15,7 @@ public enum AccessibilityMode { this.key = key; } - public String toHumanString(ClientContext ctx) { + public String toHumanString(Context ctx) { return ctx.getString(key); } diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java index fc5e133bd3..657ebb850c 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsGeneralActivity.java @@ -12,7 +12,6 @@ import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.access.AccessibleToast; import net.osmand.plus.ApplicationMode; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.DrivingRegion; diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java index 77353391d9..0c123e827d 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchAddressOnlineFragment.java @@ -12,7 +12,6 @@ import net.londatiga.android.QuickAction; import net.osmand.PlatformUtil; import net.osmand.access.AccessibleToast; import net.osmand.data.LatLon; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java index ea869b4b4f..09ba8e999e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchHistoryFragment.java @@ -4,7 +4,6 @@ import java.util.List; import net.londatiga.android.QuickAction; import net.osmand.data.LatLon; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; @@ -49,7 +48,7 @@ public class SearchHistoryFragment extends SherlockListFragment implements Sear @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - helper = SearchHistoryHelper.getInstance((ClientContext) getActivity().getApplicationContext()); + helper = SearchHistoryHelper.getInstance((OsmandApplication) getActivity().getApplicationContext()); } @Override diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java index b5554c4aac..241ae42e11 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadFileHelper.java @@ -14,7 +14,6 @@ import java.util.zip.ZipInputStream; import net.osmand.IProgress; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java b/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java index 7855aaa51e..391c10fd44 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadIndexAdapter.java @@ -5,10 +5,11 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import net.osmand.plus.ClientContext; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.DownloadIndexActivity; import net.osmand.plus.activities.OsmandBaseExpandableListAdapter; +import android.content.Context; import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.Typeface; @@ -119,7 +120,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem } } List filter = new ArrayList(); - ClientContext c = downloadActivity.getMyApplication(); + Context c = downloadActivity; for (IndexItem item : indexFiles) { boolean add = true; final String visibleName = item.getVisibleName(c).toLowerCase(); @@ -230,7 +231,7 @@ public class DownloadIndexAdapter extends OsmandBaseExpandableListAdapter implem TextView item = (TextView) row.findViewById(R.id.download_item); TextView description = (TextView) row.findViewById(R.id.download_descr); IndexItem e = (IndexItem) getChild(groupPosition, childPosition); - ClientContext clctx = downloadActivity.getMyApplication(); + OsmandApplication clctx = downloadActivity.getMyApplication(); String eName = e.getVisibleDescription(clctx) + "\n" + e.getVisibleName(clctx); item.setText(eName.trim()); //$NON-NLS-1$ String d = e.getDate() + "\n" + e.getSizeDescription(clctx); diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java index 2c0cb84b3b..df0dc3046f 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadOsmandIndexesHelper.java @@ -10,13 +10,11 @@ import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.TimeZone; import java.util.zip.GZIPInputStream; import net.osmand.AndroidUtils; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.Version; diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItem.java b/OsmAnd/src/net/osmand/plus/download/IndexItem.java index 15cc1c6478..b0c0e7c7ae 100644 --- a/OsmAnd/src/net/osmand/plus/download/IndexItem.java +++ b/OsmAnd/src/net/osmand/plus/download/IndexItem.java @@ -14,7 +14,6 @@ import java.util.TimeZone; import net.osmand.IndexConstants; import net.osmand.PlatformUtil; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; @@ -52,7 +51,7 @@ public class IndexItem implements Comparable { this.type = type; } - public String getVisibleDescription(ClientContext ctx) { + public String getVisibleDescription(Context ctx) { String s = ""; //$NON-NLS-1$ if (type == DownloadActivityType.SRTM_COUNTRY_FILE) { return ctx.getString(R.string.download_srtm_maps); @@ -66,7 +65,7 @@ public class IndexItem implements Comparable { return s; } - public String getVisibleName(ClientContext ctx) { + public String getVisibleName(Context ctx) { String s = ""; if (fileName.endsWith(IndexConstants.VOICE_INDEX_EXT_ZIP)) { s = ctx.getString(R.string.voice) + "\n"; @@ -134,7 +133,7 @@ public class IndexItem implements Comparable { return date; } - public String getSizeDescription(ClientContext ctx) { + public String getSizeDescription(Context ctx) { return size + " MB"; } diff --git a/OsmAnd/src/net/osmand/plus/download/IndexItemCategory.java b/OsmAnd/src/net/osmand/plus/download/IndexItemCategory.java index d42500f9c7..840f7ad511 100644 --- a/OsmAnd/src/net/osmand/plus/download/IndexItemCategory.java +++ b/OsmAnd/src/net/osmand/plus/download/IndexItemCategory.java @@ -7,7 +7,6 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.Version; diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index bfa5d432cf..07fbf870c4 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -9,7 +9,6 @@ import java.util.List; import net.osmand.CallbackWithObject; import net.osmand.IndexConstants; import net.osmand.access.AccessibleToast; -import net.osmand.plus.ClientContext; import net.osmand.plus.ContextMenuAdapter; import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities.GPXFile; diff --git a/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java b/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java index 1a594b5383..f1a48fa986 100644 --- a/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java +++ b/OsmAnd/src/net/osmand/plus/render/NativeOsmandLibrary.java @@ -3,7 +3,7 @@ package net.osmand.plus.render; import net.osmand.NativeLibrary; import net.osmand.PlatformUtil; -import net.osmand.plus.ClientContext; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.render.OsmandRenderer.RenderingContext; import net.osmand.render.RenderingRuleSearchRequest; import net.osmand.render.RenderingRulesStorage; @@ -29,7 +29,7 @@ public class NativeOsmandLibrary extends NativeLibrary { } - public static NativeOsmandLibrary getLibrary(RenderingRulesStorage storage, ClientContext ctx) { + public static NativeOsmandLibrary getLibrary(RenderingRulesStorage storage, OsmandApplication ctx) { if (!isLoaded()) { synchronized (NativeOsmandLibrary.class) { if (!isLoaded()) { @@ -73,7 +73,7 @@ public class NativeOsmandLibrary extends NativeLibrary { return isNativeSupported != null; } - public static boolean isNativeSupported(RenderingRulesStorage storage, ClientContext ctx) { + public static boolean isNativeSupported(RenderingRulesStorage storage, OsmandApplication ctx) { if(storage != null) { getLibrary(storage, ctx); } diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index 23b745482d..7893f08b48 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -14,7 +14,6 @@ import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; import net.osmand.data.DataTileManager; import net.osmand.data.LatLon; import net.osmand.plus.ApplicationMode; -import net.osmand.plus.ClientContext; import net.osmand.plus.GPXUtilities.WptPt; import net.osmand.plus.R; import net.osmand.plus.routing.AlarmInfo.AlarmInfoType; @@ -22,6 +21,7 @@ import net.osmand.router.RouteSegmentResult; import net.osmand.router.TurnType; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; +import android.content.Context; public class RouteCalculationResult { // could not be null and immodifiable! @@ -93,7 +93,7 @@ public class RouteCalculationResult { } public RouteCalculationResult(List list, Location start, LatLon end, List intermediates, - ClientContext ctx, boolean leftSide, float routingTime) { + Context ctx, boolean leftSide, float routingTime) { this.routingTime = routingTime; List computeDirections = new ArrayList(); this.errorMessage = null; @@ -141,7 +141,7 @@ public class RouteCalculationResult { return Collections.emptyList(); } - private static void calculateIntermediateIndexes(ClientContext ctx, List locations, + private static void calculateIntermediateIndexes(Context ctx, List locations, List intermediates, List localDirections, int[] intermediatePoints) { if(intermediates != null && localDirections != null) { int[] interLocations = new int[intermediates.size()]; @@ -226,7 +226,7 @@ public class RouteCalculationResult { * PREPARATION */ private static List convertVectorResult(List directions, List locations, List list, - List alarms, ClientContext ctx) { + List alarms, Context ctx) { float prevDirectionTime = 0; float prevDirectionDistance = 0; List segmentsToPopulate = new ArrayList(); @@ -296,7 +296,7 @@ public class RouteCalculationResult { } protected static void addMissingTurnsToRoute(List locations, - List originalDirections, Location start, LatLon end, ApplicationMode mode, ClientContext ctx, + List originalDirections, Location start, LatLon end, ApplicationMode mode, Context ctx, boolean leftSide){ if(locations.isEmpty()){ return; @@ -459,7 +459,7 @@ public class RouteCalculationResult { } - public static String toString(TurnType type, ClientContext ctx) { + public static String toString(TurnType type, Context ctx) { if(type.isRoundAbout()){ return ctx.getString(R.string.route_roundabout, type.getExitOut()); } else if(type.getValue().equals(TurnType.C)) { diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index 02da021b7f..d9d7b92828 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -28,7 +28,6 @@ import net.osmand.binary.BinaryMapIndexReader; import net.osmand.data.DataTileManager; import net.osmand.data.LatLon; import net.osmand.plus.ApplicationMode; -import net.osmand.plus.ClientContext; import net.osmand.plus.GPXUtilities; import net.osmand.plus.GPXUtilities.GPXFile; import net.osmand.plus.GPXUtilities.Route; @@ -66,6 +65,7 @@ import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; +import android.content.Context; import android.os.Bundle; import btools.routingapp.IBRouterService; @@ -514,7 +514,7 @@ public class RouteProvider { return sublist; } - protected String getString(ClientContext ctx, int resId){ + protected String getString(Context ctx, int resId){ if(ctx == null){ return ""; //$NON-NLS-1$ } diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index d94ebb2f46..7c39e70bc8 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -4,7 +4,6 @@ package net.osmand.plus.routing; import net.osmand.Location; import net.osmand.binary.RouteDataObject; import net.osmand.plus.ApplicationMode; -import net.osmand.plus.ClientContext; import net.osmand.plus.routing.AlarmInfo.AlarmInfoType; import net.osmand.plus.routing.RouteCalculationResult.NextDirectionInfo; import net.osmand.plus.voice.AbstractPrologCommandPlayer; @@ -15,6 +14,7 @@ import net.osmand.router.TurnType; import net.osmand.util.Algorithms; import alice.tuprolog.Struct; import alice.tuprolog.Term; +import android.content.Context; public class VoiceRouter { @@ -653,7 +653,7 @@ public class VoiceRouter { } } - public void onApplicationTerminate(ClientContext ctx) { + public void onApplicationTerminate(Context ctx) { if (player != null) { player.clear(); } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java index 40a4f8b79f..6461bb36fe 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/AppearanceWidgetsFactory.java @@ -1,8 +1,10 @@ package net.osmand.plus.views.mapwidgets; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.widget.Toast; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + import net.osmand.access.AccessibleToast; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; @@ -13,11 +15,9 @@ import net.osmand.plus.views.MapInfoLayer; import net.osmand.plus.views.OsmandMapTileView; import net.osmand.render.RenderingRuleProperty; import net.osmand.render.RenderingRulesStorage; - -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.widget.Toast; public class AppearanceWidgetsFactory { diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/BaseMapWidget.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/BaseMapWidget.java index e5024f1f47..af9c535029 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/BaseMapWidget.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/BaseMapWidget.java @@ -1,6 +1,5 @@ package net.osmand.plus.views.mapwidgets; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import net.osmand.plus.views.OsmandMapLayer.DrawSettings; import net.osmand.plus.views.ShadowText; diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 21922571b8..bee72d72ea 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -46,7 +46,7 @@ public class MapInfoWidgetsFactory { @Override public boolean updateInfo(DrawSettings d) { // draw speed - Location loc = map.getMyApplication().getLastKnownLocation(); + Location loc = map.getMyApplication().getLocationProvider().getLastKnownLocation(); if (loc != null && loc.hasAltitude()) { double compAlt = loc.getAltitude(); if (cachedAlt != (int) compAlt) { diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java index 5462731cb0..b9547eadb5 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/RouteInfoWidgetsFactory.java @@ -340,7 +340,7 @@ public class RouteInfoWidgetsFactory { @Override public boolean updateInfo(DrawSettings drawSettings) { - Location loc = app.getLastKnownLocation(); + Location loc = app.getLocationProvider().getLastKnownLocation(); // draw speed if (loc != null && loc.hasSpeed()) { // .1 mps == 0.36 kph diff --git a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java index 4c2751650c..089457c0c5 100644 --- a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java @@ -7,7 +7,6 @@ import java.util.Collections; import java.util.List; import net.osmand.PlatformUtil; -import net.osmand.plus.ClientContext; import net.osmand.plus.OsmandApplication; import org.apache.commons.logging.Log;