Fix colors
This commit is contained in:
parent
a57d9b22ad
commit
e438204d35
3 changed files with 18 additions and 18 deletions
|
@ -56,7 +56,7 @@ public class OsmandExtraSettings extends OsmandPlugin {
|
|||
final MapInfoLayer mapInfoLayer = activity.getMapLayers().getMapInfoLayer();
|
||||
final MapInfoControls mapInfoControls = mapInfoLayer.getMapInfoControls();
|
||||
final MapInfoControlRegInfo transparent = mapInfoControls.registerAppearanceWidget(0, R.string.map_widget_transparent,
|
||||
"transparent", EnumSet.of(ApplicationMode.PEDESTRIAN, ApplicationMode.DEFAULT));
|
||||
"transparent", view.getSettings().TRANSPARENT_MAP_THEME);
|
||||
transparent.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -67,7 +67,7 @@ public class OsmandExtraSettings extends OsmandPlugin {
|
|||
});
|
||||
|
||||
final MapInfoControlRegInfo fluorescent = mapInfoControls.registerAppearanceWidget(0, R.string.map_widget_fluorescent,
|
||||
"fluorescent", EnumSet.noneOf(ApplicationMode.class));
|
||||
"fluorescent", view.getSettings().FLUORESCENT_OVERLAYS);
|
||||
fluorescent.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Set;
|
|||
import java.util.TreeSet;
|
||||
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.OsmandSettings.CommonPreference;
|
||||
import net.osmand.plus.activities.ApplicationMode;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -67,23 +68,14 @@ public class MapInfoControls {
|
|||
}
|
||||
|
||||
public MapInfoControlRegInfo registerAppearanceWidget(int drawable, int messageId, String key,
|
||||
EnumSet<ApplicationMode> appDefaultModes) {
|
||||
CommonPreference<Boolean> pref) {
|
||||
MapInfoControlRegInfo ii = new MapInfoControlRegInfo();
|
||||
ii.defaultModes = appDefaultModes.clone();
|
||||
ii.defaultModes = EnumSet.noneOf(ApplicationMode.class);
|
||||
ii.defaultCollapsible = null;
|
||||
ii.key = key;
|
||||
ii.blPreference = pref;
|
||||
ii.visibleModes = EnumSet.noneOf(ApplicationMode.class);
|
||||
ii.visibleCollapsible = null;
|
||||
for(ApplicationMode ms : ApplicationMode.values() ) {
|
||||
boolean def = appDefaultModes.contains(ms);
|
||||
Set<String> set = visibleElements.get(ms);
|
||||
if(set != null) {
|
||||
def = set.contains(key);
|
||||
}
|
||||
if(def){
|
||||
ii.visibleModes.add(ms);
|
||||
}
|
||||
}
|
||||
ii.drawable = drawable;
|
||||
ii.messageId = messageId;
|
||||
this.appearanceWidgets.add(ii);
|
||||
|
@ -281,18 +273,22 @@ public class MapInfoControls {
|
|||
private EnumSet<ApplicationMode> defaultCollapsible;
|
||||
private EnumSet<ApplicationMode> visibleModes;
|
||||
private EnumSet<ApplicationMode> visibleCollapsible;
|
||||
private CommonPreference<Boolean> blPreference = null;
|
||||
private Runnable stateChangeListener = null;
|
||||
public int priorityOrder;
|
||||
|
||||
public boolean visibleCollapsed(ApplicationMode mode){
|
||||
return visibleCollapsible != null && visibleCollapsible.contains(mode);
|
||||
return blPreference == null && visibleCollapsible != null && visibleCollapsible.contains(mode);
|
||||
}
|
||||
|
||||
public boolean collapseEnabled(ApplicationMode mode){
|
||||
return visibleCollapsible != null;
|
||||
return visibleCollapsible != null && blPreference == null;
|
||||
}
|
||||
|
||||
public boolean visible(ApplicationMode mode){
|
||||
if(blPreference != null) {
|
||||
return blPreference.getModeValue(mode);
|
||||
}
|
||||
return visibleModes.contains(mode);
|
||||
}
|
||||
|
||||
|
@ -303,6 +299,10 @@ public class MapInfoControls {
|
|||
return this;
|
||||
}
|
||||
|
||||
public void setPreference(CommonPreference<Boolean> blPreference) {
|
||||
this.blPreference = blPreference;
|
||||
}
|
||||
|
||||
|
||||
public void setStateChangeListener(Runnable stateChangeListener) {
|
||||
this.stateChangeListener = stateChangeListener;
|
||||
|
|
|
@ -233,7 +233,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
|
||||
private void registerAppearanceWidgets() {
|
||||
final MapInfoControlRegInfo showRuler = mapInfoControls.registerAppearanceWidget(0, R.string.map_widget_show_ruler,
|
||||
"showRuler", EnumSet.allOf(ApplicationMode.class));
|
||||
"showRuler", view.getSettings().SHOW_RULER);
|
||||
showRuler.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -244,7 +244,7 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
});
|
||||
|
||||
final MapInfoControlRegInfo displayViewDirections = mapInfoControls.registerAppearanceWidget(0, R.string.map_widget_view_direction,
|
||||
"viewDirection", EnumSet.of(ApplicationMode.BICYCLE, ApplicationMode.PEDESTRIAN));
|
||||
"viewDirection", view.getSettings().SHOW_VIEW_ANGLE);
|
||||
displayViewDirections.setStateChangeListener(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
Loading…
Reference in a new issue