test fluorescent overlays with seperate setting

This commit is contained in:
sonora 2012-02-28 00:35:05 +01:00
parent 976285479d
commit 7f231f6282
8 changed files with 39 additions and 7 deletions

View file

@ -16,12 +16,14 @@
<!-- LAYER and SPECIAL PURPOSE consistency colors -->
<color name="gpx_track">#B4A00AD7</color>
<color name="gpx_track_fluorescent">#B400FFFF</color>
<color name="pos_heading">#0000FF</color>
<color name="pos_area">#0000FF</color>
<color name="pos_around">#707CDC</color> <!-- family blue similar to above -->
<color name="nav_track">#0000FF</color> <!-- needs to be brighter, hardly visible in night mode -->
<color name="nav_arrow">#FADE23</color> <!-- shouldn't this be same as 'nav_track'? -->
<color name="nav_track_fluorescent">#CCFF6600</color>
<color name="nav_arrow">#FADE23</color>
<color name="nav_arrow_imminent">#FF2300</color>
<color name="nav_arrow_distant">#C0C0C0</color>
<color name="nav_point">#FA5050</color>

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources>
<string name="use_fluorescent_overlays">Use fluorescent overlays</string>
<string name="use_fluorescent_overlays_descr">Use fluorescent colors to display tracks and routes</string>
<string name="offline_poi_edition">Offline POI editing</string>
<string name="offline_poi_edition_descr">Always use offline POI editing</string>

View file

@ -46,6 +46,7 @@
android:key="use_english_names"></CheckBoxPreference>
<CheckBoxPreference android:key="show_altitude_info" android:title="@string/show_altitude_info" android:summary="@string/show_altitude_info_descr"/>
<CheckBoxPreference android:key="transparent_map_theme" android:title="@string/use_transparent_map_theme" android:summary="@string/use_transparent_map_theme_descr"/>
<CheckBoxPreference android:key="fluorescent_overlays" android:title="@string/use_fluorescent_overlays" android:summary="@string/use_fluorescent_overlays_descr"/>
<CheckBoxPreference android:key="show_zoom_level" android:title="@string/show_zoom_level" android:summary="@string/show_zoom_level_descr"/>
</PreferenceScreen>

View file

@ -1095,6 +1095,9 @@ public class OsmandSettings {
TRANSPARENT_MAP_THEME.setModeDefaultValue(ApplicationMode.PEDESTRIAN, true);
}
public final CommonPreference<Boolean> FLUORESCENT_OVERLAYS =
new BooleanPreference("fluorescent_overlays", false, false, true);
public final CommonPreference<Boolean> SHOW_ALTITUDE_INFO =
new BooleanPreference("show_altitude_info", false, false, true);
{

View file

@ -187,6 +187,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
registerBooleanPreference(osmandSettings.TRANSPARENT_MAP_THEME,screen);
registerBooleanPreference(osmandSettings.TEST_ANIMATE_ROUTING,screen);
registerBooleanPreference(osmandSettings.SHOW_ALTITUDE_INFO,screen);
registerBooleanPreference(osmandSettings.FLUORESCENT_OVERLAYS,screen);
registerBooleanPreference(osmandSettings.SHOW_ZOOM_LEVEL,screen);
CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen);
//disable the checkbox if the library cannot be used

View file

@ -31,17 +31,20 @@ public class GPXLayer extends OsmandMapLayer {
private void initUI() {
paint = new Paint();
paint.setColor(view.getResources().getColor(R.color.gpx_track));
if (view.getSettings().FLUORESCENT_OVERLAYS.get()) {
paint.setColor(view.getResources().getColor(R.color.gpx_track_fluorescent));
} else {
paint.setColor(view.getResources().getColor(R.color.gpx_track));
}
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(14);
paint.setAntiAlias(true);
paint.setStrokeCap(Cap.ROUND);
paint.setStrokeJoin(Join.ROUND);
path = new Path();
}
@Override
public void initLayer(OsmandMapTileView view) {
this.view = view;
@ -53,6 +56,7 @@ public class GPXLayer extends OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, DrawSettings nightMode) {
initUI(); //to change color immediately when needed
List<List<WptPt>> points = this.points;
if(points.isEmpty()){
return;

View file

@ -8,6 +8,7 @@ import android.graphics.Paint.Cap;
import android.graphics.Paint.Join;
import android.graphics.Paint.Style;
import android.graphics.Path;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
public class MiniMapControl extends MapInfoControl {
@ -35,7 +36,11 @@ public class MiniMapControl extends MapInfoControl {
paintMiniRoute = new Paint();
paintMiniRoute.setStyle(Style.STROKE);
paintMiniRoute.setStrokeWidth(35 * scaleCoefficient);
paintMiniRoute.setColor(getResources().getColor(R.color.nav_track));
if (view.getSettings().FLUORESCENT_OVERLAYS.get()) {
paintMiniRoute.setColor(getResources().getColor(R.color.nav_track_fluorescent));
} else {
paintMiniRoute.setColor(getResources().getColor(R.color.nav_track));
}
paintMiniRoute.setStrokeJoin(Join.ROUND);
paintMiniRoute.setStrokeCap(Cap.ROUND);
paintMiniRoute.setAntiAlias(true);
@ -56,6 +61,14 @@ public class MiniMapControl extends MapInfoControl {
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//to change color immediately when needed
if (view.getSettings().FLUORESCENT_OVERLAYS.get()) {
paintMiniRoute.setColor(getResources().getColor(R.color.nav_track_fluorescent));
} else {
paintMiniRoute.setColor(getResources().getColor(R.color.nav_track));
}
if (miniMapPath != null && !miniMapPath.isEmpty()) {
canvas.save();
canvas.translate(centerMiniRouteX - view.getCenterPointX(), centerMiniRouteY - view.getCenterPointY());

View file

@ -5,6 +5,7 @@ import java.util.List;
import net.osmand.LogUtil;
import net.osmand.osm.MapUtils;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.R;
import android.graphics.Canvas;
@ -40,7 +41,11 @@ public class RouteLayer extends OsmandMapLayer {
boundsRect = new Rect(0, 0, view.getWidth(), view.getHeight());
tileRect = new RectF();
paint = new Paint();
paint.setColor(view.getResources().getColor(R.color.nav_track));
if (view.getSettings().FLUORESCENT_OVERLAYS.get()) {
paint.setColor(view.getResources().getColor(R.color.nav_track_fluorescent));
} else {
paint.setColor(view.getResources().getColor(R.color.nav_track));
}
paint.setStyle(Style.STROKE);
paint.setStrokeWidth(14);
paint.setAlpha(150);
@ -60,6 +65,7 @@ public class RouteLayer extends OsmandMapLayer {
@Override
public void onDraw(Canvas canvas, RectF latLonBounds, RectF tilesRect, DrawSettings nightMode) {
initUI(); //to change color immediately when needed
path.reset();
if (helper.hasPointsToShow()) {
long time = System.currentTimeMillis();