Fix route colors

This commit is contained in:
Victor Shcherb 2012-09-26 00:51:29 +02:00
parent 95733467a2
commit 333ca98519
4 changed files with 18 additions and 19 deletions

View file

@ -24,7 +24,7 @@
<color name="pos_around">#707CDC</color> <!-- family blue similar to above --> <color name="pos_around">#707CDC</color> <!-- family blue similar to above -->
<!-- <color name="nav_track">#960000FF</color> Old blue colors - not bright enough especially in night mode --> <!-- <color name="nav_track">#960000FF</color> Old blue colors - not bright enough especially in night mode -->
<color name="nav_track">#CCFF6600</color> <color name="nav_track">#960000FF</color>
<color name="nav_track_fluorescent">#CCFF6600</color> <color name="nav_track_fluorescent">#CCFF6600</color>
<color name="nav_arrow">#FADE23</color> <color name="nav_arrow">#FADE23</color>
<color name="nav_arrow_imminent">#FF2300</color> <color name="nav_arrow_imminent">#FF2300</color>

View file

@ -9,7 +9,6 @@ import gnu.trove.set.hash.TLongHashSet;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.RandomAccessFile;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
@ -30,7 +29,6 @@ import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.binary.BinaryMapIndexReader.MapIndex; import net.osmand.binary.BinaryMapIndexReader.MapIndex;
import net.osmand.binary.BinaryMapIndexReader.SearchRequest; import net.osmand.binary.BinaryMapIndexReader.SearchRequest;
import net.osmand.binary.BinaryMapIndexReader.TagValuePair; import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
import net.osmand.data.IndexConstants;
import net.osmand.data.MapAlgorithms; import net.osmand.data.MapAlgorithms;
import net.osmand.data.MapTileDownloader.IMapDownloaderCallback; import net.osmand.data.MapTileDownloader.IMapDownloaderCallback;
import net.osmand.osm.MapUtils; import net.osmand.osm.MapUtils;
@ -48,7 +46,6 @@ import net.osmand.render.RenderingRulesStorage;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import android.app.ActivityManager;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Bitmap.Config; import android.graphics.Bitmap.Config;
@ -105,7 +102,6 @@ public class MapRenderRepositories {
} }
public void initializeNewResource(final IProgress progress, File file, BinaryMapIndexReader reader) { public void initializeNewResource(final IProgress progress, File file, BinaryMapIndexReader reader) {
long start = System.currentTimeMillis();
if (files.containsKey(file.getAbsolutePath())) { if (files.containsKey(file.getAbsolutePath())) {
closeConnection(files.get(file.getAbsolutePath()), file.getAbsolutePath()); closeConnection(files.get(file.getAbsolutePath()), file.getAbsolutePath());
@ -117,10 +113,6 @@ public class MapRenderRepositories {
log.error("Initializing native db " + file.getAbsolutePath() + " failed!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ log.error("Initializing native db " + file.getAbsolutePath() + " failed!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else { } else {
nativeFiles.add(file.getAbsolutePath()); nativeFiles.add(file.getAbsolutePath());
// long val = System.currentTimeMillis();
// if (log.isDebugEnabled()) {
// log.debug("Initializing native db " + file.getAbsolutePath() + " " + (val - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// }
} }
} }
} }
@ -630,10 +622,14 @@ public class MapRenderRepositories {
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
ActivityManager activityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE); // ActivityManager activityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); // ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo); // activityManager.getMemoryInfo(memoryInfo);
AccessibleToast.makeText(context, context.getString(R.string.rendering_out_of_memory) + " (" + memoryInfo.availMem / 1048576L + " MB available) ", Toast.LENGTH_SHORT).show(); // int avl = (int) (memoryInfo.availMem / (1 << 20));
int max = (int) (Runtime.getRuntime().maxMemory() / (1 << 20));
int avl = (int) (Runtime.getRuntime().freeMemory() / (1 << 20));
String s = " (" + avl + " MB available of " + max + ") ";
AccessibleToast.makeText(context, context.getString(R.string.rendering_out_of_memory) + s , Toast.LENGTH_SHORT).show();
} }
}); });
} finally { } finally {

View file

@ -52,7 +52,6 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import android.app.ActivityManager;
import android.content.Context; import android.content.Context;
import android.location.Location; import android.location.Location;
@ -387,10 +386,14 @@ public class RouteProvider {
return new RouteCalculationResult(result, start, end, intermediates, app, leftSide); return new RouteCalculationResult(result, start, end, intermediates, app, leftSide);
} }
} catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) {
ActivityManager activityManager = (ActivityManager)app.getSystemService(Context.ACTIVITY_SERVICE); // ActivityManager activityManager = (ActivityManager)app.getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo(); // ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(memoryInfo); // activityManager.getMemoryInfo(memoryInfo);
return new RouteCalculationResult("Not enough process memory "+ "(" + memoryInfo.availMem / 1048576L + " MB available) "); // int avl = (int) (memoryInfo.availMem / (1 << 20));
int max = (int) (Runtime.getRuntime().maxMemory() / (1 << 20));
int avl = (int) (Runtime.getRuntime().freeMemory() / (1 << 20));
String s = " (" + avl + " MB available of " + max + ") ";
return new RouteCalculationResult("Not enough process memory "+ s);
} }
} }

View file

@ -58,7 +58,7 @@ public class RouteLayer extends OsmandMapLayer {
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, DrawSettings nightMode) { public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, DrawSettings nightMode) {
path.reset(); path.reset();
if (helper.getFinalLocation() != null && helper.getRoute().isCalculated()) { if (helper.getFinalLocation() != null && helper.getRoute().isCalculated()) {
if (false && view.getSettings().FLUORESCENT_OVERLAYS.get()) { if (nightMode != null && nightMode.isNightMode()) {
paint.setColor(view.getResources().getColor(R.color.nav_track_fluorescent)); paint.setColor(view.getResources().getColor(R.color.nav_track_fluorescent));
} else { } else {
paint.setColor(view.getResources().getColor(R.color.nav_track)); paint.setColor(view.getResources().getColor(R.color.nav_track));