Add follow action to groups activity

This commit is contained in:
vshcherb 2014-05-29 12:27:01 +02:00 committed by Victor Shcherb
parent ab5e4ef10f
commit 46380d4d8a
4 changed files with 15 additions and 13 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="osmo_follow">Follow</string>
<string name="osmo_sign_in">Sign in</string>
<string name="osmo_create_groups_confirm">In order to create groups you need to be a registered user of OsMo.</string>
<string name="osmo_credentials_not_valid">Your osmo credentials are not valid.</string>

View file

@ -102,6 +102,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
public static final int GROUP_INFO = 8;
protected static final int SETTINGS_ID = 9;
protected static final int SETTINGS_DEV_ID = 10;
protected static final int TRACK_DEV_ID = 11;
private static final int LIST_REFRESH_MSG_ID = OsmAndConstants.UI_HANDLER_SEARCH + 30;
private static final long RECENT_THRESHOLD = 60000;
@ -353,6 +354,11 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
createMenuItem(menu, SETTINGS_DEV_ID, R.string.settings, R.drawable.ic_action_settings_light, R.drawable.ic_action_settings_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
if(device != null && device.getLastLocation() != null) {
MenuItem menuItem = createMenuItem(menu, TRACK_DEV_ID, R.string.osmo_set_moving_target, R.drawable.ic_action_flage_light, R.drawable.ic_action_flage_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM );
menuItem.setTitleCondensed(getString(R.string.osmo_follow));
}
if(group != null) {
createMenuItem(menu, GROUP_INFO, R.string.osmo_group_info, R.drawable.ic_action_info_light, R.drawable.ic_action_info_dark,
MenuItem.SHOW_AS_ACTION_IF_ROOM);
@ -393,7 +399,12 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
if(item.getItemId() == SETTINGS_DEV_ID) {
if(item.getItemId() == TRACK_DEV_ID) {
if(device != null) {
OsMoPositionLayer.setFollowDestination(device);
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
}
} else if(item.getItemId() == SETTINGS_DEV_ID) {
showSettingsDialog(device);
} else if(item.getItemId() == DELETE_ACTION_ID ) {
Builder bld = new AlertDialog.Builder(OsMoGroupsActivity.this);
@ -424,7 +435,7 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
Location location = device.getLastLocation();
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(),
null, device.getVisibleName(), device);
osMoPlugin.setMapFollowTrackerId(device);
OsMoPositionLayer.setFollowTrackerId(device);
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
}
} else if(item.getItemId() == ON_OFF_ACTION_ID) {

View file

@ -40,7 +40,6 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
private OsMoGroups groups;
private BaseMapWidget osmoControl;
private OsMoPositionLayer olayer;
private Object followTrackerId;
// 2014-05-27 23:11:40
public static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@ -288,15 +287,6 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
}).reg();
}
public Object getFollowTrackerId() {
return followTrackerId;
}
public void setMapFollowTrackerId(OsMoDevice d) {
if(olayer != null) {
OsMoPositionLayer.setFollowTrackerId(d);
}
}
@Override
public String getId() {

View file

@ -238,7 +238,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
if(sameDestId && l != null) {
TargetPointsHelper targets = map.getMyApplication().getTargetPointsHelper();
RoutingHelper rh = map.getMyApplication().getRoutingHelper();
double dist = 0.1;
double dist = 1;
if(rh.isRouteBeingCalculated()) {
dist = 100;
} else if(rh.isRouteCalculated()) {