Fix server colors

This commit is contained in:
Victor Shcherb 2014-06-01 16:42:16 +02:00
parent c944bff72c
commit dca616d349
5 changed files with 17 additions and 12 deletions

View file

@ -333,12 +333,12 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
storage.save();
}
public OsMoDevice addConnectedDevice(String trackerId, String nameUser, int userColor) {
public OsMoDevice addConnectedDevice(String trackerId, String nameUser, int genColor) {
OsMoDevice us = new OsMoDevice();
us.group = storage.getMainGroup();
us.trackerId = trackerId;
us.userName = nameUser;
us.userColor = userColor;
us.genColor = genColor;
us.group.users.put(trackerId, us);
connectDeviceImpl(us);
storage.save();

View file

@ -958,7 +958,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
int activeColor = model.getColor();
if (activeColor == 0) {
activeColor = getRandomColor();
osMoPlugin.getGroups().setDeviceProperties(model, model.getVisibleName(), activeColor);
model.setGenColor(activeColor);
}
//Location location = tracker.getLastLocation(model.trackerId);
if (location == null || mapLocation == null) {

View file

@ -25,7 +25,7 @@ public class OsMoGroupsStorage {
private static final String GROUP_ID = "group_id";
private static final String TRACKER_ID = "trackerId";
private static final String USER_NAME = "userName";
private static final String USER_COLOR = "userColor";
private static final String USER_COLOR = "userSetColor";
private static final String SERVER_COLOR = "serverColor";
private static final String DESCRIPTION = "description";
private static final String POLICY = "policy";
@ -310,6 +310,7 @@ public class OsMoGroupsStorage {
protected String userName;
protected int serverColor;
protected int userColor;
protected int genColor;
protected String trackerId;
protected boolean enabled;
protected boolean active;
@ -336,6 +337,11 @@ public class OsMoGroupsStorage {
public void setLastOnline(long lastOnline) {
this.lastOnline = lastOnline;
}
public void setGenColor(int genColor) {
this.genColor = genColor;
}
public long getLastOnline() {
return lastOnline;
}
@ -369,7 +375,7 @@ public class OsMoGroupsStorage {
if(serverColor != 0) {
return serverColor ;
}
return userColor;
return genColor;
}
public String getVisibleName(){

View file

@ -341,7 +341,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
long timestamp = obj.getLong("created") * 1000;
boolean visible = obj.has("visible");
boolean changed = false;
if(!f.exists() || (fl.lastModified() != timestamp) ) {
if(!f.exists() || (f.lastModified() != timestamp) ) {
boolean sizeEqual = f.exists() && obj.has("size") && obj.getLong("size") == f.length();
if(sizeEqual && !f.setLastModified(timestamp - 1)){
// false alarm

View file

@ -63,9 +63,10 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
pointAltUI = new Paint();
pointAltUI.setColor(view.getApplication().getResources().getColor(R.color.poi_background));
pointAltUI.setStyle(Style.FILL);
pointAltUI.setAntiAlias(true);
point = new Paint();
point.setColor(Color.DKGRAY);
point.setColor(Color.GRAY);
point.setAntiAlias(true);
point.setStyle(Style.FILL_AND_STROKE);
}
@ -79,14 +80,12 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
final float zoom = tb.getZoom() + tb.getZoomScale();
if(zoom < startZoom){
r = 0;
} else if(zoom <= 11){
r = 10;
} else if(zoom <= 14){
r = 12;
} else if(zoom <= 16){
r = 14;
} else if(zoom <= 17){
r = 16;
} else {
r = 18;
r = 14;
}
return (int) (r * tb.getDensity());
}