Add username
This commit is contained in:
parent
950b7cef2f
commit
067a265adc
3 changed files with 21 additions and 4 deletions
|
@ -171,8 +171,8 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
|
||||||
storage.save();
|
storage.save();
|
||||||
}
|
}
|
||||||
processed = true;
|
processed = true;
|
||||||
} else if(command.equalsIgnoreCase("AGROUP_CREATE") || command.equalsIgnoreCase("GROUP_JOIN") ) {
|
} else if(command.equalsIgnoreCase("GROUP_CREATE") || command.equalsIgnoreCase("GROUP_JOIN") ) {
|
||||||
if(command.equalsIgnoreCase("AGROUP_CREATE")) {
|
if(command.equalsIgnoreCase("GROUP_CREATE")) {
|
||||||
operation = command;
|
operation = command;
|
||||||
try {
|
try {
|
||||||
gid = obj.getString(GROUP_ID);
|
gid = obj.getString(GROUP_ID);
|
||||||
|
@ -289,8 +289,8 @@ public class OsMoGroups implements OsMoReactor, OsmoTrackerListener {
|
||||||
obj.put("expireTime", expireTime);
|
obj.put("expireTime", expireTime);
|
||||||
obj.put("description", description);
|
obj.put("description", description);
|
||||||
obj.put("policy", policy);
|
obj.put("policy", policy);
|
||||||
service.pushCommand("AGROUP_CREATE|" + obj.toString());
|
service.pushCommand("GROUP_CREATE|" + obj.toString());
|
||||||
return "AGROUP_CREATE";
|
return "GROUP_CREATE";
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsActivity;
|
import net.osmand.plus.activities.SettingsActivity;
|
||||||
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
import net.osmand.plus.osmo.OsMoGroupsStorage.OsMoDevice;
|
||||||
|
import net.osmand.plus.osmo.OsMoService.SessionInfo;
|
||||||
import net.osmand.plus.osmodroid.OsMoDroidLayer;
|
import net.osmand.plus.osmodroid.OsMoDroidLayer;
|
||||||
import net.osmand.plus.parkingpoint.ParkingPositionLayer;
|
import net.osmand.plus.parkingpoint.ParkingPositionLayer;
|
||||||
import net.osmand.plus.views.MapInfoLayer;
|
import net.osmand.plus.views.MapInfoLayer;
|
||||||
|
@ -126,6 +127,21 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
|
||||||
boolean visible = true;
|
boolean visible = true;
|
||||||
String txt = "OsMo";
|
String txt = "OsMo";
|
||||||
String subtxt = "";
|
String subtxt = "";
|
||||||
|
SessionInfo si = getService().getCurrentSessionInfo();
|
||||||
|
if (si != null) {
|
||||||
|
String uname = si.username;
|
||||||
|
if (uname != null && uname.length() > 0) {
|
||||||
|
if (uname.length() > 7 && uname.indexOf(' ') != -1) {
|
||||||
|
uname = uname.substring(0, uname.indexOf(' '));
|
||||||
|
}
|
||||||
|
if (uname.length() > 4 && uname.indexOf(' ') != -1) {
|
||||||
|
txt = "";
|
||||||
|
subtxt = uname;
|
||||||
|
} else {
|
||||||
|
txt = uname;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Drawable small = srcinactive;
|
Drawable small = srcinactive;
|
||||||
Drawable big = srcinactive;
|
Drawable big = srcinactive;
|
||||||
long last = service.getLastCommandTime();
|
long last = service.getLastCommandTime();
|
||||||
|
|
|
@ -42,6 +42,7 @@ public class TextInfoWidget extends BaseMapWidget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setText(String text, String subtext) {
|
public void setText(String text, String subtext) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.subtext = subtext;
|
this.subtext = subtext;
|
||||||
|
|
Loading…
Reference in a new issue